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