Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fdbc1f896f5865455335e43a63137772389ed54c
      
https://github.com/WebKit/WebKit/commit/fdbc1f896f5865455335e43a63137772389ed54c
  Author: Alan Baradlay <[email protected]>
  Date:   2026-08-21 (Fri, 21 Aug 2026)

  Changed paths:
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AXSearchManager.cpp
    M Source/WebCore/accessibility/AccessibilityScrollView.cpp
    M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Node.cpp
    M Source/WebCore/dom/TreeScope.cpp
    M Source/WebCore/editing/FrameSelection.cpp
    M Source/WebCore/editing/mac/EditorMac.mm
    M Source/WebCore/html/MediaElementSession.cpp
    M Source/WebCore/layout/integration/LayoutIntegrationBoxTreeUpdater.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/HistoryController.cpp
    M Source/WebCore/loader/ImageLoader.cpp
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebCore/rendering/RenderObject.h
    M Source/WebCore/rendering/RenderObjectDocument.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceContainer.cpp
    M Source/WebCore/style/StyleResolveForDocument.cpp
    M Source/WebCore/style/StyleScope.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm

  Log Message:
  -----------
  [cleanup] Replace Document's two render tree booleans with an explicit 
RenderTreeState
https://bugs.webkit.org/show_bug.cgi?id=322218
<rdar://problem/185452641>

Reviewed by Sam Weinig.

A document's render tree is in one of three states: not built, built, or being 
taken down. Taking one down is not
instantaneous - destroyRenderTree() walks the tree destroying renderers - so 
for that duration the tree is still
there but must not be walked or added to, which is a different situation from 
there being no tree at all.

Two booleans covered those three states between them, and neither named the 
third. hasLivingRenderTree() was
renderView() && !renderTreeBeingDestroyed(), so a false answer meant either of 
the other two and callers could not
tell which; anyone who needed to went around it and read renderView() directly. 
"Living" invites the question of
whether a tree being destroyed counts, which is exactly the ambiguity.

(RenderObject::renderTreeBeingDestroyed() stays for now. It is a forwarder on a 
different class rather than a second way of
asking the same question of a Document, and it reads well at its 59 call sites, 
so only its body moves to the new state.)

No change in behavior.

* Source/WebCore/dom/Document.h:
(WebCore::Document::renderTreeState const):
(WebCore::Document::renderTreeBeingDestroyed const): Deleted.
(WebCore::Document::hasLivingRenderTree const): Deleted.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::createRenderTree):
(WebCore::Document::destroyRenderTree):
(WebCore::Document::topDocument const):
(WebCore::Document::removedLastRef):
(WebCore::Document::caretPositionFromPoint):
(WebCore::Document::updateTextRenderer):
(WebCore::Document::updateSVGRenderer):
(WebCore::Document::ensurePendingRenderTreeUpdate):
(WebCore::Document::styleForElementIgnoringPendingStylesheets):
(WebCore::Document::didBecomeCurrentDocumentInFrame):
(WebCore::Document::willBeRemovedFromFrame):
(WebCore::Document::implicitClose):
(WebCore::Document::prepareMouseEvent):
(WebCore::Document::mainFrameDocument const):
* Source/WebCore/rendering/RenderObjectDocument.h:
(WebCore::RenderObject::renderTreeBeingDestroyed const):
* Source/WebCore/rendering/RenderObject.h: Fix a stale comment naming the wrong 
header.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::notificationPostTimerFired):
* Source/WebCore/accessibility/AXSearchManager.cpp:
(WebCore::appendAccessibilityObject):
* Source/WebCore/accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::webAreaObject const):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateChildren):
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::applyPendingAcceleratedActions):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::clientWidth):
(WebCore::Element::clientHeight):
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::computeEditabilityWithStyle const):
(WebCore::Node::inRenderedDocument const):
* Source/WebCore/dom/TreeScope.cpp:
(WebCore::absolutePointIfNotClipped):
(WebCore::TreeScope::elementFromPoint):
(WebCore::TreeScope::elementsFromPoint):
* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::FrameSelection::updateSelectionAppearanceNow):
* Source/WebCore/editing/mac/EditorMac.mm:
(WebCore::Editor::selectionWillChange):
* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::isElementMainContentForPurposesOfAutoplay):
* Source/WebCore/layout/integration/LayoutIntegrationBoxTreeUpdater.cpp:
(WebCore::LayoutIntegration::BoxTreeUpdater::tearDown):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::~LineLayout):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::clear):
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::saveDocumentState):
* Source/WebCore/loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):
(WebCore::ImageLoader::dispatchPendingBeforeLoadEvent):
(WebCore::ImageLoader::dispatchPendingLoadEvent):
(WebCore::ImageLoader::dispatchPendingErrorEvent):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::setView):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::destroyRenderTrees):
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::resolveMouseTarget):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceContainer.cpp:
(WebCore::LegacyRenderSVGResourceContainer::markAllClientLayersForInvalidation):
* Source/WebCore/style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::updateActiveStyleSheets):
(WebCore::Style::Scope::styleSheetsForStyleSheetList):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didChangeSelection):
(WebKit::WebPage::discardedComposition):
(WebKit::WebPage::sendEditorStateUpdate):
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm:
(WebKit::inlineVideoFrame):

Canonical link: https://commits.webkit.org/319598@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to