Modified: trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp (281743 => 281744)
--- trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp 2021-08-29 15:14:13 UTC (rev 281743)
+++ trunk/Source/WebCore/display/css/DisplayBoxFactory.cpp 2021-08-29 16:10:25 UTC (rev 281744)
@@ -150,7 +150,6 @@
auto lineLayoutRect = LayoutRect { lineRect.left(), lineRect.top(), lineRect.width(), lineRect.height() };
auto runRect = LayoutRect { run.logicalLeft(), run.logicalTop(), run.logicalWidth(), run.logicalHeight() };
- runRect.moveBy(lineLayoutRect.location());
runRect.move(containingBlockContext.offsetFromRoot);
auto style = Style { run.layoutBox().style() };
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (281743 => 281744)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-08-29 15:14:13 UTC (rev 281743)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-08-29 16:10:25 UTC (rev 281744)
@@ -45,7 +45,9 @@
{
auto& formattingState = this->formattingState();
// Every line starts with a root run, even the empty ones.
- formattingState.addLineRun({ lineIndex, LineRun::Type::RootInlineBox, root(), lineBox.logicalRectForRootInlineBox(), { }, { }, lineBox.rootInlineBox().hasContent()});
+ auto rootInlineBoxRect = lineBox.logicalRectForRootInlineBox();
+ rootInlineBoxRect.moveBy(lineBoxLogicalTopLeft);
+ formattingState.addLineRun({ lineIndex, LineRun::Type::RootInlineBox, root(), rootInlineBoxRect, { }, { }, lineBox.rootInlineBox().hasContent()});
// Spanning inline boxes start at the very beginning of the line.
auto lineSpanningInlineBoxIndex = formattingState.lineRuns().size();
@@ -60,19 +62,25 @@
for (auto& lineRun : lineContent.runs) {
auto& layoutBox = lineRun.layoutBox();
switch (lineRun.type()) {
- case InlineItem::Type::Text:
- formattingState.addLineRun({ lineIndex, LineRun::Type::Text, layoutBox, lineBox.logicalRectForTextRun(lineRun), lineRun.expansion(), lineRun.textContent() });
+ case InlineItem::Type::Text: {
+ auto textRunRect = lineBox.logicalRectForTextRun(lineRun);
+ textRunRect.moveBy(lineBoxLogicalTopLeft);
+ formattingState.addLineRun({ lineIndex, LineRun::Type::Text, layoutBox, textRunRect, lineRun.expansion(), lineRun.textContent() });
break;
- case InlineItem::Type::SoftLineBreak:
- formattingState.addLineRun({ lineIndex, LineRun::Type::SoftLineBreak, layoutBox, lineBox.logicalRectForTextRun(lineRun), lineRun.expansion(), lineRun.textContent() });
+ }
+ case InlineItem::Type::SoftLineBreak: {
+ auto softLineBreakRunRect = lineBox.logicalRectForTextRun(lineRun);
+ softLineBreakRunRect.moveBy(lineBoxLogicalTopLeft);
+ formattingState.addLineRun({ lineIndex, LineRun::Type::SoftLineBreak, layoutBox, softLineBreakRunRect, lineRun.expansion(), lineRun.textContent() });
break;
+ }
case InlineItem::Type::HardLineBreak: {
// Only hard linebreaks have associated layout boxes.
auto lineBreakBoxRect = lineBox.logicalRectForLineBreakBox(layoutBox);
+ lineBreakBoxRect.moveBy(lineBoxLogicalTopLeft);
formattingState.addLineRun({ lineIndex, LineRun::Type::LineBreakBox, layoutBox, lineBreakBoxRect, lineRun.expansion(), { } });
auto& boxGeometry = formattingState.boxGeometry(layoutBox);
- lineBreakBoxRect.moveBy(lineBoxLogicalTopLeft);
boxGeometry.setLogicalTopLeft(toLayoutPoint(lineBreakBoxRect.topLeft()));
boxGeometry.setContentBoxHeight(toLayoutUnit(lineBreakBoxRect.height()));
break;
@@ -81,11 +89,11 @@
ASSERT(layoutBox.isAtomicInlineLevelBox());
auto& boxGeometry = formattingState.boxGeometry(layoutBox);
auto logicalBorderBox = lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, boxGeometry);
+ logicalBorderBox.moveBy(lineBoxLogicalTopLeft);
formattingState.addLineRun({ lineIndex, LineRun::Type::AtomicInlineLevelBox, layoutBox, logicalBorderBox, lineRun.expansion(), { } });
auto borderBoxLogicalTopLeft = logicalBorderBox.topLeft();
// Note that inline boxes are relative to the line and their top position can be negative.
- borderBoxLogicalTopLeft.moveBy(lineBoxLogicalTopLeft);
// Atomic inline boxes are all set. Their margin/border/content box geometries are already computed. We just have to position them here.
boxGeometry.setLogicalTopLeft(toLayoutPoint(borderBoxLogicalTopLeft));
break;
@@ -94,6 +102,7 @@
// This inline box showed up first on this line.
auto& boxGeometry = formattingState.boxGeometry(layoutBox);
auto inlineBoxBorderBox = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
+ inlineBoxBorderBox.moveBy(lineBoxLogicalTopLeft);
if (lineBox.hasContent()) {
// FIXME: It's expected to not have any runs on empty lines. We should reconsider this.
formattingState.addLineRun({ lineIndex, LineRun::Type::NonRootInlineBox, layoutBox, inlineBoxBorderBox, { }, { }, lineBox.inlineLevelBoxForLayoutBox(layoutBox).hasContent() });
@@ -101,7 +110,6 @@
auto inlineBoxSize = LayoutSize { LayoutUnit::fromFloatCeil(inlineBoxBorderBox.width()), LayoutUnit::fromFloatCeil(inlineBoxBorderBox.height()) };
auto logicalRect = Rect { LayoutPoint { inlineBoxBorderBox.topLeft() }, inlineBoxSize };
- logicalRect.moveBy(LayoutPoint { lineBoxLogicalTopLeft });
boxGeometry.setLogicalTopLeft(logicalRect.topLeft());
auto contentBoxHeight = logicalRect.height() - (boxGeometry.verticalBorder() + boxGeometry.verticalPadding().value_or(0_lu));
boxGeometry.setContentBoxHeight(contentBoxHeight);
@@ -133,12 +141,12 @@
auto& boxGeometry = formattingState.boxGeometry(layoutBox);
// 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);
formattingState.lineRuns().insert(lineSpanningInlineBoxIndex++, { lineIndex, LineRun::Type::NonRootInlineBox, layoutBox, inlineBoxBorderBox, { }, { }, inlineLevelBox.hasContent(), true });
auto inlineBoxSize = LayoutSize { LayoutUnit::fromFloatCeil(inlineBoxBorderBox.width()), LayoutUnit::fromFloatCeil(inlineBoxBorderBox.height()) };
auto logicalRect = Rect { LayoutPoint { inlineBoxBorderBox.topLeft() }, inlineBoxSize };
- logicalRect.moveBy(LayoutPoint { lineBoxLogicalTopLeft });
// Middle or end of the inline box. Let's stretch the box as needed.
auto enclosingBorderBoxRect = BoxGeometry::borderBoxRect(boxGeometry);
enclosingBorderBoxRect.expandToContain(logicalRect);
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (281743 => 281744)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-08-29 15:14:13 UTC (rev 281743)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp 2021-08-29 16:10:25 UTC (rev 281744)
@@ -255,12 +255,10 @@
}
auto& layoutBox = lineRun.layoutBox();
auto lineIndex = lineRun.lineIndex();
- 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() };
auto& geometry = m_layoutState.geometryForBox(layoutBox);
- runRect.moveBy({ lineBoxLogicalRect.left(), lineBoxLogicalRect.top() });
runRect.setSize({ geometry.borderBoxWidth(), geometry.borderBoxHeight() });
if (lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition)
runRect.setY(roundToInt(runRect.y()));
@@ -268,7 +266,6 @@
// FIXME: Add support for cases when the run is after ellipsis.
if (lineRun.isInlineBox()) {
auto lineRunRect = lineRun.logicalRect();
- lineRunRect.moveBy(lineBoxLogicalRect.topLeft());
auto hasScrollableContent = [&] {
// In standards mode, inline boxes always start with an imaginary strut.
return m_layoutState.inStandardsMode() || lineRun.hasContent() || geometry.horizontalBorder() || (geometry.horizontalPadding() && geometry.horizontalPadding().value());
@@ -288,7 +285,6 @@
auto lineIndex = lineRun.lineIndex();
auto& lineBoxLogicalRect = lines[lineIndex].lineBoxLogicalRect();
auto runRect = FloatRect { lineRun.logicalRect() };
- runRect.moveBy({ lineBoxLogicalRect.left(), lineBoxLogicalRect.top() });
if (lineLevelVisualAdjustmentsForRuns[lineIndex].needsIntegralPosition)
runRect.setY(roundToInt(runRect.y()));