Changeset 22027 in webkit
- Timestamp:
- Jun 6, 2007 7:47:42 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r22024 r22027 1 2007-06-06 Lars Knoll <lars@trolltech.com> 2 3 Reviewed by Zack 4 5 Add an API to create and load plugins. 6 Don't include moc files by hand anymore, rather let 7 qmake handle them. 8 9 * WebCore.pro: 10 * platform/qt/MimeTypeRegistryQt.cpp: 11 (WebCore::): 12 (WebCore::MimeTypeRegistry::getMIMETypeForExtension): 13 * platform/qt/QWebPopup.cpp: 14 * platform/qt/SharedTimerQt.cpp: 15 1 16 2007-06-06 Mark Rowe <mrowe@apple.com> 2 17 -
trunk/WebCore/WebCore.pro
r21938 r22027 60 60 LIBS += -lxml2 -lxslt 61 61 } 62 62 63 qt-port { 63 64 INCLUDEPATH += \ … … 134 135 135 136 STYLESHEETS_EMBED = $$PWD/css/html4.css 136 137 MANUALMOC =138 qt-port:MANUALMOC += \139 $$PWD/platform/qt/QWebPopup.h \140 $$PWD/platform/qt/SharedTimerQt.h \141 $$PWD/../WebKitQt/Api/qwebframe.h \142 $$PWD/../WebKitQt/Api/qwebpage.h \143 $$PWD/../WebKitQt/Api/qwebnetworkinterface.h \144 $$PWD/../WebKitQt/Api/qwebnetworkinterface_p.h \145 $$PWD/../WebKitQt/Api/qcookiejar.h \146 $$PWD/../WebKitQt/WebCoreSupport/FrameLoaderClientQt.h147 137 148 138 LUT_FILES += \ … … 715 705 xml/XSLTProcessor.cpp 716 706 707 qt-port:HEADERS += \ 708 $$PWD/platform/qt/QWebPopup.h \ 709 $$PWD/platform/qt/SharedTimerQt.h \ 710 $$PWD/../WebKitQt/Api/qwebframe.h \ 711 $$PWD/../WebKitQt/Api/qwebpage.h \ 712 $$PWD/../WebKitQt/Api/qwebnetworkinterface.h \ 713 $$PWD/../WebKitQt/Api/qwebnetworkinterface_p.h \ 714 $$PWD/../WebKitQt/Api/qwebobjectplugin.h \ 715 $$PWD/../WebKitQt/Api/qwebobjectplugin_p.h \ 716 $$PWD/../WebKitQt/Api/qcookiejar.h \ 717 $$PWD/../WebKitQt/WebCoreSupport/FrameLoaderClientQt.h 718 717 719 qt-port:SOURCES += \ 718 720 page/qt/DragControllerQt.cpp \ … … 782 784 ../WebKitQt/Api/qwebpage.cpp \ 783 785 ../WebKitQt/Api/qwebpagehistory.cpp \ 784 ../WebKitQt/Api/qwebsettings.cpp 786 ../WebKitQt/Api/qwebsettings.cpp \ 787 ../WebKitQt/Api/qwebobjectplugin.cpp 785 788 786 789 gdk-port:SOURCES += \ … … 1389 1392 QMAKE_EXTRA_COMPILERS += stylesheets 1390 1393 1391 # GENERATOR M1392 manual_moc.output = tmp/${QMAKE_FILE_BASE}.moc1393 manual_moc.commands = $$QMAKE_MOC ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}1394 manual_moc.input = MANUALMOC1395 manual_moc.CONFIG += target_predeps no_link1396 QMAKE_EXTRA_COMPILERS += manual_moc1397 1398 1394 # GENERATOR 10: XPATH grammar 1399 1395 xpathbison.output = tmp/${QMAKE_FILE_BASE}.cpp -
trunk/WebCore/platform/qt/MimeTypeRegistryQt.cpp
r21827 r22027 30 30 #include "NotImplemented.h" 31 31 32 namespace WebCore 32 #include "qwebobjectplugin_p.h" 33 34 namespace WebCore 33 35 { 34 36 … … 41 43 { "gif", "image/gif" }, 42 44 { "html", "text/html" }, 43 { "ico", "image/x-icon" }, 45 { "ico", "image/x-icon" }, 44 46 { "jpeg", "image/jpeg" }, 45 47 { "jpg", "image/jpeg" }, … … 64 66 { 0, 0 } 65 67 }; 66 68 67 69 String MimeTypeRegistry::getMIMETypeForExtension(const String &ext) 68 70 { 69 71 String s = ext.lower(); 72 70 73 const ExtensionMap *e = extensionMap; 71 74 while (e->extension) { … … 74 77 ++e; 75 78 } 76 // unknown, let's just assume plain text 77 return "text/plain"; 79 QString type = QWebFactoryLoader::self()->mimeTypeForExtension(ext); 80 if (!type.isEmpty()) 81 return type; 82 83 return "application/octet-stream"; 78 84 } 79 85 -
trunk/WebCore/platform/qt/QWebPopup.cpp
r19772 r22027 23 23 #include <QCoreApplication> 24 24 #include <QMouseEvent> 25 26 #include "QWebPopup.moc"27 25 28 26 namespace WebCore { -
trunk/WebCore/platform/qt/SharedTimerQt.cpp
r21516 r22027 51 51 } 52 52 53 #include "SharedTimerQt.moc"54 55 53 // vim: ts=4 sw=4 et -
trunk/WebKitQt/Api/qcookiejar.cpp
r19347 r22027 104 104 return gJar; 105 105 } 106 107 108 #include "qcookiejar.moc" -
trunk/WebKitQt/Api/qwebframe.cpp
r21515 r22027 323 323 viewport()->scroll(dx, dy); 324 324 } 325 326 #include "qwebframe.moc" -
trunk/WebKitQt/Api/qwebnetworkinterface.cpp
r21754 r22027 794 794 } 795 795 796 #include "qwebnetworkinterface_p.moc"797 #include "qwebnetworkinterface.moc"798 -
trunk/WebKitQt/Api/qwebpage.cpp
r21836 r22027 358 358 return settings; 359 359 } 360 361 362 #include "qwebpage.moc" -
trunk/WebKitQt/ChangeLog
r21836 r22027 1 2007-06-06 Lars Knoll <lars@trolltech.com> 2 3 Reviewed by Zack 4 5 Add an API to create and load plugins. 6 Don't include moc files by hand anymore, rather let 7 qmake handle them. 8 9 * Api/qcookiejar.cpp: 10 (QCookieJar::cookieJar): 11 * Api/qwebframe.cpp: 12 (QWebFrame::scrollContentsBy): 13 * Api/qwebnetworkinterface.cpp: 14 * Api/qwebobjectplugin.cpp: Added. 15 (QWebFactoryLoader::QWebFactoryLoader): 16 (QWebFactoryLoader::self): 17 (QWebFactoryLoader::mimeTypeForExtension): 18 (QWebFactoryLoader::create): 19 (QWebObjectPlugin::QWebObjectPlugin): 20 (QWebObjectPlugin::~QWebObjectPlugin): 21 (QWebObjectPlugin::extensionsForMimetype): 22 * Api/qwebobjectplugin.h: Added. 23 * Api/qwebobjectplugin_p.h: Added. 24 (QWebFactoryLoader::mimeTypes): 25 (QWebFactoryLoader::extensions): 26 (QWebFactoryLoader::supportsMimeType): 27 * Api/qwebpage.cpp: 28 (QWebPage::settings): 29 * WebCoreSupport/FrameLoaderClientQt.cpp: 30 (WebCore::FrameLoaderClientQt::dispatchDidHandleOnloadEvents): 31 (WebCore::FrameLoaderClientQt::postProgressEstimateChangedNotification): 32 (WebCore::FrameLoaderClientQt::objectContentType): 33 (WebCore::FrameLoaderClientQt::createPlugin): 34 1 35 2007-05-28 Zack Rusin <zrusin@trolltech.com> 2 36 -
trunk/WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp
r21827 r22027 45 45 #include "qwebframe.h" 46 46 #include "qwebframe_p.h" 47 #include "qwebobjectplugin_p.h" 47 48 48 49 #include <qfileinfo.h> … … 289 290 void FrameLoaderClientQt::dispatchDidHandleOnloadEvents() 290 291 { 291 292 // don't need this one 292 293 } 293 294 … … 425 426 { 426 427 if (m_webFrame && m_frame->page()) 427 emit loadProgressChanged( m_frame->page()->progress()->estimatedProgress() * 100);428 emit loadProgressChanged(qRound(m_frame->page()->progress()->estimatedProgress() * 100)); 428 429 } 429 430 … … 503 504 return false; 504 505 } 505 506 506 507 507 bool FrameLoaderClientQt::representationExistsForURLScheme(const String& URLScheme) const … … 864 864 } 865 865 866 ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& mimeType) 867 { 866 ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& _mimeType) 867 { 868 //qDebug()<<" ++++++++++++++++ url is "<<url.prettyURL()<<", mime = "<<mimeType; 868 869 if (!url.isValid()) 869 return ObjectContentType(); 870 return ObjectContentNone; 871 872 String mimeType = _mimeType; 873 if (!mimeType.length()) { 874 QFileInfo fi(url.path()); 875 mimeType = MimeTypeRegistry::getMIMETypeForExtension(fi.suffix()); 876 } 877 878 if (!mimeType.length()) 879 return ObjectContentFrame; 880 881 if (MimeTypeRegistry::isSupportedImageMIMEType(mimeType)) 882 return ObjectContentImage; 883 884 if (QWebFactoryLoader::self()->supportsMimeType(mimeType)) 885 return ObjectContentPlugin; 886 887 if (MimeTypeRegistry::isSupportedNonImageMIMEType(mimeType)) 888 return ObjectContentFrame; 870 889 871 //This is not really correct. it works because getMIMETypeForExtension 872 // currently returns only the mimetypes that frames can handle 873 QFileInfo fi(url.path()); 874 String rtype = MimeTypeRegistry::getMIMETypeForExtension(fi.suffix()); 875 if (!rtype.isEmpty()) 876 return ObjectContentFrame; 877 return ObjectContentType(); 878 } 879 880 Widget* FrameLoaderClientQt::createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) 881 { 882 notImplemented(); 890 return ObjectContentNone; 891 } 892 893 Widget* FrameLoaderClientQt::createPlugin(Element* element, const KURL& url, const Vector<String>& paramNames, 894 const Vector<String>& paramValues, const String& mimeType, bool loadManually) 895 { 896 //qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<mimeType; 897 //qDebug()<<"------\t url = "<<url.prettyURL(); 898 QStringList params; 899 QStringList values; 900 for (int i = 0; i < paramNames.size(); ++i) 901 params.append(paramNames[i]); 902 for (int i = 0; i < paramValues.size(); ++i) 903 values.append(paramValues[i]); 904 905 QObject *object = QWebFactoryLoader::self()->create(m_webFrame->viewport(), mimeType, params, values); 906 if (object) { 907 QWidget *widget = qobject_cast<QWidget *>(object); 908 if (widget) { 909 Widget* w= new Widget(); 910 w->setQWidget(widget); 911 return w; 912 } 913 // FIXME: make things work for widgetless plugins as well 914 delete object; 915 } 916 883 917 return 0; 884 918 } … … 904 938 905 939 } 906 907 #include "FrameLoaderClientQt.moc"
Note: See TracChangeset
for help on using the changeset viewer.