Title: [285716] trunk/Source/WebCore
- Revision
- 285716
- Author
- [email protected]
- Date
- 2021-11-12 06:40:42 -0800 (Fri, 12 Nov 2021)
Log Message
[LFC][IFC] Add inline box margin-start support for visual ordering (bidi)
https://bugs.webkit.org/show_bug.cgi?id=233022
Reviewed by Antti Koivisto.
Line run geometry is margin box based (only applicable for inline level boxes), while
the displayRect() returns border box based geometry (again, only relevant for inline level boxes).
When computing the border box based left position using the distanceFromLogicalPreviousRun (line run based)
we have to offset it with the margin value.
* layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineContent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (285715 => 285716)
--- trunk/Source/WebCore/ChangeLog 2021-11-12 14:25:04 UTC (rev 285715)
+++ trunk/Source/WebCore/ChangeLog 2021-11-12 14:40:42 UTC (rev 285716)
@@ -1,3 +1,18 @@
+2021-11-12 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] Add inline box margin-start support for visual ordering (bidi)
+ https://bugs.webkit.org/show_bug.cgi?id=233022
+
+ Reviewed by Antti Koivisto.
+
+ Line run geometry is margin box based (only applicable for inline level boxes), while
+ the displayRect() returns border box based geometry (again, only relevant for inline level boxes).
+ When computing the border box based left position using the distanceFromLogicalPreviousRun (line run based)
+ we have to offset it with the margin value.
+
+ * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+ (WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineContent):
+
2021-11-12 Adrian Perez de Castro <[email protected]>
Non-unified build fixes, early November 2021 edition, bis x2
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (285715 => 285716)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-11-12 14:25:04 UTC (rev 285715)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp 2021-11-12 14:40:42 UTC (rev 285716)
@@ -95,6 +95,7 @@
auto displayBoxRect = [&] {
auto logicalRect = InlineRect { };
+ auto marginStart = std::optional<LayoutUnit> { };
if (lineRun.isText() || lineRun.isSoftLineBreak())
logicalRect = lineBox.logicalRectForTextRun(lineRun);
@@ -102,6 +103,7 @@
logicalRect = lineBox.logicalRectForLineBreakBox(layoutBox);
else {
auto& boxGeometry = formattingState.boxGeometry(layoutBox);
+ marginStart = boxGeometry.marginStart();
if (lineRun.isBox())
logicalRect = lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, boxGeometry);
else if (lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart())
@@ -119,13 +121,13 @@
// Certain css properties (e.g. word-spacing) may introduce a gap between runs.
auto distanceFromLogicalPreviousRun = logicalPreviousRun ? lineRun.logicalLeft() - logicalPreviousRun->logicalRight() : lineRun.logicalLeft();
auto visualOrderRect = logicalRect;
- auto contentLeft = contentRightInVisualOrder + distanceFromLogicalPreviousRun;
+ auto contentLeft = contentRightInVisualOrder + distanceFromLogicalPreviousRun + marginStart.value_or(0);
visualOrderRect.setLeft(contentLeft);
// The inline box right edge includes its content as well as the inline box end (padding-right etc).
// What we need here is the inline box start run's width.
- contentRightInVisualOrder = lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart()
- ? visualOrderRect.left() + lineRun.logicalWidth()
- : visualOrderRect.right();
+ // Note that content width does not refer to content _box_ here (it does include padding and border for inline level boxes).
+ auto contentWidth = lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart() ? lineRun.logicalWidth() - *marginStart : logicalRect.width();
+ contentRightInVisualOrder = visualOrderRect.left() + contentWidth;
return visualOrderRect;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes