Title: [289897] trunk/Source/WebCore
Revision
289897
Author
[email protected]
Date
2022-02-16 09:29:44 -0800 (Wed, 16 Feb 2022)

Log Message

[LFC][Integration] LineLayout::firstLineBaseline callers expect physical position
https://bugs.webkit.org/show_bug.cgi?id=236688

Reviewed by Antti Koivisto.

Legacy line layout returns the physical position too, though in a bit obscure manner:

  firstRootBox()->logicalTop() + firstLineStyle().metricsOfPrimaryFont().descent(firstRootBox()->baselineType())
  where
    // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
    float logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_topLeft.x(); }

* layout/integration/LayoutIntegrationLine.h:
(WebCore::LayoutIntegration::Line::lineBoxHeight const):
(WebCore::LayoutIntegration::Line::lineBoxWidth const):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::firstLinePhysicalBaseline const):
(WebCore::LayoutIntegration::LineLayout::lastLineLogicalBaseline const):
(WebCore::LayoutIntegration::LineLayout::firstLineBaseline const): Deleted.
(WebCore::LayoutIntegration::LineLayout::lastLineBaseline const): Deleted.
* layout/integration/LayoutIntegrationLineLayout.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline const):
(WebCore::RenderBlockFlow::inlineBlockBaseline const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289896 => 289897)


--- trunk/Source/WebCore/ChangeLog	2022-02-16 17:27:51 UTC (rev 289896)
+++ trunk/Source/WebCore/ChangeLog	2022-02-16 17:29:44 UTC (rev 289897)
@@ -1,3 +1,30 @@
+2022-02-16  Alan Bujtas  <[email protected]>
+
+        [LFC][Integration] LineLayout::firstLineBaseline callers expect physical position
+        https://bugs.webkit.org/show_bug.cgi?id=236688
+
+        Reviewed by Antti Koivisto.
+
+        Legacy line layout returns the physical position too, though in a bit obscure manner:
+
+          firstRootBox()->logicalTop() + firstLineStyle().metricsOfPrimaryFont().descent(firstRootBox()->baselineType())
+          where
+            // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
+            float logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_topLeft.x(); }
+
+        * layout/integration/LayoutIntegrationLine.h:
+        (WebCore::LayoutIntegration::Line::lineBoxHeight const):
+        (WebCore::LayoutIntegration::Line::lineBoxWidth const):
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::firstLinePhysicalBaseline const):
+        (WebCore::LayoutIntegration::LineLayout::lastLineLogicalBaseline const):
+        (WebCore::LayoutIntegration::LineLayout::firstLineBaseline const): Deleted.
+        (WebCore::LayoutIntegration::LineLayout::lastLineBaseline const): Deleted.
+        * layout/integration/LayoutIntegrationLineLayout.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::firstLineBaseline const):
+        (WebCore::RenderBlockFlow::inlineBlockBaseline const):
+
 2022-02-16  Gavin Phillips  <[email protected]>
 
         Allow exposed WebGL and WebAudio interfaces to be controlled via a setting

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h (289896 => 289897)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2022-02-16 17:27:51 UTC (rev 289896)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2022-02-16 17:29:44 UTC (rev 289897)
@@ -58,6 +58,8 @@
     float lineBoxBottom() const { return m_lineBoxRect.maxY(); }
     float lineBoxLeft() const { return m_lineBoxRect.x(); }
     float lineBoxRight() const { return m_lineBoxRect.maxX(); }
+    float lineBoxHeight() const { return m_lineBoxRect.height(); }
+    float lineBoxWidth() const { return m_lineBoxRect.width(); }
 
     float enclosingContentTop() const { return m_enclosingContentTop; }
     float enclosingContentBottom() const { return m_enclosingContentBottom; }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (289896 => 289897)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-16 17:27:51 UTC (rev 289896)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-02-16 17:29:44 UTC (rev 289897)
@@ -424,7 +424,7 @@
     return m_inlineContent->lines.size();
 }
 
-LayoutUnit LineLayout::firstLineBaseline() const
+LayoutUnit LineLayout::firstLinePhysicalBaseline() const
 {
     if (!m_inlineContent || m_inlineContent->lines.isEmpty()) {
         ASSERT_NOT_REACHED();
@@ -435,12 +435,10 @@
     if (rootLayoutBox().style().isHorizontalWritingMode())
         return LayoutUnit { firstLine.lineBoxTop() + firstLine.baseline() };
 
-    // See LineLayout::lastLineBaseline below for more info.
-    auto lineLogicalTop = flow().logicalHeight() - firstLine.lineBoxRight();
-    return LayoutUnit { lineLogicalTop + firstLine.baseline() };
+    return LayoutUnit { firstLine.lineBoxLeft() + (firstLine.lineBoxWidth() - firstLine.baseline()) };
 }
 
-LayoutUnit LineLayout::lastLineBaseline() const
+LayoutUnit LineLayout::lastLineLogicalBaseline() const
 {
     if (!m_inlineContent || m_inlineContent->lines.isEmpty()) {
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (289896 => 289897)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2022-02-16 17:27:51 UTC (rev 289896)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2022-02-16 17:29:44 UTC (rev 289897)
@@ -88,8 +88,8 @@
     LayoutUnit contentLogicalHeight() const;
     size_t lineCount() const;
 
-    LayoutUnit firstLineBaseline() const;
-    LayoutUnit lastLineBaseline() const;
+    LayoutUnit firstLinePhysicalBaseline() const;
+    LayoutUnit lastLineLogicalBaseline() const;
 
     void adjustForPagination();
     void collectOverflow();

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (289896 => 289897)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-02-16 17:27:51 UTC (rev 289896)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-02-16 17:29:44 UTC (rev 289897)
@@ -2959,7 +2959,7 @@
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     if (modernLineLayout())
-        return LayoutUnit { floorToInt(modernLineLayout()->firstLineBaseline()) };
+        return LayoutUnit { floorToInt(modernLineLayout()->firstLinePhysicalBaseline()) };
 #endif
 
     ASSERT(firstRootBox());
@@ -3010,7 +3010,7 @@
         }
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
         else if (modernLineLayout())
-            lastBaseline = floorToInt(modernLineLayout()->lastLineBaseline());
+            lastBaseline = floorToInt(modernLineLayout()->lastLineLogicalBaseline());
 #endif
     }
     // According to the CSS spec http://www.w3.org/TR/CSS21/visudet.html, we shouldn't be performing this min, but should
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to