Changeset 94906 in webkit


Ignore:
Timestamp:
Sep 10, 2011 6:15:49 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore: [Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters
https://bugs.webkit.org/show_bug.cgi?id=34884

KURL::path() alone does not handle removing the leading slash from a windows file path.
Using QUrl::toLocalFile() will turn file:///C:/path into C:/path appropriately.

Patch by Jarred Nicholls <jarred@sencha.com> on 2011-09-10
Reviewed by Andreas Kling.

  • platform/qt/KURLQt.cpp:

(WebCore::KURL::fileSystemPath):

Source/WebKit/qt: [Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters
https://bugs.webkit.org/show_bug.cgi?id=34884

KURL::path() alone does not handle removing the leading slash from a windows file path.
Using QUrl::toLocalFile() will turn file:///C:/path into C:/path appropriately.

New test case that ensures a user stylesheet from the file system will load correctly
on all platforms.

Patch by Jarred Nicholls <jarred@sencha.com> on 2011-09-10
Reviewed by Andreas Kling.

  • tests/qwebpage/resources/user.css: Added.

(p):

  • tests/qwebpage/tst_qwebpage.cpp:

(tst_QWebPage::userStyleSheetFromFile):

Location:
trunk/Source
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r94905 r94906  
     12011-09-10  Jarred Nicholls  <jarred@sencha.com>
     2
     3        [Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters
     4        https://bugs.webkit.org/show_bug.cgi?id=34884
     5       
     6        KURL::path() alone does not handle removing the leading slash from a windows file path.
     7        Using QUrl::toLocalFile() will turn file:///C:/path into C:/path appropriately.
     8
     9        Reviewed by Andreas Kling.
     10
     11        * platform/qt/KURLQt.cpp:
     12        (WebCore::KURL::fileSystemPath):
     13
    1142011-09-10  Ken Buchanan <kenrb@chromium.org>
    215
  • trunk/Source/WebCore/platform/qt/KURLQt.cpp

    r60746 r94906  
    4747        return String();
    4848
    49     return String(path());
     49    return static_cast<QUrl>(*this).toLocalFile();
    5050}
    5151
  • trunk/Source/WebKit/qt/ChangeLog

    r94889 r94906  
     12011-09-10  Jarred Nicholls  <jarred@sencha.com>
     2
     3        [Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters
     4        https://bugs.webkit.org/show_bug.cgi?id=34884
     5       
     6        KURL::path() alone does not handle removing the leading slash from a windows file path.
     7        Using QUrl::toLocalFile() will turn file:///C:/path into C:/path appropriately.
     8       
     9        New test case that ensures a user stylesheet from the file system will load correctly
     10        on all platforms.
     11
     12        Reviewed by Andreas Kling.
     13
     14        * tests/qwebpage/resources/user.css: Added.
     15        (p):
     16        * tests/qwebpage/tst_qwebpage.cpp:
     17        (tst_QWebPage::userStyleSheetFromFile):
     18
    1192011-09-09  Fady Samuel  <fsamuel@chromium.org>
    220
  • trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r94620 r94906  
    102102    void acceptNavigationRequestWithNewWindow();
    103103    void userStyleSheet();
     104    void userStyleSheetFromLocalFileUrl();
    104105    void loadHtml5Video();
    105106    void modified();
     
    466467    TestNetworkManager* networkManager = new TestNetworkManager(m_page);
    467468    m_page->setNetworkAccessManager(networkManager);
    468     networkManager->requestedUrls.clear();
    469469
    470470    m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css;charset=utf-8;base64,"
    471471            + QByteArray("p { background-image: url('http://does.not/exist.png');}").toBase64()));
     472    m_view->setHtml("<p>hello world</p>");
     473    QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool))));
     474
     475    QVERIFY(networkManager->requestedUrls.count() >= 1);
     476    QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png"));
     477}
     478
     479void tst_QWebPage::userStyleSheetFromLocalFileUrl()
     480{
     481    TestNetworkManager* networkManager = new TestNetworkManager(m_page);
     482    m_page->setNetworkAccessManager(networkManager);
     483
     484    QUrl styleSheetUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebpage/resources/user.css"));
     485    m_page->settings()->setUserStyleSheetUrl(styleSheetUrl);
    472486    m_view->setHtml("<p>hello world</p>");
    473487    QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool))));
Note: See TracChangeset for help on using the changeset viewer.