[webkit-changes] [WebKit/WebKit] de27a5: [LFC][Integration] Add a Layout::Box pointer to Re...

Antti Koivisto noreply at github.com
Sat Sep 24 00:41:10 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: de27a5057c3d776936c38f82873c986514c20f20
      https://github.com/WebKit/WebKit/commit/de27a5057c3d776936c38f82873c986514c20f20
  Author: Antti Koivisto <antti at apple.com>
  Date:   2022-09-24 (Sat, 24 Sep 2022)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/FormattingContext.cpp
    M Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp
    M Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h
    M Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
    M Source/WebCore/layout/layouttree/LayoutBox.cpp
    M Source/WebCore/layout/layouttree/LayoutBox.h
    M Source/WebCore/layout/layouttree/LayoutContainerBox.h
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderElement.h
    M Source/WebCore/rendering/RenderObject.cpp
    M Source/WebCore/rendering/RenderObject.h
    M Source/WebCore/rendering/RenderView.cpp
    M Source/WebCore/rendering/RenderView.h

  Log Message:
  -----------
  [LFC][Integration] Add a Layout::Box pointer to RenderObject
https://bugs.webkit.org/show_bug.cgi?id=245568
<rdar://100316721>

Reviewed by Alan Bujtas.

Replace the map in LineLayout with a direct pointer in render objects.
This is faster and also uses less memory in most cases since with expanded IFC coverage majority of renderers already end up in these maps.

The patch also makes it so that there is only ever a single layout box per renderer. Before an inline-block could have two
associated layout boxes (a child box for the parent inline formatting context and the root of its own context).

The patch also adds InitialContainingBlock to RenderView. All layout boxes without other parents are parented there so
it acts as the root of the layout box tree.

* Source/WebCore/layout/formattingContexts/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::geometryForBox const):
* Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::BoxTree):
(WebCore::LayoutIntegration::BoxTree::~BoxTree):
(WebCore::LayoutIntegration::BoxTree::buildTreeForInlineContent):
(WebCore::LayoutIntegration::BoxTree::appendChild):
(WebCore::LayoutIntegration::BoxTree::rootLayoutBox const):
(WebCore::LayoutIntegration::BoxTree::rootLayoutBox):
(WebCore::LayoutIntegration::BoxTree::layoutBoxForRenderer):
(WebCore::LayoutIntegration::BoxTree::rendererForLayoutBox):
(WebCore::LayoutIntegration::BoxTree::initialContainingBlock):
(): Deleted.
* Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h:
(WebCore::LayoutIntegration::BoxTree::boxCount const):
(WebCore::LayoutIntegration::BoxTree::renderers const):
(WebCore::LayoutIntegration::BoxTree::rootLayoutBox const): Deleted.
(WebCore::LayoutIntegration::BoxTree::rootLayoutBox): Deleted.
(): Deleted.
(WebCore::LayoutIntegration::BoxTree::boxAndRendererList const): Deleted.
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::layout):
(WebCore::LayoutIntegration::FlexLayout::updateRenderers const):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::constructContent):
* Source/WebCore/layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::Box):
(WebCore::Layout::Box::removeFromParent):
(WebCore::Layout::Box::establishesInlineFormattingContext const):
* Source/WebCore/layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::isInlineIntegrationRoot const):
(WebCore::Layout::Box::setIsInlineIntegrationRoot):
(WebCore::Layout::Box::incrementPtrCount const):
(WebCore::Layout::Box::decrementPtrCount const):
(WebCore::Layout::Box::isIntegrationRoot const): Deleted.
* Source/WebCore/layout/layouttree/LayoutContainerBox.cpp:
(WebCore::Layout::ContainerBox::appendChild):
* Source/WebCore/layout/layouttree/LayoutContainerBox.h:
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::layoutBox):
(WebCore::RenderElement::layoutBox const):
* Source/WebCore/rendering/RenderElement.h:
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::setLayoutBox):
(WebCore::RenderObject::clearLayoutBox):
* Source/WebCore/rendering/RenderObject.h:
(WebCore::RenderObject::layoutBox):
(WebCore::RenderObject::layoutBox const):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::RenderView):
* Source/WebCore/rendering/RenderView.h:

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




More information about the webkit-changes mailing list