- Revision
- 282072
- Author
- [email protected]
- Date
- 2021-09-06 20:26:03 -0700 (Mon, 06 Sep 2021)
Log Message
[LFC][Integration] Remove redundant NonRootInlineBox
https://bugs.webkit.org/show_bug.cgi?id=229967
Reviewed by Antti Koivisto.
Now that all the inline boxes generate runs, and we use those runs to do painint/hittest, this
helper structure is not needed anymore.
* layout/integration/LayoutIntegrationInlineContent.h:
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::build const):
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayRuns const): Deleted.
* layout/integration/LayoutIntegrationInlineContentBuilder.h:
* layout/integration/LayoutIntegrationLine.h:
(WebCore::LayoutIntegration::NonRootInlineBox::NonRootInlineBox): Deleted.
(WebCore::LayoutIntegration::NonRootInlineBox::layoutBox const): Deleted.
(WebCore::LayoutIntegration::NonRootInlineBox::style const): Deleted.
(WebCore::LayoutIntegration::NonRootInlineBox::lineIndex const): Deleted.
(WebCore::LayoutIntegration::NonRootInlineBox::rect const): Deleted.
(WebCore::LayoutIntegration::NonRootInlineBox::setVerticalPositionIntegral): Deleted.
(WebCore::LayoutIntegration::NonRootInlineBox::hasScrollableContent const): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (282071 => 282072)
--- trunk/Source/WebCore/ChangeLog 2021-09-07 01:54:49 UTC (rev 282071)
+++ trunk/Source/WebCore/ChangeLog 2021-09-07 03:26:03 UTC (rev 282072)
@@ -1,3 +1,28 @@
+2021-09-06 Alan Bujtas <[email protected]>
+
+ [LFC][Integration] Remove redundant NonRootInlineBox
+ https://bugs.webkit.org/show_bug.cgi?id=229967
+
+ Reviewed by Antti Koivisto.
+
+ Now that all the inline boxes generate runs, and we use those runs to do painint/hittest, this
+ helper structure is not needed anymore.
+
+ * layout/integration/LayoutIntegrationInlineContent.h:
+ * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+ (WebCore::LayoutIntegration::InlineContentBuilder::build const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayRuns const): Deleted.
+ * layout/integration/LayoutIntegrationInlineContentBuilder.h:
+ * layout/integration/LayoutIntegrationLine.h:
+ (WebCore::LayoutIntegration::NonRootInlineBox::NonRootInlineBox): Deleted.
+ (WebCore::LayoutIntegration::NonRootInlineBox::layoutBox const): Deleted.
+ (WebCore::LayoutIntegration::NonRootInlineBox::style const): Deleted.
+ (WebCore::LayoutIntegration::NonRootInlineBox::lineIndex const): Deleted.
+ (WebCore::LayoutIntegration::NonRootInlineBox::rect const): Deleted.
+ (WebCore::LayoutIntegration::NonRootInlineBox::setVerticalPositionIntegral): Deleted.
+ (WebCore::LayoutIntegration::NonRootInlineBox::hasScrollableContent const): Deleted.
+
2021-09-06 Commit Queue <[email protected]>
Unreviewed, reverting r282058.
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h (282071 => 282072)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h 2021-09-07 01:54:49 UTC (rev 282071)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContent.h 2021-09-07 03:26:03 UTC (rev 282072)
@@ -59,7 +59,6 @@
Runs runs;
Lines lines;
- Vector<NonRootInlineBox> nonRootInlineBoxes;
float clearGapAfterLastLine { 0 };
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (282071 => 282072)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-09-07 01:54:49 UTC (rev 282071)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-09-07 03:26:03 UTC (rev 282072)
@@ -67,42 +67,16 @@
void InlineContentBuilder::build(Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
{
- createDisplayRuns(inlineFormattingState, inlineContent);
- createDisplayLines(inlineFormattingState.lines(), inlineContent);
-}
-
-void InlineContentBuilder::createDisplayRuns(Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
-{
- // FIXME: Remove this loop when we transitioned to the "run only" setup (i.e. each inline box is represented as a run as well)
- auto& lineBoxes = const_cast<Layout::InlineFormattingState&>(inlineFormattingState).lineBoxes();
- for (size_t lineIndex = 0; lineIndex < lineBoxes.size(); ++lineIndex) {
- auto& lineBox = lineBoxes[lineIndex];
- auto lineBoxLogicalTopLeft = inlineFormattingState.lines()[lineIndex].lineBoxLogicalRect().topLeft();
- for (auto& nonRootInlineLevelBox : lineBox.nonRootInlineLevelBoxes()) {
- if (!nonRootInlineLevelBox.isInlineBox())
- continue;
- auto& layoutBox = nonRootInlineLevelBox.layoutBox();
- auto& boxGeometry = inlineFormattingState.boxGeometry(layoutBox);
- auto hasScrollableContent = [&] {
- // In standards mode, inline boxes always start with an imaginary strut.
- return m_layoutState.inStandardsMode() || nonRootInlineLevelBox.hasContent() || boxGeometry.horizontalBorder() || (boxGeometry.horizontalPadding() && boxGeometry.horizontalPadding().value());
- };
- // Inline boxes may or may not be wrapped and have runs on multiple lines (e.g. <span>first line<br>second line<br>third line</span>)
- auto inlineBoxBorderBox = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
- inlineBoxBorderBox.moveBy(lineBoxLogicalTopLeft);
- inlineContent.nonRootInlineBoxes.append({ lineIndex, layoutBox, inlineBoxBorderBox, hasScrollableContent() });
- }
- }
// FIXME: This might need a different approach with partial layout where the layout code needs to know about the runs.
inlineContent.runs = WTFMove(inlineFormattingState.runs());
+ createDisplayLines(inlineFormattingState, inlineContent);
}
-void InlineContentBuilder::createDisplayLines(const Layout::InlineLines& lines, InlineContent& inlineContent) const
+void InlineContentBuilder::createDisplayLines(Layout::InlineFormattingState& inlineFormattingState, InlineContent& inlineContent) const
{
+ auto& lines = inlineFormattingState.lines();
auto& runs = inlineContent.runs;
- auto& nonRootInlineBoxes = inlineContent.nonRootInlineBoxes;
size_t runIndex = 0;
- size_t inlineBoxIndex = 0;
inlineContent.lines.reserveInitialCapacity(lines.size());
for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) {
auto& line = lines[lineIndex];
@@ -121,32 +95,33 @@
lineInkOverflowRect.unite(run.inkOverflow());
auto& layoutBox = run.layoutBox();
- if (!layoutBox.isReplacedBox())
+ if (run.isNonRootInlineBox()) {
+ // Collect scrollable overflow from inline boxes. All other inline level boxes (e.g atomic inline level boxes) stretch the line.
+ auto hasScrollableContent = [&] {
+ // In standards mode, inline boxes always start with an imaginary strut.
+ auto& boxGeometry = inlineFormattingState.boxGeometry(layoutBox);
+ return m_layoutState.inStandardsMode() || run.hasContent() || boxGeometry.horizontalBorder() || (boxGeometry.horizontalPadding() && boxGeometry.horizontalPadding().value());
+ };
+ if (hasScrollableContent())
+ scrollableOverflowRect.unite(run.logicalRect());
continue;
-
- // Similar to LegacyInlineFlowBox::addReplacedChildOverflow.
- auto& box = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox));
- auto runLogicalRect = run.logicalRect();
- if (!box.hasSelfPaintingLayer()) {
- auto childInkOverflow = box.logicalVisualOverflowRectForPropagation(&box.parent()->style());
- childInkOverflow.move(runLogicalRect.left(), runLogicalRect.top());
- lineInkOverflowRect.unite(childInkOverflow);
}
- auto childScrollableOverflow = box.logicalLayoutOverflowRectForPropagation(&box.parent()->style());
- childScrollableOverflow.move(runLogicalRect.left(), runLogicalRect.top());
- scrollableOverflowRect.unite(childScrollableOverflow);
+ if (layoutBox.isReplacedBox()) {
+ // Similar to LegacyInlineFlowBox::addReplacedChildOverflow.
+ auto& box = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox));
+ auto runLogicalRect = run.logicalRect();
+ if (!box.hasSelfPaintingLayer()) {
+ auto childInkOverflow = box.logicalVisualOverflowRectForPropagation(&box.parent()->style());
+ childInkOverflow.move(runLogicalRect.left(), runLogicalRect.top());
+ lineInkOverflowRect.unite(childInkOverflow);
+ }
+ auto childScrollableOverflow = box.logicalLayoutOverflowRectForPropagation(&box.parent()->style());
+ childScrollableOverflow.move(runLogicalRect.left(), runLogicalRect.top());
+ scrollableOverflowRect.unite(childScrollableOverflow);
+ continue;
+ }
}
- // Collect scrollable overflow from inline boxes. All other inline level boxes (e.g atomic inline level boxes) stretch the line.
- while (inlineBoxIndex < nonRootInlineBoxes.size() && nonRootInlineBoxes[inlineBoxIndex].lineIndex() == lineIndex) {
- auto& inlineBox = nonRootInlineBoxes[inlineBoxIndex++];
- if (line.needsIntegralPosition())
- inlineBox.setVerticalPositionIntegral();
-
- if (inlineBox.hasScrollableContent())
- scrollableOverflowRect.unite(inlineBox.rect());
- }
-
auto adjustedLineBoxRect = FloatRect { lineBoxLogicalRect };
// Final enclosing top and bottom values are in the same coordinate space as the line itself.
auto enclosingTopAndBottom = line.enclosingTopAndBottom() + lineBoxLogicalRect.top();
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h (282071 => 282072)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h 2021-09-07 01:54:49 UTC (rev 282071)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.h 2021-09-07 03:26:03 UTC (rev 282072)
@@ -46,8 +46,7 @@
void build(Layout::InlineFormattingState&, InlineContent&) const;
private:
- void createDisplayRuns(Layout::InlineFormattingState&, InlineContent&) const;
- void createDisplayLines(const Layout::InlineLines&, InlineContent&) const;
+ void createDisplayLines(Layout::InlineFormattingState&, InlineContent&) const;
const Layout::LayoutState& m_layoutState;
const RenderBlockFlow& m_blockFlow;
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h (282071 => 282072)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h 2021-09-07 01:54:49 UTC (rev 282071)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h 2021-09-07 03:26:03 UTC (rev 282072)
@@ -86,34 +86,6 @@
float m_contentWidth { 0 };
};
-class NonRootInlineBox {
-public:
- NonRootInlineBox(size_t lineIndex, const Layout::Box& layoutBox, const FloatRect& rect, bool hasScrollableContent)
- : m_lineIndex(lineIndex)
- , m_layoutBox(makeWeakPtr(layoutBox))
- , m_rect(rect)
- , m_hasScrollableContent(hasScrollableContent)
- {
- }
-
- const Layout::Box& layoutBox() const { return *m_layoutBox; }
- const RenderStyle& style() const { return m_layoutBox->style(); }
-
- size_t lineIndex() const { return m_lineIndex; }
-
- FloatRect rect() const { return m_rect; }
-
- void setVerticalPositionIntegral() { m_rect.setY(roundToInt(m_rect.y())); }
-
- bool hasScrollableContent() const { return m_hasScrollableContent; }
-
-private:
- const size_t m_lineIndex;
- WeakPtr<const Layout::Box> m_layoutBox;
- FloatRect m_rect;
- bool m_hasScrollableContent { false };
-};
-
}
}