Title: [118460] trunk/Source/WebCore
Revision
118460
Author
[email protected]
Date
2012-05-24 18:55:45 -0700 (Thu, 24 May 2012)

Log Message

Scoped stylesheet should be per-document-configurable.
https://bugs.webkit.org/show_bug.cgi?id=86985

Reviewed by Kent Tamura.

This change replaced RuntimeEnabledFeatures::styleScopedEnabled() callsites
with newly introduced ContextEnabledFeatures::styleScopedEnabled().
Clients can override the decision by implementing FrameLoaderClient::allowStyleScoped().

No new tests. This isn't testable on DRT.

* bindings/generic/ContextEnabledFeatures.cpp:
(WebCore):
(WebCore::ContextEnabledFeatures::styleScopedEnabled):
* bindings/generic/ContextEnabledFeatures.h:
(WebCore):
(ContextEnabledFeatures):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::determineScope):
* css/StyleResolver.h:
(StyleResolver):
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::registerWithScopingNode):
(WebCore::HTMLStyleElement::unregisterWithScopingNode):
* loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::allowStyleScoped):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (118459 => 118460)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 01:49:40 UTC (rev 118459)
+++ trunk/Source/WebCore/ChangeLog	2012-05-25 01:55:45 UTC (rev 118460)
@@ -1,3 +1,32 @@
+2012-05-24  MORITA Hajime  <[email protected]>
+
+        Scoped stylesheet should be per-document-configurable.
+        https://bugs.webkit.org/show_bug.cgi?id=86985
+
+        Reviewed by Kent Tamura.
+
+        This change replaced RuntimeEnabledFeatures::styleScopedEnabled() callsites
+        with newly introduced ContextEnabledFeatures::styleScopedEnabled().
+        Clients can override the decision by implementing FrameLoaderClient::allowStyleScoped().
+
+        No new tests. This isn't testable on DRT.
+
+        * bindings/generic/ContextEnabledFeatures.cpp:
+        (WebCore):
+        (WebCore::ContextEnabledFeatures::styleScopedEnabled):
+        * bindings/generic/ContextEnabledFeatures.h:
+        (WebCore):
+        (ContextEnabledFeatures):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::determineScope):
+        * css/StyleResolver.h:
+        (StyleResolver):
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::registerWithScopingNode):
+        (WebCore::HTMLStyleElement::unregisterWithScopingNode):
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::allowStyleScoped):
+
 2012-05-24  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r118452.

Modified: trunk/Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp (118459 => 118460)


--- trunk/Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp	2012-05-25 01:49:40 UTC (rev 118459)
+++ trunk/Source/WebCore/bindings/generic/ContextEnabledFeatures.cpp	2012-05-25 01:55:45 UTC (rev 118460)
@@ -32,6 +32,7 @@
 #include "ContextEnabledFeatures.h"
 
 #include "DOMWindow.h"
+#include "Document.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
@@ -50,4 +51,16 @@
 }
 #endif
 
+#if ENABLE(STYLE_SCOPED)
+bool ContextEnabledFeatures::styleScopedEnabled(Document* document)
+{
+    if (!document)
+        return false;
+    if (Frame* frame = document->frame())
+        return frame->loader()->client()->allowStyleScoped(RuntimeEnabledFeatures::styleScopedEnabled());
+    return false;
+   
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/generic/ContextEnabledFeatures.h (118459 => 118460)


--- trunk/Source/WebCore/bindings/generic/ContextEnabledFeatures.h	2012-05-25 01:49:40 UTC (rev 118459)
+++ trunk/Source/WebCore/bindings/generic/ContextEnabledFeatures.h	2012-05-25 01:55:45 UTC (rev 118460)
@@ -34,6 +34,7 @@
 namespace WebCore {
 
 class DOMWindow;
+class Document;
 
 // A class that stores static enablers for all experimental features. Note that
 // the method names must line up with the _javascript_ method they enable for code
@@ -44,6 +45,9 @@
 #if ENABLE(SHADOW_DOM)
     static bool shadowDOMEnabled(DOMWindow*);
 #endif
+#if ENABLE(STYLE_SCOPED)
+    static bool styleScopedEnabled(Document*);
+#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (118459 => 118460)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-05-25 01:49:40 UTC (rev 118459)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-05-25 01:55:45 UTC (rev 118460)
@@ -52,6 +52,7 @@
 #include "CachedImage.h"
 #include "CalculationValue.h"
 #include "ContentData.h"
+#include "ContextEnabledFeatures.h"
 #include "Counter.h"
 #include "CounterContent.h"
 #include "CursorList.h"
@@ -89,7 +90,6 @@
 #include "RenderStyleConstants.h"
 #include "RenderTheme.h"
 #include "RotateTransformOperation.h"
-#include "RuntimeEnabledFeatures.h"
 #include "SVGDocumentExtensions.h"
 #include "SVGFontFaceElement.h"
 #include "ScaleTransformOperation.h"
@@ -490,7 +490,7 @@
 {
     ASSERT(sheet);
 
-    if (!RuntimeEnabledFeatures::styleScopedEnabled())
+    if (!ContextEnabledFeatures::styleScopedEnabled(document()))
         return 0;
 
     Node* ownerNode = sheet->ownerNode();

Modified: trunk/Source/WebCore/css/StyleResolver.h (118459 => 118460)


--- trunk/Source/WebCore/css/StyleResolver.h	2012-05-25 01:49:40 UTC (rev 118459)
+++ trunk/Source/WebCore/css/StyleResolver.h	2012-05-25 01:55:45 UTC (rev 118460)
@@ -510,7 +510,7 @@
 #endif
 
 #if ENABLE(STYLE_SCOPED)
-    static const ContainerNode* determineScope(const CSSStyleSheet*);
+    const ContainerNode* determineScope(const CSSStyleSheet*);
 
     typedef HashMap<const ContainerNode*, OwnPtr<RuleSet> > ScopedRuleSetMap;
 

Modified: trunk/Source/WebCore/html/HTMLStyleElement.cpp (118459 => 118460)


--- trunk/Source/WebCore/html/HTMLStyleElement.cpp	2012-05-25 01:49:40 UTC (rev 118459)
+++ trunk/Source/WebCore/html/HTMLStyleElement.cpp	2012-05-25 01:55:45 UTC (rev 118460)
@@ -25,11 +25,11 @@
 #include "HTMLStyleElement.h"
 
 #include "Attribute.h"
+#include "ContextEnabledFeatures.h"
 #include "Document.h"
 #include "Event.h"
 #include "EventSender.h"
 #include "HTMLNames.h"
-#include "RuntimeEnabledFeatures.h"
 #include "ScriptEventListener.h"
 #include "ScriptableDocumentParser.h"
 #include "StyleSheetContents.h"
@@ -105,7 +105,7 @@
     ASSERT(inDocument());
     if (m_isRegisteredWithScopingNode)
         return;
-    if (!RuntimeEnabledFeatures::styleScopedEnabled())
+    if (!ContextEnabledFeatures::styleScopedEnabled(document()))
         return;
 
     ContainerNode* scope = parentNode();
@@ -130,10 +130,10 @@
 {
     // 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 || !RuntimeEnabledFeatures::styleScopedEnabled());
+    ASSERT(m_isRegisteredWithScopingNode || !ContextEnabledFeatures::styleScopedEnabled(document()));
     if (!m_isRegisteredWithScopingNode)
         return;
-    if (!RuntimeEnabledFeatures::styleScopedEnabled())
+    if (!ContextEnabledFeatures::styleScopedEnabled(document()))
         return;
 
     ASSERT(scope);

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (118459 => 118460)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2012-05-25 01:49:40 UTC (rev 118459)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2012-05-25 01:55:45 UTC (rev 118460)
@@ -312,6 +312,7 @@
         virtual bool allowRunningInsecureContent(bool enabledPerSettings, SecurityOrigin*, const KURL&) { return enabledPerSettings; }
 
         virtual bool shadowDOMAllowed(bool enabledAsRuntimeFeatures) { return enabledAsRuntimeFeatures; }
+        virtual bool allowStyleScoped(bool enabledAsRuntimeFeatures) { return enabledAsRuntimeFeatures; }
 
         // This callback notifies the client that the frame was about to run
         // _javascript_ but did not because allowScript returned false. We
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to