Title: [108474] trunk
Revision
108474
Author
[email protected]
Date
2012-02-22 02:45:15 -0800 (Wed, 22 Feb 2012)

Log Message

<style scoped>: Add runtime-flag
https://bugs.webkit.org/show_bug.cgi?id=79074

Source/WebCore:

Added runtime-flag.
Query runtime flag when (un)registering a <style scoped> element, and when determineing a style sheet's scope.

Reviewed by Dimitri Glazkov.

No new tests. (no change in functionality)

* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore):
* bindings/generic/RuntimeEnabledFeatures.h:
(RuntimeEnabledFeatures):
(WebCore::RuntimeEnabledFeatures::styleScopedEnabled):
(WebCore::RuntimeEnabledFeatures::setStyleScopedEnabled):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::determineScopingElement):
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::registerWithScopingNode):
(WebCore::HTMLStyleElement::unregisterWithScopingNode):
* html/HTMLStyleElement.idl:

Source/WebKit/chromium:

Added a runtime-flag.
Enable default STYLE_SCOPED compile-time flag for Chromium.

Reviewed by Dimitri Glazkov.

* features.gypi: enable STYLE_SCOPED
* public/WebRuntimeFeatures.h:
(WebRuntimeFeatures):
* src/WebRuntimeFeatures.cpp:
(WebKit::WebRuntimeFeatures::enableStyleScoped):
(WebKit):
(WebKit::WebRuntimeFeatures::isStyleScopedEnabled):

Tools:

Enable the runtime-flag for DRT.

Reviewed by Dimitri Glazkov.

* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::TestShell):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108473 => 108474)


--- trunk/Source/WebCore/ChangeLog	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebCore/ChangeLog	2012-02-22 10:45:15 UTC (rev 108474)
@@ -1,3 +1,28 @@
+2012-02-20  Roland Steiner  <[email protected]>
+
+        <style scoped>: Add runtime-flag
+        https://bugs.webkit.org/show_bug.cgi?id=79074
+
+        Added runtime-flag.
+        Query runtime flag when (un)registering a <style scoped> element, and when determineing a style sheet's scope.
+
+        Reviewed by Dimitri Glazkov.
+
+        No new tests. (no change in functionality)
+
+        * bindings/generic/RuntimeEnabledFeatures.cpp:
+        (WebCore):
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (RuntimeEnabledFeatures):
+        (WebCore::RuntimeEnabledFeatures::styleScopedEnabled):
+        (WebCore::RuntimeEnabledFeatures::setStyleScopedEnabled):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::determineScopingElement):
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::registerWithScopingNode):
+        (WebCore::HTMLStyleElement::unregisterWithScopingNode):
+        * html/HTMLStyleElement.idl:
+
 2012-02-21  Alexander Pavlov  <[email protected]>
 
         Web Inspector: Audit rules to recommend unprefixing supported CSS properties

Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp (108473 => 108474)


--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp	2012-02-22 10:45:15 UTC (rev 108474)
@@ -185,4 +185,7 @@
 bool RuntimeEnabledFeatures::isMultipleShadowSubtreesEnabled = false;
 #endif
 
+#if ENABLE(STYLE_SCOPED)
+bool RuntimeEnabledFeatures::isStyleScopedEnabled = false;
+#endif
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (108473 => 108474)


--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2012-02-22 10:45:15 UTC (rev 108474)
@@ -199,6 +199,11 @@
     static void setMultipleShadowSubtreesEnabled(bool isEnabled) { isMultipleShadowSubtreesEnabled = isEnabled; }
 #endif
 
+#if ENABLE(STYLE_SCOPED)
+    static bool styleScopedEnabled() { return isStyleScopedEnabled; }
+    static void setStyleScopedEnabled(bool isEnabled) { isStyleScopedEnabled = isEnabled; }
+#endif
+
 private:
     // Never instantiate.
     RuntimeEnabledFeatures() { }
@@ -260,6 +265,10 @@
     static bool isShadowDOMEnabled;
     static bool isMultipleShadowSubtreesEnabled;
 #endif
+
+#if ENABLE(STYLE_SCOPED)
+    static bool isStyleScopedEnabled;
+#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (108473 => 108474)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-02-22 10:45:15 UTC (rev 108474)
@@ -87,6 +87,7 @@
 #include "RenderStyleConstants.h"
 #include "RenderTheme.h"
 #include "RotateTransformOperation.h"
+#include "RuntimeEnabledFeatures.h"
 #include "ScaleTransformOperation.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
@@ -446,6 +447,9 @@
 {
     ASSERT(sheet);
 
+    if (!RuntimeEnabledFeatures::styleScopedEnabled())
+        return 0;
+
     Node* ownerNode = sheet->findStyleSheetOwnerNode();
     if (!ownerNode || !ownerNode->isHTMLElement() || !ownerNode->hasTagName(HTMLNames::styleTag))
         return 0;

Modified: trunk/Source/WebCore/html/HTMLStyleElement.cpp (108473 => 108474)


--- trunk/Source/WebCore/html/HTMLStyleElement.cpp	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebCore/html/HTMLStyleElement.cpp	2012-02-22 10:45:15 UTC (rev 108474)
@@ -27,6 +27,7 @@
 #include "Attribute.h"
 #include "Document.h"
 #include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
 #include "ScriptEventListener.h"
 #include "ScriptableDocumentParser.h"
 
@@ -87,44 +88,50 @@
     // Therefore we cannot rely on scoped()!
     ASSERT(!m_isRegisteredWithScopingNode);
     ASSERT(inDocument());
-    if (!m_isRegisteredWithScopingNode) {
-        ContainerNode* scope = parentNode();
-        if (!scope)
-            return;
-        if (!scope->isElementNode() && !scope->isShadowRoot()) {
-            // DocumentFragment nodes should never be inDocument,
-            // <style> should not be a child of Document, PI or some such.
-            ASSERT_NOT_REACHED();
-            return;
-        }
+    if (m_isRegisteredWithScopingNode)
+        return;
+    if (!RuntimeEnabledFeatures::styleScopedEnabled())
+        return;
 
-        scope->registerScopedHTMLStyleChild();
-        scope->setNeedsStyleRecalc();
-        if (inDocument() && !document()->parsing() && document()->renderer())
-            document()->styleSelectorChanged(DeferRecalcStyle);
+    ContainerNode* scope = parentNode();
+    if (!scope)
+        return;
+    if (!scope->isElementNode() && !scope->isShadowRoot()) {
+        // DocumentFragment nodes should never be inDocument,
+        // <style> should not be a child of Document, PI or some such.
+        ASSERT_NOT_REACHED();
+        return;
+    }
 
-        m_isRegisteredWithScopingNode = true;
-    }
+    scope->registerScopedHTMLStyleChild();
+    scope->setNeedsStyleRecalc();
+    if (inDocument() && !document()->parsing() && document()->renderer())
+        document()->styleSelectorChanged(DeferRecalcStyle);
+
+    m_isRegisteredWithScopingNode = true;
 }
 
 void HTMLStyleElement::unregisterWithScopingNode()
 {
     // Note: We cannot rely on the 'scoped' element still being present when this method is invoked.
     // Therefore we cannot rely on scoped()!
-    ASSERT(m_isRegisteredWithScopingNode);
-    if (m_isRegisteredWithScopingNode) {
-        ContainerNode* scope = parentNode();
-        ASSERT(scope);
-        if (scope) {
-            ASSERT(scope->hasScopedHTMLStyleChild());
-            scope->unregisterScopedHTMLStyleChild();
-            scope->setNeedsStyleRecalc();
-        }
-        if (inDocument() && !document()->parsing() && document()->renderer())
-            document()->styleSelectorChanged(DeferRecalcStyle);
+    ASSERT(m_isRegisteredWithScopingNode || !RuntimeEnabledFeatures::styleScopedEnabled());
+    if (!m_isRegisteredWithScopingNode)
+        return;
+    if (!RuntimeEnabledFeatures::styleScopedEnabled())
+        return;
 
-        m_isRegisteredWithScopingNode = false;
+    ContainerNode* scope = parentNode();
+    ASSERT(scope);
+    if (scope) {
+        ASSERT(scope->hasScopedHTMLStyleChild());
+        scope->unregisterScopedHTMLStyleChild();
+        scope->setNeedsStyleRecalc();
     }
+    if (inDocument() && !document()->parsing() && document()->renderer())
+        document()->styleSelectorChanged(DeferRecalcStyle);
+
+    m_isRegisteredWithScopingNode = false;
 }
 #endif
 

Modified: trunk/Source/WebCore/html/HTMLStyleElement.idl (108473 => 108474)


--- trunk/Source/WebCore/html/HTMLStyleElement.idl	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebCore/html/HTMLStyleElement.idl	2012-02-22 10:45:15 UTC (rev 108474)
@@ -22,7 +22,7 @@
 
     interface HTMLStyleElement : HTMLElement {
         attribute boolean disabled;
-        attribute [Conditional=STYLE_SCOPED] boolean scoped;
+        attribute [Conditional=STYLE_SCOPED, V8EnabledAtRuntime=styleScoped] boolean scoped;
         attribute [Reflect] DOMString media;
         attribute [Reflect] DOMString type;
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (108473 => 108474)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-02-22 10:45:15 UTC (rev 108474)
@@ -1,3 +1,21 @@
+2012-02-20  Roland Steiner  <[email protected]>
+
+        <style scoped>: Add runtime-flag
+        https://bugs.webkit.org/show_bug.cgi?id=79074
+
+        Added a runtime-flag.
+        Enable default STYLE_SCOPED compile-time flag for Chromium.
+
+        Reviewed by Dimitri Glazkov.
+
+        * features.gypi: enable STYLE_SCOPED
+        * public/WebRuntimeFeatures.h:
+        (WebRuntimeFeatures):
+        * src/WebRuntimeFeatures.cpp:
+        (WebKit::WebRuntimeFeatures::enableStyleScoped):
+        (WebKit):
+        (WebKit::WebRuntimeFeatures::isStyleScopedEnabled):
+
 2012-02-22  Yuta Kitamura  <[email protected]>
 
         Unreviewed, rolling out r108453.

Modified: trunk/Source/WebKit/chromium/features.gypi (108473 => 108474)


--- trunk/Source/WebKit/chromium/features.gypi	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebKit/chromium/features.gypi	2012-02-22 10:45:15 UTC (rev 108474)
@@ -85,7 +85,7 @@
       'ENABLE_SHARED_WORKERS=1',
       'ENABLE_SMOOTH_SCROLLING=1',
       'ENABLE_SQL_DATABASE=1',
-      'ENABLE_STYLE_SCOPED=0',
+      'ENABLE_STYLE_SCOPED=1',
       'ENABLE_SVG=<(enable_svg)',
       'ENABLE_SVG_FONTS=<(enable_svg)',
       'ENABLE_TOUCH_EVENTS=<(enable_touch_events)',

Modified: trunk/Source/WebKit/chromium/public/WebRuntimeFeatures.h (108473 => 108474)


--- trunk/Source/WebKit/chromium/public/WebRuntimeFeatures.h	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebKit/chromium/public/WebRuntimeFeatures.h	2012-02-22 10:45:15 UTC (rev 108474)
@@ -124,6 +124,9 @@
     WEBKIT_EXPORT static void enableShadowDOM(bool);
     WEBKIT_EXPORT static bool isShadowDOMEnabled();
 
+    WEBKIT_EXPORT static void enableStyleScoped(bool);
+    WEBKIT_EXPORT static bool isStyleScopedEnabled();
+
 private:
     WebRuntimeFeatures();
 };

Modified: trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp (108473 => 108474)


--- trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp	2012-02-22 10:45:15 UTC (rev 108474)
@@ -450,5 +450,23 @@
 #endif
 }
 
+void WebRuntimeFeatures::enableStyleScoped(bool enable)
+{
+#if ENABLE(STYLE_SCOPED)
+    RuntimeEnabledFeatures::setStyleScopedEnabled(enable);
+#else
+    UNUSED_PARAM(enable);
+#endif
+}
 
+bool WebRuntimeFeatures::isStyleScopedEnabled()
+{
+#if ENABLE(STYLE_SCOPED)
+    return RuntimeEnabledFeatures::styleScopedEnabled();
+#else
+    return false;
+#endif
+}
+
+
 } // namespace WebKit

Modified: trunk/Tools/ChangeLog (108473 => 108474)


--- trunk/Tools/ChangeLog	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Tools/ChangeLog	2012-02-22 10:45:15 UTC (rev 108474)
@@ -1,3 +1,15 @@
+2012-02-20  Roland Steiner  <[email protected]>
+
+        <style scoped>: Add runtime-flag
+        https://bugs.webkit.org/show_bug.cgi?id=79074
+
+        Enable the runtime-flag for DRT. 
+
+        Reviewed by Dimitri Glazkov.
+
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::TestShell):
+
 2012-02-22  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed, rolling out r107351.

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (108473 => 108474)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-02-22 10:42:46 UTC (rev 108473)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-02-22 10:45:15 UTC (rev 108474)
@@ -129,6 +129,7 @@
     WebRuntimeFeatures::enableVideoTrack(true);
     WebRuntimeFeatures::enableGamepad(true);
     WebRuntimeFeatures::enableShadowDOM(true);
+    WebRuntimeFeatures::enableStyleScoped(true);
 
     m_webPermissions = adoptPtr(new WebPermissions(this));
     m_accessibilityController = adoptPtr(new AccessibilityController(this));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to