Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (286788 => 286789)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-12-09 18:58:34 UTC (rev 286788)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-12-09 19:01:10 UTC (rev 286789)
@@ -128,7 +128,8 @@
, lineRun.expansion()
, InlineDisplay::Box::Text { text->start, text->length, content, adjustedContentToRender(), text->needsHyphen }
, true
- , { } });
+ , { }
+ });
}
void InlineDisplayContentBuilder::appendSoftLineBreakDisplayBox(const Line::Run& lineRun, const InlineRect& softLineBreakRunRect, DisplayBoxes& boxes)
@@ -145,7 +146,8 @@
, softLineBreakRunRect
, softLineBreakRunRect
, lineRun.expansion()
- , InlineDisplay::Box::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() } });
+ , InlineDisplay::Box::Text { text->start, text->length, downcast<InlineTextBox>(layoutBox).content() }
+ });
}
void InlineDisplayContentBuilder::appendHardLineBreakDisplayBox(const Line::Run& lineRun, const InlineRect& lineBreakBoxRect, DisplayBoxes& boxes)
@@ -159,7 +161,8 @@
, lineBreakBoxRect
, lineBreakBoxRect
, lineRun.expansion()
- , { } });
+ , { }
+ });
auto& boxGeometry = formattingState().boxGeometry(layoutBox);
boxGeometry.setLogicalTopLeft(toLayoutPoint(lineBreakBoxRect.topLeft()));
@@ -185,7 +188,8 @@
, borderBoxRect
, inkOverflow()
, lineRun.expansion()
- , { } });
+ , { }
+ });
// Note that inline boxes are relative to the line and their top position can be negative.
// Atomic inline boxes are all set. Their margin/border/content box geometries are already computed. We just have to position them here.
formattingState().boxGeometry(layoutBox).setLogicalTopLeft(toLayoutPoint(borderBoxRect.topLeft()));
@@ -236,7 +240,8 @@
, { }
, { }
, inlineBox.hasContent()
- , isFirstLastBox(inlineBox) });
+ , isFirstLastBox(inlineBox)
+ });
// This inline box showed up first on this line.
setInlineBoxGeometry(layoutBox, inlineBoxBorderBox, true);
}
@@ -261,11 +266,26 @@
, { }
, { }
, inlineBox.hasContent()
- , isFirstLastBox(inlineBox) });
+ , isFirstLastBox(inlineBox)
+ });
// Middle or end of the inline box. Let's stretch the box as needed.
setInlineBoxGeometry(layoutBox, inlineBoxBorderBox, false);
}
+void InlineDisplayContentBuilder::appendInlineDisplayBoxAtBidiBoundary(const Box& layoutBox, DisplayBoxes& boxes)
+{
+ // Geometries for inline boxes at bidi boundaries are computed at a post-process step.
+ boxes.append({ m_lineIndex
+ , InlineDisplay::Box::Type::NonRootInlineBox
+ , layoutBox
+ , UBIDI_DEFAULT_LTR
+ , { }
+ , { }
+ , { }
+ , { }
+ });
+}
+
void InlineDisplayContentBuilder::processNonBidiContent(const LineBuilder::LineContent& lineContent, const LineBox& lineBox, const InlineLayoutPoint& lineBoxLogicalTopLeft, DisplayBoxes& boxes)
{
// Create the inline boxes on the current line. This is mostly text and atomic inline boxes.
@@ -377,7 +397,7 @@
if (auto* lowestCommonAncestor = ancestorStack.unwind(containerBox))
return *lowestCommonAncestor;
auto& enclosingDisplayBoxNodeForContainer = ensureDisplayBoxForContainer(containerBox.parent(), ancestorStack, boxes);
- boxes.append({ m_lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, containerBox, UBIDI_DEFAULT_LTR, { }, { }, { }, { }, true, { } });
+ appendInlineDisplayBoxAtBidiBoundary(containerBox, boxes);
return createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(containerBox, boxes.size() - 1, enclosingDisplayBoxNodeForContainer, ancestorStack);
}
@@ -403,7 +423,6 @@
auto beforeInlineBoxContent = [&] {
auto logicalRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
auto visualRect = InlineRect { lineBoxLogicalTop + logicalRect.top(), contentRightInVisualOrder, { }, logicalRect.height() };
- // FIXME: Add support for ink overflow.
if (!displayBox.isFirstForLayoutBox())
return displayBox.setLogicalRect(visualRect, visualRect);
@@ -427,6 +446,13 @@
};
afterInlineBoxContent();
+ auto computeInkOverflow = [&] {
+ auto inkOverflow = displayBox.logicalRect();
+ m_contentHasInkOverflow = computeBoxShadowInkOverflow(!m_lineIndex ? layoutBox.firstLineStyle() : layoutBox.style(), inkOverflow) || m_contentHasInkOverflow;
+ displayBox.adjustInkOverflow(inkOverflow);
+ };
+ computeInkOverflow();
+
setInlineBoxGeometry(layoutBox, displayBox.logicalRect(), displayBox.isFirstForLayoutBox());
if (lineBox.inlineLevelBoxForLayoutBox(layoutBox).hasContent())
displayBox.setHasContent();
@@ -498,7 +524,7 @@
continue;
}
if (lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart()) {
- boxes.append({ m_lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, layoutBox, UBIDI_DEFAULT_LTR, { }, { }, { }, { }, true, { } });
+ appendInlineDisplayBoxAtBidiBoundary(layoutBox, boxes);
createdDisplayBoxNodeForContainerBoxAndPushToAncestorStack(downcast<ContainerBox>(layoutBox), boxes.size() - 1, parentDisplayBoxNode, ancestorStack);
continue;
}
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h (286788 => 286789)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h 2021-12-09 18:58:34 UTC (rev 286788)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h 2021-12-09 19:01:10 UTC (rev 286789)
@@ -59,6 +59,7 @@
void appendAtomicInlineLevelDisplayBox(const Line::Run&, const InlineRect& , DisplayBoxes&);
void appendInlineBoxDisplayBox(const Line::Run&, const InlineLevelBox&, const InlineRect&, bool linehasContent, DisplayBoxes&);
void appendSpanningInlineBoxDisplayBox(const Line::Run&, const InlineLevelBox&, const InlineRect&, DisplayBoxes&);
+ void appendInlineDisplayBoxAtBidiBoundary(const Box&, DisplayBoxes&);
void setInlineBoxGeometry(const Box&, const InlineRect&, bool isFirstInlineBoxFragment);
void adjustVisualGeometryForChildNode(const DisplayBoxNode&, InlineLayoutUnit& accumulatedOffset, InlineLayoutUnit lineBoxLogicalTop, DisplayBoxes&, const LineBox&);