summaryrefslogtreecommitdiff
path: root/Source/WebCore/testing/Internals.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-24 16:36:50 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-24 16:36:50 +0100
commitad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch)
treeb34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebCore/testing/Internals.cpp
parent03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff)
downloadqtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebCore/testing/Internals.cpp')
-rw-r--r--Source/WebCore/testing/Internals.cpp67
1 files changed, 54 insertions, 13 deletions
diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp
index 06e34cd3c..84e9cf754 100644
--- a/Source/WebCore/testing/Internals.cpp
+++ b/Source/WebCore/testing/Internals.cpp
@@ -50,15 +50,14 @@
#include "RenderTreeAsText.h"
#include "Settings.h"
#include "ShadowRoot.h"
+#include "ShadowRootList.h"
#include "SpellChecker.h"
#include "TextIterator.h"
-#if ENABLE(GESTURE_EVENTS)
-#include "PlatformGestureEvent.h"
-#endif
-
-#if ENABLE(SMOOTH_SCROLLING)
-#include "ScrollAnimator.h"
+#if ENABLE(SHADOW_DOM)
+#include "RuntimeEnabledFeatures.h"
+#else
+#include <wtf/UnusedParam.h>
#endif
#if ENABLE(INPUT_COLOR)
@@ -157,6 +156,16 @@ bool Internals::isValidContentSelect(Element* contentElement, ExceptionCode& ec)
return toHTMLContentElement(contentElement)->isSelectValid();
}
+bool Internals::attached(Node* node, ExceptionCode& ec)
+{
+ if (!node) {
+ ec = INVALID_ACCESS_ERR;
+ return false;
+ }
+
+ return node->attached();
+}
+
String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec)
{
if (!element) {
@@ -173,11 +182,11 @@ String Internals::elementRenderTreeAsText(Element* element, ExceptionCode& ec)
return representation;
}
-size_t Internals::numberOfScopedHTMLStyleChildren(const Element* element, ExceptionCode& ec) const
+size_t Internals::numberOfScopedHTMLStyleChildren(const Node* scope, ExceptionCode& ec) const
{
- if (element)
+ if (scope && (scope->isElementNode() || scope->isShadowRoot()))
#if ENABLE(STYLE_SCOPED)
- return element->numberOfScopedHTMLStyleChildren();
+ return scope->numberOfScopedHTMLStyleChildren();
#else
return 0;
#endif
@@ -193,20 +202,43 @@ Internals::ShadowRootIfShadowDOMEnabledOrNode* Internals::ensureShadowRoot(Eleme
return 0;
}
- if (ShadowRoot* root = host->shadowRoot())
- return root;
+ if (host->hasShadowRoot())
+ return host->shadowRootList()->youngestShadowRoot();
return ShadowRoot::create(host, ec).get();
}
Internals::ShadowRootIfShadowDOMEnabledOrNode* Internals::shadowRoot(Element* host, ExceptionCode& ec)
{
+ // FIXME: Internals::shadowRoot() in tests should be converted to youngestShadowRoot() or oldestShadowRoot().
+ // https://bugs.webkit.org/show_bug.cgi?id=78465
+ return youngestShadowRoot(host, ec);
+}
+
+Internals::ShadowRootIfShadowDOMEnabledOrNode* Internals::youngestShadowRoot(Element* host, ExceptionCode& ec)
+{
+ if (!host) {
+ ec = INVALID_ACCESS_ERR;
+ return 0;
+ }
+
+ if (!host->hasShadowRoot())
+ return 0;
+
+ return host->shadowRootList()->youngestShadowRoot();
+}
+
+Internals::ShadowRootIfShadowDOMEnabledOrNode* Internals::oldestShadowRoot(Element* host, ExceptionCode& ec)
+{
if (!host) {
ec = INVALID_ACCESS_ERR;
return 0;
}
- return host->shadowRoot();
+ if (!host->hasShadowRoot())
+ return 0;
+
+ return host->shadowRootList()->oldestShadowRoot();
}
void Internals::removeShadowRoot(Element* host, ExceptionCode& ec)
@@ -219,6 +251,15 @@ void Internals::removeShadowRoot(Element* host, ExceptionCode& ec)
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) {
@@ -226,7 +267,7 @@ Element* Internals::includerFor(Node* node, ExceptionCode& ec)
return 0;
}
- return NodeRenderingContext(node).includer();
+ return NodeRenderingContext(node).insertionPoint();
}
String Internals::shadowPseudoId(Element* element, ExceptionCode& ec)