diff options
Diffstat (limited to 'Source/WebCore/testing')
-rw-r--r-- | Source/WebCore/testing/InternalSettings.cpp | 11 | ||||
-rw-r--r-- | Source/WebCore/testing/InternalSettings.h | 1 | ||||
-rw-r--r-- | Source/WebCore/testing/InternalSettings.idl | 1 | ||||
-rw-r--r-- | Source/WebCore/testing/Internals.cpp | 37 | ||||
-rw-r--r-- | Source/WebCore/testing/Internals.h | 7 | ||||
-rw-r--r-- | Source/WebCore/testing/Internals.idl | 3 |
6 files changed, 55 insertions, 5 deletions
diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp index a4dbb44bf..c2b045dca 100644 --- a/Source/WebCore/testing/InternalSettings.cpp +++ b/Source/WebCore/testing/InternalSettings.cpp @@ -271,4 +271,15 @@ void InternalSettings::setPerTileDrawingEnabled(bool enabled, ExceptionCode& ec) settings()->setPerTileDrawingEnabled(enabled); } +void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode& ec) +{ +#if ENABLE(TOUCH_EVENTS) + InternalSettingsGuardForSettings(); + settings()->setTouchEventEmulationEnabled(enabled); +#else + UNUSED_PARAM(enabled); + UNUSED_PARAM(ec); +#endif +} + } diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h index be9328ee7..64800926c 100644 --- a/Source/WebCore/testing/InternalSettings.h +++ b/Source/WebCore/testing/InternalSettings.h @@ -64,6 +64,7 @@ public: float pageScaleFactor(ExceptionCode&); void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&); void setPerTileDrawingEnabled(bool enabled, ExceptionCode&); + void setTouchEventEmulationEnabled(bool enabled, ExceptionCode&); private: InternalSettings(Frame*, InternalSettings* old); diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl index c2f5b2ac7..036008384 100644 --- a/Source/WebCore/testing/InternalSettings.idl +++ b/Source/WebCore/testing/InternalSettings.idl @@ -44,6 +44,7 @@ module window { boolean unifiedTextCheckingEnabled() raises (DOMException); float pageScaleFactor() raises(DOMException); void setPageScaleFactor(in float scaleFactor, in long x, in long y) raises(DOMException); + void setTouchEventEmulationEnabled(in boolean enabled) raises(DOMException); }; } diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index 16447fc60..06e34cd3c 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -193,7 +193,10 @@ Internals::ShadowRootIfShadowDOMEnabledOrNode* Internals::ensureShadowRoot(Eleme return 0; } - return host->ensureShadowRoot(); + if (ShadowRoot* root = host->shadowRoot()) + return root; + + return ShadowRoot::create(host, ec).get(); } Internals::ShadowRootIfShadowDOMEnabledOrNode* Internals::shadowRoot(Element* host, ExceptionCode& ec) @@ -278,7 +281,7 @@ unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc return node->document()->markers()->markersFor(node, markerTypes).size(); } -PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) +DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) { if (!node) { ec = INVALID_ACCESS_ERR; @@ -294,7 +297,23 @@ PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(node, markerTypes); if (markers.size() <= index) return 0; - return Range::create(node->document(), node, markers[index]->startOffset(), node, markers[index]->endOffset()); + return markers[index]; +} + +PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) +{ + DocumentMarker* marker = markerAt(node, markerType, index, ec); + if (!marker) + return 0; + return Range::create(node->document(), node, marker->startOffset(), node, marker->endOffset()); +} + +String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) +{ + DocumentMarker* marker = markerAt(node, markerType, index, ec); + if (!marker) + return String(); + return marker->description(); } void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionCode& ec) @@ -539,5 +558,15 @@ bool Internals::shouldDisplayTrackKind(Document* document, const String& kind, E return false; #endif } - + +unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec) +{ + if (!document) { + ec = INVALID_ACCESS_ERR; + return 0; + } + + return document->wheelEventHandlerCount(); +} + } diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h index b87253106..439dc75c6 100644 --- a/Source/WebCore/testing/Internals.h +++ b/Source/WebCore/testing/Internals.h @@ -36,6 +36,7 @@ namespace WebCore { class ClientRect; class Document; +class DocumentMarker; class Element; class InternalSettings; class Node; @@ -79,7 +80,8 @@ public: PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&); unsigned markerCountForNode(Node*, const String&, ExceptionCode&); - PassRefPtr<Range> markerRangeForNode(Node*, const String&, unsigned, ExceptionCode&); + PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&); + String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&); void setScrollViewPosition(Document*, long x, long y, ExceptionCode&); @@ -105,12 +107,15 @@ public: void setShouldDisplayTrackKind(Document*, const String& kind, bool, ExceptionCode&); bool shouldDisplayTrackKind(Document*, const String& kind, ExceptionCode&); + unsigned wheelEventHandlerCount(Document*, ExceptionCode&); + static const char* internalsId; InternalSettings* settings() const { return m_settings.get(); } private: explicit Internals(Document*); + DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&); RefPtr<InternalSettings> m_settings; }; diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl index da081f5aa..9bf05751d 100644 --- a/Source/WebCore/testing/Internals.idl +++ b/Source/WebCore/testing/Internals.idl @@ -53,6 +53,7 @@ module window { ClientRect boundingBox(in Element element) raises(DOMException); unsigned long markerCountForNode(in Node node, in DOMString markerType) raises(DOMException); Range markerRangeForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException); + DOMString markerDescriptionForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException); void setScrollViewPosition(in Document document, in long x, in long y) raises(DOMException); @@ -79,6 +80,8 @@ module window { #endif attribute [Custom] Array userPreferredLanguages; + unsigned long wheelEventHandlerCount(in Document document) raises (DOMException); + readonly attribute InternalSettings settings; }; } |