Title: [118095] trunk
Revision
118095
Author
[email protected]
Date
2012-05-22 18:41:29 -0700 (Tue, 22 May 2012)

Log Message

Add a Setting to make position:fixed form a new stacking context
https://bugs.webkit.org/show_bug.cgi?id=87186

Reviewed by Adam Barth.

Source/WebCore:

position:fixed elements form a new stacking context in several mobile WebKit ports and in the Qt port always. To
be consistent across devices, we want to try turning it on everywhere. This will likely cause compatibility
issues, so we need a runtime setting in order to stage the change carefully.

Tests: fast/block/positioning/fixed-position-stacking-context.html
       fast/block/positioning/fixed-position-stacking-context2.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):
* page/Settings.cpp:
(WebCore::Settings::Settings):
* page/Settings.h:
(WebCore::Settings::setFixedPositionCreatesStackingContext):
(WebCore::Settings::fixedPositionCreatesStackingContext):
(Settings):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::InternalSettings):
(WebCore::InternalSettings::restoreTo):
(WebCore::InternalSettings::setFixedPositionCreatesStackingContext):
(WebCore):
* testing/InternalSettings.h:
(InternalSettings):
* testing/InternalSettings.idl:

Source/WebKit/chromium:

* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setFixedPositionCreatesStackingContext):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):

LayoutTests:

Adds layout tests that confirm we don't creates stacking contexts for position:fixed by default, but we do when
the fixedPositionCreatesStackingContext Setting is true.

Qt and Blackberry will need different expectations since they set this via an #ifdef

* fast/block/positioning/fixed-position-stacking-context-expected.png: Added.
* fast/block/positioning/fixed-position-stacking-context-expected.txt: Added.
* fast/block/positioning/fixed-position-stacking-context.html: Added.
* fast/block/positioning/fixed-position-stacking-context2-expected.png: Added.
* fast/block/positioning/fixed-position-stacking-context2-expected.txt: Added.
* fast/block/positioning/fixed-position-stacking-context2.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118094 => 118095)


--- trunk/LayoutTests/ChangeLog	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/LayoutTests/ChangeLog	2012-05-23 01:41:29 UTC (rev 118095)
@@ -1,3 +1,22 @@
+2012-05-22  James Robinson  <[email protected]>
+
+        Add a Setting to make position:fixed form a new stacking context
+        https://bugs.webkit.org/show_bug.cgi?id=87186
+
+        Reviewed by Adam Barth.
+
+        Adds layout tests that confirm we don't creates stacking contexts for position:fixed by default, but we do when
+        the fixedPositionCreatesStackingContext Setting is true.
+
+        Qt and Blackberry will need different expectations since they set this via an #ifdef
+
+        * fast/block/positioning/fixed-position-stacking-context-expected.png: Added.
+        * fast/block/positioning/fixed-position-stacking-context-expected.txt: Added.
+        * fast/block/positioning/fixed-position-stacking-context.html: Added.
+        * fast/block/positioning/fixed-position-stacking-context2-expected.png: Added.
+        * fast/block/positioning/fixed-position-stacking-context2-expected.txt: Added.
+        * fast/block/positioning/fixed-position-stacking-context2.html: Added.
+
 2012-05-22  Adam Barth  <[email protected]>
 
         RenderInline::absoluteRects does some incorrect layout math

Added: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context-expected.txt (0 => 118095)


--- trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context-expected.txt	2012-05-23 01:41:29 UTC (rev 118095)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x8
+  RenderBlock {HTML} at (0,0) size 800x8
+    RenderBody {BODY} at (8,8) size 784x0
+layer at (0,0) size 100x100
+  RenderBlock (positioned) {DIV} at (0,0) size 100x100
+layer at (0,0) size 100x100
+  RenderBlock (positioned) zI: 1 {DIV} at (0,0) size 100x100 [bgcolor=#FF0000]
+layer at (0,0) size 100x100
+  RenderBlock (positioned) zI: 1 {DIV} at (0,0) size 100x100 [bgcolor=#FF0000]
+layer at (0,0) size 100x100
+  RenderBlock (positioned) zI: 2 {DIV} at (0,0) size 100x100 [bgcolor=#008000]
Property changes on: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context.html (0 => 118095)


--- trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context.html	2012-05-23 01:41:29 UTC (rev 118095)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<title>Fixed position elements do not establish stacking contexts by default</title>
+<style>
+div {
+    height: 100px;
+    width: 100px;
+    margin: 0;
+    padding: 0;
+    top: 0;
+    left: 0;
+    position:fixed;
+}
+
+.red {
+    position:fixed;
+    background: red;
+    z-index: 1;
+}
+
+.green {
+    position:fixed;
+    background: green;
+    z-index: 2;
+}
+</style>
+<div class="red"></div>
+<div class="container">
+  <div class="red"></div>
+  <div class="green"></div>
+</div>
Property changes on: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2-expected.txt (0 => 118095)


--- trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2-expected.txt	2012-05-23 01:41:29 UTC (rev 118095)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x8
+  RenderBlock {HTML} at (0,0) size 800x8
+    RenderBody {BODY} at (8,8) size 784x0
+layer at (0,0) size 100x100
+  RenderBlock (positioned) {DIV} at (0,0) size 100x100
+layer at (0,0) size 100x100
+  RenderBlock (positioned) zI: 1 {DIV} at (0,0) size 100x100 [bgcolor=#008000]
+layer at (0,0) size 100x100
+  RenderBlock (positioned) zI: 2 {DIV} at (0,0) size 100x100 [bgcolor=#FF0000]
+layer at (0,0) size 100x100
+  RenderBlock (positioned) zI: 1 {DIV} at (0,0) size 100x100 [bgcolor=#008000]
Property changes on: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2.html (0 => 118095)


--- trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2.html	2012-05-23 01:41:29 UTC (rev 118095)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<title>Fixed position elements do establish stacking contexts with setting enabled</title>
+<style>
+div {
+    height: 100px;
+    width: 100px;
+    margin: 0;
+    padding: 0;
+    top: 0;
+    left: 0;
+    position:fixed;
+}
+
+.green {
+    position:fixed;
+    background: green;
+    z-index: 1;
+}
+
+.red {
+    position:fixed;
+    background: red;
+    z-index: 2;
+}
+</style>
+<script>
+if ("internals" in window) {
+    window.internals.settings.setFixedPositionCreatesStackingContext(true);
+} else {
+    document.write("This test depends on the FixedPositionCreatesStackingContext setting being true, so run in DumpRenderTree or manually enable it");
+}
+</script>
+<div class="green"></div>
+<div class="container">
+  <div class="green"></div>
+  <div class="red"></div>
+</div>
Property changes on: trunk/LayoutTests/fast/block/positioning/fixed-position-stacking-context2.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (118094 => 118095)


--- trunk/Source/WebCore/ChangeLog	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebCore/ChangeLog	2012-05-23 01:41:29 UTC (rev 118095)
@@ -1,3 +1,34 @@
+2012-05-22  James Robinson  <[email protected]>
+
+        Add a Setting to make position:fixed form a new stacking context
+        https://bugs.webkit.org/show_bug.cgi?id=87186
+
+        Reviewed by Adam Barth.
+
+        position:fixed elements form a new stacking context in several mobile WebKit ports and in the Qt port always. To
+        be consistent across devices, we want to try turning it on everywhere. This will likely cause compatibility
+        issues, so we need a runtime setting in order to stage the change carefully.
+
+        Tests: fast/block/positioning/fixed-position-stacking-context.html
+               fast/block/positioning/fixed-position-stacking-context2.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::collectMatchingRulesForList):
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        * page/Settings.h:
+        (WebCore::Settings::setFixedPositionCreatesStackingContext):
+        (WebCore::Settings::fixedPositionCreatesStackingContext):
+        (Settings):
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::InternalSettings):
+        (WebCore::InternalSettings::restoreTo):
+        (WebCore::InternalSettings::setFixedPositionCreatesStackingContext):
+        (WebCore):
+        * testing/InternalSettings.h:
+        (InternalSettings):
+        * testing/InternalSettings.idl:
+
 2012-05-22  Adam Barth  <[email protected]>
 
         RenderInline::absoluteRects does some incorrect layout math

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (118094 => 118095)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-05-23 01:41:29 UTC (rev 118095)
@@ -2047,6 +2047,8 @@
         || style->hasTransformRelatedProperty() || style->hasMask() || style->boxReflect() || style->hasFilter()
 #ifdef FIXED_POSITION_CREATES_STACKING_CONTEXT
         || style->position() == FixedPosition
+#else
+        || (style->position() == FixedPosition && e->document()->page()->settings()->fixedPositionCreatesStackingContext())
 #endif
 #if ENABLE(OVERFLOW_SCROLLING)
         // Touch overflow scrolling creates a stacking context.

Modified: trunk/Source/WebCore/page/Settings.cpp (118094 => 118095)


--- trunk/Source/WebCore/page/Settings.cpp	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebCore/page/Settings.cpp	2012-05-23 01:41:29 UTC (rev 118095)
@@ -268,6 +268,7 @@
     , m_wantsBalancedSetDefersLoadingBehavior(false)
     , m_requestAnimationFrameEnabled(true)
     , m_needsDidFinishLoadOrderQuirk(false)
+    , m_fixedPositionCreatesStackingContext(false)
     , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired)
     , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds)
 {

Modified: trunk/Source/WebCore/page/Settings.h (118094 => 118095)


--- trunk/Source/WebCore/page/Settings.h	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebCore/page/Settings.h	2012-05-23 01:41:29 UTC (rev 118095)
@@ -570,6 +570,9 @@
         void setNeedsDidFinishLoadOrderQuirk(bool needsQuirk) { m_needsDidFinishLoadOrderQuirk = needsQuirk; }
         bool needsDidFinishLoadOrderQuirk() const { return m_needsDidFinishLoadOrderQuirk; }
 
+        void setFixedPositionCreatesStackingContext(bool creates) { m_fixedPositionCreatesStackingContext = creates; }
+        bool fixedPositionCreatesStackingContext() const { return m_fixedPositionCreatesStackingContext; }
+
 #if USE(JSC)
         static void setShouldRespectPriorityInCSSAttributeSetters(bool);
         static bool shouldRespectPriorityInCSSAttributeSetters();
@@ -738,6 +741,8 @@
         bool m_requestAnimationFrameEnabled : 1;
         bool m_needsDidFinishLoadOrderQuirk : 1;
 
+        bool m_fixedPositionCreatesStackingContext : 1;
+
         Timer<Settings> m_loadsImagesAutomaticallyTimer;
         void loadsImagesAutomaticallyTimerFired(Timer<Settings>*);
         

Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (118094 => 118095)


--- trunk/Source/WebCore/testing/InternalSettings.cpp	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp	2012-05-23 01:41:29 UTC (rev 118095)
@@ -99,6 +99,7 @@
     , m_originalShadowDOMEnabled(RuntimeEnabledFeatures::shadowDOMEnabled())
 #endif
     , m_originalEditingBehavior(settings()->editingBehaviorType())
+    , m_originalFixedPositionCreatesStackingContext(settings()->fixedPositionCreatesStackingContext())
 {
 }
 
@@ -111,6 +112,7 @@
     RuntimeEnabledFeatures::setShadowDOMEnabled(m_originalShadowDOMEnabled);
 #endif
     settings->setEditingBehaviorType(m_originalEditingBehavior);
+    settings->setFixedPositionCreatesStackingContext(m_originalFixedPositionCreatesStackingContext);
 }
 
 Settings* InternalSettings::settings() const
@@ -344,4 +346,10 @@
         ec = SYNTAX_ERR;
 }
 
+void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, ExceptionCode& ec)
+{
+    InternalSettingsGuardForFrameView();
+    settings()->setFixedPositionCreatesStackingContext(creates);
 }
+
+}

Modified: trunk/Source/WebCore/testing/InternalSettings.h (118094 => 118095)


--- trunk/Source/WebCore/testing/InternalSettings.h	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebCore/testing/InternalSettings.h	2012-05-23 01:41:29 UTC (rev 118095)
@@ -76,6 +76,7 @@
     void setCSSExclusionsEnabled(bool enabled, ExceptionCode&);
     void setMediaPlaybackRequiresUserGesture(bool, ExceptionCode&);
     void setEditingBehavior(const String&, ExceptionCode&);
+    void setFixedPositionCreatesStackingContext(bool, ExceptionCode&);
 
     void restoreTo(Settings*);
 
@@ -93,6 +94,7 @@
     bool m_originalShadowDOMEnabled;
 #endif
     EditingBehaviorType m_originalEditingBehavior;
+    bool m_originalFixedPositionCreatesStackingContext;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/testing/InternalSettings.idl (118094 => 118095)


--- trunk/Source/WebCore/testing/InternalSettings.idl	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebCore/testing/InternalSettings.idl	2012-05-23 01:41:29 UTC (rev 118095)
@@ -54,6 +54,7 @@
         void setCSSExclusionsEnabled(in boolean enabled) raises(DOMException);
         void setMediaPlaybackRequiresUserGesture(in boolean enabled) raises(DOMException);
         void setEditingBehavior(in DOMString behavior) raises(DOMException);
+        void setFixedPositionCreatesStackingContext(in boolean creates) raises(DOMException);
     };
 }
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (118094 => 118095)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-23 01:41:29 UTC (rev 118095)
@@ -1,3 +1,17 @@
+2012-05-22  James Robinson  <[email protected]>
+
+        Add a Setting to make position:fixed form a new stacking context
+        https://bugs.webkit.org/show_bug.cgi?id=87186
+
+        Reviewed by Adam Barth.
+
+        * public/WebSettings.h:
+        * src/WebSettingsImpl.cpp:
+        (WebKit::WebSettingsImpl::setFixedPositionCreatesStackingContext):
+        (WebKit):
+        * src/WebSettingsImpl.h:
+        (WebSettingsImpl):
+
 2012-05-22  Dana Jansens  <[email protected]>
 
         [chromium] Don't force the visibleLayerRect to be empty for animating layers whose front face is not visible

Modified: trunk/Source/WebKit/chromium/public/WebSettings.h (118094 => 118095)


--- trunk/Source/WebKit/chromium/public/WebSettings.h	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebKit/chromium/public/WebSettings.h	2012-05-23 01:41:29 UTC (rev 118095)
@@ -151,6 +151,7 @@
     virtual bool viewportEnabled() const = 0;
     virtual void setDefaultTileSize(WebSize) = 0;
     virtual void setMaxUntiledLayerSize(WebSize) = 0;
+    virtual void setFixedPositionCreatesStackingContext(bool) = 0;
 
 
 protected:

Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp (118094 => 118095)


--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp	2012-05-23 01:41:29 UTC (rev 118095)
@@ -586,6 +586,11 @@
     m_settings->setMediaPlaybackRequiresUserGesture(required);
 }
 
+void WebSettingsImpl::setFixedPositionCreatesStackingContext(bool creates)
+{
+    m_settings->setFixedPositionCreatesStackingContext(creates);
+}
+
 void WebSettingsImpl::setViewportEnabled(bool enabled)
 {
     m_viewportEnabled = enabled;

Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.h (118094 => 118095)


--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.h	2012-05-23 01:39:09 UTC (rev 118094)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.h	2012-05-23 01:41:29 UTC (rev 118095)
@@ -142,6 +142,7 @@
     virtual void setPerTilePaintingEnabled(bool);
     virtual void setPartialSwapEnabled(bool);
     virtual void setThreadedAnimationEnabled(bool);
+    virtual void setFixedPositionCreatesStackingContext(bool);
     virtual void setViewportEnabled(bool);
     virtual void setMediaPlaybackRequiresUserGesture(bool);
     virtual bool viewportEnabled() const { return m_viewportEnabled; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to