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:
LayoutTests: 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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108003
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-15 Shinya Kawanaka <shinyak@chromium.org>
+
+ 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 <mhahnenberg@apple.com>
Fix the broken viewport tests
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="../../js/resources/js-test-post.js"></script>
</body>
+2012-02-15 Shinya Kawanaka <shinyak@chromium.org>
+
+ 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 <mhahnenberg@apple.com>
Fix the broken viewport tests
#endif
__ZNK7WebCore4Node31numberOfScopedHTMLStyleChildrenEv
+
+#if ENABLE(SHADOW_DOM)
+__ZN7WebCore22RuntimeEnabledFeatures32setMultipleShadowSubtreesEnabledEb
+#endif
#if ENABLE(SHADOW_DOM)
bool RuntimeEnabledFeatures::isShadowDOMEnabled = false;
+bool RuntimeEnabledFeatures::isMultipleShadowSubtreesEnabled = false;
#endif
} // namespace WebCore
#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:
#if ENABLE(SHADOW_DOM)
static bool isShadowDOMEnabled;
+ static bool isMultipleShadowSubtreesEnabled;
#endif
};
#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)
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;
}
#include "Document.h"
#include "Element.h"
+#include "RuntimeEnabledFeatures.h"
#include "ShadowRoot.h"
namespace WebCore {
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);
}
#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
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) {
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&);
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);