Changeset 48075 in webkit
- Timestamp:
- Sep 4, 2009 2:33:08 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r48074 r48075 1 2009-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 1 33 2009-09-04 Mikhail Naganov <mnaganov@chromium.org> 2 34 -
trunk/WebCore/WebCore.pro
r48025 r48075 1058 1058 loader/archive/ArchiveResource.cpp \ 1059 1059 loader/archive/ArchiveResourceCollection.cpp \ 1060 loader/UserStyleSheetLoader.cpp \1061 1060 loader/Cache.cpp \ 1062 1061 loader/CachedCSSStyleSheet.cpp \ … … 1773 1772 loader/TextResourceDecoder.h \ 1774 1773 loader/ThreadableLoader.h \ 1775 loader/UserStyleSheetLoader.h \1776 1774 loader/WorkerThreadableLoader.h \ 1777 1775 page/animation/AnimationBase.h \ -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r48057 r48075 1123 1123 65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; }; 1124 1124 72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; }; 1125 7284ADDD0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7284ADDB0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp */; };1126 1125 7284ADDE0E6FEB31002EEFBD /* UserStyleSheetLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */; }; 1127 1126 75793E830D0CE0B3007FC0AC /* MessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */; }; … … 6295 6294 65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; }; 6296 6295 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>"; };6298 6296 7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserStyleSheetLoader.h; sourceTree = "<group>"; }; 6299 6297 75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = MessageEvent.cpp; path = dom/MessageEvent.cpp; sourceTree = SOURCE_ROOT; }; … … 14380 14378 0B9056170F2578BE0095FF6A /* ThreadableLoader.h */, 14381 14379 0B9056180F2578BE0095FF6A /* ThreadableLoaderClient.h */, 14382 7284ADDB0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp */,14383 14380 7284ADDC0E6FEB31002EEFBD /* UserStyleSheetLoader.h */, 14384 14381 0B9056F60F2685F30095FF6A /* WorkerThreadableLoader.cpp */, … … 19538 19535 D086FE9909D53AAB005BC74D /* UnlinkCommand.cpp in Sources */, 19539 19536 65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */, 19540 7284ADDD0E6FEB31002EEFBD /* UserStyleSheetLoader.cpp in Sources */,19541 19537 15C7708E100D3C6B005BA267 /* ValidityState.cpp in Sources */, 19542 19538 93309E1D099E64920056E581 /* visible_units.cpp in Sources */, -
trunk/WebCore/dom/Document.cpp
r48071 r48075 1866 1866 } 1867 1867 1868 #if FRAME_LOADS_USER_STYLESHEET1869 void Document::setUserStyleSheet(const String& sheet)1870 {1871 if (m_usersheet != sheet) {1872 m_usersheet = sheet;1873 updateStyleSelector();1874 }1875 }1876 #endif1877 1878 1868 String Document::userStyleSheet() const 1879 1869 { 1880 #if FRAME_LOADS_USER_STYLESHEET1881 return m_usersheet;1882 #else1883 1870 Page* page = this->page(); 1884 1871 if (!page) 1885 1872 return String(); 1886 1873 return page->userStyleSheet(); 1887 #endif1888 1874 } 1889 1875 -
trunk/WebCore/dom/Document.h
r48071 r48075 37 37 #include "Timer.h" 38 38 #include <wtf/HashCountedSet.h> 39 40 // FIXME: We should move Mac off of the old Frame-based user stylesheet loading41 // code and onto the new code in Page. We can't do that until the code in Page42 // supports non-file: URLs, however.43 #if PLATFORM(MAC) || PLATFORM(QT)44 #define FRAME_LOADS_USER_STYLESHEET 145 #else46 #define FRAME_LOADS_USER_STYLESHEET 047 #endif48 39 49 40 namespace WebCore { … … 447 438 virtual String userAgent(const KURL&) const; 448 439 449 #if FRAME_LOADS_USER_STYLESHEET450 void setUserStyleSheet(const String& sheet);451 #endif452 453 440 String userStyleSheet() const; 454 441 … … 922 909 mutable RefPtr<DOMImplementation> m_implementation; 923 910 924 #if FRAME_LOADS_USER_STYLESHEET925 String m_usersheet;926 #endif927 928 911 // Track the number of currently loading top-level stylesheets. Sheets 929 912 // loaded using the @import directive are not included in this count. -
trunk/WebCore/loader/FrameLoader.cpp
r48057 r48075 955 955 } 956 956 957 #if FRAME_LOADS_USER_STYLESHEET958 KURL userStyleSheet = settings ? settings->userStyleSheetLocation() : KURL();959 if (!userStyleSheet.isEmpty())960 m_frame->setUserStyleSheetLocation(userStyleSheet);961 #endif962 963 957 restoreDocumentState(); 964 958 -
trunk/WebCore/page/Frame.cpp
r48073 r48075 87 87 #endif 88 88 89 #if FRAME_LOADS_USER_STYLESHEET90 #include "UserStyleSheetLoader.h"91 #endif92 93 89 #if ENABLE(SVG) 94 90 #include "SVGDocument.h" … … 826 822 m_doc->docLoader()->setAutoLoadImages(m_page && m_page->settings()->loadsImagesAutomatically()); 827 823 828 #if FRAME_LOADS_USER_STYLESHEET829 const KURL userStyleSheetLocation = m_page ? m_page->settings()->userStyleSheetLocation() : KURL();830 if (!userStyleSheetLocation.isEmpty())831 setUserStyleSheetLocation(userStyleSheetLocation);832 else833 setUserStyleSheet(String());834 #endif835 836 824 // FIXME: It's not entirely clear why the following is needed. 837 825 // The document automatically does this as required when you set the style sheet. -
trunk/WebCore/page/Frame.h
r48069 r48075 81 81 class Widget; 82 82 83 #if FRAME_LOADS_USER_STYLESHEET84 class UserStyleSheetLoader;85 #endif86 87 83 template <typename T> class Timer; 88 84 … … 146 142 Settings* settings() const; // can be NULL 147 143 148 #if FRAME_LOADS_USER_STYLESHEET149 void setUserStyleSheetLocation(const KURL&);150 void setUserStyleSheet(const String& styleSheetData);151 #endif152 153 144 void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize); 154 145 … … 372 363 bool m_isDisconnected; 373 364 bool m_excludeFromTextSearch; 374 375 #if FRAME_LOADS_USER_STYLESHEET376 OwnPtr<UserStyleSheetLoader> m_userStyleSheetLoader;377 #endif378 379 365 }; 380 366 -
trunk/WebCore/page/Page.cpp
r46987 r48075 22 22 #include "Page.h" 23 23 24 #include "Base64.h" 24 25 #include "CSSStyleSelector.h" 25 26 #include "Chrome.h" … … 440 441 void Page::userStyleSheetLocationChanged() 441 442 { 442 #if !FRAME_LOADS_USER_STYLESHEET 443 // FIXME: We should provide a way to load other types of URLs than just444 // 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(); 447 448 else 448 449 m_userStyleSheetPath = String(); … … 451 452 m_userStyleSheet = String(); 452 453 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 } 454 471 } 455 472 456 473 const String& Page::userStyleSheet() const 457 474 { 458 if (m_userStyleSheetPath.isEmpty()) { 459 ASSERT(m_userStyleSheet.isEmpty()); 475 if (m_userStyleSheetPath.isEmpty()) 460 476 return m_userStyleSheet; 461 }462 477 463 478 time_t modTime; -
trunk/WebCore/page/mac/FrameMac.mm
r48069 r48075 29 29 #import "Frame.h" 30 30 31 #import "Base64.h"32 31 #import "BlockExceptions.h" 33 32 #import "ColorMac.h" … … 54 53 #import "Scrollbar.h" 55 54 #import "SimpleFontData.h" 56 #import "UserStyleSheetLoader.h"57 55 #import "WebCoreViewFactory.h" 58 56 #import "visible_units.h" … … 534 532 } 535 533 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 them541 // 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 565 534 } // namespace WebCore -
trunk/WebCore/page/qt/FrameQt.cpp
r40024 r48075 34 34 } 35 35 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 52 36 } 53 37 // vim: ts=4 sw=4 et
Note: See TracChangeset
for help on using the changeset viewer.