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