2008-09-04 Tor Arne Vestbø <tavestbo@trolltech.com>
authorvestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Sep 2008 11:44:17 +0000 (11:44 +0000)
committervestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Sep 2008 11:44:17 +0000 (11:44 +0000)
        Reviewed by Simon.

        Re-enable support for user stylesheets in QtWebKit

        QtWebKit now follows the FRAME_LOADS_USER_STYLESHEET
        code path, which allows us to keep API support for
        loading user style sheets from remote URLs.

        As part of the change UserStyleSheetLoader.cpp/h was
        moved from WebCore/loader/mac to WebCore/loader.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@36088 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.pro
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/dom/Document.h
WebCore/loader/UserStyleSheetLoader.cpp [moved from WebCore/loader/mac/UserStyleSheetLoader.cpp with 100% similarity]
WebCore/loader/UserStyleSheetLoader.h [moved from WebCore/loader/mac/UserStyleSheetLoader.h with 100% similarity]
WebCore/page/qt/FrameQt.cpp
WebKit/qt/ChangeLog
WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

index 2ee19be1ccca933e0017afa7f4e4081e2c6b55b7..38b2d8d5992546b0a0f8c550d4a3442b40154270 100644 (file)
@@ -1,3 +1,27 @@
+2008-09-04  Tor Arne Vestbø  <tavestbo@trolltech.com>
+
+        Reviewed by Simon.
+
+        Re-enable support for user stylesheets in QtWebKit
+        
+        QtWebKit now follows the FRAME_LOADS_USER_STYLESHEET
+        code path, which allows us to keep API support for
+        loading user style sheets from remote URLs.
+        
+        As part of the change UserStyleSheetLoader.cpp/h was
+        moved from WebCore/loader/mac to WebCore/loader.
+
+        * WebCore.pro:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Document.h:
+        * loader/UserStyleSheetLoader.cpp: Renamed from WebCore/loader/mac/UserStyleSheetLoader.cpp.
+        (UserStyleSheetLoader::UserStyleSheetLoader):
+        (UserStyleSheetLoader::~UserStyleSheetLoader):
+        * loader/UserStyleSheetLoader.h: Renamed from WebCore/loader/mac/UserStyleSheetLoader.h.
+        * page/qt/FrameQt.cpp:
+        (WebCore::Frame::setUserStyleSheetLocation):
+        (WebCore::Frame::setUserStyleSheet):
+
 2008-09-04  Alp Toker  <alp@nuanti.com>
 
         Reviewed by Eric.
index abcbc880b9ff94ed0fb02a41ae695292a0bc456c..232275191ac9eaef5a5e7f93d35d26c65f5791bb 100644 (file)
@@ -115,7 +115,7 @@ INCLUDEPATH += \
     $$PWD/platform/graphics/filters \
     $$PWD/platform/graphics/qt \
     $$PWD/svg/graphics/qt \
-    $$PWD/loader/qt \
+    $$PWD/loader \
     $$PWD/page/qt \
     $$PWD/../WebKit/qt/WebCoreSupport \
     $$PWD/../WebKit/qt/Api \
@@ -694,6 +694,7 @@ SOURCES += \
     loader/archive/ArchiveFactory.cpp \
     loader/archive/ArchiveResource.cpp \
     loader/archive/ArchiveResourceCollection.cpp \
+    loader/UserStyleSheetLoader.cpp \
     loader/Cache.cpp \
     loader/CachedCSSStyleSheet.cpp \
     loader/CachedFont.cpp \
index 3b3d1c5eb2d51e29ca672fea6dc28ada4d3413bd..cc5382c70b731c6792ae85481b4163e9d7835b44 100644 (file)
                65DF323E09D1DE65000BE325 /* JSCanvasRenderingContext2D.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DF323809D1DE65000BE325 /* JSCanvasRenderingContext2D.h */; };
                65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */; };
                65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
+               7284ADDD0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7284ADDB0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp */; };
+               7284ADDE0E6FEB31002EEFBD /* UserStyleSheetLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */; };
                75793E830D0CE0B3007FC0AC /* MessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */; };
                75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793E810D0CE0B3007FC0AC /* MessageEvent.h */; };
                75793EC80D0CE72D007FC0AC /* JSMessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75793EC60D0CE72D007FC0AC /* JSMessageEvent.cpp */; };
                BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFE2F0F0C1B58370020235F /* JSRect.cpp */; };
                BCFE2F120C1B58380020235F /* JSRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFE2F100C1B58370020235F /* JSRect.h */; };
                BCFE8E320A02A1D30009E61D /* WebCoreTextRenderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCFE8E310A02A1D30009E61D /* WebCoreTextRenderer.mm */; };
-               C0294DF30D5A6FD800CC7D6B /* UserStyleSheetLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0294DF10D5A6FD800CC7D6B /* UserStyleSheetLoader.cpp */; };
-               C0294DF40D5A6FD800CC7D6B /* UserStyleSheetLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = C0294DF20D5A6FD800CC7D6B /* UserStyleSheetLoader.h */; };
                C02B14C20D81E02A00D8A970 /* JavaScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = C02B14BF0D81E02A00D8A970 /* JavaScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
                C02B14C30D81E02A00D8A970 /* JavaScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C02B14C00D81E02A00D8A970 /* JavaScriptDebugServer.cpp */; };
                C02B14C40D81E02A00D8A970 /* JavaScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = C02B14C10D81E02A00D8A970 /* JavaScriptDebugServer.h */; };
                65DF323809D1DE65000BE325 /* JSCanvasRenderingContext2D.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCanvasRenderingContext2D.h; sourceTree = "<group>"; };
                65F80697054D9F86008BF776 /* BlockExceptions.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BlockExceptions.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
+               7284ADDB0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserStyleSheetLoader.cpp; sourceTree = "<group>"; };
+               7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserStyleSheetLoader.h; sourceTree = "<group>"; };
                75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = MessageEvent.cpp; path = dom/MessageEvent.cpp; sourceTree = SOURCE_ROOT; };
                75793E810D0CE0B3007FC0AC /* MessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = MessageEvent.h; path = dom/MessageEvent.h; sourceTree = SOURCE_ROOT; };
                75793E820D0CE0B3007FC0AC /* MessageEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = MessageEvent.idl; path = dom/MessageEvent.idl; sourceTree = SOURCE_ROOT; };
                BE91FC8B06133666005E3790 /* Position.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Position.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BE91FC8C06133666005E3790 /* Position.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Position.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreKeyboardUIMode.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               C0294DF10D5A6FD800CC7D6B /* UserStyleSheetLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserStyleSheetLoader.cpp; sourceTree = "<group>"; };
-               C0294DF20D5A6FD800CC7D6B /* UserStyleSheetLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserStyleSheetLoader.h; sourceTree = "<group>"; };
                C02B14BF0D81E02A00D8A970 /* JavaScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptDebugListener.h; sourceTree = "<group>"; };
                C02B14C00D81E02A00D8A970 /* JavaScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptDebugServer.cpp; sourceTree = "<group>"; };
                C02B14C10D81E02A00D8A970 /* JavaScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptDebugServer.h; sourceTree = "<group>"; };
                                656D371A0ADBA5DE00A4554D /* LoaderNSURLExtras.h */,
                                656D371B0ADBA5DE00A4554D /* LoaderNSURLExtras.mm */,
                                51AA3F6E0BD5AA9E00892971 /* ResourceLoaderMac.mm */,
-                               C0294DF10D5A6FD800CC7D6B /* UserStyleSheetLoader.cpp */,
-                               C0294DF20D5A6FD800CC7D6B /* UserStyleSheetLoader.h */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                1A6938000A11100A00C127FE /* TextDocument.h */,
                                F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */,
                                F523D27902DE43D7018635CA /* TextResourceDecoder.h */,
+                               7284ADDB0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp */,
+                               7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */,
                        );
                        path = loader;
                        sourceTree = "<group>";
                                934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
                                934F71420D5A6F4400018D69 /* ResourceError.h in Headers */,
                                934F71440D5A6F5300018D69 /* AuthenticationChallenge.h in Headers */,
-                               C0294DF40D5A6FD800CC7D6B /* UserStyleSheetLoader.h in Headers */,
                                37F818FD0D657606005E1F05 /* WebCoreURLResponse.h in Headers */,
                                BCC573350D695BBE006EF517 /* DOMProgressEvent.h in Headers */,
                                BCC573380D695BD7006EF517 /* DOMProgressEventInternal.h in Headers */,
                                316FE07F0E6CCC2800BF6088 /* DOMWebKitCSSKeyframeRuleInternal.h in Headers */,
                                316FE0800E6CCC2800BF6088 /* DOMWebKitCSSKeyframesRule.h in Headers */,
                                316FE0820E6CCC2800BF6088 /* DOMWebKitCSSKeyframesRuleInternal.h in Headers */,
+                               7284ADDE0E6FEB31002EEFBD /* UserStyleSheetLoader.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                51A9267E0D53F0570063ECC2 /* OriginUsageRecord.cpp in Sources */,
                                934F71380D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp in Sources */,
                                934F713E0D5A6F2800018D69 /* ResourceErrorBase.cpp in Sources */,
-                               C0294DF30D5A6FD800CC7D6B /* UserStyleSheetLoader.cpp in Sources */,
                                37F818FE0D657606005E1F05 /* WebCoreURLResponse.mm in Sources */,
                                BCC573360D695BBE006EF517 /* DOMProgressEvent.mm in Sources */,
                                A77979160D6B9D0C003851B9 /* CanvasPixelArray.cpp in Sources */,
                                316FE0730E6CCBEE00BF6088 /* JSWebKitCSSKeyframesRule.cpp in Sources */,
                                316FE07E0E6CCC2800BF6088 /* DOMWebKitCSSKeyframeRule.mm in Sources */,
                                316FE0810E6CCC2800BF6088 /* DOMWebKitCSSKeyframesRule.mm in Sources */,
+                               7284ADDD0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 5fa1370bafe0fb7024b6c5a8e4294772e66ce245..58adb3bbdbfe620e06e5e892cd746ba25b66d357 100644 (file)
@@ -40,7 +40,7 @@
 // FIXME: We should move Mac off of the old Frame-based user stylesheet loading
 // code and onto the new code in Page. We can't do that until the code in Page
 // supports non-file: URLs, however.
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(QT)
 #define FRAME_LOADS_USER_STYLESHEET 1
 #else
 #define FRAME_LOADS_USER_STYLESHEET 0
index 560fd5bde73dee538af87a2884fc4937935ad521..1bbbff50c1572e81062c9821161414523f9d133d 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "config.h"
 #include "Frame.h"
+#include "FramePrivate.h"
+#include "UserStyleSheetLoader.h"
 
 namespace WebCore {
 
@@ -30,6 +32,22 @@ DragImageRef Frame::dragImageForSelection()
 {
     return 0;
 }
-    
+
+void Frame::setUserStyleSheetLocation(const KURL& url)
+{
+    delete d->m_userStyleSheetLoader;
+    d->m_userStyleSheetLoader = 0;
+    if (d->m_doc && d->m_doc->docLoader())
+        d->m_userStyleSheetLoader = new UserStyleSheetLoader(d->m_doc, url.string());
+}
+
+void Frame::setUserStyleSheet(const String& styleSheet)
+{
+    delete d->m_userStyleSheetLoader;
+    d->m_userStyleSheetLoader = 0;
+    if (d->m_doc)
+        d->m_doc->setUserStyleSheet(styleSheet);
+}
+
 }
 // vim: ts=4 sw=4 et
index dd467dc29803b396424a41def07fe96a59442d0e..43456fdc849b816ebac668903be80bd6843afd59 100644 (file)
@@ -1,3 +1,19 @@
+2008-09-04  Tor Arne Vestbø  <tavestbo@trolltech.com>
+
+        Reviewed by Simon.
+
+        Re-enable support for user stylesheets in QtWebKit
+        
+        QtWebKit now follows the FRAME_LOADS_USER_STYLESHEET
+        code path, which allows us to keep API support for
+        loading user style sheets from remote URLs.
+        
+        As part of the change UserStyleSheetLoader.cpp/h was
+        moved from WebCore/loader/mac to WebCore/loader.
+
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (tst_QWebPage::userStyleSheet):
+
 2008-08-29  Holger Hans Peter Freyther  <zecke@selfish.org>
 
         Reviewed by Eric Seidel.
index 7c443ca2773e44abbb44f6510ff6c0eed5b79855..da9379e19eff97eea8eefe276115fc8755dacaa1 100644 (file)
@@ -262,7 +262,7 @@ void tst_QWebPage::userStyleSheet()
     m_view->setHtml("<p>hello world</p>");
     QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool))));
 
-    QCOMPARE(networkManager->requestedUrls.count(), 2);
+    QVERIFY(networkManager->requestedUrls.count() >= 2);
     QCOMPARE(networkManager->requestedUrls.at(0), QUrl::fromEncoded("data:text/css,p { background-image: url(qrc:/does/not/exist.png);}"));
     QCOMPARE(networkManager->requestedUrls.at(1), QUrl::fromEncoded("qrc:/does/not/exist.png"));
 }