Title: [152335] trunk/Source/WebCore
Revision
152335
Author
[email protected]
Date
2013-07-02 20:19:06 -0700 (Tue, 02 Jul 2013)

Log Message

Don't set z-index: 0 on lots of elements with -webkit-overflow-scrolling: touch
https://bugs.webkit.org/show_bug.cgi?id=118337

Reviewed by Benjamin Poulain.

-webkit-overflow-scrolling: touch is an inherited property that, on iOS, controls
the behavior of overflow scrolling content, and causes overflow scrolling elements
to become CSS stacking contexts.

However, the code was too aggressive in setting style->setZIndex(0), doing so
for any element with overflow != hidden. Since the default for overflow is visible,
that meant almost every element.

Previously, this didn't really matter. However, since r125693, any renderer with non-auto
z-index gets a RenderLayer, and that RenderLayer will become a stacking context. The result
was too many RenderLayers and incorrect stacking context behavior.

Fix by ensuring that -webkit-overflow-scrolling: touch  only affects elements which
are actually scrollable.

Also move the code that does this to below the code that adjust overflow style
for different elements.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152334 => 152335)


--- trunk/Source/WebCore/ChangeLog	2013-07-03 02:45:27 UTC (rev 152334)
+++ trunk/Source/WebCore/ChangeLog	2013-07-03 03:19:06 UTC (rev 152335)
@@ -1,3 +1,32 @@
+2013-07-02  Simon Fraser  <[email protected]>
+
+        Don't set z-index: 0 on lots of elements with -webkit-overflow-scrolling: touch
+        https://bugs.webkit.org/show_bug.cgi?id=118337
+
+        Reviewed by Benjamin Poulain.
+
+        -webkit-overflow-scrolling: touch is an inherited property that, on iOS, controls
+        the behavior of overflow scrolling content, and causes overflow scrolling elements
+        to become CSS stacking contexts.
+         
+        However, the code was too aggressive in setting style->setZIndex(0), doing so
+        for any element with overflow != hidden. Since the default for overflow is visible,
+        that meant almost every element.
+        
+        Previously, this didn't really matter. However, since r125693, any renderer with non-auto
+        z-index gets a RenderLayer, and that RenderLayer will become a stacking context. The result
+        was too many RenderLayers and incorrect stacking context behavior.
+        
+        Fix by ensuring that -webkit-overflow-scrolling: touch  only affects elements which
+        are actually scrollable.
+        
+        Also move the code that does this to below the code that adjust overflow style
+        for different elements.
+
+        * css/StyleResolver.cpp:
+        (WebCore::isScrollableOverflow):
+        (WebCore::StyleResolver::adjustRenderStyle):
+
 2013-07-02  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r152318.

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (152334 => 152335)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-07-03 02:45:27 UTC (rev 152334)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-07-03 03:19:06 UTC (rev 152335)
@@ -1352,6 +1352,13 @@
     return display == FLEX || display == INLINE_FLEX;
 }
 
+#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
+static bool isScrollableOverflow(EOverflow overflow)
+{
+    return overflow == OSCROLL || overflow == OAUTO || overflow == OOVERLAY;
+}
+#endif
+
 void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
 {
     ASSERT(parentStyle);
@@ -1470,10 +1477,6 @@
         || style->hasBlendMode()
         || style->position() == StickyPosition
         || (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext())
-#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
-        // Touch overflow scrolling creates a stacking context.
-        || ((style->overflowX() != OHIDDEN || style->overflowY() != OHIDDEN) && style->useTouchOverflowScrolling())
-#endif
 #if ENABLE(DIALOG_ELEMENT)
         || (e && e->isInTopLayer())
 #endif
@@ -1526,6 +1529,12 @@
         style->setOverflowY(OVISIBLE);
     }
 
+#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
+    // Touch overflow scrolling creates a stacking context.
+    if (style->useTouchOverflowScrolling() && (isScrollableOverflow(style->overflowX()) || isScrollableOverflow(style->overflowY())))
+        style->setZIndex(0);
+#endif
+
     // Cull out any useless layers and also repeat patterns into additional layers.
     style->adjustBackgroundLayers();
     style->adjustMaskLayers();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to