Diff
Modified: trunk/Source/WebCore/ChangeLog (270144 => 270145)
--- trunk/Source/WebCore/ChangeLog 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/ChangeLog 2020-11-21 14:02:00 UTC (rev 270145)
@@ -1,5 +1,53 @@
2020-11-21 Zalan Bujtas <[email protected]>
+ [LFC][Integration] Remove redundant lineBoxWidth from Line
+ https://bugs.webkit.org/show_bug.cgi?id=219208
+
+ Reviewed by Antti Koivisto.
+
+ Line::lineBoxWidth() is incorrectly returning the content logical width. By definition it is the available horizontal space
+ for the content and therefore it equals to Line::rect().width().
+ 1. Replace lineLogicalRect with lineBoxLogicalRect.
+ 2. Remove redundant lineBoxWidth() from Line.
+
+ * display/css/DisplayBoxFactory.cpp:
+ (WebCore::Display::BoxFactory::displayBoxForTextRun const):
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
+ * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedContentHeightAndMargin):
+ * layout/inlineformatting/InlineFormattingContext.cpp:
+ (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
+ * layout/inlineformatting/InlineFormattingContext.h:
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+ (WebCore::Layout::InlineFormattingContext::Geometry::computedLineLogicalRect const): Deleted.
+ * layout/inlineformatting/InlineLineBox.h:
+ (WebCore::Layout::LineBox::logicalRect const):
+ (WebCore::Layout::LineBox::logicalTopLeft const):
+ (WebCore::Layout::LineBox::logicalSize const):
+ * layout/inlineformatting/InlineLineGeometry.h:
+ (WebCore::Layout::InlineLineGeometry::lineBoxLogicalRect const):
+ (WebCore::Layout::InlineLineGeometry::moveVertically):
+ (WebCore::Layout::InlineLineGeometry::InlineLineGeometry):
+ (WebCore::Layout::InlineLineGeometry::logicalRect const): Deleted.
+ (WebCore::Layout::InlineLineGeometry::lineBoxLogicalSize const): Deleted.
+ * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+ (WebCore::LayoutIntegration::lineOverflowWidth):
+ (WebCore::LayoutIntegration::InlineContentBuilder::computeLineLevelVisualAdjustmentsForRuns const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLineRuns const):
+ (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+ * layout/integration/LayoutIntegrationLine.h:
+ (WebCore::LayoutIntegration::Line::Line):
+ (WebCore::LayoutIntegration::Line::rect const):
+ (WebCore::LayoutIntegration::Line::lineBoxWidth const): Deleted.
+ * layout/integration/LayoutIntegrationPagination.cpp:
+ (WebCore::LayoutIntegration::makeAdjustedContent):
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::showInlineTreeAndRuns):
+
+2020-11-21 Zalan Bujtas <[email protected]>
+
[LFC][IFC] Remove InlineLineGeometry::logicalLeft/top/bottom/right/width/height helper functions
https://bugs.webkit.org/show_bug.cgi?id=219226
Modified: trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp (270144 => 270145)
--- trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp 2020-11-21 14:02:00 UTC (rev 270145)
@@ -135,7 +135,7 @@
std::unique_ptr<Box> BoxFactory::displayBoxForTextRun(const Layout::LineRun& run, const Layout::InlineLineGeometry& lineGeometry, LayoutSize offsetFromRoot) const
{
ASSERT(run.text());
- auto lineRect = lineGeometry.logicalRect();
+ auto lineRect = lineGeometry.lineBoxLogicalRect();
auto lineLayoutRect = LayoutRect { lineRect.left(), lineRect.top(), lineRect.width(), lineRect.height() };
auto runRect = LayoutRect { run.logicalLeft(), run.logicalTop(), run.logicalWidth(), run.logicalHeight() };
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (270144 => 270145)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2020-11-21 14:02:00 UTC (rev 270145)
@@ -197,8 +197,8 @@
auto& lines = inlineFormattingState.lines();
// Even empty containers generate one line.
ASSERT(!lines.isEmpty());
- top = lines.first().logicalRect().top();
- bottom = lines.last().logicalRect().bottom() + inlineFormattingState.clearGapAfterLastLine();
+ top = lines.first().lineBoxLogicalRect().top();
+ bottom = lines.last().lineBoxLogicalRect().bottom() + inlineFormattingState.clearGapAfterLastLine();
} else if (formattingContextRoot.establishesFlexFormattingContext()) {
auto& lines = layoutState.establishedFlexFormattingState(formattingContextRoot).lines();
ASSERT(!lines.isEmpty());
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (270144 => 270145)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2020-11-21 14:02:00 UTC (rev 270145)
@@ -81,7 +81,7 @@
auto& lines = inlineFormattingState.lines();
// Even empty containers generate one line.
ASSERT(!lines.isEmpty());
- return { toLayoutUnit(lines.last().logicalRect().bottom() + inlineFormattingState.clearGapAfterLastLine()) - borderAndPaddingTop, nonCollapsedMargin };
+ return { toLayoutUnit(lines.last().lineBoxLogicalRect().bottom() + inlineFormattingState.clearGapAfterLastLine()) - 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/inlineformatting/InlineFormattingContext.cpp (270144 => 270145)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp 2020-11-21 14:02:00 UTC (rev 270145)
@@ -410,7 +410,7 @@
formattingState.addLineBox(geometry.lineBoxForLineContent(lineContent));
const auto& lineBox = formattingState.lineBoxes().last();
- auto lineLogicalRect = geometry.computedLineLogicalRect(lineBox, lineContent);
+ auto& lineBoxLogicalRect = lineBox.logicalRect();
auto updateFloatGeometry = [&] {
if (lineContent.floats.isEmpty())
@@ -421,8 +421,8 @@
auto& floatBox = floatCandidate.item->layoutBox();
auto& boxGeometry = formattingState.boxGeometry(floatBox);
// Set static position first.
- auto verticalStaticPosition = floatCandidate.isIntrusive ? lineLogicalRect.top() : lineLogicalRect.bottom();
- boxGeometry.setLogicalTopLeft({ lineLogicalRect.left(), verticalStaticPosition });
+ auto verticalStaticPosition = floatCandidate.isIntrusive ? lineBoxLogicalRect.top() : lineBoxLogicalRect.bottom();
+ boxGeometry.setLogicalTopLeft({ lineBoxLogicalRect.left(), verticalStaticPosition });
// Float it.
boxGeometry.setLogicalTopLeft(floatingContext.positionForFloat(floatBox, horizontalConstraints));
floatingContext.append(floatBox);
@@ -457,7 +457,7 @@
// Let's convert top/left relative to the formatting context root.
auto logicalRect = lineBox.logicalMarginRectForInlineLevelBox(layoutBox);
// Inline box height includes the margin box. Let's account for that.
- auto borderBoxLogicalTopLeft = lineLogicalRect.topLeft();
+ auto borderBoxLogicalTopLeft = lineBoxLogicalRect.topLeft();
borderBoxLogicalTopLeft.move(logicalRect.left(), logicalRect.top() + boxGeometry.marginBefore());
if (layoutBox.isInFlowPositioned())
@@ -493,11 +493,11 @@
updateBoxGeometry();
auto constructLineGeometry = [&] {
- formattingState.addLine({ lineLogicalRect, lineBox.logicalSize(), lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }), lineContent.contentLogicalWidth });
+ formattingState.addLine({ lineBoxLogicalRect, lineBox.alignmentBaseline(), lineBox.horizontalAlignmentOffset().valueOr(InlineLayoutUnit { }), lineContent.contentLogicalWidth });
};
constructLineGeometry();
- return lineLogicalRect;
+ return lineBoxLogicalRect;
}
void InlineFormattingContext::invalidateFormattingState(const InvalidationState&)
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (270144 => 270145)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h 2020-11-21 14:02:00 UTC (rev 270145)
@@ -67,7 +67,6 @@
class Geometry : public FormattingContext::Geometry {
public:
LineBox lineBoxForLineContent(const LineBuilder::LineContent&);
- InlineRect computedLineLogicalRect(const LineBox&, const LineBuilder::LineContent&) const;
InlineLayoutUnit logicalTopForNextLine(const LineBuilder::LineContent&, InlineLayoutUnit previousLineLogicalBottom, const FloatingContext&) const;
ContentHeightAndMargin inlineBlockContentHeightAndMargin(const Box&, const HorizontalConstraints&, const OverriddenVerticalValues&) const;
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (270144 => 270145)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2020-11-21 14:02:00 UTC (rev 270145)
@@ -259,7 +259,7 @@
if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) {
auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox));
auto& lastLine = formattingState.lines().last();
- auto inlineBlockBaseline = lastLine.logicalRect().top() + lastLine.baseline();
+ auto inlineBlockBaseline = lastLine.lineBoxLogicalRect().top() + lastLine.baseline();
ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline;
} else if (layoutBox.isReplacedBox())
ascent = downcast<ReplacedBox>(layoutBox).baseline().valueOr(marginBoxHeight);
@@ -528,11 +528,6 @@
return LineBoxBuilder(formattingContext()).build(lineContent);
}
-InlineRect InlineFormattingContext::Geometry::computedLineLogicalRect(const LineBox& lineBox, const LineBuilder::LineContent& lineContent) const
-{
- return { lineBox.logicalTopLeft(), lineContent.lineLogicalWidth, lineBox.logicalHeight() };
-}
-
InlineLayoutUnit InlineFormattingContext::Geometry::logicalTopForNextLine(const LineBuilder::LineContent& lineContent, InlineLayoutUnit previousLineLogicalBottom, const FloatingContext& floatingContext) const
{
// Normally the next line's logical top is the previous line's logical bottom, but when the line ends
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h (270144 => 270145)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h 2020-11-21 14:02:00 UTC (rev 270145)
@@ -131,10 +131,11 @@
enum class IsLineConsideredEmpty { No, Yes };
LineBox(const InlineLayoutPoint& logicalTopLeft, InlineLayoutUnit logicalWidth, IsLineConsideredEmpty);
+ const InlineRect& logicalRect() const { return m_logicalRect; }
InlineLayoutUnit logicalWidth() const { return logicalSize().width(); }
InlineLayoutUnit logicalHeight() const { return logicalSize().height(); }
- InlineLayoutPoint logicalTopLeft() const { return m_logicalRect.topLeft(); }
- InlineLayoutSize logicalSize() const { return m_logicalRect.size(); }
+ InlineLayoutPoint logicalTopLeft() const { return logicalRect().topLeft(); }
+ InlineLayoutSize logicalSize() const { return logicalRect().size(); }
Optional<InlineLayoutUnit> horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; }
bool isConsideredEmpty() const { return m_isConsideredEmpty; }
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h (270144 => 270145)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineGeometry.h 2020-11-21 14:02:00 UTC (rev 270145)
@@ -35,10 +35,9 @@
class InlineLineGeometry {
WTF_MAKE_FAST_ALLOCATED;
public:
- InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth);
+ InlineLineGeometry(const InlineRect& lineBoxLogicalRect, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth);
- const InlineRect& logicalRect() const { return m_logicalRect; }
- const InlineLayoutSize& lineBoxLogicalSize() const { return m_lineBoxLogicalSize; }
+ const InlineRect& lineBoxLogicalRect() const { return m_lineBoxLogicalRect; }
InlineLayoutUnit baseline() const { return m_aligmentBaseline; }
@@ -45,19 +44,17 @@
InlineLayoutUnit contentLogicalLeftOffset() const { return m_contentLogicalLeftOffset; }
InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
- void moveVertically(InlineLayoutUnit offset) { m_logicalRect.moveVertically(offset); }
+ void moveVertically(InlineLayoutUnit offset) { m_lineBoxLogicalRect.moveVertically(offset); }
private:
- InlineRect m_logicalRect;
- InlineLayoutSize m_lineBoxLogicalSize;
+ InlineRect m_lineBoxLogicalRect;
InlineLayoutUnit m_aligmentBaseline { 0 };
InlineLayoutUnit m_contentLogicalLeftOffset { 0 };
InlineLayoutUnit m_contentLogicalWidth { 0 };
};
-inline InlineLineGeometry::InlineLineGeometry(const InlineRect& lineLogicalRect, const InlineLayoutSize& lineBoxLogicalSize, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth)
- : m_logicalRect(lineLogicalRect)
- , m_lineBoxLogicalSize(lineBoxLogicalSize)
+inline InlineLineGeometry::InlineLineGeometry(const InlineRect& lineBoxLogicalRect, InlineLayoutUnit aligmentBaseline, InlineLayoutUnit contentLogicalLeftOffset, InlineLayoutUnit contentLogicalWidth)
+ : m_lineBoxLogicalRect(lineBoxLogicalRect)
, m_aligmentBaseline(aligmentBaseline)
, m_contentLogicalLeftOffset(contentLogicalLeftOffset)
, m_contentLogicalWidth(contentLogicalWidth)
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (270144 => 270145)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2020-11-21 14:02:00 UTC (rev 270145)
@@ -48,7 +48,7 @@
bool needsTrailingContentReplacement { false };
};
-inline static float lineOverflowWidth(const RenderBlockFlow& flow, InlineLayoutUnit lineLogicalWidth, InlineLayoutUnit lineBoxLogicalWidth)
+inline static float lineOverflowWidth(const RenderBlockFlow& flow, InlineLayoutUnit lineBoxLogicalWidth, InlineLayoutUnit lineContentLogicalWidth)
{
// FIXME: It's the copy of the lets-adjust-overflow-for-the-caret behavior from ComplexLineLayout::addOverflowFromInlineChildren.
auto endPadding = flow.hasOverflowClip() ? flow.paddingEnd() : 0_lu;
@@ -56,8 +56,8 @@
endPadding = flow.endPaddingWidthForCaret();
if (flow.hasOverflowClip() && !endPadding && flow.element() && flow.element()->isRootEditableElement())
endPadding = 1;
- lineBoxLogicalWidth += endPadding;
- return std::max(lineLogicalWidth, lineBoxLogicalWidth);
+ lineContentLogicalWidth += endPadding;
+ return std::max(lineBoxLogicalWidth, lineContentLogicalWidth);
}
class Iterator {
@@ -186,9 +186,9 @@
lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition = lineNeedsLegacyIntegralVerticalPosition();
if (shouldCheckHorizontalOverflowForContentReplacement) {
auto& line = lines[lineIndex];
- auto& lineLogicalRect = line.logicalRect();
- auto overflowWidth = lineOverflowWidth(m_blockFlow, lineLogicalRect.width(), line.lineBoxLogicalSize().width());
- lineLevelVisualAdjustmentsForRuns[lineIndex].needsTrailingContentReplacement = overflowWidth > lineLogicalRect.width();
+ auto lineBoxLogicalWidth = line.lineBoxLogicalRect().width();
+ auto overflowWidth = lineOverflowWidth(m_blockFlow, lineBoxLogicalWidth, line.contentLogicalWidth());
+ lineLevelVisualAdjustmentsForRuns[lineIndex].needsTrailingContentReplacement = overflowWidth > lineBoxLogicalWidth;
}
}
return lineLevelVisualAdjustmentsForRuns;
@@ -213,13 +213,13 @@
auto createDisplayBoxRun = [&](auto& lineRun) {
auto& layoutBox = lineRun.layoutBox();
auto lineIndex = lineRun.lineIndex();
- auto& lineLogicalRect = lines[lineIndex].logicalRect();
+ auto& lineBoxLogicalRect = lines[lineIndex].lineBoxLogicalRect();
// Inline boxes are relative to the line box while final Runs need to be relative to the parent Box
// FIXME: Shouldn't we just leave them be relative to the line box?
auto runRect = FloatRect { lineRun.logicalRect() };
// Line runs are margin box based, let's convert them to border box.
auto& geometry = m_layoutState.geometryForBox(layoutBox);
- runRect.moveBy({ lineLogicalRect.left() + std::max(geometry.marginStart(), 0_lu), lineLogicalRect.top() + geometry.marginBefore() });
+ runRect.moveBy({ lineBoxLogicalRect.left() + std::max(geometry.marginStart(), 0_lu), lineBoxLogicalRect.top() + geometry.marginBefore() });
runRect.setSize({ geometry.borderBoxWidth(), geometry.borderBoxHeight() });
if (lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition)
runRect.setY(roundToInt(runRect.y()));
@@ -232,11 +232,11 @@
RELEASE_ASSERT(startOffset < endOffset);
auto& layoutBox = lineRun.layoutBox();
auto lineIndex = lineRun.lineIndex();
- auto& lineLogicalRect = lines[lineIndex].logicalRect();
+ auto& lineBoxLogicalRect = lines[lineIndex].lineBoxLogicalRect();
auto runRect = FloatRect { lineRun.logicalRect() };
// Inline boxes are relative to the line box while final Runs need to be relative to the parent Box
// FIXME: Shouldn't we just leave them be relative to the line box?
- runRect.moveBy({ lineLogicalRect.left(), lineLogicalRect.top() });
+ runRect.moveBy({ lineBoxLogicalRect.left(), lineBoxLogicalRect.top() });
if (lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition)
runRect.setY(roundToInt(runRect.y()));
@@ -254,12 +254,12 @@
}
auto runLogicalRect = lineRun.logicalRect();
auto ellipsisWidth = style.fontCascade().width(WebCore::TextRun { &horizontalEllipsis });
- if (runLogicalRect.right() + ellipsisWidth > lineLogicalRect.right()) {
+ if (runLogicalRect.right() + ellipsisWidth > lineBoxLogicalRect.right()) {
// The next run with ellipsis would surely overflow. So let's just add it to this run even if
// it makes the run wider than it originally was.
hasAdjustedTrailingLineList[lineIndex] = true;
float resultWidth = 0;
- auto maxWidth = lineLogicalRect.width() - runLogicalRect.left();
+ auto maxWidth = lineBoxLogicalRect.width() - runLogicalRect.left();
return StringTruncator::rightTruncate(originalContent, maxWidth, style.fontCascade(), resultWidth, true);
}
}
@@ -307,10 +307,9 @@
size_t runIndex = 0;
for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) {
auto& line = lines[lineIndex];
- auto& lineLogicalRect = line.logicalRect();
- auto lineBoxLogicalSize = line.lineBoxLogicalSize();
+ auto& lineBoxLogicalRect = line.lineBoxLogicalRect();
// FIXME: This is where the logical to physical translate should happen.
- auto scrollableOverflowRect = FloatRect { lineLogicalRect.left(), lineLogicalRect.top(), lineOverflowWidth(m_blockFlow, lineLogicalRect.width(), lineBoxLogicalSize.width()), lineLogicalRect.height() };
+ auto scrollableOverflowRect = FloatRect { lineBoxLogicalRect.left(), lineBoxLogicalRect.top(), lineOverflowWidth(m_blockFlow, lineBoxLogicalRect.width(), line.contentLogicalWidth()), lineBoxLogicalRect.height() };
auto firstRunIndex = runIndex;
auto lineInkOverflowRect = scrollableOverflowRect;
@@ -317,10 +316,9 @@
while (runIndex < runs.size() && runs[runIndex].lineIndex() == lineIndex)
lineInkOverflowRect.unite(runs[runIndex++].inkOverflow());
auto runCount = runIndex - firstRunIndex;
- auto lineRect = FloatRect { lineLogicalRect };
auto enclosingTopAndBottom = [&] {
// 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).
+ // This mostly matches 'line box rect', unless line-height triggers line box overflow (not to be confused with ink or scroll overflow).
auto enclosingTop = Optional<float> { };
auto enclosingBottom = Optional<float> { };
auto& lineBox = lineBoxes[lineIndex];
@@ -338,14 +336,15 @@
// There's always at least one inline level box, the root inline box.
ASSERT(enclosingBottom && enclosingTop);
// inline boxes are relative to the line, let's make them relative to the root's content box.
- return Line::EnclosingTopAndBottom { lineRect.y() + *enclosingTop, lineRect.y() + *enclosingBottom };
+ return Line::EnclosingTopAndBottom { lineBoxLogicalRect.top() + *enclosingTop, lineBoxLogicalRect.top() + *enclosingBottom };
}();
+ auto adjustedLineBoxRect = FloatRect { lineBoxLogicalRect };
if (lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition) {
- lineRect.setY(roundToInt(lineRect.y()));
+ adjustedLineBoxRect.setY(roundToInt(adjustedLineBoxRect.y()));
enclosingTopAndBottom.top = roundToInt(enclosingTopAndBottom.top);
enclosingTopAndBottom.bottom = roundToInt(enclosingTopAndBottom.bottom);
}
- inlineContent.lines.append({ firstRunIndex, runCount, lineRect, lineBoxLogicalSize.width(), enclosingTopAndBottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLogicalLeftOffset(), line.contentLogicalWidth() });
+ inlineContent.lines.append({ firstRunIndex, runCount, adjustedLineBoxRect, enclosingTopAndBottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLogicalLeftOffset(), line.contentLogicalWidth() });
}
}
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h (270144 => 270145)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h 2020-11-21 14:02:00 UTC (rev 270145)
@@ -40,11 +40,10 @@
float top { 0 };
float bottom { 0 };
};
- Line(size_t firstRunIndex, size_t runCount, const FloatRect& lineRect, float lineBoxWidth, EnclosingTopAndBottom enclosingTopAndBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float contentLeftOffset, float contentWidth)
+ Line(size_t firstRunIndex, size_t runCount, const FloatRect& lineBoxRect, EnclosingTopAndBottom enclosingTopAndBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float contentLeftOffset, float contentWidth)
: m_firstRunIndex(firstRunIndex)
, m_runCount(runCount)
- , m_lineRect(lineRect)
- , m_lineBoxWidth(lineBoxWidth)
+ , m_lineBoxRect(lineBoxRect)
, m_enclosingTopAndBottom(enclosingTopAndBottom)
, m_scrollableOverflow(scrollableOverflow)
, m_inkOverflow(inkOverflow)
@@ -56,8 +55,7 @@
size_t firstRunIndex() const { return m_firstRunIndex; }
size_t runCount() const { return m_runCount; }
- const FloatRect& rect() const { return m_lineRect; }
- float lineBoxWidth() const { return m_lineBoxWidth; }
+ const FloatRect& rect() const { return m_lineBoxRect; }
float enclosingContentTop() const { return m_enclosingTopAndBottom.top; }
float enclosingContentBottom() const { return m_enclosingTopAndBottom.bottom; }
const FloatRect& scrollableOverflow() const { return m_scrollableOverflow; }
@@ -69,12 +67,10 @@
private:
size_t m_firstRunIndex { 0 };
size_t m_runCount { 0 };
- // Line is always as tall as the line box is. However they may differ in width.
- // While line box encloses all the inline level boxes on the line horizontally, the line itself may be shorter (and trigger horizontal overflow).
+ // This is line box geometry (see https://www.w3.org/TR/css-inline-3/#line-box).
+ FloatRect m_lineBoxRect;
// Enclosing top and bottom includes all inline level boxes (border box) vertically. In certain cases (see line-height property)
// the line (and the line box) is not as tall as the inline level boxes on the line.
- FloatRect m_lineRect;
- float m_lineBoxWidth { 0 };
EnclosingTopAndBottom m_enclosingTopAndBottom;
FloatRect m_scrollableOverflow;
FloatRect m_inkOverflow;
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp (270144 => 270145)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp 2020-11-21 14:02:00 UTC (rev 270145)
@@ -130,7 +130,6 @@
line.firstRunIndex(),
line.runCount(),
moveVertically(line.rect(), offset),
- line.rect().width(),
{ line.enclosingContentTop() + offset, line.enclosingContentBottom() + offset },
moveVertically(line.scrollableOverflow(), offset),
moveVertically(line.inkOverflow(), offset),
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (270144 => 270145)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2020-11-21 13:13:29 UTC (rev 270144)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2020-11-21 14:02:00 UTC (rev 270145)
@@ -394,8 +394,8 @@
};
addSpacing();
auto& line = lines[lineIndex];
- auto& lineLogicalRect = line.logicalRect();
- stream << "line at (" << lineLogicalRect.left() << "," << lineLogicalRect.top() << ") size (" << lineLogicalRect.width() << "x" << lineLogicalRect.height() << ") baseline (" << line.baseline() << ")";
+ auto& lineBoxLogicalRect = line.lineBoxLogicalRect();
+ stream << "line at (" << lineBoxLogicalRect.left() << "," << lineBoxLogicalRect.top() << ") size (" << lineBoxLogicalRect.width() << "x" << lineBoxLogicalRect.height() << ") baseline (" << line.baseline() << ")";
stream.nextLine();
addSpacing();