Use the parent box style to adjust RenderStyle for alignment.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 May 2017 14:09:37 +0000 (14:09 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 May 2017 14:09:37 +0000 (14:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172215

Patch by Emilio Cobos Álvarez <ecobos@igalia.com> on 2017-05-29
Reviewed by Antti Koivisto.

Source/WebCore:

The css-flexbox spec defined align-self in terms of the parent
element, which is what this code did.

The css-align spec defines these properties in terms of the style of
the containing box instead, which means display: contents styles
should not be used for this adjustment, but the parent box style
instead.

For example, align-items is defined as:

> This property specifies the default align-self for all of the boxes
> (including anonymous boxes) participating in this box’s formatting
> context.

Note that the css-align spec was recently updated to align (no pun
intended) with Gecko, and make the |auto| value compute to itself.
This patch puts us in a more recent spec than before, but not totally
up-to-date.

Tests: imported/w3c/web-platform-tests/css/css-display-3/display-contents-alignment-001.html
       imported/w3c/web-platform-tests/css/css-display-3/display-contents-alignment-002.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::StyleResolver::adjustStyleForAlignment):

LayoutTests:

* TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217536 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp

index 907140d..3284c1a 100644 (file)
@@ -1,3 +1,12 @@
+2017-05-29  Emilio Cobos Álvarez  <ecobos@igalia.com>
+
+        Use the parent box style to adjust RenderStyle for alignment.
+        https://bugs.webkit.org/show_bug.cgi?id=172215
+
+        Reviewed by Antti Koivisto.
+
+        * TestExpectations:
+
 2017-05-29  Per Arne Vollan  <pvollan@apple.com>
 
         Unreviewed Windows test gardening, update expected results after r217418.
 2017-05-29  Per Arne Vollan  <pvollan@apple.com>
 
         Unreviewed Windows test gardening, update expected results after r217418.
index 15285f4..cf47244 100644 (file)
@@ -1160,7 +1160,6 @@ webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-co
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-before-after-001.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-table-002-none.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-flex-003.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-before-after-001.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-table-002-none.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-flex-003.html [ ImageOnlyFailure ]
-webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-alignment-001.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-table-001.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-before-after-002.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-table-002.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-table-001.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-before-after-002.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-table-002.html [ ImageOnlyFailure ]
@@ -1169,7 +1168,6 @@ webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-co
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-flex-002-none.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-flex-002.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-before-after-001.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-flex-002-none.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-flex-002.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-before-after-001.html [ ImageOnlyFailure ]
-webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-alignment-002.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-flow-root-001.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-inline-flex-001-inline.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-flex-003-none.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-flow-root-001.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-inline-flex-001-inline.html [ ImageOnlyFailure ]
 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-flex-003-none.html [ ImageOnlyFailure ]
index 5f51049..c0294a3 100644 (file)
@@ -1,3 +1,36 @@
+2017-05-29  Emilio Cobos Álvarez  <ecobos@igalia.com>
+
+        Use the parent box style to adjust RenderStyle for alignment.
+        https://bugs.webkit.org/show_bug.cgi?id=172215
+
+        Reviewed by Antti Koivisto.
+
+        The css-flexbox spec defined align-self in terms of the parent
+        element, which is what this code did.
+
+        The css-align spec defines these properties in terms of the style of
+        the containing box instead, which means display: contents styles
+        should not be used for this adjustment, but the parent box style
+        instead.
+
+        For example, align-items is defined as:
+
+        > This property specifies the default align-self for all of the boxes
+        > (including anonymous boxes) participating in this box’s formatting
+        > context.
+
+        Note that the css-align spec was recently updated to align (no pun
+        intended) with Gecko, and make the |auto| value compute to itself.
+        This patch puts us in a more recent spec than before, but not totally
+        up-to-date.
+
+        Tests: imported/w3c/web-platform-tests/css/css-display-3/display-contents-alignment-001.html
+               imported/w3c/web-platform-tests/css/css-display-3/display-contents-alignment-002.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        (WebCore::StyleResolver::adjustStyleForAlignment):
+
 2017-05-28  Dan Bernstein  <mitz@apple.com>
 
         [Xcode] ALWAYS_SEARCH_USER_PATHS is set to YES
 2017-05-28  Dan Bernstein  <mitz@apple.com>
 
         [Xcode] ALWAYS_SEARCH_USER_PATHS is set to YES
index a1029ee..fc2eedf 100644 (file)
@@ -1042,10 +1042,10 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par
             style.setDisplay(BLOCK);
     }
     
             style.setDisplay(BLOCK);
     }
     
-    adjustStyleForAlignment(style, parentStyle);
+    adjustStyleForAlignment(style, *parentBoxStyle);
 }
     
 }
     
-void StyleResolver::adjustStyleForAlignment(RenderStyle& style, const RenderStyle& parentStyle)
+void StyleResolver::adjustStyleForAlignment(RenderStyle& style, const RenderStyle& parentBoxStyle)
 {
     // To avoid needing to copy the StyleRareNonInheritedData, we repurpose the 'auto'
     // flag to not just mean 'auto' prior to running adjustRenderStyle but also
 {
     // To avoid needing to copy the StyleRareNonInheritedData, we repurpose the 'auto'
     // flag to not just mean 'auto' prior to running adjustRenderStyle but also
@@ -1055,23 +1055,23 @@ void StyleResolver::adjustStyleForAlignment(RenderStyle& style, const RenderStyl
     // 'auto' computes to the the inherited value. Otherwise, 'auto' computes to
     // 'normal'.
     if (style.justifyItems().position() == ItemPositionAuto) {
     // 'auto' computes to the the inherited value. Otherwise, 'auto' computes to
     // 'normal'.
     if (style.justifyItems().position() == ItemPositionAuto) {
-        if (parentStyle.justifyItems().positionType() == LegacyPosition)
-            style.setJustifyItems(parentStyle.justifyItems());
+        if (parentBoxStyle.justifyItems().positionType() == LegacyPosition)
+            style.setJustifyItems(parentBoxStyle.justifyItems());
     }
     
     // The 'auto' keyword computes the computed value of justify-items on the
     // parent (minus any legacy keywords), or 'normal' if the box has no parent.
     if (style.justifySelf().position() == ItemPositionAuto) {
     }
     
     // The 'auto' keyword computes the computed value of justify-items on the
     // parent (minus any legacy keywords), or 'normal' if the box has no parent.
     if (style.justifySelf().position() == ItemPositionAuto) {
-        if (parentStyle.justifyItems().positionType() == LegacyPosition)
-            style.setJustifySelfPosition(parentStyle.justifyItems().position());
-        else if (parentStyle.justifyItems().position() != ItemPositionAuto)
-            style.setJustifySelf(parentStyle.justifyItems());
+        if (parentBoxStyle.justifyItems().positionType() == LegacyPosition)
+            style.setJustifySelfPosition(parentBoxStyle.justifyItems().position());
+        else if (parentBoxStyle.justifyItems().position() != ItemPositionAuto)
+            style.setJustifySelf(parentBoxStyle.justifyItems());
     }
     
     // The 'auto' keyword computes the computed value of align-items on the parent
     // or 'normal' if the box has no parent.
     }
     
     // The 'auto' keyword computes the computed value of align-items on the parent
     // or 'normal' if the box has no parent.
-    if (style.alignSelf().position() == ItemPositionAuto && parentStyle.alignItems().position() != RenderStyle::initialDefaultAlignment().position())
-        style.setAlignSelf(parentStyle.alignItems());
+    if (style.alignSelf().position() == ItemPositionAuto && parentBoxStyle.alignItems().position() != RenderStyle::initialDefaultAlignment().position())
+        style.setAlignSelf(parentBoxStyle.alignItems());
 }
 
 bool StyleResolver::checkRegionStyle(const Element* regionElement)
 }
 
 bool StyleResolver::checkRegionStyle(const Element* regionElement)