Title: [269818] trunk/Source/WebCore
Revision
269818
Author
[email protected]
Date
2020-11-14 09:38:37 -0800 (Sat, 14 Nov 2020)

Log Message

[LFC][Integration] Use the physical size when setting the pre-computed width/height on ReplacedBox
https://bugs.webkit.org/show_bug.cgi?id=218915

Reviewed by Antti Koivisto.

This is where the logical vs. physical coordinate flip happens on the integration level.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateReplacedDimensions):
(WebCore::LayoutIntegration::LineLayout::updateInlineBlockDimensions):
* layout/integration/LayoutIntegrationLineLayout.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutModernLines):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269817 => 269818)


--- trunk/Source/WebCore/ChangeLog	2020-11-14 15:26:56 UTC (rev 269817)
+++ trunk/Source/WebCore/ChangeLog	2020-11-14 17:38:37 UTC (rev 269818)
@@ -1,5 +1,21 @@
 2020-11-14  Zalan Bujtas  <[email protected]>
 
+        [LFC][Integration] Use the physical size when setting the pre-computed width/height on ReplacedBox
+        https://bugs.webkit.org/show_bug.cgi?id=218915
+
+        Reviewed by Antti Koivisto.
+
+        This is where the logical vs. physical coordinate flip happens on the integration level.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::updateReplacedDimensions):
+        (WebCore::LayoutIntegration::LineLayout::updateInlineBlockDimensions):
+        * layout/integration/LayoutIntegrationLineLayout.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::layoutModernLines):
+
+2020-11-14  Zalan Bujtas  <[email protected]>
+
         [LFC][IFC] Display runs generated by boxes should have border box geometries
         https://bugs.webkit.org/show_bug.cgi?id=218932
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (269817 => 269818)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-14 15:26:56 UTC (rev 269817)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-11-14 17:38:37 UTC (rev 269818)
@@ -110,12 +110,24 @@
 
 void LineLayout::updateReplacedDimensions(const RenderBox& replaced)
 {
-    auto& layoutBox = m_boxTree.layoutBoxForRenderer(replaced);
+    updateLayoutBoxDimensions(replaced);
+}
+
+void LineLayout::updateInlineBlockDimensions(const RenderBlock& inlineBlock)
+{
+    updateLayoutBoxDimensions(inlineBlock);
+}
+
+void LineLayout::updateLayoutBoxDimensions(const RenderBox& replacedOrInlineBlock)
+{
+    auto& layoutBox = m_boxTree.layoutBoxForRenderer(replacedOrInlineBlock);
+    // Internally both replaced and inline-box content use replaced boxes.
     auto& replacedBox = downcast<Layout::ReplacedBox>(layoutBox);
 
-    replacedBox.setContentSizeForIntegration({ replaced.contentLogicalWidth(), replaced.contentLogicalHeight() });
+    // Always use the physical size here for inline level boxes (this is where the logical vs. physical coords flip happens).
+    replacedBox.setContentSizeForIntegration({ replacedOrInlineBlock.contentWidth(), replacedOrInlineBlock.contentHeight() });
 
-    auto baseline = replaced.baselinePosition(AlphabeticBaseline, false /* firstLine */, HorizontalLine, PositionOnContainingLine);
+    auto baseline = replacedOrInlineBlock.baselinePosition(AlphabeticBaseline, false /* firstLine */, HorizontalLine, PositionOnContainingLine);
     replacedBox.setBaseline(baseline);
 }
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (269817 => 269818)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-11-14 15:26:56 UTC (rev 269817)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-11-14 17:38:37 UTC (rev 269818)
@@ -64,6 +64,7 @@
     static bool canUseForAfterStyleChange(const RenderBlockFlow&, StyleDifference);
 
     void updateReplacedDimensions(const RenderBox&);
+    void updateInlineBlockDimensions(const RenderBlock&);
     void updateStyle(const RenderBoxModelObject&);
     void layout();
 
@@ -101,6 +102,7 @@
     void prepareFloatingState();
     void constructContent();
     InlineContent& ensureInlineContent();
+    void updateLayoutBoxDimensions(const RenderBox&);
 
     RenderBlockFlow& flow() { return m_boxTree.flow(); }
 

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (269817 => 269818)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-11-14 15:26:56 UTC (rev 269817)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-11-14 17:38:37 UTC (rev 269818)
@@ -3621,8 +3621,8 @@
         if (is<RenderBlock>(renderer)) {
             auto& block = downcast<RenderBlock>(renderer);
             block.layoutIfNeeded();
-            // FIXME: Taking the same path as replaced for now.
-            layoutFormattingContextLineLayout.updateReplacedDimensions(block);
+            ASSERT(block.style().display() == DisplayType::InlineBlock);
+            layoutFormattingContextLineLayout.updateInlineBlockDimensions(block);
             continue;
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to