Title: [252724] trunk
Revision
252724
Author
[email protected]
Date
2019-11-20 17:48:28 -0800 (Wed, 20 Nov 2019)

Log Message

getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
https://bugs.webkit.org/show_bug.cgi?id=15562

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

More passing tests.

* web-platform-tests/css/css-position/inheritance-expected.txt:
* web-platform-tests/css/css-values/calc-integer-expected.txt:
* web-platform-tests/css/css-values/calc-z-index-fractions-001-expected.txt:
* web-platform-tests/css/css-values/minmax-integer-computed-expected.txt:

Source/WebCore:

The computed value of z-index should be the specified value, but Style::Adjuster::adjust() set z-index
to auto on non-positioned elements, so we reported the incorrect computed value.

Fix by storing the specified value in RenderStyle as "zIndex", and the used value as "effectiveZIndex", and
converting all rendering code to use the "effective" variants. getComputedStyle reads "zIndex".

Style::Adjuster::adjust() copies zIndex to effectiveZIndex for positioned elements.

Tests: fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::apply):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::createInnerTextStyle):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::animate):
* rendering/RenderBox.cpp:
(WebCore::isCandidateForOpaquenessTest):
* rendering/RenderBox.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):
* rendering/RenderFullScreen.cpp:
(WebCore::createFullScreenStyle):
* rendering/RenderLayer.cpp:
(WebCore::canCreateStackingContext):
(WebCore::RenderLayer::shouldBeCSSStackingContext const):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderLayer.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo):
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::styleWillChange):
* rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayerRepaint const):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::specifiedZIndex const):
(WebCore::RenderStyle::hasAutoSpecifiedZIndex const):
(WebCore::RenderStyle::setSpecifiedZIndex):
(WebCore::RenderStyle::setHasAutoSpecifiedZIndex):
(WebCore::RenderStyle::usedZIndex const):
(WebCore::RenderStyle::hasAutoUsedZIndex const):
(WebCore::RenderStyle::setUsedZIndex):
(WebCore::RenderStyle::setHasAutoUsedZIndex):
(WebCore::RenderStyle::hasAutoZIndex const): Deleted.
(WebCore::RenderStyle::setHasAutoZIndex): Deleted.
(WebCore::RenderStyle::zIndex const): Deleted.
(WebCore::RenderStyle::setZIndex): Deleted.
* rendering/style/StyleBoxData.cpp:
(WebCore::StyleBoxData::StyleBoxData):
(WebCore::StyleBoxData::operator== const):
* rendering/style/StyleBoxData.h:
(WebCore::StyleBoxData::specifiedZIndex const):
(WebCore::StyleBoxData::hasAutoSpecifiedZIndex const):
(WebCore::StyleBoxData::usedZIndex const):
(WebCore::StyleBoxData::hasAutoUsedZIndex const):
(WebCore::StyleBoxData::zIndex const): Deleted.
(WebCore::StyleBoxData::hasAutoZIndex const): Deleted.
* style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):

LayoutTests:

* fast/css-grid-layout/grid-item-z-index-support-expected.txt:
* fast/css-grid-layout/grid-item-z-index-support.html:
* fast/css/getComputedStyle/getComputedStyle-zIndex-auto-expected.txt:
* fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252723 => 252724)


--- trunk/LayoutTests/ChangeLog	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/ChangeLog	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1,3 +1,15 @@
+2019-11-20  Simon Fraser  <[email protected]>
+
+        getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
+        https://bugs.webkit.org/show_bug.cgi?id=15562
+
+        Reviewed by Antti Koivisto.
+
+        * fast/css-grid-layout/grid-item-z-index-support-expected.txt:
+        * fast/css-grid-layout/grid-item-z-index-support.html:
+        * fast/css/getComputedStyle/getComputedStyle-zIndex-auto-expected.txt:
+        * fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html:
+
 2019-11-20  Kate Cheney  <[email protected]>
 
         [ Jazz ] http/tests/resourceLoadStatistics/cookie-deletion.html is timing out

Modified: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto-expected.txt (252723 => 252724)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto-expected.txt	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto-expected.txt	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1,5 +1,5 @@
 Non-positioned Div:
-    Computed Style = auto (Should be auto)
+    Computed Style = 20 (Should be 20)
     element.style.zIndex = 20 (Should be 20)
 
 Positioned Div:

Modified: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html (252723 => 252724)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html	2019-11-21 01:48:28 UTC (rev 252724)
@@ -15,7 +15,7 @@
             var element = document.getElementById('nonPositionedDiv');
             var compStyle = element.ownerDocument.defaultView.getComputedStyle(element, null);
             log("Non-positioned Div:");
-            log("    Computed Style = " + compStyle.zIndex + " (Should be auto)");
+            log("    Computed Style = " + compStyle.zIndex + " (Should be 20)");
             log("    element.style.zIndex = " + element.style.zIndex + " (Should be 20)");
             log("");
 

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-item-z-index-support-expected.txt (252723 => 252724)


--- trunk/LayoutTests/fast/css-grid-layout/grid-item-z-index-support-expected.txt	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-item-z-index-support-expected.txt	2019-11-21 01:48:28 UTC (rev 252724)
@@ -5,7 +5,7 @@
 
 Test z-index property for a regular element
 PASS getComputedStyle(item, '').getPropertyValue('z-index') is 'auto'
-PASS getComputedStyle(item, '').getPropertyValue('z-index') is 'auto'
+PASS getComputedStyle(item, '').getPropertyValue('z-index') is '-10'
 Test z-index property once the element becomes a grid item
 PASS getComputedStyle(item, '').getPropertyValue('z-index') is '-10'
 PASS getComputedStyle(item, '').getPropertyValue('z-index') is '10'

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-item-z-index-support.html (252723 => 252724)


--- trunk/LayoutTests/fast/css-grid-layout/grid-item-z-index-support.html	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-item-z-index-support.html	2019-11-21 01:48:28 UTC (rev 252724)
@@ -14,7 +14,7 @@
 var item = document.getElementById("item");
 shouldBe("getComputedStyle(item, '').getPropertyValue('z-index')", "'auto'");
 item.style.zIndex = "-10";
-shouldBe("getComputedStyle(item, '').getPropertyValue('z-index')", "'auto'");
+shouldBe("getComputedStyle(item, '').getPropertyValue('z-index')", "'-10'");
 
 debug('Test z-index property once the element becomes a grid item');
 var grid = document.getElementById("grid");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (252723 => 252724)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1,3 +1,17 @@
+2019-11-20  Simon Fraser  <[email protected]>
+
+        getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
+        https://bugs.webkit.org/show_bug.cgi?id=15562
+
+        Reviewed by Antti Koivisto.
+
+        More passing tests.
+
+        * web-platform-tests/css/css-position/inheritance-expected.txt:
+        * web-platform-tests/css/css-values/calc-integer-expected.txt:
+        * web-platform-tests/css/css-values/calc-z-index-fractions-001-expected.txt:
+        * web-platform-tests/css/css-values/minmax-integer-computed-expected.txt:
+
 2019-11-19  Youenn Fablet  <[email protected]>
 
         getUserMedia echoCancellation constraint has no affect

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/inheritance-expected.txt (252723 => 252724)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/inheritance-expected.txt	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/inheritance-expected.txt	2019-11-21 01:48:28 UTC (rev 252724)
@@ -17,6 +17,6 @@
 FAIL Property inset-start does not inherit assert_true: expected true got false
 FAIL Property inset-end has initial value auto assert_true: inset-end doesn't seem to be supported in the computed style expected true got false
 FAIL Property inset-end does not inherit assert_true: expected true got false
-FAIL Property z-index has initial value auto assert_equals: expected "auto" but got "0"
+PASS Property z-index has initial value auto 
 PASS Property z-index does not inherit 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-integer-expected.txt (252723 => 252724)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-integer-expected.txt	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-integer-expected.txt	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1,9 +1,9 @@
 
-FAIL Sanity assert_equals: expected "2" but got "auto"
-FAIL Basic division works assert_equals: expected "2" but got "auto"
-FAIL Rounds up if fractional part is >= 0.5 assert_equals: expected "1" but got "auto"
-FAIL Accepts numbers, and rounds assert_equals: expected "1" but got "auto"
-FAIL Operation between <integer> and <number> works assert_equals: expected "3" but got "auto"
-FAIL Rounds down if fractional part is < 0.5 assert_equals: expected "0" but got "auto"
-FAIL Only rounds at the end of the conversion assert_equals: expected "1" but got "auto"
+PASS Sanity 
+PASS Basic division works 
+PASS Rounds up if fractional part is >= 0.5 
+PASS Accepts numbers, and rounds 
+PASS Operation between <integer> and <number> works 
+PASS Rounds down if fractional part is < 0.5 
+PASS Only rounds at the end of the conversion 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-z-index-fractions-001-expected.txt (252723 => 252724)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-z-index-fractions-001-expected.txt	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-z-index-fractions-001-expected.txt	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1,4 +1,4 @@
 
-FAIL testing z-index: calc(3 / 2) assert_equals: expected "2" but got "auto"
-FAIL testing z-index: calc(-3 / 2) assert_equals: expected "-1" but got "auto"
+PASS testing z-index: calc(3 / 2) 
+FAIL testing z-index: calc(-3 / 2) assert_equals: expected "-1" but got "-2"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-integer-computed-expected.txt (252723 => 252724)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-integer-computed-expected.txt	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-integer-computed-expected.txt	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1,12 +1,12 @@
 
-PASS Property z-index value 'min(1)' computes to 'auto' 
-PASS Property z-index value 'max(1)' computes to 'auto' 
-PASS Property z-index value 'min(0.4)' computes to 'auto' 
-PASS Property z-index value 'min(0.6)' computes to 'auto' 
-PASS Property z-index value 'max(0.4)' computes to 'auto' 
-PASS Property z-index value 'max(0.6)' computes to 'auto' 
-PASS Property z-index value 'min(1.1, max(0.4, 0.6))' computes to 'auto' 
-PASS Property z-index value 'max(0.3, min(1.1, 0.4))' computes to 'auto' 
-PASS Property z-index value 'calc(min(0.3, 0.6) * 2)' computes to 'auto' 
-PASS Property z-index value 'calc(max(0.3, 0.6) / 2)' computes to 'auto' 
+PASS Property z-index value 'min(1)' computes to '1' 
+PASS Property z-index value 'max(1)' computes to '1' 
+PASS Property z-index value 'min(0.4)' computes to '0' 
+PASS Property z-index value 'min(0.6)' computes to '1' 
+PASS Property z-index value 'max(0.4)' computes to '0' 
+PASS Property z-index value 'max(0.6)' computes to '1' 
+PASS Property z-index value 'min(1.1, max(0.4, 0.6))' computes to '1' 
+PASS Property z-index value 'max(0.3, min(1.1, 0.4))' computes to '0' 
+PASS Property z-index value 'calc(min(0.3, 0.6) * 2)' computes to '1' 
+PASS Property z-index value 'calc(max(0.3, 0.6) / 2)' computes to '0' 
 

Modified: trunk/Source/WebCore/ChangeLog (252723 => 252724)


--- trunk/Source/WebCore/ChangeLog	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/ChangeLog	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1,3 +1,77 @@
+2019-11-20  Simon Fraser  <[email protected]>
+
+        getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
+        https://bugs.webkit.org/show_bug.cgi?id=15562
+
+        Reviewed by Antti Koivisto.
+
+        The computed value of z-index should be the specified value, but Style::Adjuster::adjust() set z-index
+        to auto on non-positioned elements, so we reported the incorrect computed value.
+
+        Fix by storing the specified value in RenderStyle as "zIndex", and the used value as "effectiveZIndex", and
+        converting all rendering code to use the "effective" variants. getComputedStyle reads "zIndex".
+
+        Style::Adjuster::adjust() copies zIndex to effectiveZIndex for positioned elements.
+
+        Tests: fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html
+
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::apply):
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/CSSProperties.json:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::createInnerTextStyle):
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::animate):
+        * rendering/RenderBox.cpp:
+        (WebCore::isCandidateForOpaquenessTest):
+        * rendering/RenderBox.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::styleWillChange):
+        * rendering/RenderFullScreen.cpp:
+        (WebCore::createFullScreenStyle):
+        * rendering/RenderLayer.cpp:
+        (WebCore::canCreateStackingContext):
+        (WebCore::RenderLayer::shouldBeCSSStackingContext const):
+        (WebCore::RenderLayer::calculateClipRects const):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::logLayerInfo):
+        * rendering/RenderLayerModelObject.cpp:
+        (WebCore::RenderLayerModelObject::styleWillChange):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::RenderTreeAsText::writeRenderObject):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::changeRequiresLayerRepaint const):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::specifiedZIndex const):
+        (WebCore::RenderStyle::hasAutoSpecifiedZIndex const):
+        (WebCore::RenderStyle::setSpecifiedZIndex):
+        (WebCore::RenderStyle::setHasAutoSpecifiedZIndex):
+        (WebCore::RenderStyle::usedZIndex const):
+        (WebCore::RenderStyle::hasAutoUsedZIndex const):
+        (WebCore::RenderStyle::setUsedZIndex):
+        (WebCore::RenderStyle::setHasAutoUsedZIndex):
+        (WebCore::RenderStyle::hasAutoZIndex const): Deleted.
+        (WebCore::RenderStyle::setHasAutoZIndex): Deleted.
+        (WebCore::RenderStyle::zIndex const): Deleted.
+        (WebCore::RenderStyle::setZIndex): Deleted.
+        * rendering/style/StyleBoxData.cpp:
+        (WebCore::StyleBoxData::StyleBoxData):
+        (WebCore::StyleBoxData::operator== const):
+        * rendering/style/StyleBoxData.h:
+        (WebCore::StyleBoxData::specifiedZIndex const):
+        (WebCore::StyleBoxData::hasAutoSpecifiedZIndex const):
+        (WebCore::StyleBoxData::usedZIndex const):
+        (WebCore::StyleBoxData::hasAutoUsedZIndex const):
+        (WebCore::StyleBoxData::zIndex const): Deleted.
+        (WebCore::StyleBoxData::hasAutoZIndex const): Deleted.
+        * style/StyleAdjuster.cpp:
+        (WebCore::Style::Adjuster::adjust const):
+
 2019-11-19  Ryosuke Niwa  <[email protected]>
 
         MicrotaskQueue should be accessed via EventLoop

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (252723 => 252724)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1060,8 +1060,8 @@
     // https://w3c.github.io/web-animations/#side-effects-section
     // For every property targeted by at least one animation effect that is current or in effect, the user agent
     // must act as if the will-change property ([css-will-change-1]) on the target element includes the property.
-    if (m_triggersStackingContext && targetStyle.hasAutoZIndex())
-        targetStyle.setZIndex(0);
+    if (m_triggersStackingContext && targetStyle.hasAutoUsedZIndex())
+        targetStyle.setUsedZIndex(0);
 }
 
 void KeyframeEffect::invalidate()

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (252723 => 252724)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -3226,9 +3226,9 @@
         case CSSPropertyFontVariantEastAsian:
             return fontVariantEastAsianPropertyValue(style.fontDescription().variantEastAsianVariant(), style.fontDescription().variantEastAsianWidth(), style.fontDescription().variantEastAsianRuby());
         case CSSPropertyZIndex:
-            if (style.hasAutoZIndex())
+            if (style.hasAutoSpecifiedZIndex())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
-            return cssValuePool.createValue(style.zIndex(), CSSUnitType::CSS_NUMBER);
+            return cssValuePool.createValue(style.specifiedZIndex(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyZoom:
             return cssValuePool.createValue(style.zoom(), CSSUnitType::CSS_NUMBER);
         case CSSPropertyBoxSizing:

Modified: trunk/Source/WebCore/css/CSSProperties.json (252723 => 252724)


--- trunk/Source/WebCore/css/CSSProperties.json	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/css/CSSProperties.json	2019-11-21 01:48:28 UTC (rev 252724)
@@ -4356,7 +4356,8 @@
         },
         "z-index": {
             "codegen-properties": {
-                "auto-functions": true
+                "auto-functions": true,
+                "name-for-methods": "SpecifiedZIndex"
             },
             "specification": {
                 "category": "css-22",

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (252723 => 252724)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -2092,8 +2092,8 @@
         textBlockStyle.setTextOverflow(TextOverflow::Clip);
         textBlockStyle.setMaskImage(StyleGeneratedImage::create(autoFillStrongPasswordMaskImage()));
         // A stacking context is needed for the mask.
-        if (textBlockStyle.hasAutoZIndex())
-            textBlockStyle.setZIndex(0);
+        if (textBlockStyle.hasAutoUsedZIndex())
+            textBlockStyle.setUsedZIndex(0);
     }
 
     // Do not allow line-height to be smaller than our default.

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (252723 => 252724)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1612,7 +1612,7 @@
         new PropertyWrapper<float>(CSSPropertyColumnWidth, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth),
         new PropertyWrapper<float>(CSSPropertyWebkitBorderHorizontalSpacing, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing),
         new PropertyWrapper<float>(CSSPropertyWebkitBorderVerticalSpacing, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing),
-        new PropertyWrapper<int>(CSSPropertyZIndex, &RenderStyle::zIndex, &RenderStyle::setZIndex),
+        new PropertyWrapper<int>(CSSPropertyZIndex, &RenderStyle::specifiedZIndex, &RenderStyle::setSpecifiedZIndex),
         new PropertyWrapper<short>(CSSPropertyOrphans, &RenderStyle::orphans, &RenderStyle::setOrphans),
         new PropertyWrapper<short>(CSSPropertyWidows, &RenderStyle::widows, &RenderStyle::setWidows),
         new LengthPropertyWrapper(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight),

Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.cpp (252723 => 252724)


--- trunk/Source/WebCore/page/animation/CompositeAnimation.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -337,8 +337,8 @@
     // the user agent must act as if the will-change property ([css-will-change-1]) on the element additionally
     // includes all the properties animated by the animation.
     if (forceStackingContext && animatedStyle) {
-        if (animatedStyle->hasAutoZIndex())
-            animatedStyle->setZIndex(0);
+        if (animatedStyle->hasAutoUsedZIndex())
+            animatedStyle->setUsedZIndex(0);
     }
 
     return { WTFMove(animatedStyle), animationChangeRequiresRecomposite };

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1482,7 +1482,7 @@
         if (childLayer->isComposited())
             return false;
         // FIXME: Deal with z-index.
-        if (!childStyle.hasAutoZIndex())
+        if (!childStyle.hasAutoUsedZIndex())
             return false;
         if (childLayer->hasTransform() || childLayer->isTransparent() || childLayer->hasFilter())
             return false;

Modified: trunk/Source/WebCore/rendering/RenderBox.h (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderBox.h	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2019-11-21 01:48:28 UTC (rev 252724)
@@ -53,7 +53,7 @@
     {
         return isDocumentElementRenderer() || isPositioned() || createsGroup() || hasClipPath() || hasOverflowClip()
             || hasTransformRelatedProperty() || hasHiddenBackface() || hasReflection() || style().specifiesColumns()
-            || !style().hasAutoZIndex() || hasRunningAcceleratedAnimations();
+            || !style().hasAutoUsedZIndex() || hasRunningAcceleratedAnimations();
     }
 
     bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const final;

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -711,8 +711,8 @@
         // If our z-index changes value or our visibility changes,
         // we need to dirty our stacking context's z-order list.
         bool visibilityChanged = m_style.visibility() != newStyle.visibility()
-            || m_style.zIndex() != newStyle.zIndex()
-            || m_style.hasAutoZIndex() != newStyle.hasAutoZIndex();
+            || m_style.usedZIndex() != newStyle.usedZIndex()
+            || m_style.hasAutoUsedZIndex() != newStyle.hasAutoUsedZIndex();
 
         if (visibilityChanged)
             document().invalidateRenderingDependentRegions();

Modified: trunk/Source/WebCore/rendering/RenderFullScreen.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderFullScreen.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -67,7 +67,7 @@
     auto fullscreenStyle = RenderStyle::create();
 
     // Create a stacking context:
-    fullscreenStyle.setZIndex(INT_MAX);
+    fullscreenStyle.setUsedZIndex(INT_MAX);
 
     fullscreenStyle.setFontDescription({ });
     fullscreenStyle.fontCascade().update(nullptr);

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -566,7 +566,7 @@
         || renderer.isPositioned() // Note that this only creates stacking context in conjunction with explicit z-index.
         || renderer.hasReflection()
         || renderer.style().hasIsolation()
-        || !renderer.style().hasAutoZIndex()
+        || !renderer.style().hasAutoUsedZIndex()
         || (renderer.style().willChange() && renderer.style().willChange()->canCreateStackingContext());
 }
 
@@ -587,7 +587,7 @@
 
 bool RenderLayer::shouldBeCSSStackingContext() const
 {
-    return !renderer().style().hasAutoZIndex() || isRenderViewLayer();
+    return !renderer().style().hasAutoUsedZIndex() || isRenderViewLayer();
 }
 
 bool RenderLayer::setIsNormalFlowOnly(bool isNormalFlowOnly)
@@ -6601,7 +6601,7 @@
     // FIXME: RenderLayer already handles visibility changes through our visibility dirty bits. This logic could
     // likely be folded along with the rest.
     if (oldStyle) {
-        if (oldStyle->zIndex() != renderer().style().zIndex() || oldStyle->visibility() != renderer().style().visibility()) {
+        if (oldStyle->usedZIndex() != renderer().style().usedZIndex() || oldStyle->visibility() != renderer().style().visibility()) {
             dirtyStackingContextZOrderLists();
             if (isStackingContext())
                 dirtyZOrderLists();
@@ -6810,9 +6810,9 @@
 
     // Map in our mask.
     newStyle.setMaskBoxImage(renderer().style().boxReflect()->mask());
-    
+
     // Style has transform and mask, so needs to be stacking context.
-    newStyle.setZIndex(0);
+    newStyle.setUsedZIndex(0);
 
     return newStyle;
 }

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2019-11-21 01:48:28 UTC (rev 252724)
@@ -648,7 +648,7 @@
     LayoutPoint convertToLayerCoords(const RenderLayer* ancestorLayer, const LayoutPoint&, ColumnOffsetAdjustment adjustForColumns = DontAdjustForColumns) const;
     LayoutSize offsetFromAncestor(const RenderLayer*, ColumnOffsetAdjustment = DontAdjustForColumns) const;
 
-    int zIndex() const { return renderer().style().zIndex(); }
+    int zIndex() const { return renderer().style().usedZIndex(); }
 
     enum PaintLayerFlag {
         PaintLayerHaveTransparency                      = 1 << 0,

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1393,8 +1393,8 @@
     StringBuilder logString;
     logString.append(pad(' ', 12 + depth * 2, hex(reinterpret_cast<uintptr_t>(&layer), Lowercase)), " id ", backing->graphicsLayer()->primaryLayerID(), " (", FormattedNumber::fixedWidth(absoluteBounds.x().toFloat(), 3), ',', FormattedNumber::fixedWidth(absoluteBounds.y().toFloat(), 3), '-', FormattedNumber::fixedWidth(absoluteBounds.maxX().toFloat(), 3), ',', FormattedNumber::fixedWidth(absoluteBounds.maxY().toFloat(), 3), ") ", FormattedNumber::fixedWidth(backing->backingStoreMemoryEstimate() / 1024, 2), "KB");
 
-    if (!layer.renderer().style().hasAutoZIndex())
-        logString.append(" z-index: ", layer.renderer().style().zIndex());
+    if (!layer.renderer().style().hasAutoUsedZIndex())
+        logString.append(" z-index: ", layer.renderer().style().usedZIndex());
 
     logString.append(" (", logReasonsForCompositing(layer), ") ");
 

Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -132,8 +132,8 @@
             // When a layout hint happens, we do a repaint of the layer, since the layer could end up being destroyed.
             if (hasLayer()) {
                 if (oldStyle->position() != newStyle.position()
-                    || oldStyle->zIndex() != newStyle.zIndex()
-                    || oldStyle->hasAutoZIndex() != newStyle.hasAutoZIndex()
+                    || oldStyle->usedZIndex() != newStyle.usedZIndex()
+                    || oldStyle->hasAutoUsedZIndex() != newStyle.hasAutoUsedZIndex()
                     || !(oldStyle->clip() == newStyle.clip())
                     || oldStyle->hasClip() != newStyle.hasClip()
                     || oldStyle->opacity() != newStyle.opacity()

Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -176,8 +176,8 @@
     if (behavior.contains(RenderAsTextFlag::ShowAddresses))
         ts << " " << static_cast<const void*>(&o);
 
-    if (o.style().zIndex())
-        ts << " zI: " << o.style().zIndex();
+    if (o.style().usedZIndex()) // FIXME: This should use !hasAutoUsedZIndex().
+        ts << " zI: " << o.style().usedZIndex();
 
     if (o.node()) {
         String tagName = getTagName(o.node());

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -982,7 +982,7 @@
 bool RenderStyle::changeRequiresLayerRepaint(const RenderStyle& other, OptionSet<StyleDifferenceContextSensitiveProperty>& changedContextSensitiveProperties) const
 {
     // Style::Resolver has ensured that zIndex is non-auto only if it's applicable.
-    if (m_boxData->zIndex() != other.m_boxData->zIndex() || m_boxData->hasAutoZIndex() != other.m_boxData->hasAutoZIndex())
+    if (m_boxData->usedZIndex() != other.m_boxData->usedZIndex() || m_boxData->hasAutoUsedZIndex() != other.m_boxData->hasAutoUsedZIndex())
         return true;
 
     if (position() != PositionType::Static) {

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (252723 => 252724)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2019-11-21 01:48:28 UTC (rev 252724)
@@ -1029,11 +1029,32 @@
     PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(m_inheritedFlags.printColorAdjust); }
     void setPrintColorAdjust(PrintColorAdjust value) { m_inheritedFlags.printColorAdjust = static_cast<unsigned>(value); }
 
-    bool hasAutoZIndex() const { return m_boxData->hasAutoZIndex(); }
-    void setHasAutoZIndex() { SET_VAR(m_boxData, m_hasAutoZIndex, true); SET_VAR(m_boxData, m_zIndex, 0); }
-    int zIndex() const { return m_boxData->zIndex(); }
-    void setZIndex(int v) { SET_VAR(m_boxData, m_hasAutoZIndex, false); SET_VAR(m_boxData, m_zIndex, v); }
+    int specifiedZIndex() const { return m_boxData->specifiedZIndex(); }
+    bool hasAutoSpecifiedZIndex() const { return m_boxData->hasAutoSpecifiedZIndex(); }
+    void setSpecifiedZIndex(int v)
+    {
+        SET_VAR(m_boxData, m_hasAutoSpecifiedZIndex, false);
+        SET_VAR(m_boxData, m_specifiedZIndex, v);
+    }
+    void setHasAutoSpecifiedZIndex()
+    {
+        SET_VAR(m_boxData, m_hasAutoSpecifiedZIndex, true);
+        SET_VAR(m_boxData, m_specifiedZIndex, 0);
+    }
 
+    int usedZIndex() const { return m_boxData->usedZIndex(); }
+    bool hasAutoUsedZIndex() const { return m_boxData->hasAutoUsedZIndex(); }
+    void setUsedZIndex(int v)
+    {
+        SET_VAR(m_boxData, m_hasAutoUsedZIndex, false);
+        SET_VAR(m_boxData, m_usedZIndex, v);
+    }
+    void setHasAutoUsedZIndex()
+    {
+        SET_VAR(m_boxData, m_hasAutoUsedZIndex, true);
+        SET_VAR(m_boxData, m_usedZIndex, 0);
+    }
+
     void setHasAutoWidows() { SET_VAR(m_rareInheritedData, hasAutoWidows, true); SET_VAR(m_rareInheritedData, widows, initialWidows()); }
     void setWidows(short w) { SET_VAR(m_rareInheritedData, hasAutoWidows, false); SET_VAR(m_rareInheritedData, widows, w); }
 

Modified: trunk/Source/WebCore/rendering/style/StyleBoxData.cpp (252723 => 252724)


--- trunk/Source/WebCore/rendering/style/StyleBoxData.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/style/StyleBoxData.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -29,7 +29,7 @@
 
 struct SameSizeAsStyleBoxData : public RefCounted<SameSizeAsStyleBoxData> {
     Length length[7];
-    int m_zIndex;
+    int m_zIndex[2];
     uint32_t bitfields;
 };
 
@@ -40,8 +40,10 @@
     , m_maxWidth(RenderStyle::initialMaxSize())
     , m_minHeight(RenderStyle::initialMinSize())
     , m_maxHeight(RenderStyle::initialMaxSize())
-    , m_zIndex(0)
-    , m_hasAutoZIndex(true)
+    , m_specifiedZIndex(0)
+    , m_usedZIndex(0)
+    , m_hasAutoSpecifiedZIndex(true)
+    , m_hasAutoUsedZIndex(true)
     , m_boxSizing(static_cast<unsigned>(BoxSizing::ContentBox))
 #if ENABLE(CSS_BOX_DECORATION_BREAK)
     , m_boxDecorationBreak(static_cast<unsigned>(BoxDecorationBreak::Slice))
@@ -58,8 +60,10 @@
     , m_minHeight(o.m_minHeight)
     , m_maxHeight(o.m_maxHeight)
     , m_verticalAlign(o.m_verticalAlign)
-    , m_zIndex(o.m_zIndex)
-    , m_hasAutoZIndex(o.m_hasAutoZIndex)
+    , m_specifiedZIndex(o.m_specifiedZIndex)
+    , m_usedZIndex(o.m_usedZIndex)
+    , m_hasAutoSpecifiedZIndex(o.m_hasAutoSpecifiedZIndex)
+    , m_hasAutoUsedZIndex(o.m_hasAutoUsedZIndex)
     , m_boxSizing(o.m_boxSizing)
 #if ENABLE(CSS_BOX_DECORATION_BREAK)
     , m_boxDecorationBreak(o.m_boxDecorationBreak)
@@ -75,19 +79,21 @@
 bool StyleBoxData::operator==(const StyleBoxData& o) const
 {
     return m_width == o.m_width
-           && m_height == o.m_height
-           && m_minWidth == o.m_minWidth
-           && m_maxWidth == o.m_maxWidth
-           && m_minHeight == o.m_minHeight
-           && m_maxHeight == o.m_maxHeight
-           && m_verticalAlign == o.m_verticalAlign
-           && m_zIndex == o.m_zIndex
-           && m_hasAutoZIndex == o.m_hasAutoZIndex
-           && m_boxSizing == o.m_boxSizing
+        && m_height == o.m_height
+        && m_minWidth == o.m_minWidth
+        && m_maxWidth == o.m_maxWidth
+        && m_minHeight == o.m_minHeight
+        && m_maxHeight == o.m_maxHeight
+        && m_verticalAlign == o.m_verticalAlign
+        && m_specifiedZIndex == o.m_specifiedZIndex
+        && m_hasAutoSpecifiedZIndex == o.m_hasAutoSpecifiedZIndex
+        && m_usedZIndex == o.m_usedZIndex
+        && m_hasAutoUsedZIndex == o.m_hasAutoUsedZIndex
+        && m_boxSizing == o.m_boxSizing
 #if ENABLE(CSS_BOX_DECORATION_BREAK)
-           && m_boxDecorationBreak == o.m_boxDecorationBreak
+        && m_boxDecorationBreak == o.m_boxDecorationBreak
 #endif
-            ;
+        ;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/style/StyleBoxData.h (252723 => 252724)


--- trunk/Source/WebCore/rendering/style/StyleBoxData.h	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/rendering/style/StyleBoxData.h	2019-11-21 01:48:28 UTC (rev 252724)
@@ -53,9 +53,12 @@
     
     const Length& verticalAlign() const { return m_verticalAlign; }
     
-    int zIndex() const { return m_zIndex; }
-    bool hasAutoZIndex() const { return m_hasAutoZIndex; }
-    
+    int specifiedZIndex() const { return m_specifiedZIndex; }
+    bool hasAutoSpecifiedZIndex() const { return m_hasAutoSpecifiedZIndex; }
+
+    int usedZIndex() const { return m_usedZIndex; }
+    bool hasAutoUsedZIndex() const { return m_hasAutoUsedZIndex; }
+
     BoxSizing boxSizing() const { return static_cast<BoxSizing>(m_boxSizing); }
 #if ENABLE(CSS_BOX_DECORATION_BREAK)
     BoxDecorationBreak boxDecorationBreak() const { return static_cast<BoxDecorationBreak>(m_boxDecorationBreak); }
@@ -78,8 +81,10 @@
 
     Length m_verticalAlign;
 
-    int m_zIndex;
-    unsigned m_hasAutoZIndex : 1;
+    int m_specifiedZIndex;
+    int m_usedZIndex;
+    unsigned m_hasAutoSpecifiedZIndex : 1;
+    unsigned m_hasAutoUsedZIndex : 1;
     unsigned m_boxSizing : 1; // BoxSizing
 #if ENABLE(CSS_BOX_DECORATION_BREAK)
     unsigned m_boxDecorationBreak : 1; // BoxDecorationBreak

Modified: trunk/Source/WebCore/style/StyleAdjuster.cpp (252723 => 252724)


--- trunk/Source/WebCore/style/StyleAdjuster.cpp	2019-11-21 01:47:56 UTC (rev 252723)
+++ trunk/Source/WebCore/style/StyleAdjuster.cpp	2019-11-21 01:48:28 UTC (rev 252724)
@@ -294,13 +294,15 @@
     }
 
     // Make sure our z-index value is only applied if the object is positioned.
-    if (style.position() == PositionType::Static && !m_parentBoxStyle.isDisplayFlexibleOrGridBox())
-        style.setHasAutoZIndex();
+    if (style.hasAutoSpecifiedZIndex() || (style.position() == PositionType::Static && !m_parentBoxStyle.isDisplayFlexibleOrGridBox()))
+        style.setHasAutoUsedZIndex();
+    else
+        style.setUsedZIndex(style.specifiedZIndex());
 
     // Auto z-index becomes 0 for the root element and transparent objects. This prevents
     // cases where objects that should be blended as a single unit end up with a non-transparent
     // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
-    if (style.hasAutoZIndex()) {
+    if (style.hasAutoUsedZIndex()) {
         if ((m_element && m_document.documentElement() == m_element)
             || style.opacity() < 1.0f
             || style.hasTransformRelatedProperty()
@@ -316,7 +318,7 @@
             || style.position() == PositionType::Sticky
             || style.position() == PositionType::Fixed
             || style.willChangeCreatesStackingContext())
-            style.setZIndex(0);
+            style.setUsedZIndex(0);
     }
 
     if (m_element) {
@@ -385,8 +387,8 @@
 
 #if ENABLE(OVERFLOW_SCROLLING_TOUCH)
     // Touch overflow scrolling creates a stacking context.
-    if (style.hasAutoZIndex() && style.useTouchOverflowScrolling() && (isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY())))
-        style.setZIndex(0);
+    if (style.hasAutoUsedZIndex() && style.useTouchOverflowScrolling() && (isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY())))
+        style.setUsedZIndex(0);
 #endif
 
     // Cull out any useless layers and also repeat patterns into additional layers.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to