Title: [269223] trunk/Source/WebCore
Revision
269223
Author
[email protected]
Date
2020-10-31 05:19:30 -0700 (Sat, 31 Oct 2020)

Log Message

[LFC][Integration] Generate RootInlineBox::lineTop/lineBottom matching geometries
https://bugs.webkit.org/show_bug.cgi?id=218412

Reviewed by Antti Koivisto.

Line::enclosingRect's y() and maxY() match RootInlineBox::lineTop() and lineBottom() vertical coordinates.
It is required by the line iterator as some clients are apparently interested in the overflown area.

* layout/integration/LayoutIntegrationLine.h:
(WebCore::LayoutIntegration::Line::Line):
(WebCore::LayoutIntegration::Line::enclosingRect const):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::constructContent):
* layout/integration/LayoutIntegrationPagination.cpp:
(WebCore::LayoutIntegration::makeAdjustedContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269222 => 269223)


--- trunk/Source/WebCore/ChangeLog	2020-10-31 12:18:33 UTC (rev 269222)
+++ trunk/Source/WebCore/ChangeLog	2020-10-31 12:19:30 UTC (rev 269223)
@@ -1,5 +1,23 @@
 2020-10-31  Zalan Bujtas  <[email protected]>
 
+        [LFC][Integration] Generate RootInlineBox::lineTop/lineBottom matching geometries
+        https://bugs.webkit.org/show_bug.cgi?id=218412
+
+        Reviewed by Antti Koivisto.
+
+        Line::enclosingRect's y() and maxY() match RootInlineBox::lineTop() and lineBottom() vertical coordinates.
+        It is required by the line iterator as some clients are apparently interested in the overflown area.
+
+        * layout/integration/LayoutIntegrationLine.h:
+        (WebCore::LayoutIntegration::Line::Line):
+        (WebCore::LayoutIntegration::Line::enclosingRect const):
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::constructContent):
+        * layout/integration/LayoutIntegrationPagination.cpp:
+        (WebCore::LayoutIntegration::makeAdjustedContent):
+
+2020-10-31  Zalan Bujtas  <[email protected]>
+
         [LFC][IFC] Rename ContainerStart/End to InlineBoxStart/End
         https://bugs.webkit.org/show_bug.cgi?id=218410
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h (269222 => 269223)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2020-10-31 12:18:33 UTC (rev 269222)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2020-10-31 12:19:30 UTC (rev 269223)
@@ -35,10 +35,11 @@
 class Line {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    Line(size_t firstRunIndex, size_t runCount, const FloatRect& rect, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float horizontalAlignmentOffset)
+    Line(size_t firstRunIndex, size_t runCount, const FloatRect& rect, const FloatRect& enclosingRect, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float horizontalAlignmentOffset)
         : m_firstRunIndex(firstRunIndex)
         , m_runCount(runCount)
         , m_rect(rect)
+        , m_enclosingRect(enclosingRect)
         , m_scrollableOverflow(scrollableOverflow)
         , m_inkOverflow(inkOverflow)
         , m_baseline(baseline)
@@ -49,6 +50,7 @@
     size_t firstRunIndex() const { return m_firstRunIndex; }
     size_t runCount() const { return m_runCount; }
     const FloatRect& rect() const { return m_rect; }
+    const FloatRect& enclosingRect() const { return m_enclosingRect; }
     const FloatRect& scrollableOverflow() const { return m_scrollableOverflow; }
     const FloatRect& inkOverflow() const { return m_inkOverflow; }
     float baseline() const { return m_baseline; }
@@ -58,6 +60,8 @@
     size_t m_firstRunIndex { 0 };
     size_t m_runCount { 0 };
     FloatRect m_rect;
+    // Enclosing rect fully encloses all the inline level boxes on the line.
+    FloatRect m_enclosingRect;
     FloatRect m_scrollableOverflow;
     FloatRect m_inkOverflow;
     float m_baseline { 0 };

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (269222 => 269223)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-10-31 12:18:33 UTC (rev 269222)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-10-31 12:19:30 UTC (rev 269223)
@@ -216,6 +216,7 @@
 
     auto constructDisplayLine = [&] {
         auto& lines = m_inlineFormattingState.lines();
+        auto& lineBoxes = m_inlineFormattingState.lineBoxes();
         auto& runs = displayInlineContent.runs;
         size_t runIndex = 0;
         for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) {
@@ -244,9 +245,23 @@
             auto lineRect = FloatRect { line.logicalRect() };
             // Painting code (specifically TextRun's xPos) needs the line box offset to be able to compute tab positions.
             lineRect.setX(lineBoxLogicalRect.left());
-            if (lineNeedsLegacyIntegralVerticalPosition(lineIndex))
+            auto enclosingLineRect = [&] {
+                // Let's (vertically)enclose all the inline level boxes.
+                // This mostly matches 'lineRect', unless line-height triggers line box overflow (not to be confused with ink or scroll overflow).
+                auto enclosingRect = lineRect;
+                auto& lineBox = lineBoxes[lineIndex];
+                for (auto& inlineLevelBox : lineBox.inlineLevelBoxList()) {
+                    auto inlineLevelBoxLogicalRect = lineBox.logicalRectForInlineLevelBox(inlineLevelBox->layoutBox());
+                    enclosingRect.setY(std::min(enclosingRect.y(), inlineLevelBoxLogicalRect.top()));
+                    enclosingRect.shiftMaxYEdgeTo(std::max(enclosingRect.maxY(), inlineLevelBoxLogicalRect.bottom()));
+                }
+                return enclosingRect;
+            }();
+            if (lineNeedsLegacyIntegralVerticalPosition(lineIndex)) {
                 lineRect.setY(roundToInt(lineRect.y()));
-            displayInlineContent.lines.append({ firstRunIndex, runCount, lineRect, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.horizontalAlignmentOffset() });
+                enclosingLineRect.setY(roundToInt(enclosingLineRect.y()));
+            }
+            displayInlineContent.lines.append({ firstRunIndex, runCount, lineRect, enclosingLineRect, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.horizontalAlignmentOffset() });
         }
     };
     constructDisplayLine();

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp (269222 => 269223)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp	2020-10-31 12:18:33 UTC (rev 269222)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp	2020-10-31 12:19:30 UTC (rev 269223)
@@ -130,6 +130,7 @@
             line.firstRunIndex(),
             line.runCount(),
             moveVertically(line.rect(), offset),
+            moveVertically(line.rect(), offset),
             moveVertically(line.scrollableOverflow(), offset),
             moveVertically(line.inkOverflow(), offset),
             line.baseline(),
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to