void RenderTreeUpdater::commit(std::unique_ptr<const Style::Update> styleUpdate) { ASSERT(&m_document == &styleUpdate->document()); if (!m_document.shouldCreateRenderers() || !m_document.renderView()) return; Style::PostResolutionCallbackDisabler callbackDisabler(m_document); m_styleUpdate = WTFMove(styleUpdate); for (auto* root : findRenderingRoots(*m_styleUpdate)) updateRenderTree(*root); m_styleUpdate = nullptr; }
void attachRenderTree(Element* current, const AttachContext& context) { PostAttachCallbackDisabler callbackDisabler(current); WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; if (current->hasCustomStyleResolveCallbacks()) current->willAttachRenderers(); createRendererIfNeeded(current, context); if (current->parentElement() && current->parentElement()->isInCanvasSubtree()) current->setIsInCanvasSubtree(true); current->updateBeforePseudoElement(NoChange); StyleResolverParentPusher parentPusher(current); // When a shadow root exists, it does the work of attaching the children. if (ShadowRoot* shadowRoot = current->shadowRoot()) { parentPusher.push(); attachShadowRoot(shadowRoot, context); } else if (current->firstChild()) parentPusher.push(); attachChildren(current, context); Node* sibling = current->nextSibling(); if (current->renderer() && sibling && !sibling->renderer() && sibling->attached()) Text::createTextRenderersForSiblingsAfterAttachIfNeeded(sibling); current->setAttached(true); current->clearNeedsStyleRecalc(); if (Document* document = current->document()) { if (AXObjectCache* cache = document->axObjectCache()) cache->updateCacheAfterNodeIsAttached(current); } current->updateAfterPseudoElement(NoChange); current->updateFocusAppearanceAfterAttachIfNeeded(); if (current->hasCustomStyleResolveCallbacks()) current->didAttachRenderers(); }