Title: [134366] branches/chromium/1312/Source
Revision
134366
Author
morr...@google.com
Date
2012-11-12 22:36:48 -0800 (Mon, 12 Nov 2012)

Log Message

Merge 133429 - Shadow DOM should be able to be disabled per context.
https://bugs.webkit.org/show_bug.cgi?id=101173

Reviewed by Dimitri Glazkov.

Source/WebCore:

This change pulls back relevant bits from r131549. Note that if
the the port enables runtime Shadow DOM flag, this can cause slow
down on some Chromium page cycler test cases (which r131549
attempted to fix).

This change is temporal and the flags should be switched back from
ContextFeatures to RuntimeEnabledFeatures once it gains sufficent
stability.

* dom/ContextFeatures.cpp:
(WebCore::ContextFeatures::shadowDOMEnabled):
(WebCore):
* dom/ContextFeatures.h:
* dom/Position.cpp:
(WebCore::Position::Position):
(WebCore::Position::findParent):
* dom/TreeScope.cpp:
(WebCore::TreeScope::getSelection):
* html/HTMLTagNames.in:
* html/shadow/HTMLContentElement.cpp:
(WebCore::HTMLContentElement::contentTagName):
* page/DOMWindow.idl:

Source/WebKit/chromium:

* src/ContextFeaturesClientImpl.cpp:
(WebKit::ContextFeaturesClientImpl::askIfIsEnabled):


TBR=morr...@google.com
Review URL: https://codereview.chromium.org/11410062

Modified Paths

Diff

Modified: branches/chromium/1312/Source/WebCore/dom/ContextFeatures.cpp (134365 => 134366)


--- branches/chromium/1312/Source/WebCore/dom/ContextFeatures.cpp	2012-11-13 06:36:05 UTC (rev 134365)
+++ branches/chromium/1312/Source/WebCore/dom/ContextFeatures.cpp	2012-11-13 06:36:48 UTC (rev 134366)
@@ -63,6 +63,18 @@
 #endif
 }
 
+bool ContextFeatures::shadowDOMEnabled(Document* document)
+{
+#if ENABLE(SHADOW_DOM)
+    if (!document)
+        return RuntimeEnabledFeatures::shadowDOMEnabled();
+    return document->contextFeatures()->isEnabled(document, ShadowDOM, RuntimeEnabledFeatures::shadowDOMEnabled());
+#else
+    UNUSED_PARAM(document);
+    return false;
+#endif
+}
+
 bool ContextFeatures::styleScopedEnabled(Document* document)
 {
 #if ENABLE(STYLE_SCOPED)

Modified: branches/chromium/1312/Source/WebCore/dom/ContextFeatures.h (134365 => 134366)


--- branches/chromium/1312/Source/WebCore/dom/ContextFeatures.h	2012-11-13 06:36:05 UTC (rev 134365)
+++ branches/chromium/1312/Source/WebCore/dom/ContextFeatures.h	2012-11-13 06:36:48 UTC (rev 134366)
@@ -40,6 +40,7 @@
 public:
     enum FeatureType {
         DialogElement = 0,
+        ShadowDOM,
         StyleScoped,
         PagePopup,
         HTMLNotifications,
@@ -53,6 +54,7 @@
     static PassRefPtr<ContextFeatures> create(ContextFeaturesClient*);
 
     static bool dialogElementEnabled(Document*);
+    static bool shadowDOMEnabled(Document*);
     static bool styleScopedEnabled(Document*);
     static bool pagePopupEnabled(Document*);
     static bool htmlNotificationsEnabled(Document*);

Modified: branches/chromium/1312/Source/WebCore/dom/Position.cpp (134365 => 134366)


--- branches/chromium/1312/Source/WebCore/dom/Position.cpp	2012-11-13 06:36:05 UTC (rev 134365)
+++ branches/chromium/1312/Source/WebCore/dom/Position.cpp	2012-11-13 06:36:48 UTC (rev 134366)
@@ -27,13 +27,13 @@
 #include "Position.h"
 
 #include "CSSComputedStyleDeclaration.h"
+#include "ContextFeatures.h"
 #include "HTMLNames.h"
 #include "InlineTextBox.h"
 #include "Logging.h"
 #include "PositionIterator.h"
 #include "RenderBlock.h"
 #include "RenderText.h"
-#include "RuntimeEnabledFeatures.h"
 #include "Text.h"
 #include "TextIterator.h"
 #include "VisiblePosition.h"
@@ -82,7 +82,7 @@
     , m_isLegacyEditingPosition(true)
 {
 #if ENABLE(SHADOW_DOM)
-    ASSERT((m_anchorNode && RuntimeEnabledFeatures::shadowDOMEnabled())
+    ASSERT((m_anchorNode && ContextFeatures::shadowDOMEnabled(m_anchorNode->document()))
            || !m_anchorNode || !m_anchorNode->isShadowRoot());
 #else
     ASSERT(!m_anchorNode || !m_anchorNode->isShadowRoot());
@@ -96,7 +96,7 @@
     , m_isLegacyEditingPosition(false)
 {
 #if ENABLE(SHADOW_DOM)
-    ASSERT((m_anchorNode && RuntimeEnabledFeatures::shadowDOMEnabled())
+    ASSERT((m_anchorNode && ContextFeatures::shadowDOMEnabled(m_anchorNode->document()))
            || !m_anchorNode || !m_anchorNode->isShadowRoot());
 #else
     ASSERT(!m_anchorNode || !m_anchorNode->isShadowRoot());
@@ -114,7 +114,7 @@
     , m_isLegacyEditingPosition(false)
 {
 #if ENABLE(SHADOW_DOM)
-    ASSERT((m_anchorNode && RuntimeEnabledFeatures::shadowDOMEnabled())
+    ASSERT((m_anchorNode && ContextFeatures::shadowDOMEnabled(m_anchorNode->document()))
            || !m_anchorNode || !editingIgnoresContent(m_anchorNode.get()) || !m_anchorNode->isShadowRoot());
 #else
     ASSERT(!m_anchorNode || !editingIgnoresContent(m_anchorNode.get()) || !m_anchorNode->isShadowRoot());
@@ -858,7 +858,7 @@
     // FIXME: See http://web.ug/82697
 
 #if ENABLE(SHADOW_DOM)
-    if (RuntimeEnabledFeatures::shadowDOMEnabled())
+    if (ContextFeatures::shadowDOMEnabled(node->document()))
         return node->parentNode();
 #endif
 

Modified: branches/chromium/1312/Source/WebCore/dom/TreeScope.cpp (134365 => 134366)


--- branches/chromium/1312/Source/WebCore/dom/TreeScope.cpp	2012-11-13 06:36:05 UTC (rev 134365)
+++ branches/chromium/1312/Source/WebCore/dom/TreeScope.cpp	2012-11-13 06:36:48 UTC (rev 134366)
@@ -28,6 +28,7 @@
 
 #include "ComposedShadowTreeWalker.h"
 #include "ContainerNode.h"
+#include "ContextFeatures.h"
 #include "DOMSelection.h"
 #include "DOMWindow.h"
 #include "Document.h"
@@ -42,7 +43,6 @@
 #include "IdTargetObserverRegistry.h"
 #include "InsertionPoint.h"
 #include "Page.h"
-#include "RuntimeEnabledFeatures.h"
 #include "ShadowRoot.h"
 #include "TreeScopeAdopter.h"
 #include <wtf/Vector.h>
@@ -189,7 +189,7 @@
     // as a container. It is now enabled only if runtime Shadow DOM feature is enabled.
     // See https://bugs.webkit.org/show_bug.cgi?id=82697
 #if ENABLE(SHADOW_DOM)
-    if (RuntimeEnabledFeatures::shadowDOMEnabled()) {
+    if (ContextFeatures::shadowDOMEnabled(rootNode()->document())) {
         m_selection = DOMSelection::create(this);
         return m_selection.get();
     }

Modified: branches/chromium/1312/Source/WebCore/html/HTMLTagNames.in (134365 => 134366)


--- branches/chromium/1312/Source/WebCore/html/HTMLTagNames.in	2012-11-13 06:36:05 UTC (rev 134365)
+++ branches/chromium/1312/Source/WebCore/html/HTMLTagNames.in	2012-11-13 06:36:48 UTC (rev 134366)
@@ -31,7 +31,7 @@
 col interfaceName=HTMLTableColElement
 colgroup interfaceName=HTMLTableColElement
 command interfaceName=HTMLElement
-content interfaceName=HTMLContentElement, conditional=SHADOW_DOM, runtimeConditional=shadowDOM
+content interfaceName=HTMLContentElement, conditional=SHADOW_DOM, contextConditional=shadowDOM
 webkitShadowContent interfaceName=HTMLElement, noConstructor
 datalist interfaceName=HTMLDataListElement, conditional=DATALIST_ELEMENT
 dd interfaceName=HTMLElement
@@ -97,7 +97,7 @@
 optgroup interfaceName=HTMLOptGroupElement
 option
 output constructorNeedsFormElement
-shadow interfaceName=HTMLShadowElement, conditional=SHADOW_DOM, runtimeConditional=shadowDOM
+shadow interfaceName=HTMLShadowElement, conditional=SHADOW_DOM, contextConditional=shadowDOM
 p interfaceName=HTMLParagraphElement
 param
 plaintext interfaceName=HTMLElement

Modified: branches/chromium/1312/Source/WebCore/html/shadow/HTMLContentElement.cpp (134365 => 134366)


--- branches/chromium/1312/Source/WebCore/html/shadow/HTMLContentElement.cpp	2012-11-13 06:36:05 UTC (rev 134365)
+++ branches/chromium/1312/Source/WebCore/html/shadow/HTMLContentElement.cpp	2012-11-13 06:36:48 UTC (rev 134366)
@@ -29,10 +29,10 @@
 
 #include "ContentDistributor.h"
 #include "ContentSelectorQuery.h"
+#include "ContextFeatures.h"
 #include "ElementShadow.h"
 #include "HTMLNames.h"
 #include "QualifiedName.h"
-#include "RuntimeEnabledFeatures.h"
 #include "ShadowRoot.h"
 #include <wtf/StdLibExtras.h>
 
@@ -40,13 +40,14 @@
 
 using HTMLNames::selectAttr;
 
-const QualifiedName& HTMLContentElement::contentTagName(Document*)
+const QualifiedName& HTMLContentElement::contentTagName(Document* document)
 {
 #if ENABLE(SHADOW_DOM)
-    if (!RuntimeEnabledFeatures::shadowDOMEnabled())
+    if (!ContextFeatures::shadowDOMEnabled(document))
         return HTMLNames::webkitShadowContentTag;
     return HTMLNames::contentTag;
 #else
+    UNUSED_PARAM(document);
     return HTMLNames::webkitShadowContentTag;
 #endif
 }

Modified: branches/chromium/1312/Source/WebCore/page/DOMWindow.idl (134365 => 134366)


--- branches/chromium/1312/Source/WebCore/page/DOMWindow.idl	2012-11-13 06:36:05 UTC (rev 134365)
+++ branches/chromium/1312/Source/WebCore/page/DOMWindow.idl	2012-11-13 06:36:48 UTC (rev 134366)
@@ -392,9 +392,9 @@
     attribute EntityConstructor Entity;
     attribute EntityReferenceConstructor EntityReference;
     attribute ProcessingInstructionConstructor ProcessingInstruction;
-    [Conditional=SHADOW_DOM, V8EnabledAtRuntime=shadowDOM] attribute ShadowRootConstructor WebKitShadowRoot;
-    [Conditional=SHADOW_DOM, V8EnabledAtRuntime=shadowDOM] attribute HTMLContentElementConstructor HTMLContentElement;
-    [Conditional=SHADOW_DOM, V8EnabledAtRuntime=shadowDOM] attribute HTMLShadowElementConstructor HTMLShadowElement;
+    [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] attribute ShadowRootConstructor WebKitShadowRoot;
+    [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] attribute HTMLContentElementConstructor HTMLContentElement;
+    [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] attribute HTMLShadowElementConstructor HTMLShadowElement;
 
     attribute DOMSelectionConstructor Selection;
     attribute DOMWindowConstructor Window;

Modified: branches/chromium/1312/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp (134365 => 134366)


--- branches/chromium/1312/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp	2012-11-13 06:36:05 UTC (rev 134365)
+++ branches/chromium/1312/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp	2012-11-13 06:36:48 UTC (rev 134366)
@@ -140,6 +140,7 @@
         return defaultValue;
 
     switch (type) {
+    case ContextFeatures::ShadowDOM:
     case ContextFeatures::StyleScoped:
         return m_client->allowWebComponents(WebDocument(document), defaultValue);
     case ContextFeatures::HTMLNotifications:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to