|
Lines 46-52
inline Layout::LineGeometry::EnclosingTopAndBottom operator+(const Layout::LineG
a/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp_sec1
|
| 46 |
return { enclosingTopAndBottom.top + offset, enclosingTopAndBottom.bottom + offset }; |
46 |
return { enclosingTopAndBottom.top + offset, enclosingTopAndBottom.bottom + offset }; |
| 47 |
} |
47 |
} |
| 48 |
|
48 |
|
| 49 |
inline static float lineOverflowWidth(const RenderBlockFlow& flow, Layout::InlineLayoutUnit lineBoxLogicalWidth, Layout::InlineLayoutUnit lineContentLogicalWidth) |
49 |
inline static float lineOverflowWidth(const RenderBlockFlow& flow, Layout::InlineLayoutUnit lineContentLogicalWidth) |
| 50 |
{ |
50 |
{ |
| 51 |
// FIXME: It's the copy of the lets-adjust-overflow-for-the-caret behavior from LegacyLineLayout::addOverflowFromInlineChildren. |
51 |
// FIXME: It's the copy of the lets-adjust-overflow-for-the-caret behavior from LegacyLineLayout::addOverflowFromInlineChildren. |
| 52 |
auto endPadding = flow.hasNonVisibleOverflow() ? flow.paddingEnd() : 0_lu; |
52 |
auto endPadding = flow.hasNonVisibleOverflow() ? flow.paddingEnd() : 0_lu; |
|
Lines 54-66
inline static float lineOverflowWidth(const RenderBlockFlow& flow, Layout::Inlin
a/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp_sec2
|
| 54 |
endPadding = flow.endPaddingWidthForCaret(); |
54 |
endPadding = flow.endPaddingWidthForCaret(); |
| 55 |
if (flow.hasNonVisibleOverflow() && !endPadding && flow.element() && flow.element()->isRootEditableElement()) |
55 |
if (flow.hasNonVisibleOverflow() && !endPadding && flow.element() && flow.element()->isRootEditableElement()) |
| 56 |
endPadding = 1; |
56 |
endPadding = 1; |
| 57 |
lineContentLogicalWidth += endPadding; |
57 |
return lineContentLogicalWidth + endPadding; |
| 58 |
return std::max(lineBoxLogicalWidth, lineContentLogicalWidth); |
|
|
| 59 |
} |
58 |
} |
| 60 |
|
59 |
|
| 61 |
InlineContentBuilder::InlineContentBuilder(const Layout::LayoutState& layoutState, const RenderBlockFlow& blockFlow, const BoxTree& boxTree) |
60 |
InlineContentBuilder::InlineContentBuilder(const RenderBlockFlow& blockFlow, const BoxTree& boxTree) |
| 62 |
: m_layoutState(layoutState) |
61 |
: m_blockFlow(blockFlow) |
| 63 |
, m_blockFlow(blockFlow) |
|
|
| 64 |
, m_boxTree(boxTree) |
62 |
, m_boxTree(boxTree) |
| 65 |
{ |
63 |
{ |
| 66 |
} |
64 |
} |
|
Lines 80-88
void InlineContentBuilder::createDisplayLines(Layout::InlineFormattingState& inl
a/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp_sec3
|
| 80 |
inlineContent.lines.reserveInitialCapacity(lines.size()); |
78 |
inlineContent.lines.reserveInitialCapacity(lines.size()); |
| 81 |
for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) { |
79 |
for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) { |
| 82 |
auto& line = lines[lineIndex]; |
80 |
auto& line = lines[lineIndex]; |
| 83 |
auto& lineBoxLogicalRect = line.lineBoxLogicalRect(); |
81 |
auto scrollableOverflowRect = FloatRect { line.scrollableOverflow() }; |
| 84 |
// FIXME: This is where the logical to physical translate should happen. |
82 |
if (auto overflowWidth = lineOverflowWidth(m_blockFlow, line.contentLogicalWidth()); overflowWidth > scrollableOverflowRect.width()) |
| 85 |
auto scrollableOverflowRect = FloatRect { lineBoxLogicalRect.left(), lineBoxLogicalRect.top(), lineOverflowWidth(m_blockFlow, lineBoxLogicalRect.width(), line.contentLogicalWidth()), lineBoxLogicalRect.height() }; |
83 |
scrollableOverflowRect.setWidth(overflowWidth); |
| 86 |
|
84 |
|
| 87 |
auto firstRunIndex = runIndex; |
85 |
auto firstRunIndex = runIndex; |
| 88 |
auto lineInkOverflowRect = scrollableOverflowRect; |
86 |
auto lineInkOverflowRect = scrollableOverflowRect; |
|
Lines 93-109
void InlineContentBuilder::createDisplayLines(Layout::InlineFormattingState& inl
a/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp_sec4
|
| 93 |
lineInkOverflowRect.unite(run.inkOverflow()); |
91 |
lineInkOverflowRect.unite(run.inkOverflow()); |
| 94 |
|
92 |
|
| 95 |
auto& layoutBox = run.layoutBox(); |
93 |
auto& layoutBox = run.layoutBox(); |
| 96 |
if (run.isNonRootInlineBox()) { |
|
|
| 97 |
// Collect scrollable overflow from inline boxes. All other inline level boxes (e.g atomic inline level boxes) stretch the line. |
| 98 |
auto hasScrollableContent = [&] { |
| 99 |
// In standards mode, inline boxes always start with an imaginary strut. |
| 100 |
auto& boxGeometry = inlineFormattingState.boxGeometry(layoutBox); |
| 101 |
return m_layoutState.inStandardsMode() || run.hasContent() || boxGeometry.horizontalBorder() || (boxGeometry.horizontalPadding() && boxGeometry.horizontalPadding().value()); |
| 102 |
}; |
| 103 |
if (hasScrollableContent()) |
| 104 |
scrollableOverflowRect.unite(run.logicalRect()); |
| 105 |
continue; |
| 106 |
} |
| 107 |
if (layoutBox.isReplacedBox()) { |
94 |
if (layoutBox.isReplacedBox()) { |
| 108 |
// Similar to LegacyInlineFlowBox::addReplacedChildOverflow. |
95 |
// Similar to LegacyInlineFlowBox::addReplacedChildOverflow. |
| 109 |
auto& box = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox)); |
96 |
auto& box = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox)); |
|
Lines 116-130
void InlineContentBuilder::createDisplayLines(Layout::InlineFormattingState& inl
a/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp_sec5
|
| 116 |
auto childScrollableOverflow = box.logicalLayoutOverflowRectForPropagation(&box.parent()->style()); |
103 |
auto childScrollableOverflow = box.logicalLayoutOverflowRectForPropagation(&box.parent()->style()); |
| 117 |
childScrollableOverflow.move(runLogicalRect.left(), runLogicalRect.top()); |
104 |
childScrollableOverflow.move(runLogicalRect.left(), runLogicalRect.top()); |
| 118 |
scrollableOverflowRect.unite(childScrollableOverflow); |
105 |
scrollableOverflowRect.unite(childScrollableOverflow); |
| 119 |
continue; |
|
|
| 120 |
} |
106 |
} |
| 121 |
} |
107 |
} |
| 122 |
|
108 |
auto lineBoxLogicalRect = FloatRect { line.lineBoxLogicalRect() }; |
| 123 |
auto adjustedLineBoxRect = FloatRect { lineBoxLogicalRect }; |
|
|
| 124 |
// Final enclosing top and bottom values are in the same coordinate space as the line itself. |
| 125 |
auto enclosingTopAndBottom = line.enclosingTopAndBottom() + lineBoxLogicalRect.top(); |
| 126 |
auto runCount = runIndex - firstRunIndex; |
109 |
auto runCount = runIndex - firstRunIndex; |
| 127 |
inlineContent.lines.append({ firstRunIndex, runCount, adjustedLineBoxRect, enclosingTopAndBottom.top, enclosingTopAndBottom.bottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLogicalLeft(), line.contentLogicalWidth() }); |
110 |
inlineContent.lines.append({ firstRunIndex, runCount, lineBoxLogicalRect, line.enclosingTopAndBottom().top, line.enclosingTopAndBottom().bottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLogicalLeft(), line.contentLogicalWidth() }); |
| 128 |
} |
111 |
} |
| 129 |
} |
112 |
} |
| 130 |
|
113 |
|