Modified: trunk/Source/WebCore/ChangeLog (285155 => 285156)
--- trunk/Source/WebCore/ChangeLog 2021-11-02 08:47:27 UTC (rev 285155)
+++ trunk/Source/WebCore/ChangeLog 2021-11-02 13:56:33 UTC (rev 285156)
@@ -1,3 +1,18 @@
+2021-11-02 Alan Bujtas <za...@apple.com>
+
+ [LFC][IFC] Use the isLineSpanningInlineBoxStart line run type to update spanning inline box geometry
+ https://bugs.webkit.org/show_bug.cgi?id=232578
+
+ Reviewed by Antti Koivisto.
+
+ Now that we have dedicated LineSpanningInlineBoxStart line run type, let's use it to update the associated inline box geometry.
+
+ * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+ (WebCore::Layout::InlineDisplayContentBuilder::build):
+ (WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineContent): Move the update logic over here from the createBoxesAndUpdateGeometryForLineSpanningInlineBoxes loop.
+ (WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineSpanningInlineBoxes): Deleted.
+ * layout/formattingContexts/inline/InlineDisplayContentBuilder.h:
+
2021-11-01 Don Olmstead <don.olmst...@sony.com>
[Curl] Fix -Wreorder-ctor in CurlRequest
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (285155 => 285156)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-11-02 08:47:27 UTC (rev 285155)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-11-02 13:56:33 UTC (rev 285156)
@@ -62,7 +62,6 @@
rootInlineBoxRect.moveBy(lineBoxLogicalTopLeft);
boxes.append({ lineIndex, InlineDisplay::Box::Type::RootInlineBox, root(), UBIDI_DEFAULT_LTR, rootInlineBoxRect, rootInlineBoxRect, { }, { }, lineBox.rootInlineBox().hasContent() });
- createBoxesAndUpdateGeometryForLineSpanningInlineBoxes(lineBox, lineBoxLogicalTopLeft, lineIndex, boxes);
createBoxesAndUpdateGeometryForLineContent(lineContent, lineBox, lineBoxLogicalTopLeft, lineIndex, boxes);
collectInkOverflowForInlineBoxes(lineBox, boxes);
return boxes;
@@ -188,46 +187,35 @@
boxGeometry.setContentBoxWidth(contentBoxWidth);
continue;
}
- ASSERT(lineRun.isInlineBoxEnd() || lineRun.isWordBreakOpportunity() || lineRun.isLineSpanningInlineBoxStart());
- }
-}
+ if (lineRun.isLineSpanningInlineBoxStart()) {
+ if (!lineBox.hasContent()) {
+ // When a spanning inline box (e.g. <div>text<span><br></span></div>) lands on an empty line
+ // (empty here means no content at all including line breaks, not just visually empty) then we
+ // don't extend the spanning line box over to this line -also there is no next line in cases like this.
+ continue;
+ }
+ auto& boxGeometry = formattingState.boxGeometry(layoutBox);
+ auto inlineBoxBorderBox = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
+ inlineBoxBorderBox.moveBy(lineBoxLogicalTopLeft);
-void InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineSpanningInlineBoxes(const LineBox& lineBox, const InlineLayoutPoint& lineBoxLogicalTopLeft, const size_t lineIndex, DisplayBoxes& boxes)
-{
- if (!lineBox.hasContent()) {
- // When a spanning inline box (e.g. <div>text<span><br></span></div>) lands on an empty line
- // (empty here means no content at all including line breaks, not just visually empty) then we
- // don't extend the spanning line box over to this line -also there is no next line in cases like this.
- return;
- }
+ m_inlineBoxIndexMap.add(&layoutBox, boxes.size());
- auto& formattingState = this->formattingState();
- // FiXME: Now that we have actual line runs on spanning inline boxes (see lineRun.isLineSpanningInlineBoxStart()), move this code over to createBoxesAndUpdateGeometryForLineContent.
- for (auto& inlineLevelBox : lineBox.nonRootInlineLevelBoxes()) {
- if (!inlineLevelBox.isLineSpanningInlineBox())
- continue;
- ASSERT(inlineLevelBox.isInlineBox());
+ auto& inlineBox = lineBox.inlineLevelBoxForLayoutBox(layoutBox);
+ ASSERT(!inlineBox.isFirstBox());
+ boxes.append({ lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, layoutBox, lineRun.bidiLevel(), inlineBoxBorderBox, inlineBoxBorderBox, { }, { }, inlineBox.hasContent(), isFirstLastBox(inlineBox) });
- auto& layoutBox = inlineLevelBox.layoutBox();
- auto& boxGeometry = formattingState.boxGeometry(layoutBox);
- // Inline boxes may or may not be wrapped and have boxes on multiple lines (e.g. <span>first line<br>second line<br>third line</span>)
- auto inlineBoxBorderBox = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
- inlineBoxBorderBox.moveBy(lineBoxLogicalTopLeft);
+ auto inlineBoxSize = LayoutSize { LayoutUnit::fromFloatCeil(inlineBoxBorderBox.width()), LayoutUnit::fromFloatCeil(inlineBoxBorderBox.height()) };
+ auto logicalRect = Rect { LayoutPoint { inlineBoxBorderBox.topLeft() }, inlineBoxSize };
+ // Middle or end of the inline box. Let's stretch the box as needed.
+ auto enclosingBorderBoxRect = BoxGeometry::borderBoxRect(boxGeometry);
+ enclosingBorderBoxRect.expandToContain(logicalRect);
+ boxGeometry.setLogicalLeft(enclosingBorderBoxRect.left());
- m_inlineBoxIndexMap.add(&layoutBox, boxes.size());
-
- ASSERT(!inlineLevelBox.isFirstBox());
- boxes.append({ lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, layoutBox, UBIDI_DEFAULT_LTR, inlineBoxBorderBox, inlineBoxBorderBox, { }, { }, inlineLevelBox.hasContent(), isFirstLastBox(inlineLevelBox) });
-
- auto inlineBoxSize = LayoutSize { LayoutUnit::fromFloatCeil(inlineBoxBorderBox.width()), LayoutUnit::fromFloatCeil(inlineBoxBorderBox.height()) };
- auto logicalRect = Rect { LayoutPoint { inlineBoxBorderBox.topLeft() }, inlineBoxSize };
- // Middle or end of the inline box. Let's stretch the box as needed.
- auto enclosingBorderBoxRect = BoxGeometry::borderBoxRect(boxGeometry);
- enclosingBorderBoxRect.expandToContain(logicalRect);
- boxGeometry.setLogicalLeft(enclosingBorderBoxRect.left());
-
- boxGeometry.setContentBoxHeight(enclosingBorderBoxRect.height() - (boxGeometry.verticalBorder() + boxGeometry.verticalPadding().value_or(0_lu)));
- boxGeometry.setContentBoxWidth(enclosingBorderBoxRect.width() - (boxGeometry.horizontalBorder() + boxGeometry.horizontalPadding().value_or(0_lu)));
+ boxGeometry.setContentBoxHeight(enclosingBorderBoxRect.height() - (boxGeometry.verticalBorder() + boxGeometry.verticalPadding().value_or(0_lu)));
+ boxGeometry.setContentBoxWidth(enclosingBorderBoxRect.width() - (boxGeometry.horizontalBorder() + boxGeometry.horizontalPadding().value_or(0_lu)));
+ continue;
+ }
+ ASSERT(lineRun.isInlineBoxEnd() || lineRun.isWordBreakOpportunity());
}
}
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h (285155 => 285156)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h 2021-11-02 08:47:27 UTC (rev 285155)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.h 2021-11-02 13:56:33 UTC (rev 285156)
@@ -45,7 +45,6 @@
private:
void createBoxesAndUpdateGeometryForLineContent(const LineBuilder::LineContent&, const LineBox&, const InlineLayoutPoint& lineBoxLogicalTopLeft, const size_t lineIndex, DisplayBoxes&);
- void createBoxesAndUpdateGeometryForLineSpanningInlineBoxes(const LineBox&, const InlineLayoutPoint& lineBoxLogicalTopLeft, const size_t lineIndex, DisplayBoxes&);
void collectInkOverflowForInlineBoxes(const LineBox&, DisplayBoxes&);
const ContainerBox& root() const { return m_formattingContextRoot; }