Title: [287187] trunk/Source/WebCore
Revision
287187
Author
[email protected]
Date
2021-12-17 08:01:25 -0800 (Fri, 17 Dec 2021)

Log Message

[LFC][IFC] Inline boxes set direction for both their content and their decoration unlike other inline level elements
https://bugs.webkit.org/show_bug.cgi?id=234418

Reviewed by Antti Koivisto.

<div>
  <span dir=rtl style="border-inline-start: 10px solid yellow;">
    <span dir=ltr style="border-inline-start: 10px solid green;">
      <img style="border-inline-start: 10px solid blue;">
    </span>
  </span
</div>

produces a "green/blue/yellow" pattern in visual order.

* layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForDisplayBox):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
(WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287186 => 287187)


--- trunk/Source/WebCore/ChangeLog	2021-12-17 15:51:40 UTC (rev 287186)
+++ trunk/Source/WebCore/ChangeLog	2021-12-17 16:01:25 UTC (rev 287187)
@@ -1,3 +1,26 @@
+2021-12-17  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Inline boxes set direction for both their content and their decoration unlike other inline level elements
+        https://bugs.webkit.org/show_bug.cgi?id=234418
+
+        Reviewed by Antti Koivisto.
+
+        <div>
+          <span dir=rtl style="border-inline-start: 10px solid yellow;">
+            <span dir=ltr style="border-inline-start: 10px solid green;">
+              <img style="border-inline-start: 10px solid blue;">
+            </span>
+          </span
+        </div>
+
+        produces a "green/blue/yellow" pattern in visual order.
+
+        * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+        (WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForDisplayBox):
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions):
+        (WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):
+
 2021-12-17  Antoine Quint  <[email protected]>
 
         ActiveDOMObject::suspendIfNeeded() should not be called within constructors

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (287186 => 287187)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-12-17 15:51:40 UTC (rev 287186)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-12-17 16:01:25 UTC (rev 287187)
@@ -454,7 +454,6 @@
 
 void InlineDisplayContentBuilder::adjustVisualGeometryForDisplayBox(size_t displayBoxNodeIndex, InlineLayoutUnit& contentRightInVisualOrder, InlineLayoutUnit lineBoxLogicalTop, const DisplayBoxTree& displayBoxTree, DisplayBoxes& boxes, const LineBox& lineBox)
 {
-    auto isLeftToRightDirection = root().style().isLeftToRightDirection();
     // Non-inline box display boxes just need a horizontal adjustment while
     // inline box type of display boxes need
     // 1. horizontal adjustment and margin/border/padding start offsetting on the first box
@@ -466,10 +465,11 @@
         displayBox.setLeft(contentRightInVisualOrder);
         contentRightInVisualOrder += displayBox.width();
         if (displayBox.isAtomicInlineLevelBox() || displayBox.isGenericInlineLevelBox())
-            contentRightInVisualOrder += marginRight(formattingState().boxGeometry(layoutBox), isLeftToRightDirection);
+            contentRightInVisualOrder += marginRight(formattingState().boxGeometry(layoutBox), layoutBox.parent().style().isLeftToRightDirection());
         return;
     }
 
+    auto isLeftToRightDirection = layoutBox.style().isLeftToRightDirection();
     auto& boxGeometry = formattingState().boxGeometry(layoutBox);
     auto beforeInlineBoxContent = [&] {
         auto logicalRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (287186 => 287187)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-12-17 15:51:40 UTC (rev 287186)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-12-17 16:01:25 UTC (rev 287187)
@@ -203,7 +203,7 @@
     replacedBoxGeometry.setContentBoxHeight(replacedOrInlineBlock.contentHeight());
 
     replacedBoxGeometry.setVerticalMargin({ replacedOrInlineBlock.marginTop(), replacedOrInlineBlock.marginBottom() });
-    auto isLeftToRightDirection = flow().style().isLeftToRightDirection();
+    auto isLeftToRightDirection = replacedOrInlineBlock.parent()->style().isLeftToRightDirection();
     replacedBoxGeometry.setHorizontalMargin(logicalMargin(replacedOrInlineBlock, isLeftToRightDirection));
     replacedBoxGeometry.setBorder(logicalBorder(replacedOrInlineBlock, isLeftToRightDirection));
     replacedBoxGeometry.setPadding(logicalPadding(replacedOrInlineBlock, isLeftToRightDirection));
@@ -233,7 +233,7 @@
     auto shouldNotRetainBorderPaddingAndMarginEnd = renderInline.parent()->isAnonymousBlock() && !renderInline.isContinuation() && renderInline.inlineContinuation();
 
     boxGeometry.setVerticalMargin({ });
-    auto isLeftToRightDirection = flow().style().isLeftToRightDirection();
+    auto isLeftToRightDirection = renderInline.style().isLeftToRightDirection();
     boxGeometry.setHorizontalMargin(logicalMargin(renderInline, isLeftToRightDirection, !shouldNotRetainBorderPaddingAndMarginStart, !shouldNotRetainBorderPaddingAndMarginEnd));
     boxGeometry.setBorder(logicalBorder(renderInline, isLeftToRightDirection, !shouldNotRetainBorderPaddingAndMarginStart, !shouldNotRetainBorderPaddingAndMarginEnd));
     boxGeometry.setPadding(logicalPadding(renderInline, isLeftToRightDirection, !shouldNotRetainBorderPaddingAndMarginStart, !shouldNotRetainBorderPaddingAndMarginEnd));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to