Changeset 48075 in webkit


Ignore:
Timestamp:
Sep 4, 2009 2:33:08 PM (15 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=28984, remove the remote stylesheet loader on Mac/Qt.
Make sure the other code path (now used by everybody) can handle data URLs.

Reviewed by Adam Roben.

As per the post on webkit-dev, the ability to work remotely isn't working properly anyway (it doesn't
hold up the pending sheet count, so you'd just FOUC on every Web page), and it's extremely unlikely
that anybody is relying on this support.

Tor Arne agreed it was ok to disable (he enabled it on the Qt side), and only Mac/Qt were using this
code.

  • WebCore.pro:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/Document.cpp:

(WebCore::Document::userStyleSheet):

  • dom/Document.h:
  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::begin):

  • loader/UserStyleSheetLoader.cpp: Removed.
  • loader/UserStyleSheetLoader.h: Removed.
  • page/Frame.cpp:

(WebCore::Frame::reapplyStyles):

  • page/Frame.h:
  • page/Page.cpp:

(WebCore::Page::userStyleSheetLocationChanged):
(WebCore::Page::userStyleSheet):

  • page/mac/FrameMac.mm:
  • page/qt/FrameQt.cpp:
Location:
trunk/WebCore
Files:
2 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r48074 r48075  
     12009-09-04  Dave Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=28984, remove the remote stylesheet loader on Mac/Qt.
     6        Make sure the other code path (now used by everybody) can handle data URLs.
     7
     8        As per the post on webkit-dev, the ability to work remotely isn't working properly anyway (it doesn't
     9        hold up the pending sheet count, so you'd just FOUC on every Web page), and it's extremely unlikely
     10        that anybody is relying on this support.
     11       
     12        Tor Arne agreed it was ok to disable (he enabled it on the Qt side), and only Mac/Qt were using this
     13        code.
     14
     15        * WebCore.pro:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        * dom/Document.cpp:
     18        (WebCore::Document::userStyleSheet):
     19        * dom/Document.h:
     20        * loader/FrameLoader.cpp:
     21        (WebCore::FrameLoader::begin):
     22        * loader/UserStyleSheetLoader.cpp: Removed.
     23        * loader/UserStyleSheetLoader.h: Removed.
     24        * page/Frame.cpp:
     25        (WebCore::Frame::reapplyStyles):
     26        * page/Frame.h:
     27        * page/Page.cpp:
     28        (WebCore::Page::userStyleSheetLocationChanged):
     29        (WebCore::Page::userStyleSheet):
     30        * page/mac/FrameMac.mm:
     31        * page/qt/FrameQt.cpp:
     32
    1332009-09-04  Mikhail Naganov  <mnaganov@chromium.org>
    234
  • trunk/WebCore/WebCore.pro

    r48025 r48075  
    10581058    loader/archive/ArchiveResource.cpp \
    10591059    loader/archive/ArchiveResourceCollection.cpp \
    1060     loader/UserStyleSheetLoader.cpp \
    10611060    loader/Cache.cpp \
    10621061    loader/CachedCSSStyleSheet.cpp \
     
    17731772    loader/TextResourceDecoder.h \
    17741773    loader/ThreadableLoader.h \
    1775     loader/UserStyleSheetLoader.h \
    17761774    loader/WorkerThreadableLoader.h \
    17771775    page/animation/AnimationBase.h \
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r48057 r48075  
    11231123                65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
    11241124                72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; };
    1125                 7284ADDD0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7284ADDB0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp */; };
    11261125                7284ADDE0E6FEB31002EEFBD /* UserStyleSheetLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */; };
    11271126                75793E830D0CE0B3007FC0AC /* MessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */; };
     
    62956294                65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
    62966295                72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; };
    6297                 7284ADDB0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserStyleSheetLoader.cpp; sourceTree = "<group>"; };
    62986296                7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserStyleSheetLoader.h; sourceTree = "<group>"; };
    62996297                75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = MessageEvent.cpp; path = dom/MessageEvent.cpp; sourceTree = SOURCE_ROOT; };
     
    1438014378                                0B9056170F2578BE0095FF6A /* ThreadableLoader.h */,
    1438114379                                0B9056180F2578BE0095FF6A /* ThreadableLoaderClient.h */,
    14382                                 7284ADDB0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp */,
    1438314380                                7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */,
    1438414381                                0B9056F60F2685F30095FF6A /* WorkerThreadableLoader.cpp */,
     
    1953819535                                D086FE9909D53AAB005BC74D /* UnlinkCommand.cpp in Sources */,
    1953919536                                65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */,
    19540                                 7284ADDD0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp in Sources */,
    1954119537                                15C7708E100D3C6B005BA267 /* ValidityState.cpp in Sources */,
    1954219538                                93309E1D099E64920056E581 /* visible_units.cpp in Sources */,
  • trunk/WebCore/dom/Document.cpp

    r48071 r48075  
    18661866}
    18671867
    1868 #if FRAME_LOADS_USER_STYLESHEET
    1869 void Document::setUserStyleSheet(const String& sheet)
    1870 {
    1871     if (m_usersheet != sheet) {
    1872         m_usersheet = sheet;
    1873         updateStyleSelector();
    1874     }
    1875 }
    1876 #endif
    1877 
    18781868String Document::userStyleSheet() const
    18791869{
    1880 #if FRAME_LOADS_USER_STYLESHEET
    1881     return m_usersheet;
    1882 #else
    18831870    Page* page = this->page();
    18841871    if (!page)
    18851872        return String();
    18861873    return page->userStyleSheet();
    1887 #endif
    18881874}
    18891875
  • trunk/WebCore/dom/Document.h

    r48071 r48075  
    3737#include "Timer.h"
    3838#include <wtf/HashCountedSet.h>
    39 
    40 // FIXME: We should move Mac off of the old Frame-based user stylesheet loading
    41 // code and onto the new code in Page. We can't do that until the code in Page
    42 // supports non-file: URLs, however.
    43 #if PLATFORM(MAC) || PLATFORM(QT)
    44 #define FRAME_LOADS_USER_STYLESHEET 1
    45 #else
    46 #define FRAME_LOADS_USER_STYLESHEET 0
    47 #endif
    4839
    4940namespace WebCore {
     
    447438    virtual String userAgent(const KURL&) const;
    448439
    449 #if FRAME_LOADS_USER_STYLESHEET
    450     void setUserStyleSheet(const String& sheet);
    451 #endif
    452 
    453440    String userStyleSheet() const;
    454441
     
    922909    mutable RefPtr<DOMImplementation> m_implementation;
    923910
    924 #if FRAME_LOADS_USER_STYLESHEET
    925     String m_usersheet;
    926 #endif
    927 
    928911    // Track the number of currently loading top-level stylesheets.  Sheets
    929912    // loaded using the @import directive are not included in this count.
  • trunk/WebCore/loader/FrameLoader.cpp

    r48057 r48075  
    955955    }
    956956
    957 #if FRAME_LOADS_USER_STYLESHEET
    958     KURL userStyleSheet = settings ? settings->userStyleSheetLocation() : KURL();
    959     if (!userStyleSheet.isEmpty())
    960         m_frame->setUserStyleSheetLocation(userStyleSheet);
    961 #endif
    962 
    963957    restoreDocumentState();
    964958
  • trunk/WebCore/page/Frame.cpp

    r48073 r48075  
    8787#endif
    8888
    89 #if FRAME_LOADS_USER_STYLESHEET
    90 #include "UserStyleSheetLoader.h"
    91 #endif
    92 
    9389#if ENABLE(SVG)
    9490#include "SVGDocument.h"
     
    826822    m_doc->docLoader()->setAutoLoadImages(m_page && m_page->settings()->loadsImagesAutomatically());
    827823
    828 #if FRAME_LOADS_USER_STYLESHEET
    829     const KURL userStyleSheetLocation = m_page ? m_page->settings()->userStyleSheetLocation() : KURL();
    830     if (!userStyleSheetLocation.isEmpty())
    831         setUserStyleSheetLocation(userStyleSheetLocation);
    832     else
    833         setUserStyleSheet(String());
    834 #endif
    835 
    836824    // FIXME: It's not entirely clear why the following is needed.
    837825    // The document automatically does this as required when you set the style sheet.
  • trunk/WebCore/page/Frame.h

    r48069 r48075  
    8181    class Widget;
    8282
    83 #if FRAME_LOADS_USER_STYLESHEET
    84     class UserStyleSheetLoader;
    85 #endif
    86 
    8783    template <typename T> class Timer;
    8884
     
    146142        Settings* settings() const; // can be NULL
    147143
    148     #if FRAME_LOADS_USER_STYLESHEET
    149         void setUserStyleSheetLocation(const KURL&);
    150         void setUserStyleSheet(const String& styleSheetData);
    151     #endif
    152 
    153144        void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize);
    154145
     
    372363        bool m_isDisconnected;
    373364        bool m_excludeFromTextSearch;
    374 
    375     #if FRAME_LOADS_USER_STYLESHEET
    376         OwnPtr<UserStyleSheetLoader> m_userStyleSheetLoader;
    377     #endif
    378 
    379365    };
    380366
  • trunk/WebCore/page/Page.cpp

    r46987 r48075  
    2222#include "Page.h"
    2323
     24#include "Base64.h"
    2425#include "CSSStyleSelector.h"
    2526#include "Chrome.h"
     
    440441void Page::userStyleSheetLocationChanged()
    441442{
    442 #if !FRAME_LOADS_USER_STYLESHEET
    443     // FIXME: We should provide a way to load other types of URLs than just
    444     // file: (e.g., http:, data:).
    445     if (m_settings->userStyleSheetLocation().isLocalFile())
    446         m_userStyleSheetPath = m_settings->userStyleSheetLocation().fileSystemPath();
     443    // FIXME: Eventually we will move to a model of just being handed the sheet
     444    // text instead of loading the URL ourselves.
     445    KURL url = m_settings->userStyleSheetLocation();
     446    if (url.isLocalFile())
     447        m_userStyleSheetPath = url.fileSystemPath();
    447448    else
    448449        m_userStyleSheetPath = String();
     
    451452    m_userStyleSheet = String();
    452453    m_userStyleSheetModificationTime = 0;
    453 #endif
     454   
     455    // Data URLs with base64-encoded UTF-8 style sheets are common. We can process them
     456    // synchronously and avoid using a loader.
     457    if (url.protocolIs("data") && url.string().startsWith("data:text/css;charset=utf-8;base64,")) {
     458        m_didLoadUserStyleSheet = true;
     459       
     460        const unsigned prefixLength = 35;
     461        Vector<char> encodedData(url.string().length() - prefixLength);
     462        for (unsigned i = prefixLength; i < url.string().length(); ++i)
     463            encodedData[i - prefixLength] = static_cast<char>(url.string()[i]);
     464
     465        Vector<char> styleSheetAsUTF8;
     466        if (base64Decode(encodedData, styleSheetAsUTF8)) {
     467            m_userStyleSheet = String::fromUTF8(styleSheetAsUTF8.data());
     468            return;
     469        }
     470    }
    454471}
    455472
    456473const String& Page::userStyleSheet() const
    457474{
    458     if (m_userStyleSheetPath.isEmpty()) {
    459         ASSERT(m_userStyleSheet.isEmpty());
     475    if (m_userStyleSheetPath.isEmpty())
    460476        return m_userStyleSheet;
    461     }
    462477
    463478    time_t modTime;
  • trunk/WebCore/page/mac/FrameMac.mm

    r48069 r48075  
    2929#import "Frame.h"
    3030
    31 #import "Base64.h"
    3231#import "BlockExceptions.h"
    3332#import "ColorMac.h"
     
    5453#import "Scrollbar.h"
    5554#import "SimpleFontData.h"
    56 #import "UserStyleSheetLoader.h"
    5755#import "WebCoreViewFactory.h"
    5856#import "visible_units.h"
     
    534532}
    535533
    536 void Frame::setUserStyleSheetLocation(const KURL& url)
    537 {
    538     m_userStyleSheetLoader.clear();
    539 
    540     // Data URLs with base64-encoded UTF-8 style sheets are common. We can process them
    541     // synchronously and avoid using a loader.
    542     if (url.protocolIs("data") && url.string().startsWith("data:text/css;charset=utf-8;base64,")) {
    543         const unsigned prefixLength = 35;
    544         Vector<char> encodedData(url.string().length() - prefixLength);
    545         for (unsigned i = prefixLength; i < url.string().length(); ++i)
    546             encodedData[i - prefixLength] = static_cast<char>(url.string()[i]);
    547 
    548         Vector<char> styleSheetAsUTF8;
    549         if (base64Decode(encodedData, styleSheetAsUTF8)) {
    550             m_doc->setUserStyleSheet(String::fromUTF8(styleSheetAsUTF8.data()));
    551             return;
    552         }
    553     }
    554 
    555     if (m_doc->docLoader())
    556         m_userStyleSheetLoader.set(new UserStyleSheetLoader(m_doc, url.string()));
    557 }
    558 
    559 void Frame::setUserStyleSheet(const String& styleSheet)
    560 {
    561     m_userStyleSheetLoader.clear();
    562     m_doc->setUserStyleSheet(styleSheet);
    563 }
    564 
    565534} // namespace WebCore
  • trunk/WebCore/page/qt/FrameQt.cpp

    r40024 r48075  
    3434}
    3535
    36 void Frame::setUserStyleSheetLocation(const KURL& url)
    37 {
    38     delete m_userStyleSheetLoader;
    39     m_userStyleSheetLoader = 0;
    40     if (m_doc && m_doc->docLoader())
    41         m_userStyleSheetLoader = new UserStyleSheetLoader(m_doc, url.string());
    42 }
    43 
    44 void Frame::setUserStyleSheet(const String& styleSheet)
    45 {
    46     delete m_userStyleSheetLoader;
    47     m_userStyleSheetLoader = 0;
    48     if (m_doc)
    49         m_doc->setUserStyleSheet(styleSheet);
    50 }
    51 
    5236}
    5337// vim: ts=4 sw=4 et
Note: See TracChangeset for help on using the changeset viewer.