author Vladimir Levin <vmpstr@chromium.org>
Sat, 30 May 2020 09:50:48 +0000
changeset 597309 c84f430705686b7a73696ea93de6999d2a50dc66
parent 544998 testing/web-platform/tests/css/css-position/parsing/z-index-computed.html@b17e5baf4622707dff258f39231d1d940dcefbfd
permissions -rw-r--r--
Bug 1640732 [wpt PR 23760] - ZIndex: Report computed z-index as specified, ignoring stacking context., a=testonly Automatic update from web-platform-tests ZIndex: Report computed z-index as specified, ignoring stacking context. This patch changes the behavior of computed style z-index to comply with spec: it reports the value as specified instead of changing it to auto if the style does not induce a stacking context. Note that since z-index only applies on positioned elements, and grid and flex children, this patch introduces an EffectiveZIndex() which is set to 0 if the z-index does not apply. This is so that code relying on z-index will behave as it did before. However, ZIndex() now reflects the value that was specified. R=futhark@chromium.org, pdr@chromium.org Fixed: 1023232, 375982 Change-Id: Ib11467a9818b746c72bebbb167223f1bb41a5f9f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212391 Auto-Submit: vmpstr <vmpstr@chromium.org> Reviewed-by: Philip Rogers <pdr@chromium.org> Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: vmpstr <vmpstr@chromium.org> Cr-Commit-Position: refs/heads/master@{#771989} -- wpt-commits: 3c20a28087856bd19ef7e06e1244c536e4ff83c7 wpt-pr: 23760

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Positioned Layout Module Level 3: getComputedStyle().zIndex</title>
<link rel="help" href="https://drafts.csswg.org/css-position/#propdef-z-index">
<meta name="assert" content="z-index computed value is the keyword auto or an integer.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<div id="target"></div>
  #target {
    position: absolute;
test_computed_value("z-index", "auto");
test_computed_value("z-index", "-1");
test_computed_value("z-index", "calc(3 - 2)", "1");