Title: [281361] trunk/Source/WebCore
Revision
281361
Author
za...@apple.com
Date
2021-08-20 20:16:20 -0700 (Fri, 20 Aug 2021)

Log Message

[IFC][Integration] Walk the box tree to update the replaced content location
https://bugs.webkit.org/show_bug.cgi?id=229105

Reviewed by Antti Koivisto.

Normally there are more runs than entries in the box list. It's more performant to iterate
the box list for the renderer location adjustment.

* layout/integration/LayoutIntegrationBoxTree.h:
(WebCore::LayoutIntegration::BoxTree::boxAndRendererList):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::constructContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281360 => 281361)


--- trunk/Source/WebCore/ChangeLog	2021-08-21 02:56:54 UTC (rev 281360)
+++ trunk/Source/WebCore/ChangeLog	2021-08-21 03:16:20 UTC (rev 281361)
@@ -1,3 +1,18 @@
+2021-08-20  Alan Bujtas  <za...@apple.com>
+
+        [IFC][Integration] Walk the box tree to update the replaced content location
+        https://bugs.webkit.org/show_bug.cgi?id=229105
+
+        Reviewed by Antti Koivisto.
+
+        Normally there are more runs than entries in the box list. It's more performant to iterate
+        the box list for the renderer location adjustment.
+
+        * layout/integration/LayoutIntegrationBoxTree.h:
+        (WebCore::LayoutIntegration::BoxTree::boxAndRendererList):
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::constructContent):
+
 2021-08-20  Simon Fraser  <simon.fra...@apple.com>
 
         Use UserMediaRequestIdentifier in WebKit rather than a mysterious uint64_t

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h (281360 => 281361)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h	2021-08-21 02:56:54 UTC (rev 281360)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h	2021-08-21 03:16:20 UTC (rev 281361)
@@ -58,6 +58,12 @@
 
     size_t boxCount() const { return m_boxes.size(); }
 
+    struct BoxAndRenderer {
+        std::unique_ptr<Layout::Box> box;
+        RenderObject* renderer { nullptr };
+    };
+    const auto& boxAndRendererList() const { return m_boxes; }
+
 private:
     void buildTree();
     void appendChild(std::unique_ptr<Layout::Box>, RenderObject&);
@@ -64,10 +70,6 @@
 
     RenderBlockFlow& m_flow;
     Layout::InitialContainingBlock m_root;
-    struct BoxAndRenderer {
-        std::unique_ptr<Layout::Box> box;
-        RenderObject* renderer { nullptr };
-    };
     Vector<BoxAndRenderer, 1> m_boxes;
 
     HashMap<const RenderObject*, Layout::Box*> m_rendererToBoxMap;

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (281360 => 281361)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-08-21 02:56:54 UTC (rev 281360)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-08-21 03:16:20 UTC (rev 281361)
@@ -232,13 +232,15 @@
     inlineContentBuilder.build(inlineFormattingContext, ensureInlineContent());
     ASSERT(m_inlineContent);
 
-    for (auto& run : m_inlineContent->runs) {
-        auto& layoutBox = run.layoutBox();
+    auto& boxAndRendererList = m_boxTree.boxAndRendererList();
+    for (auto& boxAndRenderer : boxAndRendererList) {
+        auto& layoutBox = *boxAndRenderer.box;
         if (!layoutBox.isReplacedBox())
             continue;
 
-        auto& renderer = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox));
-        renderer.setLocation(flooredLayoutPoint(run.rect().location()));
+        auto& renderer = downcast<RenderBox>(*boxAndRenderer.renderer);
+        auto& boxGeometry = inlineFormattingContext.geometryForBox(layoutBox);
+        renderer.setLocation(Layout::BoxGeometry::borderBoxTopLeft(boxGeometry));
     }
 
     m_inlineContent->clearGapAfterLastLine = m_inlineFormattingState.clearGapAfterLastLine();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to