Title: [287514] trunk
Revision
287514
Author
[email protected]
Date
2022-01-02 07:05:28 -0800 (Sun, 02 Jan 2022)

Log Message

[LFC][IFC] Nested inline box continuation fails to omit margin/border/padding start/end values
https://bugs.webkit.org/show_bug.cgi?id=234789

Reviewed by Antti Koivisto.

Source/WebCore:

Nested inline boxes inside continuation do not have block parents. It's sufficient to check
for the continuation bits.

Test: fast/inline/unexpected-start-end-decoration-with-nested-continuation.html

* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTree):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):

LayoutTests:

* fast/inline/unexpected-start-end-decoration-with-nested-continuation-expected.html: Added.
* fast/inline/unexpected-start-end-decoration-with-nested-continuation.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287513 => 287514)


--- trunk/LayoutTests/ChangeLog	2022-01-02 10:32:22 UTC (rev 287513)
+++ trunk/LayoutTests/ChangeLog	2022-01-02 15:05:28 UTC (rev 287514)
@@ -1,3 +1,13 @@
+2022-01-02  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Nested inline box continuation fails to omit margin/border/padding start/end values
+        https://bugs.webkit.org/show_bug.cgi?id=234789
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/unexpected-start-end-decoration-with-nested-continuation-expected.html: Added.
+        * fast/inline/unexpected-start-end-decoration-with-nested-continuation.html: Added.
+
 2022-01-01  Antoine Quint  <[email protected]>
 
         "animation" shorthand does not parse values in the right order

Added: trunk/LayoutTests/fast/inline/unexpected-start-end-decoration-with-nested-continuation-expected.html (0 => 287514)


--- trunk/LayoutTests/fast/inline/unexpected-start-end-decoration-with-nested-continuation-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/unexpected-start-end-decoration-with-nested-continuation-expected.html	2022-01-02 15:05:28 UTC (rev 287514)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<style>
+div {
+  font-size: 20px;
+  font-family: Ahem;
+  color: green;
+}
+span {
+  background-color: green;
+}
+.start {
+  border-inline-start: 50px solid green;
+  padding-inline-start: 50px;
+}
+.end {
+  border-inline-end: 50px solid green;
+  padding-inline-end: 50px;
+}
+</style>
+<div><span class=start>XXXXX</span></div>
+<div><span class=end></span></div>
+<div><span class=start></span></div>
+<div><span class=end>XXXXX</span></div>

Added: trunk/LayoutTests/fast/inline/unexpected-start-end-decoration-with-nested-continuation.html (0 => 287514)


--- trunk/LayoutTests/fast/inline/unexpected-start-end-decoration-with-nested-continuation.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/unexpected-start-end-decoration-with-nested-continuation.html	2022-01-02 15:05:28 UTC (rev 287514)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<style>
+div {
+  font-size: 20px;
+  font-family: Ahem;
+  color: green;
+}
+.inner {
+  background-color: green;
+  border-inline-start: 50px solid green;
+  border-inline-end: 50px solid green;
+  padding-inline-start: 50px;
+  padding-inline-end: 50px;
+}
+</style>
+<!-- pre/post continuation blocks should only retain start/end decorations -->
+<div><span><span class=inner>XXXXX<div></div></span></span></div>
+<div><span><span class=inner><div></div>XXXXX</span></span></div>

Modified: trunk/Source/WebCore/ChangeLog (287513 => 287514)


--- trunk/Source/WebCore/ChangeLog	2022-01-02 10:32:22 UTC (rev 287513)
+++ trunk/Source/WebCore/ChangeLog	2022-01-02 15:05:28 UTC (rev 287514)
@@ -1,3 +1,20 @@
+2022-01-02  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Nested inline box continuation fails to omit margin/border/padding start/end values
+        https://bugs.webkit.org/show_bug.cgi?id=234789
+
+        Reviewed by Antti Koivisto.
+
+        Nested inline boxes inside continuation do not have block parents. It's sufficient to check
+        for the continuation bits.
+
+        Test: fast/inline/unexpected-start-end-decoration-with-nested-continuation.html
+
+        * layout/integration/LayoutIntegrationBoxTree.cpp:
+        (WebCore::LayoutIntegration::BoxTree::buildTree):
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):
+
 2022-01-01  Antoine Quint  <[email protected]>
 
         "animation" shorthand does not parse values in the right order

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (287513 => 287514)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-01-02 10:32:22 UTC (rev 287513)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp	2022-01-02 15:05:28 UTC (rev 287514)
@@ -122,27 +122,25 @@
             return makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::GenericElement }, WTFMove(style), WTFMove(firstLineStyle));
 
         if (is<RenderInline>(childRenderer)) {
-            if (childRenderer.parent()->isAnonymousBlock()) {
-                // This looks like continuation renderer.
-                auto& renderInline = downcast<RenderInline>(childRenderer);
-                auto shouldNotRetainBorderPaddingAndMarginStart = renderInline.isContinuation();
-                auto shouldNotRetainBorderPaddingAndMarginEnd = !renderInline.isContinuation() && renderInline.inlineContinuation();
-                auto adjustStyleForContinuation = [&] (auto& styleToAdjust) {
-                    if (shouldNotRetainBorderPaddingAndMarginStart) {
-                        styleToAdjust.setMarginStart(RenderStyle::initialMargin());
-                        styleToAdjust.resetBorderLeft();
-                        styleToAdjust.setPaddingLeft(RenderStyle::initialPadding());
-                    }
-                    if (shouldNotRetainBorderPaddingAndMarginEnd) {
-                        styleToAdjust.setMarginEnd(RenderStyle::initialMargin());
-                        styleToAdjust.resetBorderRight();
-                        styleToAdjust.setPaddingRight(RenderStyle::initialPadding());
-                    }
-                };
-                adjustStyleForContinuation(style);
-                if (firstLineStyle)
-                    adjustStyleForContinuation(*firstLineStyle);
-            }
+            // This looks like continuation renderer.
+            auto& renderInline = downcast<RenderInline>(childRenderer);
+            auto shouldNotRetainBorderPaddingAndMarginStart = renderInline.isContinuation();
+            auto shouldNotRetainBorderPaddingAndMarginEnd = !renderInline.isContinuation() && renderInline.inlineContinuation();
+            auto adjustStyleForContinuation = [&] (auto& styleToAdjust) {
+                if (shouldNotRetainBorderPaddingAndMarginStart) {
+                    styleToAdjust.setMarginStart(RenderStyle::initialMargin());
+                    styleToAdjust.resetBorderLeft();
+                    styleToAdjust.setPaddingLeft(RenderStyle::initialPadding());
+                }
+                if (shouldNotRetainBorderPaddingAndMarginEnd) {
+                    styleToAdjust.setMarginEnd(RenderStyle::initialMargin());
+                    styleToAdjust.resetBorderRight();
+                    styleToAdjust.setPaddingRight(RenderStyle::initialPadding());
+                }
+            };
+            adjustStyleForContinuation(style);
+            if (firstLineStyle)
+                adjustStyleForContinuation(*firstLineStyle);
             return makeUnique<Layout::ContainerBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::GenericElement }, WTFMove(style), WTFMove(firstLineStyle));
         }
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (287513 => 287514)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-01-02 10:32:22 UTC (rev 287513)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2022-01-02 15:05:28 UTC (rev 287514)
@@ -229,8 +229,8 @@
     auto& boxGeometry = m_layoutState.ensureGeometryForBox(m_boxTree.layoutBoxForRenderer(renderInline));
 
     // Check if this renderer is part of a continuation and adjust horizontal margin/border/padding accordingly.
-    auto shouldNotRetainBorderPaddingAndMarginStart = renderInline.parent()->isAnonymousBlock() && renderInline.isContinuation();
-    auto shouldNotRetainBorderPaddingAndMarginEnd = renderInline.parent()->isAnonymousBlock() && !renderInline.isContinuation() && renderInline.inlineContinuation();
+    auto shouldNotRetainBorderPaddingAndMarginStart = renderInline.isContinuation();
+    auto shouldNotRetainBorderPaddingAndMarginEnd = !renderInline.isContinuation() && renderInline.inlineContinuation();
 
     boxGeometry.setVerticalMargin({ });
     auto isLeftToRightDirection = renderInline.style().isLeftToRightDirection();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to