Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / testing / Internals.h
index 085f711..abf1f8d 100644 (file)
 #ifndef Internals_h
 #define Internals_h
 
-#include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "bindings/v8/ScriptPromise.h"
-#include "bindings/v8/ScriptValue.h"
+#include "bindings/core/v8/ExceptionStatePlaceholder.h"
+#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/ScriptWrappable.h"
 #include "core/css/CSSComputedStyleDeclaration.h"
 #include "core/dom/ContextLifecycleObserver.h"
-#include "core/dom/NodeList.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
-#include "wtf/ArrayBuffer.h"
+#include "platform/heap/Handle.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
 
-namespace WebCore {
+namespace blink {
 
+class CanvasRenderingContext2D;
 class ClientRect;
 class ClientRectList;
+class DOMArrayBuffer;
 class DOMPoint;
 class DOMStringList;
-class DOMWindow;
+class DictionaryTest;
 class Document;
+class DocumentFragment;
 class DocumentMarker;
 class Element;
 class ExceptionState;
-class Frame;
+class ExecutionContext;
 class GCObservation;
-class InspectorFrontendChannelDummy;
+class HTMLElement;
+class HTMLMediaElement;
 class InternalProfilers;
 class InternalRuntimeFlags;
 class InternalSettings;
+class Iterator;
 class LayerRectList;
-class MallocStatistics;
+class LocalDOMWindow;
+class LocalFrame;
 class Node;
 class Page;
 class PagePopupController;
+class PrivateScriptTest;
 class Range;
-class ExecutionContext;
 class SerializedScriptValue;
 class ShadowRoot;
 class TypeConversions;
+class UnionTypesTest;
+template <typename NodeType> class StaticNodeTypeList;
+typedef StaticNodeTypeList<Node> StaticNodeList;
 
-class Internals FINAL : public RefCounted<Internals>
-    , public ContextLifecycleObserver {
+class Internals final : public GarbageCollectedFinalized<Internals>, public ScriptWrappable, public ContextLifecycleObserver {
+    DEFINE_WRAPPERTYPEINFO();
 public:
-    static PassRefPtr<Internals> create(Document*);
+    static Internals* create(Document*);
     virtual ~Internals();
 
     static void resetToConsistentState(Page*);
@@ -79,86 +88,74 @@ public:
 
     String address(Node*);
 
-    PassRefPtr<GCObservation> observeGC(ScriptValue);
+    GCObservation* observeGC(ScriptValue);
 
     bool isPreloaded(const String& url);
     bool isLoadingFromMemoryCache(const String& url);
 
-    void crash();
-
-    void setStyleResolverStatsEnabled(bool);
-    String styleResolverStatsReport(ExceptionState&) const;
-    String styleResolverStatsTotalsReport(ExceptionState&) const;
+    bool isSharingStyle(Element*, Element*) const;
 
-    bool isSharingStyle(Element*, Element*, ExceptionState&) const;
+    PassRefPtrWillBeRawPtr<CSSStyleDeclaration> computedStyleIncludingVisitedInfo(Node*) const;
 
-    size_t numberOfScopedHTMLStyleChildren(const Node*, ExceptionState&) const;
-    PassRefPtr<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Node*, ExceptionState&) const;
+    PassRefPtrWillBeRawPtr<ShadowRoot> createUserAgentShadowRoot(Element* host);
 
-    ShadowRoot* ensureShadowRoot(Element* host, ExceptionState&);
-    ShadowRoot* shadowRoot(Element* host, ExceptionState&);
-    ShadowRoot* youngestShadowRoot(Element* host, ExceptionState&);
-    ShadowRoot* oldestShadowRoot(Element* host, ExceptionState&);
+    ShadowRoot* shadowRoot(Element* host);
+    ShadowRoot* youngestShadowRoot(Element* host);
+    ShadowRoot* oldestShadowRoot(Element* host);
     ShadowRoot* youngerShadowRoot(Node* shadow, ExceptionState&);
-    ShadowRoot* olderShadowRoot(Node* shadow, ExceptionState&);
     String shadowRootType(const Node*, ExceptionState&) const;
     bool hasShadowInsertionPoint(const Node*, ExceptionState&) const;
     bool hasContentElement(const Node*, ExceptionState&) const;
     size_t countElementShadow(const Node*, ExceptionState&) const;
-    const AtomicString& shadowPseudoId(Element*, ExceptionState&);
-    void setShadowPseudoId(Element*, const AtomicString&, ExceptionState&);
+    const AtomicString& shadowPseudoId(Element*);
 
     // CSS Animation / Transition testing.
-    unsigned numberOfActiveAnimations() const;
     void pauseAnimations(double pauseTime, ExceptionState&);
 
-    PassRefPtr<Element> createContentElement(ExceptionState&);
     bool isValidContentSelect(Element* insertionPoint, ExceptionState&);
-    Node* treeScopeRootNode(Node*, ExceptionState&);
-    Node* parentTreeScope(Node*, ExceptionState&);
+    Node* treeScopeRootNode(Node*);
+    Node* parentTreeScope(Node*);
     bool hasSelectorForIdInShadow(Element* host, const AtomicString& idValue, ExceptionState&);
     bool hasSelectorForClassInShadow(Element* host, const AtomicString& className, ExceptionState&);
     bool hasSelectorForAttributeInShadow(Element* host, const AtomicString& attributeName, ExceptionState&);
     bool hasSelectorForPseudoClassInShadow(Element* host, const String& pseudoClass, ExceptionState&);
     unsigned short compareTreeScopePosition(const Node*, const Node*, ExceptionState&) const;
 
-    // FIXME: Rename these functions if walker is prefered.
-    Node* nextSiblingByWalker(Node*, ExceptionState&);
-    Node* firstChildByWalker(Node*, ExceptionState&);
-    Node* lastChildByWalker(Node*, ExceptionState&);
-    Node* nextNodeByWalker(Node*, ExceptionState&);
-    Node* previousNodeByWalker(Node*, ExceptionState&);
+    // FIXME: Rename these functions if walker is preferred.
+    Node* nextSiblingByWalker(Node*);
+    Node* firstChildByWalker(Node*);
+    Node* lastChildByWalker(Node*);
+    Node* nextNodeByWalker(Node*);
+    Node* previousNodeByWalker(Node*);
 
     unsigned updateStyleAndReturnAffectedElementCount(ExceptionState&) const;
     unsigned needsLayoutCount(ExceptionState&) const;
+    unsigned hitTestCount(Document*, ExceptionState&) const;
 
     String visiblePlaceholder(Element*);
     void selectColorInColorChooser(Element*, const String& colorValue);
+    void endColorChooser(Element*);
     bool hasAutofocusRequest(Document*);
     bool hasAutofocusRequest();
     Vector<String> formControlStateOfHistoryItem(ExceptionState&);
     void setFormControlStateOfHistoryItem(const Vector<String>&, ExceptionState&);
     void setEnableMockPagePopup(bool, ExceptionState&);
-    PassRefPtr<PagePopupController> pagePopupController();
+    PassRefPtrWillBeRawPtr<PagePopupController> pagePopupController();
+    LocalDOMWindow* pagePopupWindow() const;
 
-    PassRefPtr<ClientRect> unscaledViewportRect(ExceptionState&);
+    PassRefPtrWillBeRawPtr<ClientRect> absoluteCaretBounds(ExceptionState&);
 
-    PassRefPtr<ClientRect> absoluteCaretBounds(ExceptionState&);
-
-    PassRefPtr<ClientRect> boundingBox(Element*, ExceptionState&);
-
-    PassRefPtr<ClientRectList> inspectorHighlightRects(Document*, ExceptionState&);
+    PassRefPtrWillBeRawPtr<ClientRect> boundingBox(Element*);
 
     unsigned markerCountForNode(Node*, const String&, ExceptionState&);
-    unsigned activeMarkerCountForNode(Node*, ExceptionState&);
-    PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionState&);
+    unsigned activeMarkerCountForNode(Node*);
+    PassRefPtrWillBeRawPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionState&);
     String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionState&);
     void addTextMatchMarker(const Range*, bool isActive);
-    void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool, ExceptionState&);
+    void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool);
+    void setMarkedTextMatchesAreHighlighted(Document*, bool);
 
-    void setScrollViewPosition(Document*, long x, long y, ExceptionState&);
-    void setPagination(Document* document, const String& mode, int gap, ExceptionState& ec) { setPagination(document, mode, gap, 0, ec); }
-    void setPagination(Document*, const String& mode, int gap, int pageLength, ExceptionState&);
+    void setFrameViewPosition(Document*, long x, long y, ExceptionState&);
     String viewportAsText(Document*, float devicePixelRatio, int availableWidth, int availableHeight, ExceptionState&);
 
     bool wasLastChangeUserEdit(Element* textField, ExceptionState&);
@@ -169,18 +166,16 @@ public:
     void setAutofilled(Element*, bool enabled, ExceptionState&);
     void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionState&);
 
-    void paintControlTints(Document*, ExceptionState&);
-
-    PassRefPtr<Range> rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionState&);
-    unsigned locationFromRange(Element* scope, const Range*, ExceptionState&);
-    unsigned lengthFromRange(Element* scope, const Range*, ExceptionState&);
-    String rangeAsText(const Range*, ExceptionState&);
+    PassRefPtrWillBeRawPtr<Range> rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength);
+    unsigned locationFromRange(Element* scope, const Range*);
+    unsigned lengthFromRange(Element* scope, const Range*);
+    String rangeAsText(const Range*);
 
-    PassRefPtr<DOMPoint> touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document*, ExceptionState&);
+    DOMPoint* touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document*, ExceptionState&);
     Node* touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document*, ExceptionState&);
-    PassRefPtr<DOMPoint> touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document*, ExceptionState&);
+    DOMPoint* touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document*, ExceptionState&);
     Node* touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document*, ExceptionState&);
-    PassRefPtr<ClientRect> bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document*, ExceptionState&);
+    PassRefPtrWillBeRawPtr<ClientRect> bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document*, ExceptionState&);
 
     int lastSpellCheckRequestSequence(Document*, ExceptionState&);
     int lastSpellCheckProcessedSequence(Document*, ExceptionState&);
@@ -188,27 +183,26 @@ public:
     Vector<AtomicString> userPreferredLanguages() const;
     void setUserPreferredLanguages(const Vector<String>&);
 
-    unsigned wheelEventHandlerCount(Document*, ExceptionState&);
-    unsigned touchEventHandlerCount(Document*, ExceptionState&);
-    PassRefPtr<LayerRectList> touchEventTargetLayerRects(Document*, ExceptionState&);
+    unsigned activeDOMObjectCount(Document*);
+    unsigned wheelEventHandlerCount(Document*);
+    unsigned scrollEventHandlerCount(Document*);
+    unsigned touchEventHandlerCount(Document*);
+    LayerRectList* touchEventTargetLayerRects(Document*, ExceptionState&);
 
     // This is used to test rect based hit testing like what's done on touch screens.
-    PassRefPtr<NodeList> nodesFromRect(Document*, int x, int y, unsigned topPadding, unsigned rightPadding,
-        unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionState&) const;
+    PassRefPtrWillBeRawPtr<StaticNodeList> nodesFromRect(Document*, int x, int y, unsigned topPadding, unsigned rightPadding,
+        unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowChildFrameContent, ExceptionState&) const;
 
-    void emitInspectorDidBeginFrame(int frameId = 0);
-    void emitInspectorDidCancelFrame();
+    bool hasSpellingMarker(Document*, int from, int length);
+    bool hasGrammarMarker(Document*, int from, int length);
+    void setContinuousSpellCheckingEnabled(bool);
 
-    bool hasSpellingMarker(Document*, int from, int length, ExceptionState&);
-    bool hasGrammarMarker(Document*, int from, int length, ExceptionState&);
-    void setContinuousSpellCheckingEnabled(bool enabled, ExceptionState&);
+    bool isOverwriteModeEnabled(Document*);
+    void toggleOverwriteModeEnabled(Document*);
 
-    bool isOverwriteModeEnabled(Document*, ExceptionState&);
-    void toggleOverwriteModeEnabled(Document*, ExceptionState&);
+    unsigned numberOfScrollableAreas(Document*);
 
-    unsigned numberOfScrollableAreas(Document*, ExceptionState&);
-
-    bool isPageBoxVisible(Document*, int pageNumber, ExceptionState&);
+    bool isPageBoxVisible(Document*, int pageNumber);
 
     static const char* internalsId;
 
@@ -224,35 +218,24 @@ public:
     String elementLayerTreeAsText(Element*, unsigned flags, ExceptionState&) const;
     String elementLayerTreeAsText(Element*, ExceptionState&) const;
 
-    PassRefPtr<NodeList> paintOrderListBeforePromote(Element*, ExceptionState&);
-    PassRefPtr<NodeList> paintOrderListAfterPromote(Element*, ExceptionState&);
-
     bool scrollsWithRespectTo(Element*, Element*, ExceptionState&);
-    bool isUnclippedDescendant(Element*, ExceptionState&);
-    bool needsCompositedScrolling(Element*, ExceptionState&);
-
-    void setNeedsCompositedScrolling(Element*, unsigned value, ExceptionState&);
 
-    String repaintRectsAsText(Document*, ExceptionState&) const;
-    PassRefPtr<ClientRectList> repaintRects(Element*, ExceptionState&) const;
-
-    String scrollingStateTreeAsText(Document*, ExceptionState&) const;
+    String scrollingStateTreeAsText(Document*) const;
     String mainThreadScrollingReasons(Document*, ExceptionState&) const;
-    PassRefPtr<ClientRectList> nonFastScrollableRects(Document*, ExceptionState&) const;
+    PassRefPtrWillBeRawPtr<ClientRectList> nonFastScrollableRects(Document*, ExceptionState&) const;
 
-    void garbageCollectDocumentResources(Document*, ExceptionState&) const;
+    void garbageCollectDocumentResources(Document*) const;
     void evictAllResources() const;
 
-    void allowRoundingHacks() const;
-
     unsigned numberOfLiveNodes() const;
     unsigned numberOfLiveDocuments() const;
     String dumpRefCountedInstanceCounts() const;
     Vector<String> consoleMessageArgumentCounts(Document*) const;
-    PassRefPtr<DOMWindow> openDummyInspectorFrontend(const String& url);
+    PassRefPtrWillBeRawPtr<LocalDOMWindow> openDummyInspectorFrontend(const String& url);
     void closeDummyInspectorFrontend();
     Vector<unsigned long> setMemoryCacheCapacities(unsigned long minDeadBytes, unsigned long maxDeadBytes, unsigned long totalBytes);
     void setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionState&);
+    String inspectorHighlightJSON(Node*, ExceptionState&);
 
     String counterValue(Element*);
 
@@ -268,16 +251,19 @@ public:
 
     void setIsCursorVisible(Document*, bool, ExceptionState&);
 
-    void webkitWillEnterFullScreenForElement(Document*, Element*);
-    void webkitDidEnterFullScreenForElement(Document*, Element*);
-    void webkitWillExitFullScreenForElement(Document*, Element*);
-    void webkitDidExitFullScreenForElement(Document*, Element*);
+    void mediaPlayerRequestFullscreen(HTMLMediaElement*);
+    double effectiveMediaVolume(HTMLMediaElement*);
+
+    void mediaPlayerRemoteRouteAvailabilityChanged(HTMLMediaElement*, bool);
+    void mediaPlayerPlayingRemotelyChanged(HTMLMediaElement*, bool);
 
     void registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme);
     void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme);
 
-    PassRefPtr<MallocStatistics> mallocStatistics() const;
-    PassRefPtr<TypeConversions> typeConversions() const;
+    TypeConversions* typeConversions() const;
+    PrivateScriptTest* privateScriptTest() const;
+    DictionaryTest* dictionaryTest() const;
+    UnionTypesTest* unionTypesTest() const;
 
     Vector<String> getReferencedFilePaths() const;
 
@@ -285,25 +271,27 @@ public:
     void stopTrackingRepaints(Document*, ExceptionState&);
     void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionState&);
     void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*, ExceptionState&);
+    void forceFullRepaint(Document*, ExceptionState&);
 
-    PassRefPtr<ClientRectList> draggableRegions(Document*, ExceptionState&);
-    PassRefPtr<ClientRectList> nonDraggableRegions(Document*, ExceptionState&);
+    PassRefPtrWillBeRawPtr<ClientRectList> draggableRegions(Document*, ExceptionState&);
+    PassRefPtrWillBeRawPtr<ClientRectList> nonDraggableRegions(Document*, ExceptionState&);
 
-    PassRefPtr<ArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const;
-    PassRefPtr<SerializedScriptValue> deserializeBuffer(PassRefPtr<ArrayBuffer>) const;
+    PassRefPtr<DOMArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const;
+    PassRefPtr<SerializedScriptValue> deserializeBuffer(PassRefPtr<DOMArrayBuffer>) const;
 
     String getCurrentCursorInfo(Document*, ExceptionState&);
 
-    String markerTextForListItem(Element*, ExceptionState&);
+    String markerTextForListItem(Element*);
 
     void forceReload(bool endToEnd);
 
-    String getImageSourceURL(Element*, ExceptionState&);
+    String getImageSourceURL(Element*);
 
     bool isSelectPopupVisible(Node*);
+    bool selectPopupItemStyleIsRtl(Node*, int);
+    int selectPopupItemStyleFontHeight(Node*, int);
 
-    PassRefPtr<ClientRect> selectionBounds(ExceptionState&);
-    String baseURL(Document*, ExceptionState&);
+    PassRefPtrWillBeRawPtr<ClientRect> selectionBounds(ExceptionState&);
 
     bool loseSharedGraphicsContext3D();
 
@@ -311,23 +299,53 @@ public:
 
     void setZoomFactor(float);
 
-    ScriptPromise addOneToPromise(ExecutionContext*, ScriptPromise);
+    void setShouldRevealPassword(Element*, bool, ExceptionState&);
+
+    ScriptPromise createResolvedPromise(ScriptState*, ScriptValue);
+    ScriptPromise createRejectedPromise(ScriptState*, ScriptValue);
+    ScriptPromise addOneToPromise(ScriptState*, ScriptPromise);
+    ScriptPromise promiseCheck(ScriptState*, long, bool, const Dictionary&, const String&, const Vector<String>&, ExceptionState&);
+    ScriptPromise promiseCheckWithoutExceptionState(ScriptState*, const Dictionary&, const String&, const Vector<String>&);
+    ScriptPromise promiseCheckRange(ScriptState*, long);
+    ScriptPromise promiseCheckOverload(ScriptState*, Location*);
+    ScriptPromise promiseCheckOverload(ScriptState*, Document*);
+    ScriptPromise promiseCheckOverload(ScriptState*, Location*, long, long);
+
+    void trace(Visitor*);
+
+    void setValueForUser(Element*, const String&);
+
+    String textSurroundingNode(Node*, int x, int y, unsigned long maxLength);
+
+    void setFocused(bool);
+
+    bool ignoreLayoutWithPendingStylesheets(Document*);
+
+    void setNetworkStateNotifierTestOnly(bool);
+    // Test must call setNetworkStateNotifierTestOnly(true) before calling setNetworkConnectionInfo.
+    void setNetworkConnectionInfo(const String&, ExceptionState&);
+    String serializeNavigationMarkup();
+    void hideAllTransitionElements();
+
+    unsigned countHitRegions(CanvasRenderingContext2D*);
+
+    void forcePluginPlaceholder(HTMLElement* plugin, PassRefPtrWillBeRawPtr<DocumentFragment>, ExceptionState&);
+    void forcePluginPlaceholder(HTMLElement* plugin, const Dictionary& options, ExceptionState&);
+
+    Iterator* iterator(ScriptState*, ExceptionState&);
 
 private:
     explicit Internals(Document*);
     Document* contextDocument() const;
-    Frame* frame() const;
+    LocalFrame* frame() const;
     Vector<String> iconURLs(Document*, int iconTypesMask) const;
-    PassRefPtr<ClientRectList> annotatedRegions(Document*, bool draggable, ExceptionState&);
+    PassRefPtrWillBeRawPtr<ClientRectList> annotatedRegions(Document*, bool draggable, ExceptionState&);
 
     DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionState&);
-    RefPtr<DOMWindow> m_frontendWindow;
-    OwnPtr<InspectorFrontendChannelDummy> m_frontendChannel;
-    RefPtr<InternalRuntimeFlags> m_runtimeFlags;
-    RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
-    RefPtr<InternalProfilers> m_profilers;
+    Member<InternalRuntimeFlags> m_runtimeFlags;
+    Member<InternalProfilers> m_profilers;
 };
 
-} // namespace WebCore
+} // namespace blink
 
-#endif
+#endif // Internals_h