[CSSRegions] Computed z-Index should return 0 instead of auto for a region
authormihnea@adobe.com <mihnea@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Oct 2013 17:33:46 +0000 (17:33 +0000)
committermihnea@adobe.com <mihnea@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Oct 2013 17:33:46 +0000 (17:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122405

Reviewed by David Hyatt.

Source/WebCore:

Test: fast/regions/layers/region-zIndex-computedStyle.html

Adjust the z-index value for a region. Also, since a box with a z-Index
that is non-auto receives a layer, i removed the requiresLayer override
in RenderRegion and RenderMultiColumnSet.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* rendering/RenderMultiColumnSet.cpp:
* rendering/RenderMultiColumnSet.h:
* rendering/RenderRegion.cpp:
* rendering/RenderRegion.h:
* rendering/style/RenderStyle.h:

LayoutTests:

* fast/regions/layers/region-zIndex-computedStyle-expected.txt: Added.
* fast/regions/layers/region-zIndex-computedStyle.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/regions/layers/region-zIndex-computedStyle-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/layers/region-zIndex-computedStyle.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/RenderMultiColumnSet.cpp
Source/WebCore/rendering/RenderMultiColumnSet.h
Source/WebCore/rendering/RenderRegion.cpp
Source/WebCore/rendering/RenderRegion.h
Source/WebCore/rendering/style/RenderStyle.h

index 80f2d61..df24f13 100644 (file)
@@ -1,3 +1,13 @@
+2013-10-08  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        [CSSRegions] Computed z-Index should return 0 instead of auto for a region
+        https://bugs.webkit.org/show_bug.cgi?id=122405
+
+        Reviewed by David Hyatt.
+
+        * fast/regions/layers/region-zIndex-computedStyle-expected.txt: Added.
+        * fast/regions/layers/region-zIndex-computedStyle.html: Added.
+
 2013-10-08  Andrei Bucur  <abucur@adobe.com>
 
         [CSS Regions] Widows don't work if the first line in a region is aligned with the top of the region
diff --git a/LayoutTests/fast/regions/layers/region-zIndex-computedStyle-expected.txt b/LayoutTests/fast/regions/layers/region-zIndex-computedStyle-expected.txt
new file mode 100644 (file)
index 0000000..4f81f3d
--- /dev/null
@@ -0,0 +1,12 @@
+Test region's computed values for z-index.
+
+A region establishes a stacking context.
+
+On success you should see PASS below
+
+PASS window.getComputedStyle(document.getElementById("region")).zIndex is "0"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
diff --git a/LayoutTests/fast/regions/layers/region-zIndex-computedStyle.html b/LayoutTests/fast/regions/layers/region-zIndex-computedStyle.html
new file mode 100644 (file)
index 0000000..8e19860
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../../resources/js-test-pre.js"></script>
+        <style>
+            #article { -webkit-flow-into: flow; }
+            #region { -webkit-flow-from: flow; }
+        </style>
+    </head>
+    <body>
+        <p>Test region's computed values for z-index.</p>
+        <p>A region establishes a stacking context.</p>
+        <p>On success you should see PASS below</p>
+        <p id="console"></p>
+        <div id="article"></div>
+        <div id="region"></div>
+    </body>
+    <script>
+        if (window.testRunner)
+            window.testRunner.dumpAsText();
+        shouldBeEqualToString('window.getComputedStyle(document.getElementById("region")).zIndex', "0");
+    </script>
+    <script src="../../../resources/js-test-post.js"></script>
+</html>
index 5cb6a27..c85d604 100644 (file)
@@ -1,3 +1,24 @@
+2013-10-08  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        [CSSRegions] Computed z-Index should return 0 instead of auto for a region
+        https://bugs.webkit.org/show_bug.cgi?id=122405
+
+        Reviewed by David Hyatt.
+
+        Test: fast/regions/layers/region-zIndex-computedStyle.html
+
+        Adjust the z-index value for a region. Also, since a box with a z-Index
+        that is non-auto receives a layer, i removed the requiresLayer override
+        in RenderRegion and RenderMultiColumnSet.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        * rendering/RenderMultiColumnSet.cpp:
+        * rendering/RenderMultiColumnSet.h:
+        * rendering/RenderRegion.cpp:
+        * rendering/RenderRegion.h:
+        * rendering/style/RenderStyle.h:
+
 2013-10-08  Andrei Bucur  <abucur@adobe.com>
 
         [CSS Regions] Widows don't work if the first line in a region is aligned with the top of the region
index 31bfe3b..be3d8de 100644 (file)
@@ -1268,6 +1268,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty
         || style->hasBlendMode()
         || style->position() == StickyPosition
         || (style->position() == FixedPosition && e && e->document().page() && e->document().page()->settings().fixedPositionCreatesStackingContext())
+        || style->hasStyleRegion()
         ))
         style->setZIndex(0);
 
index 1852208..7703859 100644 (file)
@@ -411,13 +411,6 @@ void RenderMultiColumnSet::repaintFlowThreadContent(const LayoutRect& repaintRec
     }
 }
 
-bool RenderMultiColumnSet::requiresLayer() const
-{
-    // RenderMultiColumnSet derives from RenderRegion, but unlike the CSS Regions specification, the Multi-Columns CSS
-    // specification states that the column boxes do not establish new Stacking Contexts.
-    return RenderBlockFlow::requiresLayer();
-}
-
 void RenderMultiColumnSet::collectLayerFragments(LayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect)
 {
     // Let's start by introducing the different coordinate systems involved here. They are different
index 07ac0dd..2f4898f 100644 (file)
@@ -118,8 +118,6 @@ private:
     
     virtual void repaintFlowThreadContent(const LayoutRect& repaintRect, bool immediate) const OVERRIDE;
 
-    virtual bool requiresLayer() const OVERRIDE;
-
     virtual void collectLayerFragments(LayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect) OVERRIDE;
 
     virtual const char* renderName() const;
index 0ae98bf..cee23e2 100644 (file)
@@ -374,12 +374,6 @@ void RenderRegion::repaintFlowThreadContentRectangle(const LayoutRect& repaintRe
     repaintRectangle(clippedRect, immediate);
 }
 
-bool RenderRegion::requiresLayer() const
-{
-    // All regions create stacking contexts, as specified in the CSS standard. Do that by allocating a separate RenderLayer for each.
-    return true;
-}
-
 void RenderRegion::installFlowThread()
 {
     m_flowThread = &view().flowThreadController().ensureRenderFlowThreadWithName(style()->regionThread());
index 957dc5a..d5ce95e 100644 (file)
@@ -139,8 +139,6 @@ public:
 
     virtual void collectLayerFragments(LayerFragments&, const LayoutRect&, const LayoutRect&) { }
 
-    virtual bool requiresLayer() const OVERRIDE;
-
     void addLayoutOverflowForBox(const RenderBox*, const LayoutRect&);
     void addVisualOverflowForBox(const RenderBox*, const LayoutRect&);
     LayoutRect layoutOverflowRectForBox(const RenderBox*);
index 22c5368..30a6906 100644 (file)
@@ -889,6 +889,7 @@ public:
     // End CSS3 Getters
 
     const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
+    bool hasStyleRegion() const { return !rareNonInheritedData->m_regionThread.isNull(); }
     const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
     RegionFragment regionFragment() const { return static_cast<RegionFragment>(rareNonInheritedData->m_regionFragment); }