WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
[WebKit-https.git] / Source / WebKit / qt / WebCoreSupport / DumpRenderTreeSupportQt.cpp
1 /*
2     Copyright (C) 2010 Robert Hogan <robert@roberthogan.net>
3     Copyright (C) 2008,2009,2010 Nokia Corporation and/or its subsidiary(-ies)
4     Copyright (C) 2007 Staikos Computing Services Inc.
5     Copyright (C) 2007 Apple Inc.
6
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Library General Public
9     License as published by the Free Software Foundation; either
10     version 2 of the License, or (at your option) any later version.
11
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15     Library General Public License for more details.
16
17     You should have received a copy of the GNU Library General Public License
18     along with this library; see the file COPYING.LIB.  If not, write to
19     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20     Boston, MA 02110-1301, USA.
21 */
22
23 #include "config.h"
24 #include "DumpRenderTreeSupportQt.h"
25
26 #if USE(JSC)
27 #include "APICast.h"
28 #endif
29 #include "ApplicationCacheStorage.h"
30 #include "CSSComputedStyleDeclaration.h"
31 #include "ChromeClientQt.h"
32 #include "ContainerNode.h"
33 #include "ContextMenu.h"
34 #include "ContextMenuClientQt.h"
35 #include "ContextMenuController.h"
36 #include "DeviceOrientation.h"
37 #include "DeviceOrientationClientMock.h"
38 #include "DeviceOrientationController.h"
39 #include "DocumentLoader.h"
40 #include "Editor.h"
41 #include "EditorClientQt.h"
42 #include "Element.h"
43 #include "FocusController.h"
44 #include "Frame.h"
45 #include "FrameLoaderClientQt.h"
46 #include "FrameView.h"
47 #if USE(JSC)
48 #include "GCController.h"
49 #include "JSNode.h"
50 #include "qt_runtime.h"
51 #elif USE(V8)
52 #include "V8GCController.h"
53 #include "V8Proxy.h"
54 #endif
55 #include "GeolocationClient.h"
56 #include "GeolocationClientMock.h"
57 #include "GeolocationController.h"
58 #include "GeolocationError.h"
59 #include "GeolocationPosition.h"
60 #include "HistoryItem.h"
61 #include "HTMLInputElement.h"
62 #include "InitWebCoreQt.h"
63 #include "InspectorController.h"
64 #include "NodeList.h"
65 #include "NotificationPresenterClientQt.h"
66 #include "Page.h"
67 #include "PageGroup.h"
68 #include "PluginDatabase.h"
69 #include "PluginView.h"
70 #include "PositionError.h"
71 #include "PrintContext.h"
72 #include "RenderListItem.h"
73 #include "RenderTreeAsText.h"
74 #include "SchemeRegistry.h"
75 #include "ScriptController.h"
76 #include "ScriptSourceCode.h"
77 #include "ScriptValue.h"
78 #include "SecurityOrigin.h"
79 #include "SecurityPolicy.h"
80 #include "Settings.h"
81 #include "TextIterator.h"
82 #include "ThirdPartyCookiesQt.h"
83 #include "WebCoreTestSupport.h"
84 #include "WorkerThread.h"
85 #include <wtf/CurrentTime.h>
86
87 #include "qwebelement.h"
88 #include "qwebframe.h"
89 #include "qwebframe_p.h"
90 #include "qwebhistory.h"
91 #include "qwebhistory_p.h"
92 #include "qwebpage.h"
93 #include "qwebpage_p.h"
94 #include "qwebscriptworld.h"
95
96 #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
97 #include "HTMLVideoElement.h"
98 #include "MediaPlayerPrivateQt.h"
99 #endif
100
101 #include <QAction>
102 #include <QMenu>
103 #include <QPainter>
104
105 using namespace WebCore;
106
107 QMap<int, QWebScriptWorld*> m_worldMap;
108
109 #if ENABLE(GEOLOCATION)
110 GeolocationClientMock* toGeolocationClientMock(GeolocationClient* client)
111 {
112      ASSERT(QWebPagePrivate::drtRun);
113      return static_cast<GeolocationClientMock*>(client);
114 }
115 #endif
116
117 #if ENABLE(DEVICE_ORIENTATION)
118 DeviceOrientationClientMock* toDeviceOrientationClientMock(DeviceOrientationClient* client)
119 {
120     ASSERT(QWebPagePrivate::drtRun);
121     return static_cast<DeviceOrientationClientMock*>(client);
122 }
123 #endif
124
125 QDRTNode::QDRTNode()
126     : m_node(0)
127 {
128 }
129
130 QDRTNode::QDRTNode(WebCore::Node* node)
131     : m_node(0)
132 {
133     if (node) {
134         m_node = node;
135         m_node->ref();
136     }
137 }
138
139 QDRTNode::~QDRTNode()
140 {
141     if (m_node)
142         m_node->deref();
143 }
144
145 QDRTNode::QDRTNode(const QDRTNode& other)
146     :m_node(other.m_node)
147 {
148     if (m_node)
149         m_node->ref();
150 }
151
152 QDRTNode& QDRTNode::operator=(const QDRTNode& other)
153 {
154     if (this != &other) {
155         Node* otherNode = other.m_node;
156         if (otherNode)
157             otherNode->ref();
158         if (m_node)
159             m_node->deref();
160         m_node = otherNode;
161     }
162     return *this;
163 }
164
165 #if USE(JSC)
166 QDRTNode QtDRTNodeRuntime::create(WebCore::Node* node)
167 {
168     return QDRTNode(node);
169 }
170
171 WebCore::Node* QtDRTNodeRuntime::get(const QDRTNode& node)
172 {
173     return node.m_node;
174 }
175
176 static QVariant convertJSValueToNodeVariant(JSC::JSObject* object, int *distance, HashSet<JSC::JSObject*>*)
177 {
178     if (!object || !object->inherits(&JSNode::s_info))
179         return QVariant();
180     return QVariant::fromValue<QDRTNode>(QtDRTNodeRuntime::create((static_cast<JSNode*>(object))->impl()));
181 }
182
183 static JSC::JSValue convertNodeVariantToJSValue(JSC::ExecState* exec, WebCore::JSDOMGlobalObject* globalObject, const QVariant& variant)
184 {
185     return toJS(exec, globalObject, QtDRTNodeRuntime::get(variant.value<QDRTNode>()));
186 }
187 #endif
188
189 void QtDRTNodeRuntime::initialize()
190 {
191     static bool initialized = false;
192     if (initialized)
193         return;
194     initialized = true;
195 #if USE(JSC)
196     int id = qRegisterMetaType<QDRTNode>();
197     JSC::Bindings::registerCustomType(id, convertJSValueToNodeVariant, convertNodeVariantToJSValue);
198 #endif
199 }
200
201 DumpRenderTreeSupportQt::DumpRenderTreeSupportQt()
202 {
203 }
204
205 DumpRenderTreeSupportQt::~DumpRenderTreeSupportQt()
206 {
207 }
208
209 void DumpRenderTreeSupportQt::initialize()
210 {
211     WebCore::initializeWebCoreQt();
212     QtDRTNodeRuntime::initialize();
213 }
214
215 void DumpRenderTreeSupportQt::overwritePluginDirectories()
216 {
217     PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false);
218
219     Vector<String> paths;
220     String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").data());
221     qtPath.split(UChar(':'), /* allowEmptyEntries */ false, paths);
222
223     db->setPluginDirectories(paths);
224     db->refresh();
225 }
226
227 int DumpRenderTreeSupportQt::workerThreadCount()
228 {
229 #if ENABLE(WORKERS)
230     return WebCore::WorkerThread::workerThreadCount();
231 #else
232     return 0;
233 #endif
234 }
235
236 void DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(bool b)
237 {
238     QWebPagePrivate::drtRun = b;
239 #if ENABLE(NETSCAPE_PLUGIN_API) && defined(XP_UNIX)
240     // PluginViewQt (X11) needs a few workarounds when running under DRT
241     PluginView::setIsRunningUnderDRT(b);
242 #endif
243 }
244
245 void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPage* page, bool enabled)
246 {
247     QWebPagePrivate::core(page)->settings()->setFrameFlatteningEnabled(enabled);
248 }
249
250 void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPage* page, const QString& groupName)
251 {
252     page->handle()->page->setGroupName(groupName);
253 }
254
255 QString DumpRenderTreeSupportQt::webPageGroupName(QWebPage* page)
256 {
257     return page->handle()->page->groupName();
258 }
259
260 void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPage* page, long callId, const QString& script)
261 {
262 #if ENABLE(INSPECTOR)
263     if (!page->handle()->page->inspectorController())
264         return;
265     page->handle()->page->inspectorController()->evaluateForTestInFrontend(callId, script);
266 #endif
267 }
268
269 void DumpRenderTreeSupportQt::webInspectorClose(QWebPage* page)
270 {
271 #if ENABLE(INSPECTOR)
272     if (!page->handle()->page->inspectorController())
273         return;
274     page->handle()->page->inspectorController()->close();
275 #endif
276 }
277
278 void DumpRenderTreeSupportQt::webInspectorShow(QWebPage* page)
279 {
280 #if ENABLE(INSPECTOR)
281     if (!page->handle()->page->inspectorController())
282         return;
283     page->handle()->page->inspectorController()->show();
284 #endif
285 }
286
287 bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrame* frame)
288 {
289     return QWebFramePrivate::core(frame)->document()->documentElement();
290 }
291
292 void DumpRenderTreeSupportQt::setAutofilled(const QWebElement& element, bool isAutofilled)
293 {
294     WebCore::Element* webElement = element.m_element;
295     if (!webElement)
296         return;
297     HTMLInputElement* inputElement = webElement->toInputElement();
298     if (!inputElement)
299         return;
300
301     inputElement->setAutofilled(isAutofilled);
302 }
303
304 void DumpRenderTreeSupportQt::setValueForUser(const QWebElement& element, const QString& value)
305 {
306     WebCore::Element* webElement = element.m_element;
307     if (!webElement)
308         return;
309     HTMLInputElement* inputElement = webElement->toInputElement();
310     if (!inputElement)
311         return;
312
313     inputElement->setValueForUser(value);
314 }
315
316 // Pause a given CSS animation or transition on the target node at a specific time.
317 // If the animation or transition is already paused, it will update its pause time.
318 // This method is only intended to be used for testing the CSS animation and transition system.
319 bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &animationName, double time, const QString &elementId)
320 {
321     Frame* coreFrame = QWebFramePrivate::core(frame);
322     if (!coreFrame)
323         return false;
324
325     AnimationController* controller = coreFrame->animation();
326     if (!controller)
327         return false;
328
329     Document* doc = coreFrame->document();
330     Q_ASSERT(doc);
331
332     Node* coreNode = doc->getElementById(elementId);
333     if (!coreNode || !coreNode->renderer())
334         return false;
335
336     return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time);
337 }
338
339 bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const QString &propertyName, double time, const QString &elementId)
340 {
341     Frame* coreFrame = QWebFramePrivate::core(frame);
342     if (!coreFrame)
343         return false;
344
345     AnimationController* controller = coreFrame->animation();
346     if (!controller)
347         return false;
348
349     Document* doc = coreFrame->document();
350     Q_ASSERT(doc);
351
352     Node* coreNode = doc->getElementById(elementId);
353     if (!coreNode || !coreNode->renderer())
354         return false;
355
356     return controller->pauseTransitionAtTime(coreNode->renderer(), propertyName, time);
357 }
358
359 // Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
360 int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame)
361 {
362     Frame* coreFrame = QWebFramePrivate::core(frame);
363     if (!coreFrame)
364         return false;
365
366     AnimationController* controller = coreFrame->animation();
367     if (!controller)
368         return false;
369
370     return controller->numberOfActiveAnimations(coreFrame->document());
371 }
372
373 void DumpRenderTreeSupportQt::clearFrameName(QWebFrame* frame)
374 {
375     Frame* coreFrame = QWebFramePrivate::core(frame);
376     coreFrame->tree()->clearName();
377 }
378
379 int DumpRenderTreeSupportQt::javaScriptObjectsCount()
380 {
381 #if USE(JSC)
382     return JSDOMWindowBase::commonJSGlobalData()->heap.globalObjectCount();
383 #elif USE(V8)
384     // FIXME: Find a way to do this using V8.
385     return 1;
386 #endif
387 }
388
389 void DumpRenderTreeSupportQt::garbageCollectorCollect()
390 {
391 #if USE(JSC)
392     gcController().garbageCollectNow();
393 #elif USE(V8)
394     v8::V8::LowMemoryNotification();
395 #endif
396 }
397
398 void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool waitUntilDone)
399 {
400 #if USE(JSC)
401     gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone);
402 #elif USE(V8)
403     // FIXME: Find a way to do this using V8.
404     garbageCollectorCollect();
405 #endif
406 }
407
408 // Returns the value of counter in the element specified by \a id.
409 QString DumpRenderTreeSupportQt::counterValueForElementById(QWebFrame* frame, const QString& id)
410 {
411     Frame* coreFrame = QWebFramePrivate::core(frame);
412     if (Document* document = coreFrame->document()) {
413         if (Element* element = document->getElementById(id))
414             return WebCore::counterValueForElement(element);
415     }
416     return QString();
417 }
418
419 int DumpRenderTreeSupportQt::pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height)
420 {
421     Frame* coreFrame = QWebFramePrivate::core(frame);
422     if (!coreFrame)
423         return -1;
424
425     Element* element = coreFrame->document()->getElementById(AtomicString(id));
426     if (!element)
427         return -1;
428
429     return PrintContext::pageNumberForElement(element, FloatSize(width, height));
430 }
431
432 int DumpRenderTreeSupportQt::numberOfPages(QWebFrame* frame, float width, float height)
433 {
434     Frame* coreFrame = QWebFramePrivate::core(frame);
435     if (!coreFrame)
436         return -1;
437
438     return PrintContext::numberOfPages(coreFrame, FloatSize(width, height));
439 }
440
441 // Suspend active DOM objects in this frame.
442 void DumpRenderTreeSupportQt::suspendActiveDOMObjects(QWebFrame* frame)
443 {
444     Frame* coreFrame = QWebFramePrivate::core(frame);
445     if (coreFrame->document())
446         // FIXME: This function should be changed take a ReasonForSuspension parameter 
447         // https://bugs.webkit.org/show_bug.cgi?id=45732
448         coreFrame->document()->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
449 }
450
451 // Resume active DOM objects in this frame.
452 void DumpRenderTreeSupportQt::resumeActiveDOMObjects(QWebFrame* frame)
453 {
454     Frame* coreFrame = QWebFramePrivate::core(frame);
455     if (coreFrame->document())
456         coreFrame->document()->resumeActiveDOMObjects();
457 }
458
459 void DumpRenderTreeSupportQt::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
460 {
461     SecurityPolicy::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
462 }
463
464 void DumpRenderTreeSupportQt::removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
465 {
466     SecurityPolicy::removeOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
467 }
468
469 void DumpRenderTreeSupportQt::resetOriginAccessWhiteLists()
470 {
471     SecurityPolicy::resetOriginAccessWhitelists();
472 }
473
474 void DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme)
475 {
476     SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
477 }
478
479 void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPage* page, bool value)
480 {
481     page->handle()->page->settings()->setCaretBrowsingEnabled(value);
482 }
483
484 void DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(QWebPage* page, bool value)
485 {
486     page->handle()->page->settings()->setAuthorAndUserStylesEnabled(value);
487 }
488
489 void DumpRenderTreeSupportQt::setMediaType(QWebFrame* frame, const QString& type)
490 {
491     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
492     WebCore::FrameView* view = coreFrame->view();
493     view->setMediaType(type);
494     coreFrame->document()->styleResolverChanged(RecalcStyleImmediately);
495     view->layout();
496 }
497
498 void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPage* page, bool enabled)
499 {
500     page->d->smartInsertDeleteEnabled = enabled;
501 }
502
503
504 void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled)
505 {
506     page->d->selectTrailingWhitespaceEnabled = enabled;
507 }
508
509
510 void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value)
511 {
512     page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
513 }
514
515 bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPage* page, const QString& name)
516 {
517     return page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
518 }
519
520 bool DumpRenderTreeSupportQt::findString(QWebPage* page, const QString& string, const QStringList& optionArray)
521 {
522     // 1. Parse the options from the array
523     WebCore::FindOptions options = 0;
524     const int optionCount = optionArray.size();
525     for (int i = 0; i < optionCount; ++i) {
526         const QString& option = optionArray.at(i);
527         if (option == QLatin1String("CaseInsensitive"))
528             options |= WebCore::CaseInsensitive;
529         else if (option == QLatin1String("AtWordStarts"))
530             options |= WebCore::AtWordStarts;
531         else if (option == QLatin1String("TreatMedialCapitalAsWordStart"))
532             options |= WebCore::TreatMedialCapitalAsWordStart;
533         else if (option == QLatin1String("Backwards"))
534             options |= WebCore::Backwards;
535         else if (option == QLatin1String("WrapAround"))
536             options |= WebCore::WrapAround;
537         else if (option == QLatin1String("StartInSelection"))
538             options |= WebCore::StartInSelection;
539     }
540
541     // 2. find the string
542     WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
543     return frame && frame->editor()->findString(string, options);
544 }
545
546 QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listItem)
547 {
548     return WebCore::markerTextForListItem(listItem.m_element);
549 }
550
551 static QString convertToPropertyName(const QString& name)
552 {
553     QStringList parts = name.split(QLatin1Char('-'));
554     QString camelCaseName;
555     for (int j = 0; j < parts.count(); ++j) {
556         QString part = parts.at(j);
557         if (j)
558             camelCaseName.append(part.replace(0, 1, part.left(1).toUpper()));
559         else
560             camelCaseName.append(part);
561     }
562     return camelCaseName;
563 }
564
565 QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWebElement& element)
566 {
567     QVariantMap res;
568
569     WebCore::Element* webElement = element.m_element;
570     if (!webElement)
571         return res;
572
573     RefPtr<WebCore::CSSComputedStyleDeclaration> computedStyleDeclaration = CSSComputedStyleDeclaration::create(webElement, true);
574     CSSStyleDeclaration* style = static_cast<WebCore::CSSStyleDeclaration*>(computedStyleDeclaration.get());
575     for (unsigned i = 0; i < style->length(); i++) {
576         QString name = style->item(i);
577         QString value = style->getPropertyValue(name);
578         res[convertToPropertyName(name)] = QVariant(value);
579     }
580     return res;
581 }
582
583 QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page)
584 {
585     WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
586     QVariantList selectedRange;
587     RefPtr<Range> range = frame->selection()->toNormalizedRange().get();
588
589     Element* selectionRoot = frame->selection()->rootEditableElement();
590     Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
591
592     RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
593     ASSERT(testRange->startContainer() == scope);
594     int startPosition = TextIterator::rangeLength(testRange.get());
595
596     ExceptionCode ec;
597     testRange->setEnd(range->endContainer(), range->endOffset(), ec);
598     ASSERT(testRange->startContainer() == scope);
599     int endPosition = TextIterator::rangeLength(testRange.get());
600
601     selectedRange << startPosition << (endPosition - startPosition);
602
603     return selectedRange;
604
605 }
606
607 QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, int location, int length)
608 {
609     WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
610     QVariantList rect;
611
612     if ((location + length < location) && (location + length))
613         length = 0;
614
615     RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
616
617     if (!range)
618         return QVariantList();
619
620     QRect resultRect = frame->editor()->firstRectForRange(range.get());
621     rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height();
622     return rect;
623 }
624
625 bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId)
626 {
627     Frame* coreFrame = QWebFramePrivate::core(frame);
628     if (!coreFrame)
629         return false;
630
631     Document* doc = coreFrame->document();
632     Q_ASSERT(doc);
633
634     Node* coreNode = doc->getElementById(elementId);
635     if (!coreNode || !coreNode->renderer())
636         return false;
637
638     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(coreNode);
639
640     return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete();
641 }
642
643 void DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(QWebPage* page)
644 {
645     Page* corePage = QWebPagePrivate::core(page);
646     if (!corePage)
647         return;
648     corePage->settings()->setEditingBehaviorType(EditingWindowsBehavior);
649 }
650
651 void DumpRenderTreeSupportQt::clearAllApplicationCaches()
652 {
653     WebCore::cacheStorage().empty();
654     WebCore::cacheStorage().vacuumDatabaseFile();
655 }
656
657 void DumpRenderTreeSupportQt::dumpFrameLoader(bool b)
658 {
659     FrameLoaderClientQt::dumpFrameLoaderCallbacks = b;
660 }
661
662 void DumpRenderTreeSupportQt::dumpProgressFinishedCallback(bool b)
663 {
664     FrameLoaderClientQt::dumpProgressFinishedCallback = b;
665 }
666
667 void DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(bool b)
668 {
669     FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = b;
670 }
671
672 void DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(bool b)
673 {
674     FrameLoaderClientQt::dumpResourceLoadCallbacks = b;
675 }
676
677 void DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(const QString& path)
678 {
679     FrameLoaderClientQt::dumpResourceLoadCallbacksPath = path;
680 }
681
682 void DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(bool b)
683 {
684     FrameLoaderClientQt::dumpResourceResponseMIMETypes = b;
685 }
686
687 void DumpRenderTreeSupportQt::dumpWillCacheResponseCallbacks(bool b)
688 {
689     FrameLoaderClientQt::dumpWillCacheResponseCallbacks = b;
690 }
691
692 void DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(bool b)
693 {
694     FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = b;
695 }
696
697 void DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(bool b)
698 {
699     FrameLoaderClientQt::sendRequestReturnsNull = b;
700 }
701
702 void DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(const QStringList& headers)
703 {
704     FrameLoaderClientQt::sendRequestClearHeaders = headers;
705 }
706
707 void DumpRenderTreeSupportQt::setDeferMainResourceDataLoad(bool b)
708 {
709     FrameLoaderClientQt::deferMainResourceDataLoad = b;
710 }
711
712 void DumpRenderTreeSupportQt::setCustomPolicyDelegate(bool enabled, bool permissive)
713 {
714     FrameLoaderClientQt::policyDelegateEnabled = enabled;
715     FrameLoaderClientQt::policyDelegatePermissive = permissive;
716 }
717
718 void DumpRenderTreeSupportQt::dumpHistoryCallbacks(bool b)
719 {
720     FrameLoaderClientQt::dumpHistoryCallbacks = b;
721 }
722
723 void DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(bool b)
724 {
725     ChromeClientQt::dumpVisitedLinksCallbacks = b;
726 }
727
728 void DumpRenderTreeSupportQt::dumpEditingCallbacks(bool b)
729 {
730     EditorClientQt::dumpEditingCallbacks = b;
731 }
732
733 void DumpRenderTreeSupportQt::dumpSetAcceptsEditing(bool b)
734 {
735     EditorClientQt::acceptsEditing = b;
736 }
737
738 void DumpRenderTreeSupportQt::dumpNotification(bool b)
739 {
740 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
741     NotificationPresenterClientQt::dumpNotification = b;
742 #endif
743 }
744
745 QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, const QSize& deviceSize, const QSize& availableSize)
746 {
747     WebCore::ViewportArguments args = page->d->viewportArguments();
748
749     WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args,
750         /* desktop-width */ 980,
751         /* device-width  */ deviceSize.width(),
752         /* device-height */ deviceSize.height(),
753         /* device-dpi    */ deviceDPI,
754         availableSize);
755     WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
756     WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
757
758     QString res;
759     res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n",
760             static_cast<int>(conf.layoutSize.width()),
761             static_cast<int>(conf.layoutSize.height()),
762             conf.initialScale,
763             conf.minimumScale,
764             conf.maximumScale,
765             conf.userScalable);
766
767     return res;
768 }
769
770 void DumpRenderTreeSupportQt::scalePageBy(QWebFrame* frame, float scalefactor, const QPoint& origin)
771 {
772     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
773     if (Page* page = coreFrame->page())
774         page->setPageScaleFactor(scalefactor, origin);
775 }
776
777 void DumpRenderTreeSupportQt::setMockDeviceOrientation(QWebPage* page, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
778 {
779 #if ENABLE(DEVICE_ORIENTATION)
780     Page* corePage = QWebPagePrivate::core(page);
781     DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(DeviceOrientationController::from(corePage)->client());
782     mockClient->setOrientation(DeviceOrientation::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma));
783 #endif
784 }
785
786 void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPage* page)
787 {
788 #if ENABLE(GEOLOCATION)
789     Page* corePage = QWebPagePrivate::core(page);
790     GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
791     mockClient->reset();
792 #endif
793 }
794
795 void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPage* page, bool allowed)
796 {
797 #if ENABLE(GEOLOCATION)
798     Page* corePage = QWebPagePrivate::core(page);
799     GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
800     mockClient->setPermission(allowed);
801 #endif
802 }
803
804 void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPage* page, double latitude, double longitude, double accuracy)
805 {
806 #if ENABLE(GEOLOCATION)
807     Page* corePage = QWebPagePrivate::core(page);
808     GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
809     mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy));
810 #endif
811 }
812
813 void DumpRenderTreeSupportQt::setMockGeolocationError(QWebPage* page, int errorCode, const QString& message)
814 {
815 #if ENABLE(GEOLOCATION)
816     Page* corePage = QWebPagePrivate::core(page);
817
818     GeolocationError::ErrorCode code = GeolocationError::PositionUnavailable;
819     switch (errorCode) {
820     case PositionError::PERMISSION_DENIED:
821         code = GeolocationError::PermissionDenied;
822         break;
823     case PositionError::POSITION_UNAVAILABLE:
824         code = GeolocationError::PositionUnavailable;
825         break;
826     }
827
828     GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(GeolocationController::from(corePage)->client());
829     mockClient->setError(GeolocationError::create(code, message));
830 #endif
831 }
832
833 int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPage* page)
834 {
835 #if ENABLE(GEOLOCATION)
836     Page* corePage = QWebPagePrivate::core(page);
837     GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
838     return mockClient->numberOfPendingPermissionRequests();
839 #else
840     return -1;
841 #endif
842 }
843
844 bool DumpRenderTreeSupportQt::isTargetItem(const QWebHistoryItem& historyItem)
845 {
846     QWebHistoryItem it = historyItem;
847     if (QWebHistoryItemPrivate::core(&it)->isTargetItem())
848         return true;
849     return false;
850 }
851
852 QString DumpRenderTreeSupportQt::historyItemTarget(const QWebHistoryItem& historyItem)
853 {
854     QWebHistoryItem it = historyItem;
855     return (QWebHistoryItemPrivate::core(&it)->target());
856 }
857
858 QMap<QString, QWebHistoryItem> DumpRenderTreeSupportQt::getChildHistoryItems(const QWebHistoryItem& historyItem)
859 {
860     QWebHistoryItem it = historyItem;
861     HistoryItem* item = QWebHistoryItemPrivate::core(&it);
862     const WebCore::HistoryItemVector& children = item->children();
863
864     unsigned size = children.size();
865     QMap<QString, QWebHistoryItem> kids;
866     for (unsigned i = 0; i < size; ++i) {
867         QWebHistoryItem kid(new QWebHistoryItemPrivate(children[i].get()));
868         kids.insert(DumpRenderTreeSupportQt::historyItemTarget(kid), kid);
869     }
870     return kids;
871 }
872
873 bool DumpRenderTreeSupportQt::shouldClose(QWebFrame* frame)
874 {
875     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
876     return coreFrame->loader()->shouldClose();
877 }
878
879 void DumpRenderTreeSupportQt::clearScriptWorlds()
880 {
881     m_worldMap.clear();
882 }
883
884 void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script)
885 {
886     QWebScriptWorld* scriptWorld;
887     if (!worldID) {
888         scriptWorld = new QWebScriptWorld();
889     } else if (!m_worldMap.contains(worldID)) {
890         scriptWorld = new QWebScriptWorld();
891         m_worldMap.insert(worldID, scriptWorld);
892     } else
893         scriptWorld = m_worldMap.value(worldID);
894
895     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
896
897     ScriptController* proxy = coreFrame->script();
898
899     if (!proxy)
900         return;
901 #if USE(JSC)
902     proxy->executeScriptInWorld(scriptWorld->world(), script, true);
903 #elif USE(V8)
904     ScriptSourceCode source(script);
905     Vector<ScriptSourceCode> sources;
906     sources.append(source);
907     Vector<ScriptValue> result;
908     proxy->evaluateInIsolatedWorld(0, sources, &result);
909 #endif
910 }
911
912 QString DumpRenderTreeSupportQt::pageSizeAndMarginsInPixels(QWebFrame* frame, int pageIndex, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft)
913 {
914     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
915     return PrintContext::pageSizeAndMarginsInPixels(coreFrame, pageIndex, width, height,
916                                                     marginTop, marginRight, marginBottom, marginLeft);
917 }
918
919 QString DumpRenderTreeSupportQt::pageProperty(QWebFrame* frame, const QString& propertyName, int pageNumber)
920 {
921     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
922     return PrintContext::pageProperty(coreFrame, propertyName.toUtf8().constData(), pageNumber);
923 }
924
925 void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPage* page, const QString& sourceCode)
926 {
927     page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), nullptr, nullptr, WebCore::InjectInAllFrames);
928 }
929
930 void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& title)
931 {
932 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
933     NotificationPresenterClientQt::notificationPresenter()->notificationClicked(title);
934 #endif
935 }
936
937 void DumpRenderTreeSupportQt::setDefersLoading(QWebPage* page, bool flag)
938 {
939     Page* corePage = QWebPagePrivate::core(page);
940     if (corePage)
941         corePage->setDefersLoading(flag);
942 }
943
944 void DumpRenderTreeSupportQt::goBack(QWebPage* page)
945 {
946     Page* corePage = QWebPagePrivate::core(page);
947     if (corePage)
948         corePage->goBack();
949 }
950
951 // API Candidate?
952 QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame)
953 {
954     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
955     WebCore::DocumentLoader* docLoader = coreFrame->loader()->documentLoader();
956     return docLoader->responseMIMEType();
957 }
958
959 void DumpRenderTreeSupportQt::clearOpener(QWebFrame* frame)
960 {
961     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
962     coreFrame->loader()->setOpener(0);
963 }
964
965 void DumpRenderTreeSupportQt::addURLToRedirect(const QString& origin, const QString& destination)
966 {
967     FrameLoaderClientQt::URLsToRedirect[origin] = destination;
968 }
969
970 void DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(QWebPage* page, bool enable)
971 {
972     Page* corePage = QWebPagePrivate::core(page);
973     if (corePage)
974         corePage->settings()->setInteractiveFormValidationEnabled(enable);
975 }
976
977 #ifndef QT_NO_MENU
978 static QStringList iterateContextMenu(QMenu* menu)
979 {
980     if (!menu)
981         return QStringList();
982
983     QStringList items;
984     QList<QAction *> actions = menu->actions();
985     for (int i = 0; i < actions.count(); ++i) {
986         if (actions.at(i)->isSeparator())
987             items << QLatin1String("<separator>");
988         else
989             items << actions.at(i)->text();
990         if (actions.at(i)->menu())
991             items << iterateContextMenu(actions.at(i)->menu());
992     }
993     return items;
994 }
995 #endif
996
997 QStringList DumpRenderTreeSupportQt::contextMenu(QWebPage* page)
998 {
999 #ifndef QT_NO_CONTEXTMENU
1000     return iterateContextMenu(page->d->currentContextMenu.data());
1001 #else
1002     return QStringList();
1003 #endif
1004 }
1005
1006 double DumpRenderTreeSupportQt::defaultMinimumTimerInterval()
1007 {
1008     return Settings::defaultMinDOMTimerInterval();
1009 }
1010
1011 void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPage* page, double interval)
1012 {
1013     Page* corePage = QWebPagePrivate::core(page);
1014     if (!corePage)
1015         return;
1016
1017     corePage->settings()->setMinDOMTimerInterval(interval);
1018 }
1019
1020 #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
1021 bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPage *page, const QUrl& url, const QUrl& firstPartyUrl)
1022 {
1023     Page* corePage = QWebPagePrivate::core(page);
1024     return thirdPartyCookiePolicyPermits(corePage->mainFrame()->loader()->networkingContext(), url, firstPartyUrl);
1025 }
1026 #endif
1027
1028 QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const QString& elementId)
1029 {
1030     QUrl res;
1031
1032 #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
1033     Frame* coreFrame = QWebFramePrivate::core(frame);
1034     if (!coreFrame)
1035         return res;
1036
1037     Document* doc = coreFrame->document();
1038     if (!doc)
1039         return res;
1040
1041     Node* coreNode = doc->getElementById(elementId);
1042     if (!coreNode)
1043         return res;
1044
1045     HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(coreNode);
1046     PlatformMedia platformMedia = videoElement->platformMedia();
1047     if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
1048         return res;
1049
1050     MediaPlayerPrivateQt* mediaPlayerQt = static_cast<MediaPlayerPrivateQt*>(platformMedia.media.qtMediaPlayer);
1051     if (mediaPlayerQt && mediaPlayerQt->mediaPlayer())
1052         res = mediaPlayerQt->mediaPlayer()->media().canonicalUrl();
1053 #endif
1054
1055     return res;
1056 }
1057
1058 // API Candidate?
1059 void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
1060 {
1061     KURL kurl(baseUrl);
1062     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1063     WebCore::ResourceRequest request(kurl);
1064     const QByteArray utf8 = html.toUtf8();
1065     WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length());
1066     WebCore::SubstituteData substituteData(data, WTF::String("text/html"), WTF::String("utf-8"), failingUrl);
1067     coreFrame->loader()->load(request, substituteData, false);
1068 }
1069
1070 void DumpRenderTreeSupportQt::confirmComposition(QWebPage* page, const char* text)
1071 {
1072     Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
1073     if (!frame)
1074         return;
1075
1076     Editor* editor = frame->editor();
1077     if (!editor || (!editor->hasComposition() && !text))
1078         return;
1079
1080     if (editor->hasComposition()) {
1081         if (text)
1082             editor->confirmComposition(String::fromUTF8(text));
1083         else
1084             editor->confirmComposition();
1085     } else
1086         editor->insertText(String::fromUTF8(text), 0);
1087 }
1088
1089 QString DumpRenderTreeSupportQt::layerTreeAsText(QWebFrame* frame)
1090 {
1091     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1092     return coreFrame->layerTreeAsText();
1093 }
1094
1095 void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrame* frame)
1096 {
1097     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1098 #if USE(JSC)
1099     JSC::JSLock lock(JSC::SilenceAssertionsOnly);
1100
1101     JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
1102     Q_ASSERT(window);
1103
1104     JSC::ExecState* exec = window->globalExec();
1105     Q_ASSERT(exec);
1106
1107     JSContextRef context = toRef(exec);
1108     WebCoreTestSupport::injectInternalsObject(context);
1109 #elif USE(V8)
1110     v8::HandleScope handleScope;
1111     WebCoreTestSupport::injectInternalsObject(V8Proxy::mainWorldContext(coreFrame));
1112 #endif
1113 }
1114
1115 void DumpRenderTreeSupportQt::injectInternalsObject(JSContextRef context)
1116 {
1117 #if USE(JSC)
1118     WebCoreTestSupport::injectInternalsObject(context);
1119 #endif
1120 }
1121
1122 void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame)
1123 {
1124     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1125 #if USE(JSC)
1126     JSC::JSLock lock(JSC::SilenceAssertionsOnly);
1127
1128     JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
1129     Q_ASSERT(window);
1130
1131     JSC::ExecState* exec = window->globalExec();
1132     Q_ASSERT(exec);
1133
1134     JSContextRef context = toRef(exec);
1135     WebCoreTestSupport::resetInternalsObject(context);
1136 #elif USE(V8)
1137     v8::HandleScope handleScope;
1138     WebCoreTestSupport::resetInternalsObject(V8Proxy::mainWorldContext(coreFrame));
1139 #endif
1140 }
1141
1142 bool DumpRenderTreeSupportQt::defaultHixie76WebSocketProtocolEnabled()
1143 {
1144     return true;
1145 }
1146
1147 void DumpRenderTreeSupportQt::setHixie76WebSocketProtocolEnabled(QWebPage* page, bool enabled)
1148 {
1149 #if ENABLE(WEB_SOCKETS)
1150     if (Page* corePage = QWebPagePrivate::core(page))
1151         corePage->settings()->setUseHixie76WebSocketProtocol(enabled);
1152 #else
1153     UNUSED_PARAM(page);
1154     UNUSED_PARAM(enabled);
1155 #endif
1156 }
1157
1158 QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe)
1159 {
1160     Frame* frame = QWebFramePrivate::core(qframe);
1161     PrintContext printContext(frame);
1162
1163     QRect rect = frame->view()->frameRect();
1164
1165     IntRect pageRect(0, 0, rect.width(), rect.height());
1166
1167     printContext.begin(pageRect.width(), pageRect.height());
1168     float pageHeight = 0;
1169     printContext.computePageRects(pageRect, /* headerHeight */ 0, /* footerHeight */ 0, /* userScaleFactor */ 1.0, pageHeight);
1170
1171     QPainter painter;
1172     int pageCount = printContext.pageCount();
1173     // pages * pageHeight and 1px line between each page
1174     int totalHeight = pageCount * (pageRect.height() + 1) - 1;
1175     QImage image(pageRect.width(), totalHeight, QImage::Format_ARGB32);
1176     image.fill(Qt::white);
1177     painter.begin(&image);
1178
1179     GraphicsContext ctx(&painter);
1180     for (int i = 0; i < printContext.pageCount(); ++i) {
1181         printContext.spoolPage(ctx, i, pageRect.width());
1182         // translate to next page coordinates
1183         ctx.translate(0, pageRect.height() + 1);
1184
1185         // if there is a next page, draw a blue line between these two
1186         if (i + 1 < printContext.pageCount()) {
1187             ctx.save();
1188             ctx.setStrokeColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
1189             ctx.setFillColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
1190             ctx.drawLine(IntPoint(0, -1), IntPoint(pageRect.width(), -1));
1191             ctx.restore();
1192         }
1193     }
1194
1195     painter.end();
1196     printContext.end();
1197
1198     return image;
1199 }
1200
1201 // Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
1202
1203 void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
1204 {
1205     DumpRenderTreeSupportQt::resumeActiveDOMObjects(frame);
1206 }
1207
1208 void QWEBKIT_EXPORT qt_suspendActiveDOMObjects(QWebFrame* frame)
1209 {
1210     DumpRenderTreeSupportQt::suspendActiveDOMObjects(frame);
1211 }
1212
1213 void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* frame)
1214 {
1215     DumpRenderTreeSupportQt::clearFrameName(frame);
1216 }
1217
1218 void QWEBKIT_EXPORT qt_drt_garbageCollector_collect()
1219 {
1220     DumpRenderTreeSupportQt::garbageCollectorCollect();
1221 }
1222
1223 void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone)
1224 {
1225     DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone);
1226 }
1227
1228 int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount()
1229 {
1230     return DumpRenderTreeSupportQt::javaScriptObjectsCount();
1231 }
1232
1233 int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame* frame)
1234 {
1235     return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame);
1236 }
1237
1238 void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories()
1239 {
1240     DumpRenderTreeSupportQt::overwritePluginDirectories();
1241 }
1242
1243 bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame* frame, const QString& animationName, double time, const QString& elementId)
1244 {
1245     return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId);
1246 }
1247
1248 bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame* frame, const QString& propertyName, double time, const QString &elementId)
1249 {
1250     return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId);
1251 }
1252
1253 void QWEBKIT_EXPORT qt_drt_resetOriginAccessWhiteLists()
1254 {
1255     DumpRenderTreeSupportQt::resetOriginAccessWhiteLists();
1256 }
1257
1258 void QWEBKIT_EXPORT qt_drt_run(bool b)
1259 {
1260     DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(b);
1261 }
1262
1263 void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
1264 {
1265     DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains);
1266 }
1267
1268 QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page)
1269 {
1270     return DumpRenderTreeSupportQt::webPageGroupName(page);
1271 }
1272
1273 void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName)
1274 {
1275     DumpRenderTreeSupportQt::webPageSetGroupName(page, groupName);
1276 }
1277
1278 void QWEBKIT_EXPORT qt_dump_frame_loader(bool b)
1279 {
1280     DumpRenderTreeSupportQt::dumpFrameLoader(b);
1281 }
1282
1283 void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b)
1284 {
1285     DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(b);
1286 }
1287
1288 void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b)
1289 {
1290     DumpRenderTreeSupportQt::dumpEditingCallbacks(b);
1291 }
1292
1293 void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b)
1294 {
1295     DumpRenderTreeSupportQt::dumpSetAcceptsEditing(b);
1296 }
1297