Title: [266685] trunk/Source/WebCore
Revision
266685
Author
[email protected]
Date
2020-09-06 16:42:25 -0700 (Sun, 06 Sep 2020)

Log Message

[LFC][IFC] Rename Display::LineBox to Display::Line
https://bugs.webkit.org/show_bug.cgi?id=216232

Reviewed by Sam Weinig.

Display::LineBox represent a line and not to be confused with Layout::LineBox which represents a collection of inline boxes.

* WebCore.xcodeproj/project.pbxproj:
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const):
* layout/displaytree/DisplayInlineContent.h:
(WebCore::Display::InlineContent::lineForRun const):
(WebCore::Display::InlineContent::lineBoxForRun const): Deleted.
* layout/displaytree/DisplayLine.h: Renamed from Source/WebCore/layout/displaytree/DisplayLineBox.h.
(WebCore::Display::Line::rect const):
(WebCore::Display::Line::scrollableOverflow const):
(WebCore::Display::Line::inkOverflow const):
(WebCore::Display::Line::left const):
(WebCore::Display::Line::right const):
(WebCore::Display::Line::top const):
(WebCore::Display::Line::bottom const):
(WebCore::Display::Line::width const):
(WebCore::Display::Line::height const):
(WebCore::Display::Line::baseline const):
(WebCore::Display::Line::Line):
(WebCore::Display::Line::moveVertically):
* layout/displaytree/DisplayPainter.cpp:
(WebCore::Display::paintInlineContent):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::createDisplayBoxesForLineContent):
* layout/inlineformatting/InlineFormattingContextQuirks.cpp:
(WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
* layout/inlineformatting/InlineFormattingState.h:
(WebCore::Layout::InlineFormattingState::shrinkDisplayInlineContent):
* layout/inlineformatting/InlineLineBox.cpp:
(WebCore::Layout::LineBox::constructInlineBoxes):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::contentLogicalHeight const):
(WebCore::LayoutIntegration::LineLayout::lineCount const):
(WebCore::LayoutIntegration::LineLayout::firstLineBaseline const):
(WebCore::LayoutIntegration::LineLayout::lastLineBaseline const):
(WebCore::LayoutIntegration::LineLayout::collectOverflow):
(WebCore::LayoutIntegration::LineLayout::paint):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputInlineRuns):
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
* layout/tableformatting/TableFormattingContextGeometry.cpp:
(WebCore::Layout::TableFormattingContext::Geometry::usedBaselineForCell):
* rendering/line/LineLayoutTraversalDisplayRunPath.h:
(WebCore::LineLayoutTraversal::DisplayRunPath::baseline const):
(WebCore::LineLayoutTraversal::DisplayRunPath::line const):
(WebCore::LineLayoutTraversal::DisplayRunPath::lineBox const): Deleted.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (266684 => 266685)


--- trunk/Source/WebCore/ChangeLog	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/ChangeLog	2020-09-06 23:42:25 UTC (rev 266685)
@@ -1,3 +1,64 @@
+2020-09-06  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Rename Display::LineBox to Display::Line
+        https://bugs.webkit.org/show_bug.cgi?id=216232
+
+        Reviewed by Sam Weinig.
+
+        Display::LineBox represent a line and not to be confused with Layout::LineBox which represents a collection of inline boxes.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const):
+        * layout/displaytree/DisplayInlineContent.h:
+        (WebCore::Display::InlineContent::lineForRun const):
+        (WebCore::Display::InlineContent::lineBoxForRun const): Deleted.
+        * layout/displaytree/DisplayLine.h: Renamed from Source/WebCore/layout/displaytree/DisplayLineBox.h.
+        (WebCore::Display::Line::rect const):
+        (WebCore::Display::Line::scrollableOverflow const):
+        (WebCore::Display::Line::inkOverflow const):
+        (WebCore::Display::Line::left const):
+        (WebCore::Display::Line::right const):
+        (WebCore::Display::Line::top const):
+        (WebCore::Display::Line::bottom const):
+        (WebCore::Display::Line::width const):
+        (WebCore::Display::Line::height const):
+        (WebCore::Display::Line::baseline const):
+        (WebCore::Display::Line::Line):
+        (WebCore::Display::Line::moveVertically):
+        * layout/displaytree/DisplayPainter.cpp:
+        (WebCore::Display::paintInlineContent):
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::lineLayout):
+        (WebCore::Layout::InlineFormattingContext::createDisplayBoxesForLineContent):
+        * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
+        (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
+        * layout/inlineformatting/InlineFormattingState.h:
+        (WebCore::Layout::InlineFormattingState::shrinkDisplayInlineContent):
+        * layout/inlineformatting/InlineLineBox.cpp:
+        (WebCore::Layout::LineBox::constructInlineBoxes):
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::contentLogicalHeight const):
+        (WebCore::LayoutIntegration::LineLayout::lineCount const):
+        (WebCore::LayoutIntegration::LineLayout::firstLineBaseline const):
+        (WebCore::LayoutIntegration::LineLayout::lastLineBaseline const):
+        (WebCore::LayoutIntegration::LineLayout::collectOverflow):
+        (WebCore::LayoutIntegration::LineLayout::paint):
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::outputInlineRuns):
+        * layout/tableformatting/TableFormattingContext.cpp:
+        (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
+        * layout/tableformatting/TableFormattingContextGeometry.cpp:
+        (WebCore::Layout::TableFormattingContext::Geometry::usedBaselineForCell):
+        * rendering/line/LineLayoutTraversalDisplayRunPath.h:
+        (WebCore::LineLayoutTraversal::DisplayRunPath::baseline const):
+        (WebCore::LineLayoutTraversal::DisplayRunPath::line const):
+        (WebCore::LineLayoutTraversal::DisplayRunPath::lineBox const): Deleted.
+
 2020-09-06  Chris Dumez  <[email protected]>
 
         ConvolverNode incorrectly outputs silence because m_reverb is null

Modified: trunk/Source/WebCore/Headers.cmake (266684 => 266685)


--- trunk/Source/WebCore/Headers.cmake	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/Headers.cmake	2020-09-06 23:42:25 UTC (rev 266685)
@@ -696,7 +696,7 @@
     layout/displaytree/DisplayBox.h
     layout/displaytree/DisplayInlineContent.h
     layout/displaytree/DisplayInlineRect.h
-    layout/displaytree/DisplayLineBox.h
+    layout/displaytree/DisplayLine.h
     layout/displaytree/DisplayRect.h
     layout/displaytree/DisplayRun.h
 

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (266684 => 266685)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-09-06 23:42:25 UTC (rev 266685)
@@ -2082,7 +2082,7 @@
 		6FA4454E898F2FC168BC38C1 /* JSBeforeUnloadEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 29E04A27BED2F81F98E9022B /* JSBeforeUnloadEvent.h */; };
 		6FB11B5C21783FD000E2A574 /* TextUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB11B5921783FCF00E2A574 /* TextUtil.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FB2400523DFF12800796458 /* InlineLineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB2400323DFF12700796458 /* InlineLineBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		6FB47E632277425A00C7BCB0 /* DisplayLineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB47E612277425A00C7BCB0 /* DisplayLineBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		6FB47E632277425A00C7BCB0 /* DisplayLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB47E612277425A00C7BCB0 /* DisplayLine.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FB5E214221F2453003989CF /* ContentChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FB5E212221F2447003989CF /* ContentChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FCE1A1A22618ABD004F0343 /* DisplayRun.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FCE1A1822618AB3004F0343 /* DisplayRun.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6FD9CD54227E21C800E53957 /* DisplayRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FD9CD52227E21C800E53957 /* DisplayRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9616,7 +9616,7 @@
 		6FB11B5B21783FCF00E2A574 /* TextUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextUtil.cpp; sourceTree = "<group>"; };
 		6FB22E30230097E300C20866 /* TableGrid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TableGrid.h; sourceTree = "<group>"; };
 		6FB2400323DFF12700796458 /* InlineLineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineLineBox.h; sourceTree = "<group>"; };
-		6FB47E612277425A00C7BCB0 /* DisplayLineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayLineBox.h; sourceTree = "<group>"; };
+		6FB47E612277425A00C7BCB0 /* DisplayLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayLine.h; sourceTree = "<group>"; };
 		6FB5E212221F2447003989CF /* ContentChangeObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentChangeObserver.h; sourceTree = "<group>"; };
 		6FBB860520B464B600DAD938 /* FormattingContextGeometry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingContextGeometry.cpp; sourceTree = "<group>"; };
 		6FC53AEB24AF7A8E006059FE /* TableFormattingContextQuirks.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TableFormattingContextQuirks.cpp; sourceTree = "<group>"; };
@@ -17481,7 +17481,7 @@
 				E4FB4B35239BEB10003C336A /* DisplayInlineContent.cpp */,
 				E451C6332394058E00993190 /* DisplayInlineContent.h */,
 				112FB350239C23C40087054A /* DisplayInlineRect.h */,
-				6FB47E612277425A00C7BCB0 /* DisplayLineBox.h */,
+				6FB47E612277425A00C7BCB0 /* DisplayLine.h */,
 				6F77868523491AC6004D9636 /* DisplayPainter.cpp */,
 				6F77868723491AD7004D9636 /* DisplayPainter.h */,
 				6FD9CD52227E21C800E53957 /* DisplayRect.h */,
@@ -30951,7 +30951,7 @@
 				1199FA5B208E3C7F002358CC /* DisplayBox.h in Headers */,
 				E451C6342394058F00993190 /* DisplayInlineContent.h in Headers */,
 				112FB352239C23C40087054A /* DisplayInlineRect.h in Headers */,
-				6FB47E632277425A00C7BCB0 /* DisplayLineBox.h in Headers */,
+				6FB47E632277425A00C7BCB0 /* DisplayLine.h in Headers */,
 				0FE5FBD31C3DD51E0007A2CA /* DisplayList.h in Headers */,
 				55AD09402408964000DE4D2F /* DisplayListDrawingContext.h in Headers */,
 				55AD093E2408963500DE4D2F /* DisplayListImageBuffer.h in Headers */,

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -193,11 +193,11 @@
     auto bottom = borderAndPaddingTop;
     auto& formattingRootContainer = downcast<ContainerBox>(layoutBox);
     if (formattingRootContainer.establishesInlineFormattingContext()) {
-        auto& lineBoxes = layoutState.establishedInlineFormattingState(formattingRootContainer).displayInlineContent()->lineBoxes;
+        auto& lines = layoutState.establishedInlineFormattingState(formattingRootContainer).displayInlineContent()->lines;
         // Even empty containers generate one line. 
-        ASSERT(!lineBoxes.isEmpty());
-        top = lineBoxes.first().top();
-        bottom = lineBoxes.last().bottom();
+        ASSERT(!lines.isEmpty());
+        top = lines.first().top();
+        bottom = lines.last().bottom();
     } else if (formattingRootContainer.establishesBlockFormattingContext() || formattingRootContainer.establishesTableFormattingContext() || formattingRootContainer.isDocumentBox()) {
         if (formattingRootContainer.hasInFlowChild()) {
             auto& firstBoxGeometry = formattingContext.geometryForBox(*formattingRootContainer.firstInFlowChild(), EscapeReason::NeedsGeometryFromEstablishedFormattingContext);

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -77,10 +77,10 @@
         // 1. the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines
         auto& layoutContainer = downcast<ContainerBox>(layoutBox);
         if (layoutContainer.establishesInlineFormattingContext()) {
-            auto& lineBoxes = layoutState().establishedInlineFormattingState(layoutContainer).displayInlineContent()->lineBoxes;
+            auto& lines = layoutState().establishedInlineFormattingState(layoutContainer).displayInlineContent()->lines;
             // Even empty containers generate one line. 
-            ASSERT(!lineBoxes.isEmpty());
-            return { toLayoutUnit(lineBoxes.last().bottom()) - borderAndPaddingTop, nonCollapsedMargin };
+            ASSERT(!lines.isEmpty());
+            return { toLayoutUnit(lines.last().bottom()) - borderAndPaddingTop, nonCollapsedMargin };
         }
 
         // 2. the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom margin...

Modified: trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -407,7 +407,7 @@
 
             auto isConsideredEmpty = [&] {
                 auto& formattingState = layoutState.establishedInlineFormattingState(containerBox);
-                if (auto* inlineContent = formattingState.displayInlineContent(); inlineContent && !inlineContent->lineBoxes.isEmpty())
+                if (auto* inlineContent = formattingState.displayInlineContent(); inlineContent && !inlineContent->lines.isEmpty())
                     return false;
                 // Any float box in this formatting context prevents collapsing through.
                 auto& floats = formattingState.floatingState().floats();

Modified: trunk/Source/WebCore/layout/displaytree/DisplayInlineContent.h (266684 => 266685)


--- trunk/Source/WebCore/layout/displaytree/DisplayInlineContent.h	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/displaytree/DisplayInlineContent.h	2020-09-06 23:42:25 UTC (rev 266685)
@@ -27,7 +27,7 @@
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
-#include "DisplayLineBox.h"
+#include "DisplayLine.h"
 #include "DisplayRun.h"
 #include <wtf/IteratorRange.h>
 #include <wtf/Vector.h>
@@ -39,12 +39,12 @@
     ~InlineContent();
 
     using Runs = Vector<Run, 4>;
-    using LineBoxes = Vector<LineBox, 4>;
+    using Lines = Vector<Line, 4>;
 
     Runs runs;
-    LineBoxes lineBoxes;
+    Lines lines;
 
-    const LineBox& lineBoxForRun(const Run& run) const { return lineBoxes[run.lineIndex()]; }
+    const Line& lineForRun(const Run& run) const { return lines[run.lineIndex()]; }
     WTF::IteratorRange<const Run*> runsForRect(const LayoutRect&) const;
 };
 

Copied: trunk/Source/WebCore/layout/displaytree/DisplayLine.h (from rev 266684, trunk/Source/WebCore/layout/displaytree/DisplayLineBox.h) (0 => 266685)


--- trunk/Source/WebCore/layout/displaytree/DisplayLine.h	                        (rev 0)
+++ trunk/Source/WebCore/layout/displaytree/DisplayLine.h	2020-09-06 23:42:25 UTC (rev 266685)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "DisplayInlineRect.h"
+
+namespace WebCore {
+namespace Display {
+
+class Line {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    Line(const InlineRect&, const InlineRect& scrollableOverflow, const InlineRect& inkOverflow, InlineLayoutUnit baseline);
+
+    const InlineRect& rect() const { return m_rect; }
+    const InlineRect& scrollableOverflow() const { return m_scrollableOverflow; }
+    const InlineRect& inkOverflow() const { return m_inkOverflow; }
+
+    InlineLayoutUnit left() const { return m_rect.left(); }
+    InlineLayoutUnit right() const { return m_rect.right(); }
+    InlineLayoutUnit top() const { return m_rect.top(); }
+    InlineLayoutUnit bottom() const { return m_rect.bottom(); }
+
+    InlineLayoutUnit width() const { return m_rect.width(); }
+    InlineLayoutUnit height() const { return m_rect.height(); }
+
+    void moveVertically(InlineLayoutUnit);
+
+    InlineLayoutUnit baseline() const { return m_baseline; }
+
+private:
+    InlineRect m_rect;
+    InlineRect m_scrollableOverflow;
+    InlineRect m_inkOverflow;
+    InlineLayoutUnit m_baseline { 0 };
+};
+
+inline Line::Line(const InlineRect& rect, const InlineRect& scrollableOverflow, const InlineRect& inkOverflow, InlineLayoutUnit baseline)
+    : m_rect(rect)
+    , m_scrollableOverflow(scrollableOverflow)
+    , m_inkOverflow(inkOverflow)
+    , m_baseline(baseline)
+{
+}
+
+inline void Line::moveVertically(InlineLayoutUnit offset)
+{
+    m_rect.moveVertically(offset);
+    m_inkOverflow.moveVertically(offset);
+}
+
+}
+}
+
+#endif

Deleted: trunk/Source/WebCore/layout/displaytree/DisplayLineBox.h (266684 => 266685)


--- trunk/Source/WebCore/layout/displaytree/DisplayLineBox.h	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/displaytree/DisplayLineBox.h	2020-09-06 23:42:25 UTC (rev 266685)
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-#include "DisplayInlineRect.h"
-
-namespace WebCore {
-namespace Display {
-
-class LineBox {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    LineBox(const InlineRect&, const InlineRect& scrollableOverflow, const InlineRect& inkOverflow, InlineLayoutUnit baseline);
-
-    const InlineRect& rect() const { return m_rect; }
-    const InlineRect& scrollableOverflow() const { return m_scrollableOverflow; }
-    const InlineRect& inkOverflow() const { return m_inkOverflow; }
-
-    InlineLayoutUnit left() const { return m_rect.left(); }
-    InlineLayoutUnit right() const { return m_rect.right(); }
-    InlineLayoutUnit top() const { return m_rect.top(); }
-    InlineLayoutUnit bottom() const { return m_rect.bottom(); }
-
-    InlineLayoutUnit width() const { return m_rect.width(); }
-    InlineLayoutUnit height() const { return m_rect.height(); }
-
-    void moveVertically(InlineLayoutUnit);
-
-    InlineLayoutUnit baseline() const { return m_baseline; }
-
-private:
-    InlineRect m_rect;
-    InlineRect m_scrollableOverflow;
-    InlineRect m_inkOverflow;
-    InlineLayoutUnit m_baseline { 0 };
-};
-
-inline LineBox::LineBox(const InlineRect& rect, const InlineRect& scrollableOverflow, const InlineRect& inkOverflow, InlineLayoutUnit baseline)
-    : m_rect(rect)
-    , m_scrollableOverflow(scrollableOverflow)
-    , m_inkOverflow(inkOverflow)
-    , m_baseline(baseline)
-{
-}
-
-inline void LineBox::moveVertically(InlineLayoutUnit offset)
-{
-    m_rect.moveVertically(offset);
-    m_inkOverflow.moveVertically(offset);
-}
-
-}
-}
-
-#endif

Modified: trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -128,10 +128,10 @@
 
             auto absoluteLeft = absoluteOffset.x() + run.left();
             // FIXME: Add non-baseline align painting
-            auto& lineBox = displayInlineContent->lineBoxForRun(run);
+            auto& line = displayInlineContent->lineForRun(run);
             auto baseline = absoluteOffset.y() + run.top() + style.fontMetrics().ascent();
             auto expansion = run.expansion();
-            auto textRun = TextRun { textContent->content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior };
+            auto textRun = TextRun { textContent->content(), run.left() - line.left(), expansion.horizontalExpansion, expansion.behavior };
             textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
             context.drawText(style.fontCascade(), textRun, { absoluteLeft, baseline });
         } else if (auto* cachedImage = run.image()) {

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -141,7 +141,7 @@
     };
     Optional<PreviousLine> previousLine;
     auto floatingContext = FloatingContext { root(), *this, formattingState().floatingState() };
-    auto isFirstLine = !formattingState().displayInlineContent() || formattingState().displayInlineContent()->lineBoxes.isEmpty();
+    auto isFirstLine = !formattingState().displayInlineContent() || formattingState().displayInlineContent()->lines.isEmpty();
 
     auto lineBuilder = LineBuilder { *this, floatingContext, root(), inlineItems };
     while (!needsLayoutRange.isEmpty()) {
@@ -461,7 +461,7 @@
     } else
         initialContaingBlockSize = geometryForBox(root().initialContainingBlock(), EscapeReason::StrokeOverflowNeedsViewportGeometry).contentBox().size();
     auto& inlineContent = formattingState.ensureDisplayInlineContent();
-    auto lineIndex = inlineContent.lineBoxes.size();
+    auto lineIndex = inlineContent.lines.size();
     auto lineInkOverflow = scrollableOverflow;
     // Compute final box geometry.
     for (auto& lineRun : lineContent.runs) {
@@ -520,8 +520,7 @@
             // Painting code (specifically TextRun's xPos) needs the aligned offset to be able to compute tab positions.
             lineLogicalRect.moveHorizontally(*horizontalAlignmentOffset);
         }
-        // FIXME: Display::LineBox should really be named Display::Line
-        inlineContent.lineBoxes.append({ lineLogicalRect, scrollableOverflow, lineInkOverflow, lineBoxVerticalOffset + lineBox.alignmentBaseline() });
+        inlineContent.lines.append({ lineLogicalRect, scrollableOverflow, lineInkOverflow, lineBoxVerticalOffset + lineBox.alignmentBaseline() });
     };
     constructDisplayLine();
     return lineLogicalRect;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -59,8 +59,8 @@
         if (run.isBox()) {
             if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) {
                 auto& formattingState = layoutState.establishedInlineFormattingState(downcast<ContainerBox>(layoutBox));
-                auto lastLineBox = formattingState.displayInlineContent()->lineBoxes.last();
-                if (lastLineBox.height() > lastLineBox.baseline())
+                auto lastLine = formattingState.displayInlineContent()->lines.last();
+                if (lastLine.height() > lastLine.baseline())
                     return false;
             }
             continue;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h (266684 => 266685)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h	2020-09-06 23:42:25 UTC (rev 266685)
@@ -73,7 +73,7 @@
     if (!m_displayInlineContent)
         return;
     m_displayInlineContent->runs.shrinkToFit();
-    m_displayInlineContent->lineBoxes.shrinkToFit();
+    m_displayInlineContent->lines.shrinkToFit();
 }
 
 }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -168,8 +168,8 @@
             if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) {
                 auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox));
                 // Spec makes us generate at least one line -even if it is empty.
-                auto& lastLineBox = formattingState.displayInlineContent()->lineBoxes.last();
-                auto inlineBlockBaseline = lastLineBox.top() + lastLineBox.baseline();
+                auto& lastLine = formattingState.displayInlineContent()->lines.last();
+                auto inlineBlockBaseline = lastLine.top() + lastLine.baseline();
                 // The inline-block's baseline offset is relative to its content box. Let's convert it relative to the margin box.
                 //           _______________ <- margin box
                 //          |

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -156,8 +156,8 @@
 
 LayoutUnit LineLayout::contentLogicalHeight() const
 {
-    auto& lineBoxes = displayInlineContent()->lineBoxes;
-    return LayoutUnit { lineBoxes.last().bottom() - lineBoxes.first().top() };
+    auto& lines = displayInlineContent()->lines;
+    return LayoutUnit { lines.last().bottom() - lines.first().top() };
 }
 
 size_t LineLayout::lineCount() const
@@ -167,7 +167,7 @@
         return 0;
     if (inlineContent->runs.isEmpty())
         return 0;
-    return inlineContent->lineBoxes.size();
+    return inlineContent->lines.size();
 }
 
 LayoutUnit LineLayout::firstLineBaseline() const
@@ -178,8 +178,8 @@
         return 0_lu;
     }
 
-    auto& firstLineBox = inlineContent->lineBoxes.first();
-    return Layout::toLayoutUnit(firstLineBox.top() + firstLineBox.baseline());
+    auto& firstLine = inlineContent->lines.first();
+    return Layout::toLayoutUnit(firstLine.top() + firstLine.baseline());
 }
 
 LayoutUnit LineLayout::lastLineBaseline() const
@@ -190,8 +190,8 @@
         return 0_lu;
     }
 
-    auto& lastLineBox = inlineContent->lineBoxes.last();
-    return Layout::toLayoutUnit(lastLineBox.top() + lastLineBox.baseline());
+    auto& lastLine = inlineContent->lines.last();
+    return Layout::toLayoutUnit(lastLine.top() + lastLine.baseline());
 }
 
 void LineLayout::collectOverflow(RenderBlockFlow& flow)
@@ -199,9 +199,9 @@
     ASSERT(&flow == &m_flow);
     ASSERT(!flow.hasOverflowClip());
 
-    for (auto& lineBox : displayInlineContent()->lineBoxes) {
-        flow.addLayoutOverflow(Layout::toLayoutRect(lineBox.scrollableOverflow()));
-        flow.addVisualOverflow(Layout::toLayoutRect(lineBox.inkOverflow()));
+    for (auto& line : displayInlineContent()->lines) {
+        flow.addLayoutOverflow(Layout::toLayoutRect(line.scrollableOverflow()));
+        flow.addVisualOverflow(Layout::toLayoutRect(line.inkOverflow()));
     }
 }
 
@@ -299,14 +299,14 @@
             continue;
         }
 
-        auto& lineBox = inlineContent.lineBoxForRun(run);
-        auto baseline = paintOffset.y() + lineBox.top() + lineBox.baseline();
+        auto& line = inlineContent.lineForRun(run);
+        auto baseline = paintOffset.y() + line.top() + line.baseline();
         auto expansion = run.expansion();
 
         String textWithHyphen;
         if (textContent.needsHyphen())
             textWithHyphen = makeString(textContent.content(), style.hyphenString());
-        TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContent.content(), run.left() - lineBox.left(), expansion.horizontalExpansion, expansion.behavior };
+        TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContent.content(), run.left() - line.left(), expansion.horizontalExpansion, expansion.behavior };
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
         FloatPoint textOrigin { rect.x() + paintOffset.x(), roundToDevicePixel(baseline, deviceScaleFactor) };
 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -390,7 +390,7 @@
         return;
 
     auto& displayRuns = displayInlineContent->runs;
-    auto& lineBoxes = displayInlineContent->lineBoxes;
+    auto& lines = displayInlineContent->lines;
 
     unsigned printedCharacters = 0;
     while (++printedCharacters <= depth * 2)
@@ -398,8 +398,8 @@
     stream << "  ";
 
     stream << "lines are -> ";
-    for (auto& lineBox : lineBoxes)
-        stream << "[" << lineBox.left() << "," << lineBox.top() << " " << lineBox.width() << "x" << lineBox.height() << "] ";
+    for (auto& line : lines)
+        stream << "[" << line.left() << "," << line.top() << " " << line.width() << "x" << line.height() << "] ";
     stream.nextLine();
 
     for (auto& displayRun : displayRuns) {

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -132,8 +132,8 @@
                     auto& displayContent = layoutState().establishedInlineFormattingState(cellBox).ensureDisplayInlineContent();
                     for (auto& run : displayContent.runs)
                         run.moveVertically(intrinsicPaddingTop);
-                    for (auto& lineBox : displayContent.lineBoxes)
-                        lineBox.moveVertically(intrinsicPaddingTop);
+                    for (auto& line : displayContent.lines)
+                        line.moveVertically(intrinsicPaddingTop);
                 }
             };
             adjustCellContentWithInstrinsicPaddingBefore();

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp (266684 => 266685)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp	2020-09-06 23:42:25 UTC (rev 266685)
@@ -146,12 +146,12 @@
     // or the first in-flow table-row in the cell, whichever comes first.
     // If there is no such line box, the baseline is the bottom of content edge of the cell box.
     if (cellBox.establishesInlineFormattingContext())
-        return layoutState().establishedInlineFormattingState(cellBox).displayInlineContent()->lineBoxes[0].baseline();
+        return layoutState().establishedInlineFormattingState(cellBox).displayInlineContent()->lines[0].baseline();
     for (auto& cellDescendant : descendantsOfType<ContainerBox>(cellBox)) {
         if (cellDescendant.establishesInlineFormattingContext()) {
             auto* displayInlineContent = layoutState().establishedInlineFormattingState(cellDescendant).displayInlineContent();
             if (!displayInlineContent->runs.isEmpty())
-                return displayInlineContent->lineBoxes[0].baseline();
+                return displayInlineContent->lines[0].baseline();
         }
         if (cellDescendant.establishesTableFormattingContext())
             return layoutState().establishedTableFormattingState(cellDescendant).tableGrid().rows().list()[0].baseline();

Modified: trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h (266684 => 266685)


--- trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h	2020-09-06 23:09:39 UTC (rev 266684)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h	2020-09-06 23:42:25 UTC (rev 266685)
@@ -52,7 +52,7 @@
 
     FloatRect rect() const;
 
-    float baseline() const { return lineBox().baseline(); }
+    float baseline() const { return line().baseline(); }
 
     bool isLeftToRightDirection() const { return true; }
     bool isHorizontal() const { return true; }
@@ -98,7 +98,7 @@
 private:
     const Display::InlineContent::Runs& runs() const { return m_inlineContent->runs; }
     const Display::Run& run() const { return runs()[m_runIndex]; }
-    const Display::LineBox& lineBox() const { return m_inlineContent->lineBoxForRun(run()); }
+    const Display::Line& line() const { return m_inlineContent->lineForRun(run()); }
 
     RefPtr<const Display::InlineContent> m_inlineContent;
     size_t m_endIndex { 0 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to