Changeset 252724 in webkit


Ignore:
Timestamp:
Nov 20, 2019 5:48:28 PM (4 years ago)
Author:
Simon Fraser
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:
Location:
trunk
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r252720 r252724  
     12019-11-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
     4        https://bugs.webkit.org/show_bug.cgi?id=15562
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/css-grid-layout/grid-item-z-index-support-expected.txt:
     9        * fast/css-grid-layout/grid-item-z-index-support.html:
     10        * fast/css/getComputedStyle/getComputedStyle-zIndex-auto-expected.txt:
     11        * fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html:
     12
    1132019-11-20  Kate Cheney  <katherine_cheney@apple.com>
    214
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-z-index-support-expected.txt

    r170474 r252724  
    66Test z-index property for a regular element
    77PASS getComputedStyle(item, '').getPropertyValue('z-index') is 'auto'
    8 PASS getComputedStyle(item, '').getPropertyValue('z-index') is 'auto'
     8PASS getComputedStyle(item, '').getPropertyValue('z-index') is '-10'
    99Test z-index property once the element becomes a grid item
    1010PASS getComputedStyle(item, '').getPropertyValue('z-index') is '-10'
  • trunk/LayoutTests/fast/css-grid-layout/grid-item-z-index-support.html

    r200510 r252724  
    1515shouldBe("getComputedStyle(item, '').getPropertyValue('z-index')", "'auto'");
    1616item.style.zIndex = "-10";
    17 shouldBe("getComputedStyle(item, '').getPropertyValue('z-index')", "'auto'");
     17shouldBe("getComputedStyle(item, '').getPropertyValue('z-index')", "'-10'");
    1818
    1919debug('Test z-index property once the element becomes a grid item');
  • trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto-expected.txt

    r41464 r252724  
    11Non-positioned Div:
    2     Computed Style = auto (Should be auto)
     2    Computed Style = 20 (Should be 20)
    33    element.style.zIndex = 20 (Should be 20)
    44
  • trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html

    r120683 r252724  
    1616            var compStyle = element.ownerDocument.defaultView.getComputedStyle(element, null);
    1717            log("Non-positioned Div:");
    18             log("    Computed Style = " + compStyle.zIndex + " (Should be auto)");
     18            log("    Computed Style = " + compStyle.zIndex + " (Should be 20)");
    1919            log("    element.style.zIndex = " + element.style.zIndex + " (Should be 20)");
    2020            log("");
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r252681 r252724  
     12019-11-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
     4        https://bugs.webkit.org/show_bug.cgi?id=15562
     5
     6        Reviewed by Antti Koivisto.
     7
     8        More passing tests.
     9
     10        * web-platform-tests/css/css-position/inheritance-expected.txt:
     11        * web-platform-tests/css/css-values/calc-integer-expected.txt:
     12        * web-platform-tests/css/css-values/calc-z-index-fractions-001-expected.txt:
     13        * web-platform-tests/css/css-values/minmax-integer-computed-expected.txt:
     14
    1152019-11-19  Youenn Fablet  <youenn@apple.com>
    216
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/inheritance-expected.txt

    r251641 r252724  
    1818FAIL 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
    1919FAIL Property inset-end does not inherit assert_true: expected true got false
    20 FAIL Property z-index has initial value auto assert_equals: expected "auto" but got "0"
     20PASS Property z-index has initial value auto
    2121PASS Property z-index does not inherit
    2222
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-integer-expected.txt

    r251521 r252724  
    11
    2 FAIL Sanity assert_equals: expected "2" but got "auto"
    3 FAIL Basic division works assert_equals: expected "2" but got "auto"
    4 FAIL Rounds up if fractional part is >= 0.5 assert_equals: expected "1" but got "auto"
    5 FAIL Accepts numbers, and rounds assert_equals: expected "1" but got "auto"
    6 FAIL Operation between <integer> and <number> works assert_equals: expected "3" but got "auto"
    7 FAIL Rounds down if fractional part is < 0.5 assert_equals: expected "0" but got "auto"
    8 FAIL Only rounds at the end of the conversion assert_equals: expected "1" but got "auto"
     2PASS Sanity
     3PASS Basic division works
     4PASS Rounds up if fractional part is >= 0.5
     5PASS Accepts numbers, and rounds
     6PASS Operation between <integer> and <number> works
     7PASS Rounds down if fractional part is < 0.5
     8PASS Only rounds at the end of the conversion
    99
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/calc-z-index-fractions-001-expected.txt

    r251521 r252724  
    11
    2 FAIL testing z-index: calc(3 / 2) assert_equals: expected "2" but got "auto"
    3 FAIL testing z-index: calc(-3 / 2) assert_equals: expected "-1" but got "auto"
     2PASS testing z-index: calc(3 / 2)
     3FAIL testing z-index: calc(-3 / 2) assert_equals: expected "-1" but got "-2"
    44
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-integer-computed-expected.txt

    r251521 r252724  
    11
    2 PASS Property z-index value 'min(1)' computes to 'auto'
    3 PASS Property z-index value 'max(1)' computes to 'auto'
    4 PASS Property z-index value 'min(0.4)' computes to 'auto'
    5 PASS Property z-index value 'min(0.6)' computes to 'auto'
    6 PASS Property z-index value 'max(0.4)' computes to 'auto'
    7 PASS Property z-index value 'max(0.6)' computes to 'auto'
    8 PASS Property z-index value 'min(1.1, max(0.4, 0.6))' computes to 'auto'
    9 PASS Property z-index value 'max(0.3, min(1.1, 0.4))' computes to 'auto'
    10 PASS Property z-index value 'calc(min(0.3, 0.6) * 2)' computes to 'auto'
    11 PASS Property z-index value 'calc(max(0.3, 0.6) / 2)' computes to 'auto'
     2PASS Property z-index value 'min(1)' computes to '1'
     3PASS Property z-index value 'max(1)' computes to '1'
     4PASS Property z-index value 'min(0.4)' computes to '0'
     5PASS Property z-index value 'min(0.6)' computes to '1'
     6PASS Property z-index value 'max(0.4)' computes to '0'
     7PASS Property z-index value 'max(0.6)' computes to '1'
     8PASS Property z-index value 'min(1.1, max(0.4, 0.6))' computes to '1'
     9PASS Property z-index value 'max(0.3, min(1.1, 0.4))' computes to '0'
     10PASS Property z-index value 'calc(min(0.3, 0.6) * 2)' computes to '1'
     11PASS Property z-index value 'calc(max(0.3, 0.6) / 2)' computes to '0'
    1212
  • trunk/Source/WebCore/ChangeLog

    r252723 r252724  
     12019-11-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
     4        https://bugs.webkit.org/show_bug.cgi?id=15562
     5
     6        Reviewed by Antti Koivisto.
     7
     8        The computed value of z-index should be the specified value, but Style::Adjuster::adjust() set z-index
     9        to auto on non-positioned elements, so we reported the incorrect computed value.
     10
     11        Fix by storing the specified value in RenderStyle as "zIndex", and the used value as "effectiveZIndex", and
     12        converting all rendering code to use the "effective" variants. getComputedStyle reads "zIndex".
     13
     14        Style::Adjuster::adjust() copies zIndex to effectiveZIndex for positioned elements.
     15
     16        Tests: fast/css/getComputedStyle/getComputedStyle-zIndex-auto.html
     17
     18        * animation/KeyframeEffect.cpp:
     19        (WebCore::KeyframeEffect::apply):
     20        * css/CSSComputedStyleDeclaration.cpp:
     21        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
     22        * css/CSSProperties.json:
     23        * html/HTMLInputElement.cpp:
     24        (WebCore::HTMLInputElement::createInnerTextStyle):
     25        * page/animation/CSSPropertyAnimation.cpp:
     26        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     27        * page/animation/CompositeAnimation.cpp:
     28        (WebCore::CompositeAnimation::animate):
     29        * rendering/RenderBox.cpp:
     30        (WebCore::isCandidateForOpaquenessTest):
     31        * rendering/RenderBox.h:
     32        * rendering/RenderElement.cpp:
     33        (WebCore::RenderElement::styleWillChange):
     34        * rendering/RenderFullScreen.cpp:
     35        (WebCore::createFullScreenStyle):
     36        * rendering/RenderLayer.cpp:
     37        (WebCore::canCreateStackingContext):
     38        (WebCore::RenderLayer::shouldBeCSSStackingContext const):
     39        (WebCore::RenderLayer::calculateClipRects const):
     40        * rendering/RenderLayer.h:
     41        * rendering/RenderLayerCompositor.cpp:
     42        (WebCore::RenderLayerCompositor::logLayerInfo):
     43        * rendering/RenderLayerModelObject.cpp:
     44        (WebCore::RenderLayerModelObject::styleWillChange):
     45        * rendering/RenderTreeAsText.cpp:
     46        (WebCore::RenderTreeAsText::writeRenderObject):
     47        * rendering/style/RenderStyle.cpp:
     48        (WebCore::RenderStyle::changeRequiresLayerRepaint const):
     49        * rendering/style/RenderStyle.h:
     50        (WebCore::RenderStyle::specifiedZIndex const):
     51        (WebCore::RenderStyle::hasAutoSpecifiedZIndex const):
     52        (WebCore::RenderStyle::setSpecifiedZIndex):
     53        (WebCore::RenderStyle::setHasAutoSpecifiedZIndex):
     54        (WebCore::RenderStyle::usedZIndex const):
     55        (WebCore::RenderStyle::hasAutoUsedZIndex const):
     56        (WebCore::RenderStyle::setUsedZIndex):
     57        (WebCore::RenderStyle::setHasAutoUsedZIndex):
     58        (WebCore::RenderStyle::hasAutoZIndex const): Deleted.
     59        (WebCore::RenderStyle::setHasAutoZIndex): Deleted.
     60        (WebCore::RenderStyle::zIndex const): Deleted.
     61        (WebCore::RenderStyle::setZIndex): Deleted.
     62        * rendering/style/StyleBoxData.cpp:
     63        (WebCore::StyleBoxData::StyleBoxData):
     64        (WebCore::StyleBoxData::operator== const):
     65        * rendering/style/StyleBoxData.h:
     66        (WebCore::StyleBoxData::specifiedZIndex const):
     67        (WebCore::StyleBoxData::hasAutoSpecifiedZIndex const):
     68        (WebCore::StyleBoxData::usedZIndex const):
     69        (WebCore::StyleBoxData::hasAutoUsedZIndex const):
     70        (WebCore::StyleBoxData::zIndex const): Deleted.
     71        (WebCore::StyleBoxData::hasAutoZIndex const): Deleted.
     72        * style/StyleAdjuster.cpp:
     73        (WebCore::Style::Adjuster::adjust const):
     74
    1752019-11-19  Ryosuke Niwa  <rniwa@webkit.org>
    276
  • trunk/Source/WebCore/animation/KeyframeEffect.cpp

    r252546 r252724  
    10611061    // For every property targeted by at least one animation effect that is current or in effect, the user agent
    10621062    // must act as if the will-change property ([css-will-change-1]) on the target element includes the property.
    1063     if (m_triggersStackingContext && targetStyle.hasAutoZIndex())
    1064         targetStyle.setZIndex(0);
     1063    if (m_triggersStackingContext && targetStyle.hasAutoUsedZIndex())
     1064        targetStyle.setUsedZIndex(0);
    10651065}
    10661066
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r252392 r252724  
    32273227            return fontVariantEastAsianPropertyValue(style.fontDescription().variantEastAsianVariant(), style.fontDescription().variantEastAsianWidth(), style.fontDescription().variantEastAsianRuby());
    32283228        case CSSPropertyZIndex:
    3229             if (style.hasAutoZIndex())
     3229            if (style.hasAutoSpecifiedZIndex())
    32303230                return cssValuePool.createIdentifierValue(CSSValueAuto);
    3231             return cssValuePool.createValue(style.zIndex(), CSSUnitType::CSS_NUMBER);
     3231            return cssValuePool.createValue(style.specifiedZIndex(), CSSUnitType::CSS_NUMBER);
    32323232        case CSSPropertyZoom:
    32333233            return cssValuePool.createValue(style.zoom(), CSSUnitType::CSS_NUMBER);
  • trunk/Source/WebCore/css/CSSProperties.json

    r252336 r252724  
    43574357        "z-index": {
    43584358            "codegen-properties": {
    4359                 "auto-functions": true
     4359                "auto-functions": true,
     4360                "name-for-methods": "SpecifiedZIndex"
    43604361            },
    43614362            "specification": {
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r252478 r252724  
    20932093        textBlockStyle.setMaskImage(StyleGeneratedImage::create(autoFillStrongPasswordMaskImage()));
    20942094        // A stacking context is needed for the mask.
    2095         if (textBlockStyle.hasAutoZIndex())
    2096             textBlockStyle.setZIndex(0);
     2095        if (textBlockStyle.hasAutoUsedZIndex())
     2096            textBlockStyle.setUsedZIndex(0);
    20972097    }
    20982098
  • trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp

    r252554 r252724  
    16131613        new PropertyWrapper<float>(CSSPropertyWebkitBorderHorizontalSpacing, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing),
    16141614        new PropertyWrapper<float>(CSSPropertyWebkitBorderVerticalSpacing, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing),
    1615         new PropertyWrapper<int>(CSSPropertyZIndex, &RenderStyle::zIndex, &RenderStyle::setZIndex),
     1615        new PropertyWrapper<int>(CSSPropertyZIndex, &RenderStyle::specifiedZIndex, &RenderStyle::setSpecifiedZIndex),
    16161616        new PropertyWrapper<short>(CSSPropertyOrphans, &RenderStyle::orphans, &RenderStyle::setOrphans),
    16171617        new PropertyWrapper<short>(CSSPropertyWidows, &RenderStyle::widows, &RenderStyle::setWidows),
  • trunk/Source/WebCore/page/animation/CompositeAnimation.cpp

    r252546 r252724  
    338338    // includes all the properties animated by the animation.
    339339    if (forceStackingContext && animatedStyle) {
    340         if (animatedStyle->hasAutoZIndex())
    341             animatedStyle->setZIndex(0);
     340        if (animatedStyle->hasAutoUsedZIndex())
     341            animatedStyle->setUsedZIndex(0);
    342342    }
    343343
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r252716 r252724  
    14831483            return false;
    14841484        // FIXME: Deal with z-index.
    1485         if (!childStyle.hasAutoZIndex())
     1485        if (!childStyle.hasAutoUsedZIndex())
    14861486            return false;
    14871487        if (childLayer->hasTransform() || childLayer->isTransparent() || childLayer->hasFilter())
  • trunk/Source/WebCore/rendering/RenderBox.h

    r252716 r252724  
    5454        return isDocumentElementRenderer() || isPositioned() || createsGroup() || hasClipPath() || hasOverflowClip()
    5555            || hasTransformRelatedProperty() || hasHiddenBackface() || hasReflection() || style().specifiesColumns()
    56             || !style().hasAutoZIndex() || hasRunningAcceleratedAnimations();
     56            || !style().hasAutoUsedZIndex() || hasRunningAcceleratedAnimations();
    5757    }
    5858
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r252628 r252724  
    712712        // we need to dirty our stacking context's z-order list.
    713713        bool visibilityChanged = m_style.visibility() != newStyle.visibility()
    714             || m_style.zIndex() != newStyle.zIndex()
    715             || m_style.hasAutoZIndex() != newStyle.hasAutoZIndex();
     714            || m_style.usedZIndex() != newStyle.usedZIndex()
     715            || m_style.hasAutoUsedZIndex() != newStyle.hasAutoUsedZIndex();
    716716
    717717        if (visibilityChanged)
  • trunk/Source/WebCore/rendering/RenderFullScreen.cpp

    r244440 r252724  
    6868
    6969    // Create a stacking context:
    70     fullscreenStyle.setZIndex(INT_MAX);
     70    fullscreenStyle.setUsedZIndex(INT_MAX);
    7171
    7272    fullscreenStyle.setFontDescription({ });
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r252628 r252724  
    567567        || renderer.hasReflection()
    568568        || renderer.style().hasIsolation()
    569         || !renderer.style().hasAutoZIndex()
     569        || !renderer.style().hasAutoUsedZIndex()
    570570        || (renderer.style().willChange() && renderer.style().willChange()->canCreateStackingContext());
    571571}
     
    588588bool RenderLayer::shouldBeCSSStackingContext() const
    589589{
    590     return !renderer().style().hasAutoZIndex() || isRenderViewLayer();
     590    return !renderer().style().hasAutoUsedZIndex() || isRenderViewLayer();
    591591}
    592592
     
    66026602    // likely be folded along with the rest.
    66036603    if (oldStyle) {
    6604         if (oldStyle->zIndex() != renderer().style().zIndex() || oldStyle->visibility() != renderer().style().visibility()) {
     6604        if (oldStyle->usedZIndex() != renderer().style().usedZIndex() || oldStyle->visibility() != renderer().style().visibility()) {
    66056605            dirtyStackingContextZOrderLists();
    66066606            if (isStackingContext())
     
    68116811    // Map in our mask.
    68126812    newStyle.setMaskBoxImage(renderer().style().boxReflect()->mask());
    6813    
     6813
    68146814    // Style has transform and mask, so needs to be stacking context.
    6815     newStyle.setZIndex(0);
     6815    newStyle.setUsedZIndex(0);
    68166816
    68176817    return newStyle;
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r252353 r252724  
    649649    LayoutSize offsetFromAncestor(const RenderLayer*, ColumnOffsetAdjustment = DontAdjustForColumns) const;
    650650
    651     int zIndex() const { return renderer().style().zIndex(); }
     651    int zIndex() const { return renderer().style().usedZIndex(); }
    652652
    653653    enum PaintLayerFlag {
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r252439 r252724  
    13941394    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");
    13951395
    1396     if (!layer.renderer().style().hasAutoZIndex())
    1397         logString.append(" z-index: ", layer.renderer().style().zIndex());
     1396    if (!layer.renderer().style().hasAutoUsedZIndex())
     1397        logString.append(" z-index: ", layer.renderer().style().usedZIndex());
    13981398
    13991399    logString.append(" (", logReasonsForCompositing(layer), ") ");
  • trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp

    r249080 r252724  
    133133            if (hasLayer()) {
    134134                if (oldStyle->position() != newStyle.position()
    135                     || oldStyle->zIndex() != newStyle.zIndex()
    136                     || oldStyle->hasAutoZIndex() != newStyle.hasAutoZIndex()
     135                    || oldStyle->usedZIndex() != newStyle.usedZIndex()
     136                    || oldStyle->hasAutoUsedZIndex() != newStyle.hasAutoUsedZIndex()
    137137                    || !(oldStyle->clip() == newStyle.clip())
    138138                    || oldStyle->hasClip() != newStyle.hasClip()
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r250519 r252724  
    177177        ts << " " << static_cast<const void*>(&o);
    178178
    179     if (o.style().zIndex())
    180         ts << " zI: " << o.style().zIndex();
     179    if (o.style().usedZIndex()) // FIXME: This should use !hasAutoUsedZIndex().
     180        ts << " zI: " << o.style().usedZIndex();
    181181
    182182    if (o.node()) {
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r252546 r252724  
    983983{
    984984    // Style::Resolver has ensured that zIndex is non-auto only if it's applicable.
    985     if (m_boxData->zIndex() != other.m_boxData->zIndex() || m_boxData->hasAutoZIndex() != other.m_boxData->hasAutoZIndex())
     985    if (m_boxData->usedZIndex() != other.m_boxData->usedZIndex() || m_boxData->hasAutoUsedZIndex() != other.m_boxData->hasAutoUsedZIndex())
    986986        return true;
    987987
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r252546 r252724  
    10301030    void setPrintColorAdjust(PrintColorAdjust value) { m_inheritedFlags.printColorAdjust = static_cast<unsigned>(value); }
    10311031
    1032     bool hasAutoZIndex() const { return m_boxData->hasAutoZIndex(); }
    1033     void setHasAutoZIndex() { SET_VAR(m_boxData, m_hasAutoZIndex, true); SET_VAR(m_boxData, m_zIndex, 0); }
    1034     int zIndex() const { return m_boxData->zIndex(); }
    1035     void setZIndex(int v) { SET_VAR(m_boxData, m_hasAutoZIndex, false); SET_VAR(m_boxData, m_zIndex, v); }
     1032    int specifiedZIndex() const { return m_boxData->specifiedZIndex(); }
     1033    bool hasAutoSpecifiedZIndex() const { return m_boxData->hasAutoSpecifiedZIndex(); }
     1034    void setSpecifiedZIndex(int v)
     1035    {
     1036        SET_VAR(m_boxData, m_hasAutoSpecifiedZIndex, false);
     1037        SET_VAR(m_boxData, m_specifiedZIndex, v);
     1038    }
     1039    void setHasAutoSpecifiedZIndex()
     1040    {
     1041        SET_VAR(m_boxData, m_hasAutoSpecifiedZIndex, true);
     1042        SET_VAR(m_boxData, m_specifiedZIndex, 0);
     1043    }
     1044
     1045    int usedZIndex() const { return m_boxData->usedZIndex(); }
     1046    bool hasAutoUsedZIndex() const { return m_boxData->hasAutoUsedZIndex(); }
     1047    void setUsedZIndex(int v)
     1048    {
     1049        SET_VAR(m_boxData, m_hasAutoUsedZIndex, false);
     1050        SET_VAR(m_boxData, m_usedZIndex, v);
     1051    }
     1052    void setHasAutoUsedZIndex()
     1053    {
     1054        SET_VAR(m_boxData, m_hasAutoUsedZIndex, true);
     1055        SET_VAR(m_boxData, m_usedZIndex, 0);
     1056    }
    10361057
    10371058    void setHasAutoWidows() { SET_VAR(m_rareInheritedData, hasAutoWidows, true); SET_VAR(m_rareInheritedData, widows, initialWidows()); }
  • trunk/Source/WebCore/rendering/style/StyleBoxData.cpp

    r232018 r252724  
    3030struct SameSizeAsStyleBoxData : public RefCounted<SameSizeAsStyleBoxData> {
    3131    Length length[7];
    32     int m_zIndex;
     32    int m_zIndex[2];
    3333    uint32_t bitfields;
    3434};
     
    4141    , m_minHeight(RenderStyle::initialMinSize())
    4242    , m_maxHeight(RenderStyle::initialMaxSize())
    43     , m_zIndex(0)
    44     , m_hasAutoZIndex(true)
     43    , m_specifiedZIndex(0)
     44    , m_usedZIndex(0)
     45    , m_hasAutoSpecifiedZIndex(true)
     46    , m_hasAutoUsedZIndex(true)
    4547    , m_boxSizing(static_cast<unsigned>(BoxSizing::ContentBox))
    4648#if ENABLE(CSS_BOX_DECORATION_BREAK)
     
    5961    , m_maxHeight(o.m_maxHeight)
    6062    , m_verticalAlign(o.m_verticalAlign)
    61     , m_zIndex(o.m_zIndex)
    62     , m_hasAutoZIndex(o.m_hasAutoZIndex)
     63    , m_specifiedZIndex(o.m_specifiedZIndex)
     64    , m_usedZIndex(o.m_usedZIndex)
     65    , m_hasAutoSpecifiedZIndex(o.m_hasAutoSpecifiedZIndex)
     66    , m_hasAutoUsedZIndex(o.m_hasAutoUsedZIndex)
    6367    , m_boxSizing(o.m_boxSizing)
    6468#if ENABLE(CSS_BOX_DECORATION_BREAK)
     
    7680{
    7781    return m_width == o.m_width
    78            && m_height == o.m_height
    79            && m_minWidth == o.m_minWidth
    80            && m_maxWidth == o.m_maxWidth
    81            && m_minHeight == o.m_minHeight
    82            && m_maxHeight == o.m_maxHeight
    83            && m_verticalAlign == o.m_verticalAlign
    84            && m_zIndex == o.m_zIndex
    85            && m_hasAutoZIndex == o.m_hasAutoZIndex
    86            && m_boxSizing == o.m_boxSizing
     82        && m_height == o.m_height
     83        && m_minWidth == o.m_minWidth
     84        && m_maxWidth == o.m_maxWidth
     85        && m_minHeight == o.m_minHeight
     86        && m_maxHeight == o.m_maxHeight
     87        && m_verticalAlign == o.m_verticalAlign
     88        && m_specifiedZIndex == o.m_specifiedZIndex
     89        && m_hasAutoSpecifiedZIndex == o.m_hasAutoSpecifiedZIndex
     90        && m_usedZIndex == o.m_usedZIndex
     91        && m_hasAutoUsedZIndex == o.m_hasAutoUsedZIndex
     92        && m_boxSizing == o.m_boxSizing
    8793#if ENABLE(CSS_BOX_DECORATION_BREAK)
    88            && m_boxDecorationBreak == o.m_boxDecorationBreak
     94        && m_boxDecorationBreak == o.m_boxDecorationBreak
    8995#endif
    90             ;
     96        ;
    9197}
    9298
  • trunk/Source/WebCore/rendering/style/StyleBoxData.h

    r232018 r252724  
    5454    const Length& verticalAlign() const { return m_verticalAlign; }
    5555   
    56     int zIndex() const { return m_zIndex; }
    57     bool hasAutoZIndex() const { return m_hasAutoZIndex; }
    58    
     56    int specifiedZIndex() const { return m_specifiedZIndex; }
     57    bool hasAutoSpecifiedZIndex() const { return m_hasAutoSpecifiedZIndex; }
     58
     59    int usedZIndex() const { return m_usedZIndex; }
     60    bool hasAutoUsedZIndex() const { return m_hasAutoUsedZIndex; }
     61
    5962    BoxSizing boxSizing() const { return static_cast<BoxSizing>(m_boxSizing); }
    6063#if ENABLE(CSS_BOX_DECORATION_BREAK)
     
    7982    Length m_verticalAlign;
    8083
    81     int m_zIndex;
    82     unsigned m_hasAutoZIndex : 1;
     84    int m_specifiedZIndex;
     85    int m_usedZIndex;
     86    unsigned m_hasAutoSpecifiedZIndex : 1;
     87    unsigned m_hasAutoUsedZIndex : 1;
    8388    unsigned m_boxSizing : 1; // BoxSizing
    8489#if ENABLE(CSS_BOX_DECORATION_BREAK)
  • trunk/Source/WebCore/style/StyleAdjuster.cpp

    r252631 r252724  
    295295
    296296    // Make sure our z-index value is only applied if the object is positioned.
    297     if (style.position() == PositionType::Static && !m_parentBoxStyle.isDisplayFlexibleOrGridBox())
    298         style.setHasAutoZIndex();
     297    if (style.hasAutoSpecifiedZIndex() || (style.position() == PositionType::Static && !m_parentBoxStyle.isDisplayFlexibleOrGridBox()))
     298        style.setHasAutoUsedZIndex();
     299    else
     300        style.setUsedZIndex(style.specifiedZIndex());
    299301
    300302    // Auto z-index becomes 0 for the root element and transparent objects. This prevents
    301303    // cases where objects that should be blended as a single unit end up with a non-transparent
    302304    // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
    303     if (style.hasAutoZIndex()) {
     305    if (style.hasAutoUsedZIndex()) {
    304306        if ((m_element && m_document.documentElement() == m_element)
    305307            || style.opacity() < 1.0f
     
    317319            || style.position() == PositionType::Fixed
    318320            || style.willChangeCreatesStackingContext())
    319             style.setZIndex(0);
     321            style.setUsedZIndex(0);
    320322    }
    321323
     
    386388#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
    387389    // Touch overflow scrolling creates a stacking context.
    388     if (style.hasAutoZIndex() && style.useTouchOverflowScrolling() && (isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY())))
    389         style.setZIndex(0);
     390    if (style.hasAutoUsedZIndex() && style.useTouchOverflowScrolling() && (isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY())))
     391        style.setUsedZIndex(0);
    390392#endif
    391393
Note: See TracChangeset for help on using the changeset viewer.