Diff
Modified: trunk/LayoutTests/ChangeLog (108002 => 108003)
--- trunk/LayoutTests/ChangeLog 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/LayoutTests/ChangeLog 2012-02-17 00:57:19 UTC (rev 108003)
@@ -1,3 +1,12 @@
+2012-02-15 Shinya Kawanaka <[email protected]>
+
+ Needs an internal flag to accept multiple shadow roots for the purpose of tests
+ https://bugs.webkit.org/show_bug.cgi?id=78453
+
+ Reviewed by Hajime Morita.
+
+ * fast/dom/shadow/shadow-root-js-api.html:
+
2012-02-16 Mark Hahnenberg <[email protected]>
Fix the broken viewport tests
Modified: trunk/LayoutTests/fast/dom/shadow/shadow-root-js-api.html (108002 => 108003)
--- trunk/LayoutTests/fast/dom/shadow/shadow-root-js-api.html 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-root-js-api.html 2012-02-17 00:57:19 UTC (rev 108003)
@@ -57,6 +57,18 @@
shouldBeNull("shadowRoot.querySelector('.foo')");
shouldBe("shadowRoot.querySelectorAll('div')", "[div1, div2]");
shouldBe("shadowRoot.querySelectorAll('foo')", "[]");
+
+if (window.internals) {
+ window.internals.setMultipleShadowSubtreesEnabled(true);
+
+ // FIXME: Enable this test after Element's setShadowRoot should be replaced with ShadowRootList.
+ // https://bugs.webkit.org/show_bug.cgi?id=78313
+ // var youngerShadowRoot = new WebKitShadowRoot(shadowHost);
+ // shouldNotBe("youngerShadowRoot", "shadowRoot");
+
+ window.internals.setMultipleShadowSubtreesEnabled(false);
+}
+
</script>
<script src=""
</body>
Modified: trunk/Source/WebCore/ChangeLog (108002 => 108003)
--- trunk/Source/WebCore/ChangeLog 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/ChangeLog 2012-02-17 00:57:19 UTC (rev 108003)
@@ -1,3 +1,34 @@
+2012-02-15 Shinya Kawanaka <[email protected]>
+
+ Add an internal flag to accept multiple shadow roots for the purpose of tests.
+ https://bugs.webkit.org/show_bug.cgi?id=78453
+
+ Reviewed by Hajime Morita.
+
+ This patch introduces a flag to enable multiple shadow subtrees.
+ This flag is intended to be used for testing purpose for a while.
+ We will remove it later.
+
+ No new tests, no change in behavior.
+
+ * WebCore.exp.in:
+ * bindings/generic/RuntimeEnabledFeatures.cpp:
+ (WebCore):
+ * bindings/generic/RuntimeEnabledFeatures.h:
+ (RuntimeEnabledFeatures):
+ (WebCore::RuntimeEnabledFeatures::multipleShadowSubtreesEnabled):
+ (WebCore::RuntimeEnabledFeatures::setMultipleShadowSubtreesEnabled):
+ * dom/ShadowRoot.cpp:
+ (WebCore::ShadowRoot::create):
+ * dom/ShadowRootList.cpp:
+ (WebCore::ShadowRootList::pushShadowRoot):
+ * testing/Internals.cpp:
+ (WebCore::Internals::setMultipleShadowSubtreesEnabled):
+ (WebCore):
+ * testing/Internals.h:
+ (Internals):
+ * testing/Internals.idl:
+
2012-02-16 Mark Hahnenberg <[email protected]>
Fix the broken viewport tests
Modified: trunk/Source/WebCore/WebCore.exp.in (108002 => 108003)
--- trunk/Source/WebCore/WebCore.exp.in 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-02-17 00:57:19 UTC (rev 108003)
@@ -2091,3 +2091,7 @@
#endif
__ZNK7WebCore4Node31numberOfScopedHTMLStyleChildrenEv
+
+#if ENABLE(SHADOW_DOM)
+__ZN7WebCore22RuntimeEnabledFeatures32setMultipleShadowSubtreesEnabledEb
+#endif
Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp (108002 => 108003)
--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp 2012-02-17 00:57:19 UTC (rev 108003)
@@ -182,6 +182,7 @@
#if ENABLE(SHADOW_DOM)
bool RuntimeEnabledFeatures::isShadowDOMEnabled = false;
+bool RuntimeEnabledFeatures::isMultipleShadowSubtreesEnabled = false;
#endif
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (108002 => 108003)
--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h 2012-02-17 00:57:19 UTC (rev 108003)
@@ -194,6 +194,9 @@
#if ENABLE(SHADOW_DOM)
static bool shadowDOMEnabled() { return isShadowDOMEnabled; }
static void setShadowDOMEnabled(bool isEnabled) { isShadowDOMEnabled = isEnabled; }
+
+ static bool multipleShadowSubtreesEnabled() { return isMultipleShadowSubtreesEnabled; }
+ static void setMultipleShadowSubtreesEnabled(bool isEnabled) { isMultipleShadowSubtreesEnabled = isEnabled; }
#endif
private:
@@ -255,6 +258,7 @@
#if ENABLE(SHADOW_DOM)
static bool isShadowDOMEnabled;
+ static bool isMultipleShadowSubtreesEnabled;
#endif
};
Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (108002 => 108003)
--- trunk/Source/WebCore/dom/ShadowRoot.cpp 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp 2012-02-17 00:57:19 UTC (rev 108003)
@@ -33,9 +33,14 @@
#include "HTMLContentSelector.h"
#include "HTMLNames.h"
#include "NodeRareData.h"
+#include "ShadowRootList.h"
#include "SVGNames.h"
#include "Text.h"
+#if ENABLE(SHADOW_DOM)
+#include "RuntimeEnabledFeatures.h"
+#endif
+
namespace WebCore {
ShadowRoot::ShadowRoot(Document* document)
@@ -97,7 +102,13 @@
PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ShadowRootCreationPurpose purpose, ExceptionCode& ec)
{
- if (!element || element->hasShadowRoot()) {
+#if ENABLE(SHADOW_DOM)
+ bool isMultipleShadowSubtreesEnabled = RuntimeEnabledFeatures::multipleShadowSubtreesEnabled();
+#else
+ bool isMultipleShadowSubtreesEnabled = false;
+#endif
+
+ if (!element || (!isMultipleShadowSubtreesEnabled && element->hasShadowRoot())) {
ec = HIERARCHY_REQUEST_ERR;
return 0;
}
Modified: trunk/Source/WebCore/dom/ShadowRootList.cpp (108002 => 108003)
--- trunk/Source/WebCore/dom/ShadowRootList.cpp 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/dom/ShadowRootList.cpp 2012-02-17 00:57:19 UTC (rev 108003)
@@ -29,6 +29,7 @@
#include "Document.h"
#include "Element.h"
+#include "RuntimeEnabledFeatures.h"
#include "ShadowRoot.h"
namespace WebCore {
@@ -44,9 +45,12 @@
void ShadowRootList::pushShadowRoot(ShadowRoot* shadowRoot)
{
- // FIXME: We don't support multiple shadow root subtrees yet.
- // https://bugs.webkit.org/show_bug.chi?id=77503
+#if ENABLE(SHADOW_DOM)
+ if (!RuntimeEnabledFeatures::multipleShadowSubtreesEnabled())
+ ASSERT(!hasShadowRoot());
+#else
ASSERT(!hasShadowRoot());
+#endif
m_shadowRoots.push(shadowRoot);
}
Modified: trunk/Source/WebCore/testing/Internals.cpp (108002 => 108003)
--- trunk/Source/WebCore/testing/Internals.cpp 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/testing/Internals.cpp 2012-02-17 00:57:19 UTC (rev 108003)
@@ -54,6 +54,12 @@
#include "SpellChecker.h"
#include "TextIterator.h"
+#if ENABLE(SHADOW_DOM)
+#include "RuntimeEnabledFeatures.h"
+#else
+#include <wtf/UnusedParam.h>
+#endif
+
#if ENABLE(INPUT_COLOR)
#include "ColorChooser.h"
#endif
@@ -235,6 +241,15 @@
host->removeShadowRoot();
}
+void Internals::setMultipleShadowSubtreesEnabled(bool enabled)
+{
+#if ENABLE(SHADOW_DOM)
+ RuntimeEnabledFeatures::setMultipleShadowSubtreesEnabled(enabled);
+#else
+ UNUSED_PARAM(enabled);
+#endif
+}
+
Element* Internals::includerFor(Node* node, ExceptionCode& ec)
{
if (!node) {
Modified: trunk/Source/WebCore/testing/Internals.h (108002 => 108003)
--- trunk/Source/WebCore/testing/Internals.h 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/testing/Internals.h 2012-02-17 00:57:19 UTC (rev 108003)
@@ -69,6 +69,7 @@
ShadowRootIfShadowDOMEnabledOrNode* youngestShadowRoot(Element* host, ExceptionCode&);
ShadowRootIfShadowDOMEnabledOrNode* oldestShadowRoot(Element* host, ExceptionCode&);
void removeShadowRoot(Element* host, ExceptionCode&);
+ void setMultipleShadowSubtreesEnabled(bool);
Element* includerFor(Node*, ExceptionCode&);
String shadowPseudoId(Element*, ExceptionCode&);
PassRefPtr<Element> createContentElement(Document*, ExceptionCode&);
Modified: trunk/Source/WebCore/testing/Internals.idl (108002 => 108003)
--- trunk/Source/WebCore/testing/Internals.idl 2012-02-17 00:57:14 UTC (rev 108002)
+++ trunk/Source/WebCore/testing/Internals.idl 2012-02-17 00:57:19 UTC (rev 108003)
@@ -43,6 +43,7 @@
Node youngestShadowRoot(in Element host) raises (DOMException);
Node oldestShadowRoot(in Element host) raises (DOMException);
#endif
+ void setMultipleShadowSubtreesEnabled(in boolean enabled);
Element includerFor(in Node node) raises (DOMException);
void removeShadowRoot(in Element host) raises (DOMException);
DOMString shadowPseudoId(in Element element) raises (DOMException);