Changeset 83125 in webkit
- Timestamp:
- Apr 6, 2011 5:20:32 PM (13 years ago)
- Location:
- trunk/Source/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/qt/ChangeLog
r83108 r83125 1 2011-04-06 Anders Bakken <agbakken@gmail.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] FrameLoaderClientQt.cpp has coding-style errors 6 https://bugs.webkit.org/show_bug.cgi?id=40254 7 8 * WebCoreSupport/FrameLoaderClientQt.cpp: 9 (drtDescriptionSuitableForTestResult): 10 (WebCore::FrameLoaderClientQt::hasWebView): 11 (WebCore::FrameLoaderClientQt::setCopiesOnScroll): 12 (WebCore::FrameLoaderClientQt::dispatchDidHandleOnloadEvents): 13 (WebCore::FrameLoaderClientQt::dispatchDidReceiveTitle): 14 (WebCore::FrameLoaderClientQt::dispatchDidChangeIcons): 15 (WebCore::FrameLoaderClientQt::cancelPolicyCheck): 16 (WebCore::FrameLoaderClientQt::dispatchWillSubmitForm): 17 (WebCore::FrameLoaderClientQt::postProgressStartedNotification): 18 (WebCore::FrameLoaderClientQt::postProgressFinishedNotification): 19 (WebCore::FrameLoaderClientQt::setMainFrameDocumentReady): 20 (WebCore::FrameLoaderClientQt::willChangeTitle): 21 (WebCore::FrameLoaderClientQt::didChangeTitle): 22 (WebCore::FrameLoaderClientQt::finishedLoading): 23 (WebCore::FrameLoaderClientQt::frameLoadCompleted): 24 (WebCore::FrameLoaderClientQt::provisionalLoadStarted): 25 (WebCore::FrameLoaderClientQt::didFinishLoad): 26 (WebCore::FrameLoaderClientQt::setTitle): 27 (WebCore::FrameLoaderClientQt::dispatchDidReceiveIcon): 28 (WebCore::FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld): 29 (WebCore::FrameLoaderClientQt::updateGlobalHistory): 30 (WebCore::FrameLoaderClientQt::shouldGoToHistoryItem): 31 (WebCore::FrameLoaderClientQt::shouldStopLoadingForHistoryItem): 32 (WebCore::FrameLoaderClientQt::committedLoad): 33 (WebCore::FrameLoaderClientQt::download): 34 (WebCore::FrameLoaderClientQt::dispatchWillSendRequest): 35 (WebCore::FrameLoaderClientQt::shouldUseCredentialStorage): 36 (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForResponse): 37 (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): 38 (WebCore::FrameLoaderClientQt::createFrame): 39 (WebCore::FrameLoaderClientQt::objectContentType): 40 (WebCore::FrameLoaderClientQt::createPlugin): 41 1 42 2011-04-06 Alexis Menard <alexis.menard@openbossa.org> 2 43 -
trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
r82586 r83125 32 32 33 33 #include "config.h" 34 #include "FrameLoaderClientQt.h" 35 34 36 #include "CSSComputedStyleDeclaration.h" 35 37 #include "CSSPropertyNames.h" 38 #include "DocumentLoader.h" 36 39 #include "FormState.h" 37 #include "FrameLoaderClientQt.h"38 40 #include "FrameNetworkingContextQt.h" 39 41 #include "FrameTree.h" 40 42 #include "FrameView.h" 41 #include "DocumentLoader.h" 43 #include "HTMLAppletElement.h" 44 #include "HTMLFormElement.h" 45 #include "HTMLPlugInElement.h" 46 #include "HTTPParsers.h" 47 #include "HistoryItem.h" 42 48 #include "HitTestResult.h" 43 49 #if ENABLE(ICONDATABASE) … … 46 52 #if USE(JSC) 47 53 #include "JSDOMWindowBase.h" 48 #elif USE(V8)49 #include "V8DOMWindow.h"50 54 #endif 51 55 #include "MIMETypeRegistry.h" 52 56 #include "MouseEvent.h" 53 #include " ResourceResponse.h"57 #include "NotImplemented.h" 54 58 #include "Page.h" 55 59 #include "PluginData.h" 56 60 #include "PluginDatabase.h" 57 61 #include "ProgressTracker.h" 62 #include "QNetworkReplyHandler.h" 63 #include "QWebPageClient.h" 58 64 #include "RenderPart.h" 65 #include "ResourceHandle.h" 66 #include "ResourceHandleInternal.h" 59 67 #include "ResourceRequest.h" 60 #include "HistoryItem.h" 61 #include "HTMLAppletElement.h" 62 #include "HTMLFormElement.h" 63 #include "HTMLPlugInElement.h" 64 #include "HTTPParsers.h" 65 #include "NotImplemented.h" 66 #include "QNetworkReplyHandler.h" 67 #include "ResourceHandleInternal.h" 68 #include "ResourceHandle.h" 68 #include "ResourceResponse.h" 69 69 #include "ScriptController.h" 70 70 #include "Settings.h" 71 #include "QWebPageClient.h" 71 #if USE(V8) 72 #include "V8DOMWindow.h" 73 #endif 72 74 #include "ViewportArguments.h" 73 75 76 #include "qwebframe.h" 77 #include "qwebframe_p.h" 78 #include "qwebhistory_p.h" 79 #include "qwebhistoryinterface.h" 74 80 #include "qwebpage.h" 75 81 #include "qwebpage_p.h" 76 #include "qwebframe.h"77 #include "qwebframe_p.h"78 #include "qwebhistoryinterface.h"79 82 #include "qwebpluginfactory.h" 80 81 #include <qfileinfo.h>82 83 83 84 #include <QCoreApplication> 84 85 #include <QDebug> 86 #include <QFileInfo> 85 87 #include <QGraphicsScene> 86 88 #include <QGraphicsWidget> 89 #include <QNetworkReply> 87 90 #include <QNetworkRequest> 88 #include <QNetworkReply>89 91 #include <QStringList> 90 #include "qwebhistory_p.h"91 92 #include <wtf/OwnPtr.h> 92 93 93 94 static QMap<unsigned long, QString> dumpAssignedUrls; 94 95 95 // Compare with WebKitTools/DumpRenderTree/mac/FrameLoadDelegate.mm96 static QString drtDescriptionSuitableForTestResult(WebCore::Frame* _frame)97 { 98 QWebFrame* frame = QWebFramePrivate::kit( _frame);96 // Compare with the file "WebKit/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm". 97 static QString drtDescriptionSuitableForTestResult(WebCore::Frame* webCoreFrame) 98 { 99 QWebFrame* frame = QWebFramePrivate::kit(webCoreFrame); 99 100 QString name = frame->frameName(); 100 101 … … 104 105 return QString::fromLatin1("main frame \"%1\"").arg(name); 105 106 return QLatin1String("main frame"); 106 } else { 107 if (!name.isEmpty()) 108 return QString::fromLatin1("frame \"%1\"").arg(name); 109 return QLatin1String("frame (anonymous)"); 110 } 107 } 108 if (!name.isEmpty()) 109 return QString::fromLatin1("frame \"%1\"").arg(name); 110 return QLatin1String("frame (anonymous)"); 111 111 } 112 112 … … 118 118 } 119 119 120 static QString drtDescriptionSuitableForTestResult(const WebCore::KURL& _url)121 { 122 if ( _url.isEmpty() || !_url.isLocalFile())123 return _url.string();124 // Remove the leading path from file urls 125 return QString( _url.string()).remove(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath).mid(1);120 static QString drtDescriptionSuitableForTestResult(const WebCore::KURL& kurl) 121 { 122 if (kurl.isEmpty() || !kurl.isLocalFile()) 123 return kurl.string(); 124 // Remove the leading path from file urls. 125 return QString(kurl.string()).remove(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath).mid(1); 126 126 } 127 127 … … 167 167 } 168 168 169 namespace WebCore 170 { 169 namespace WebCore { 171 170 172 171 bool FrameLoaderClientQt::dumpFrameLoaderCallbacks = false; … … 185 184 QMap<QString, QString> FrameLoaderClientQt::URLsToRedirect = QMap<QString, QString>(); 186 185 187 // Taken from DumpRenderTree/chromium/WebViewHost.cpp186 // Taken from the file "WebKit/Tools/DumpRenderTree/chromium/WebViewHost.cpp". 188 187 static const char* navigationTypeToString(NavigationType type) 189 188 { … … 251 250 bool FrameLoaderClientQt::hasWebView() const 252 251 { 253 // notImplemented();252 // notImplemented(); 254 253 return true; 255 254 } … … 332 331 void FrameLoaderClientQt::setCopiesOnScroll() 333 332 { 334 // apparently mac specific333 // Apparently this is mac specific. 335 334 } 336 335 … … 347 346 void FrameLoaderClientQt::dispatchDidHandleOnloadEvents() 348 347 { 349 // don't need this one348 // Don't need this one. 350 349 if (dumpFrameLoaderCallbacks) 351 350 printf("%s - didHandleOnloadEventsForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); … … 450 449 void FrameLoaderClientQt::dispatchDidReceiveTitle(const StringWithDirection& title) 451 450 { 452 // FIXME: use direction of title.451 // FIXME: Use direction of title. 453 452 if (dumpFrameLoaderCallbacks) 454 453 printf("%s - didReceiveTitle: %s\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)), qPrintable(QString(title.string()))); … … 469 468 return; 470 469 471 // FIXME: To be notified of changing icon URLS add notification470 // FIXME: In order to get notified of icon URLS' changes, add a notification. 472 471 // emit iconsChanged(); 473 472 } … … 548 547 void FrameLoaderClientQt::cancelPolicyCheck() 549 548 { 550 //qDebug() << "FrameLoaderClientQt::cancelPolicyCheck";549 // qDebug() << "FrameLoaderClientQt::cancelPolicyCheck"; 551 550 } 552 551 … … 556 555 { 557 556 notImplemented(); 558 // FIXME: This is surely too simple 557 // FIXME: This is surely too simple. 559 558 callPolicyFunction(function, PolicyUse); 560 559 } … … 575 574 { 576 575 if (m_webFrame && m_frame->page()) { 577 // A new load starts, so letsclear the previous error.576 // As a new load have started, clear the previous error. 578 577 m_loadError = ResourceError(); 579 578 emit loadStarted(); … … 593 592 void FrameLoaderClientQt::postProgressFinishedNotification() 594 593 { 595 // send a mousemove event to596 // (1) update the cursor to change according to whatever is underneath the mouse cursor right now 597 // (2) display the tool tip if the mouse hovers a node which has a tool tip 594 // Send a mousemove event to: 595 // (1) update the cursor to change according to whatever is underneath the mouse cursor right now; 596 // (2) display the tool tip if the mouse hovers a node which has a tool tip. 598 597 if (m_frame && m_frame->eventHandler() && m_webFrame->page()) { 599 598 QWidget* view = m_webFrame->page()->view(); … … 613 612 void FrameLoaderClientQt::setMainFrameDocumentReady(bool) 614 613 { 615 // this is only interesting once we provide an external API for the DOM614 // This is only interesting once we provide an external API for the DOM. 616 615 } 617 616 … … 619 618 void FrameLoaderClientQt::willChangeTitle(DocumentLoader*) 620 619 { 621 // no need for, dispatchDidReceiveTitle is the right callback620 // No need for, dispatchDidReceiveTitle is the right callback. 622 621 } 623 622 … … 625 624 void FrameLoaderClientQt::didChangeTitle(DocumentLoader*) 626 625 { 627 // no need for, dispatchDidReceiveTitle is the right callback626 // No need for, dispatchDidReceiveTitle is the right callback. 628 627 } 629 628 … … 633 632 if (!m_pluginView) { 634 633 // This is necessary to create an empty document. See bug 634004. 635 // However, we only want to do this if makeRepresentation has been called, to636 // match the behavior on the Mac.634 // However, we only want to do this if makeRepresentation has been called, 635 // to match the behavior on the Mac. 637 636 if (m_hasRepresentation) 638 637 loader->writer()->setEncoding("", false); … … 683 682 void FrameLoaderClientQt::frameLoadCompleted() 684 683 { 685 // Note : Can be called multiple times.684 // Note that this can be called multiple times. 686 685 } 687 686 … … 697 696 void FrameLoaderClientQt::provisionalLoadStarted() 698 697 { 699 // don't need to do anything here698 // Don't need to do anything here. 700 699 } 701 700 … … 703 702 void FrameLoaderClientQt::didFinishLoad() 704 703 { 705 //notImplemented();704 // notImplemented(); 706 705 } 707 706 … … 715 714 // Used by Apple WebKit to update the title of an existing history item. 716 715 // QtWebKit doesn't accomodate this on history items. If it ever does, 717 // it should be privateBrowsing-aware. For now, we are just passing716 // it should be privateBrowsing-aware. For now, we are just passing 718 717 // globalhistory layout tests. 719 // FIXME: use direction of title.718 // FIXME: Use direction of title. 720 719 if (dumpHistoryCallbacks) { 721 720 printf("WebView updated the title for history URL \"%s\" to \"%s\".\n", … … 736 735 void FrameLoaderClientQt::dispatchDidReceiveIcon() 737 736 { 738 if (m_webFrame) {737 if (m_webFrame) 739 738 emit m_webFrame->iconChanged(); 740 }741 739 } 742 740 … … 760 758 return; 761 759 762 if (m_webFrame) {760 if (m_webFrame) 763 761 emit m_webFrame->javaScriptWindowObjectCleared(); 764 }765 762 } 766 763 … … 798 795 void FrameLoaderClientQt::updateGlobalHistory() 799 796 { 800 QWebHistoryInterface *history = QWebHistoryInterface::defaultInterface();797 QWebHistoryInterface* history = QWebHistoryInterface::defaultInterface(); 801 798 WebCore::DocumentLoader* loader = m_frame->loader()->documentLoader(); 802 799 if (history) … … 843 840 } 844 841 845 bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem 842 bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem*) const 846 843 { 847 844 return true; 848 845 } 849 846 850 bool FrameLoaderClientQt::shouldStopLoadingForHistoryItem(WebCore::HistoryItem 847 bool FrameLoaderClientQt::shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const 851 848 { 852 849 return true; … … 908 905 loader->commitData(data, length); 909 906 910 // We re-check here as the plugin can have been created 907 // We re-check here as the plugin can have been created. 911 908 if (m_pluginView && m_pluginView->isPluginView()) { 912 909 if (!m_hasSentResponseToPlugin) { 913 910 m_pluginView->didReceiveResponse(loader->response()); 914 // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in915 // setting up this stream can cause the main document load to be cancelled, setting m_pluginView916 // to null911 // The function didReceiveResponse sets up a new stream to the plug-in. 912 // On a full-page plug-in, a failure in setting up this stream can cause the 913 // main document load to be cancelled, setting m_pluginView to null. 917 914 if (!m_pluginView) 918 915 return; … … 931 928 } 932 929 933 // copied from WebKit/Misc/WebKitErrors[Private].h930 // This was copied from file "WebKit/Source/WebKit/mac/Misc/WebKitErrors.h". 934 931 enum { 935 932 WebKitErrorCannotShowMIMEType = 100, 936 933 WebKitErrorCannotShowURL = 101, 937 934 WebKitErrorFrameLoadInterruptedByPolicyChange = 102, 938 WebKitErrorCannotUseRestrictedPort = 103,935 WebKitErrorCannotUseRestrictedPort = 103, 939 936 WebKitErrorCannotFindPlugIn = 200, 940 937 WebKitErrorCannotLoadPlugIn = 201, … … 1014 1011 QNetworkReply* reply = handler->release(); 1015 1012 if (reply) { 1016 QWebPage *page = m_webFrame->page();1013 QWebPage* page = m_webFrame->page(); 1017 1014 if (page->forwardUnsupportedContent()) 1018 1015 emit page->unsupportedContent(reply); … … 1053 1050 newRequest.setURL(QUrl(URLsToRedirect[url])); 1054 1051 } 1055 // seems like the Mac code doesn't do anything here by default neither 1056 //qDebug() << "FrameLoaderClientQt::dispatchWillSendRequest" << request.isNull() << request.url().string`(); 1057 } 1058 1059 bool 1060 FrameLoaderClientQt::shouldUseCredentialStorage(DocumentLoader*, unsigned long) 1052 // Seems like the Mac code doesn't do anything here by default neither. 1053 // qDebug() << "FrameLoaderClientQt::dispatchWillSendRequest" << request.isNull() << request.url().string(); 1054 } 1055 1056 bool FrameLoaderClientQt::shouldUseCredentialStorage(DocumentLoader*, unsigned long) 1061 1057 { 1062 1058 notImplemented(); … … 1181 1177 void FrameLoaderClientQt::dispatchDecidePolicyForResponse(FramePolicyFunction function, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest&) 1182 1178 { 1183 // we need to call directly here1179 // We need to call directly here. 1184 1180 if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment) 1185 1181 callPolicyFunction(function, PolicyDownload); … … 1218 1214 PolicyAction result; 1219 1215 1220 // Currently, this is only enabled by DRT 1216 // Currently, this is only enabled by DRT. 1221 1217 if (policyDelegateEnabled) { 1222 1218 RefPtr<Node> node; … … 1299 1295 emit m_webFrame->page()->frameCreated(webFrame); 1300 1296 1301 // ### set override encoding if we have one1297 // FIXME: Set override encoding if we have one. 1302 1298 1303 1299 m_frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get()); … … 1334 1330 ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& mimeTypeIn, bool shouldPreferPlugInsForImages) 1335 1331 { 1336 //qDebug()<<" ++++++++++++++++ url is "<<url.prettyURL()<<", mime = "<<mimeTypeIn;1332 // qDebug()<<" ++++++++++++++++ url is "<<url.prettyURL()<<", mime = "<<mimeTypeIn; 1337 1333 QFileInfo fi(url.path()); 1338 1334 String extension = fi.suffix(); … … 1435 1431 return; 1436 1432 1437 // if setMask is set with an empty QRegion, no clipping will1438 // be performed, so in that case we hide the platformWidget 1433 // If setMask is set with an empty QRegion, no clipping will 1434 // be performed, so in that case we hide the platformWidget. 1439 1435 QRegion mask = platformWidget()->mask(); 1440 1436 platformWidget()->setVisible(!mask.isEmpty()); … … 1470 1466 graphicsWidget->setGeometry(QRect(windowRect)); 1471 1467 1472 // FIXME: clipping of graphics widgets1468 // FIXME: Make the code handle clipping of graphics widgets. 1473 1469 } 1474 1470 virtual void show() … … 1497 1493 const Vector<String>& paramValues, const String& mimeType, bool loadManually) 1498 1494 { 1499 //qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType;1500 //qDebug()<<"------\t url = "<<url.prettyURL();1495 // qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType; 1496 // qDebug()<<"------\t url = "<<url.prettyURL(); 1501 1497 1502 1498 if (!m_webFrame) … … 1556 1552 if (m_webFrame->page()->d->client) 1557 1553 parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent()); 1558 if (parentWidget) // don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose.1554 if (parentWidget) // Don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose. 1559 1555 widget->setParent(parentWidget); 1560 1556 widget->hide(); 1561 1557 RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget()); 1562 1558 w->setPlatformWidget(widget); 1563 // Make sure it's invisible until properly placed into the layout 1559 // Make sure it's invisible until properly placed into the layout. 1564 1560 w->setFrameRect(IntRect(0, 0, 0, 0)); 1565 1561 return w; … … 1573 1569 parentWidget = qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent()); 1574 1570 graphicsWidget->hide(); 1575 if (parentWidget) // don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose.1571 if (parentWidget) // Don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose. 1576 1572 graphicsWidget->setParentItem(parentWidget); 1577 1573 RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget); 1578 // Make sure it's invisible until properly placed into the layout 1574 // Make sure it's invisible until properly placed into the layout. 1579 1575 w->setFrameRect(IntRect(0, 0, 0, 0)); 1580 1576 return w; … … 1582 1578 #endif // QT_NO_GRAPHICSVIEW 1583 1579 1584 // FIXME: make things work for widgetless plugins as well1580 // FIXME: Make things work for widgetless plugins as well. 1585 1581 delete object; 1586 1582 } … … 1595 1591 size_t wmodeIndex = params.find("wmode"); 1596 1592 if (wmodeIndex == -1) { 1597 // Disable XEmbed mode and force it to opaque mode 1593 // Disable XEmbed mode and force it to opaque mode. 1598 1594 params.append("wmode"); 1599 1595 values.append("opaque"); 1600 1596 } else if (!isQWebView) { 1601 // Disable transparency if client is not a QWebView 1597 // Disable transparency if client is not a QWebView. 1602 1598 values[wmodeIndex] = "opaque"; 1603 1599 } 1604 1600 #else 1605 1601 if (!isQWebView) { 1606 // inject wmode=opaque when there is no client or the client is not a QWebView1602 // Inject wmode=opaque when there is no client or the client is not a QWebView. 1607 1603 size_t wmodeIndex = params.find("wmode"); 1608 1604 if (wmodeIndex == -1) {
Note: See TracChangeset
for help on using the changeset viewer.