2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef DumpRenderTreeSupportGtk_h
20 #define DumpRenderTreeSupportGtk_h
22 #include "JSStringRef.h"
23 #include <webkit/webkitdefines.h>
27 #include <webkit/webkitdefines.h>
28 #include <webkit/webkitwebframe.h>
29 #include <wtf/text/CString.h>
34 WebFindOptionsCaseInsensitive = 1 << 0,
35 WebFindOptionsAtWordStarts = 1 << 1,
36 WebFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
37 WebFindOptionsBackwards = 1 << 3,
38 WebFindOptionsWrapAround = 1 << 4,
39 WebFindOptionsStartInSelection = 1 << 5
43 typedef unsigned WebKitFindOptions;
45 class DumpRenderTreeSupportGtk {
48 DumpRenderTreeSupportGtk();
49 ~DumpRenderTreeSupportGtk();
51 static void setDumpRenderTreeModeEnabled(bool);
52 static bool dumpRenderTreeModeEnabled();
54 static void setLinksIncludedInFocusChain(bool);
55 static bool linksIncludedInFocusChain();
56 static void setSelectTrailingWhitespaceEnabled(bool);
57 static bool selectTrailingWhitespaceEnabled();
59 static JSValueRef nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping);
60 static void dumpConfigurationForViewport(WebKitWebView* webView, gint deviceDPI, gint deviceWidth, gint deviceHeight, gint availableWidth, gint availableHeight);
62 static void clearOpener(WebKitWebFrame*);
64 // FIXME: Move these to webkitwebframe.h once their API has been discussed.
65 static GSList* getFrameChildren(WebKitWebFrame*);
66 static WTF::CString getInnerText(WebKitWebFrame*);
67 static WTF::CString dumpRenderTree(WebKitWebFrame*);
68 static WTF::CString counterValueForElementById(WebKitWebFrame*, const char* id);
69 static int pageNumberForElementById(WebKitWebFrame*, const char* id, float pageWidth, float pageHeight);
70 static int numberOfPagesForFrame(WebKitWebFrame*, float pageWidth, float pageHeight);
71 static WTF::CString pageProperty(WebKitWebFrame*, const char* propertyName, int pageNumber);
72 static bool isPageBoxVisible(WebKitWebFrame*, int pageNumber);
73 static WTF::CString pageSizeAndMarginsInPixels(WebKitWebFrame*, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft);
74 static void addUserStyleSheet(WebKitWebFrame*, const char* sourceCode, bool allFrames);
75 static guint getPendingUnloadEventCount(WebKitWebFrame*);
76 static bool pauseAnimation(WebKitWebFrame*, const char* name, double time, const char* element);
77 static bool pauseTransition(WebKitWebFrame*, const char* name, double time, const char* element);
78 static bool pauseSVGAnimation(WebKitWebFrame*, const char* animationId, double time, const char* elementId);
79 static WTF::CString markerTextForListItem(WebKitWebFrame*, JSContextRef, JSValueRef nodeObject);
80 static unsigned int numberOfActiveAnimations(WebKitWebFrame*);
81 static void suspendAnimations(WebKitWebFrame*);
82 static void resumeAnimations(WebKitWebFrame*);
83 static void clearMainFrameName(WebKitWebFrame*);
84 static AtkObject* getFocusedAccessibleElement(WebKitWebFrame*);
85 static AtkObject* getRootAccessibleElement(WebKitWebFrame*);
86 static void layoutFrame(WebKitWebFrame*);
87 static void setAutofilled(JSContextRef, JSValueRef, bool);
88 static void setValueForUser(JSContextRef, JSValueRef, JSStringRef);
91 static void executeCoreCommandByName(WebKitWebView*, const gchar* name, const gchar* value);
92 static bool isCommandEnabled(WebKitWebView*, const gchar* name);
93 static bool findString(WebKitWebView*, const gchar*, WebKitFindOptions);
94 static void setComposition(WebKitWebView*, const char* text, int start, int end);
95 static void confirmComposition(WebKitWebView*, const char* text);
96 static bool firstRectForCharacterRange(WebKitWebView*, int location, int length, GdkRectangle*);
97 static bool selectedRange(WebKitWebView*, int* start, int* end);
98 static double defaultMinimumTimerInterval(); // Not really tied to WebView
99 static void setMinimumTimerInterval(WebKitWebView*, double);
102 static void gcCollectJavascriptObjects();
103 static void gcCollectJavascriptObjectsOnAlternateThread(bool waitUntilDone);
104 static unsigned long gcCountJavascriptObjects();
106 static void whiteListAccessFromOrigin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains);
107 static void resetOriginAccessWhiteLists();
108 static unsigned int workerThreadCount();
109 static bool webkitWebFrameSelectionHasSpellingMarker(WebKitWebFrame*, gint from, gint length);
112 static bool s_drtRun;
113 static bool s_linksIncludedInTabChain;
114 static bool s_selectTrailingWhitespaceEnabled;