Changeset 30147 in webkit
- Timestamp:
- Feb 11, 2008 12:17:36 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r30146 r30147 1 2008-02-11 David Hyatt <hyatt@apple.com> 2 3 Fix for bug 17298, Acid3 text should be black and not red. Make sure stylesheets with the wrong MIME type 4 are not accepted in strict mode. 5 6 Reviewed by darin 7 8 Added http/tests/misc/css-reject-in-strict-mode.html 9 10 * css/CSSImportRule.cpp: 11 (WebCore::CSSImportRule::setCSSStyleSheet): 12 * css/CSSImportRule.h: 13 * dom/Document.cpp: 14 (WebCore::Document::setCSSStyleSheet): 15 * dom/Document.h: 16 * dom/ProcessingInstruction.cpp: 17 (WebCore::ProcessingInstruction::setCSSStyleSheet): 18 * dom/ProcessingInstruction.h: 19 * html/HTMLLinkElement.cpp: 20 (WebCore::HTMLLinkElement::setCSSStyleSheet): 21 * html/HTMLLinkElement.h: 22 * html/HTMLMediaElement.cpp: 23 (WebCore::HTMLMediaElement::pickMedia): 24 * loader/CachedCSSStyleSheet.cpp: 25 (WebCore::CachedCSSStyleSheet::ref): 26 (WebCore::CachedCSSStyleSheet::checkNotify): 27 (WebCore::CachedCSSStyleSheet::canUseSheet): 28 * loader/CachedCSSStyleSheet.h: 29 (WebCore::CachedCSSStyleSheet::sheetText): 30 * loader/CachedResourceClient.h: 31 (WebCore::CachedResourceClient::setCSSStyleSheet): 32 * loader/mac/UserStyleSheetLoader.cpp: 33 (UserStyleSheetLoader::setCSSStyleSheet): 34 * loader/mac/UserStyleSheetLoader.h: 35 1 36 2008-02-11 Adam Roben <aroben@apple.com> 2 37 -
trunk/WebCore/css/CSSImportRule.cpp
r28639 r30147 57 57 } 58 58 59 void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, const String&sheet)59 void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet* sheet) 60 60 { 61 61 if (m_styleSheet) … … 64 64 65 65 CSSStyleSheet* parent = parentStyleSheet(); 66 m_styleSheet->parseString(sheet, !parent || parent->useStrictParsing()); 66 bool strict = !parent || parent->useStrictParsing(); 67 m_styleSheet->parseString(sheet->sheetText(strict), strict); 67 68 m_loading = false; 68 69 -
trunk/WebCore/css/CSSImportRule.h
r25754 r30147 54 54 55 55 // from CachedResourceClient 56 virtual void setCSSStyleSheet(const String& url, const String& charset, const String& sheet);56 virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); 57 57 58 58 virtual void insertedIntoParent(); -
trunk/WebCore/dom/Document.cpp
r30112 r30147 27 27 #include "AXObjectCache.h" 28 28 #include "CDATASection.h" 29 #include "CachedCSSStyleSheet.h" 29 30 #include "CSSHelper.h" 30 31 #include "CSSStyleSelector.h" … … 1653 1654 } 1654 1655 1655 void Document::setCSSStyleSheet(const String &url, const String& charset, const String &sheet)1656 void Document::setCSSStyleSheet(const String &url, const String& charset, const CachedCSSStyleSheet* sheet) 1656 1657 { 1657 1658 m_sheet = new CSSStyleSheet(this, url, charset); 1658 m_sheet->parseString(sheet );1659 m_sheet->parseString(sheet->sheetText()); 1659 1660 1660 1661 updateStyleSelector(); -
trunk/WebCore/dom/Document.h
r30112 r30147 53 53 class Attribute; 54 54 class CDATASection; 55 class CachedCSSStyleSheet; 55 56 class CSSStyleDeclaration; 56 57 class CSSStyleSelector; … … 384 385 385 386 // from cachedObjectClient 386 virtual void setCSSStyleSheet(const String& url, const String& charset, const String& sheetStr);387 virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); 387 388 388 389 #if FRAME_LOADS_USER_STYLESHEET -
trunk/WebCore/dom/ProcessingInstruction.cpp
r27690 r30147 198 198 } 199 199 200 void ProcessingInstruction::setCSSStyleSheet(const String& url, const String& charset, const String&sheet)200 void ProcessingInstruction::setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet* sheet) 201 201 { 202 202 #if ENABLE(XSLT) … … 204 204 #endif 205 205 m_sheet = new CSSStyleSheet(this, url, charset); 206 parseStyleSheet(sheet );206 parseStyleSheet(sheet->sheetText()); 207 207 } 208 208 -
trunk/WebCore/dom/ProcessingInstruction.h
r28639 r30147 58 58 StyleSheet* sheet() const { return m_sheet.get(); } 59 59 bool checkStyleSheet(); 60 virtual void setCSSStyleSheet(const String& url, const String& charset, const String& sheet);60 virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); 61 61 #if ENABLE(XSLT) 62 62 virtual void setXSLStyleSheet(const String& url, const String& sheet); -
trunk/WebCore/html/HTMLLinkElement.cpp
r25754 r30147 218 218 } 219 219 220 void HTMLLinkElement::setCSSStyleSheet(const String& url, const String& charset, const String& sheetStr) 221 { 220 void HTMLLinkElement::setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet* sheet) 221 { 222 bool strict = !document()->inCompatMode(); 222 223 m_sheet = new CSSStyleSheet(this, url, charset); 223 m_sheet->parseString(sheet Str, !document()->inCompatMode());224 m_sheet->parseString(sheet->sheetText(strict), strict); 224 225 m_sheet->setTitle(title()); 225 226 -
trunk/WebCore/html/HTMLLinkElement.h
r25754 r30147 80 80 81 81 // from CachedResourceClient 82 virtual void setCSSStyleSheet(const String &url, const String& charset, const String &sheet);82 virtual void setCSSStyleSheet(const String &url, const String& charset, const CachedCSSStyleSheet* sheet); 83 83 bool isLoading() const; 84 84 virtual bool sheetLoaded(); -
trunk/WebCore/html/HTMLMediaElement.cpp
r30043 r30147 810 810 continue; 811 811 if (source->hasAttribute(mediaAttr)) { 812 MediaQueryEvaluator screenEval("screen", document()-> page(), renderer() ? renderer()->style() : 0);812 MediaQueryEvaluator screenEval("screen", document()->frame(), renderer() ? renderer()->style() : 0); 813 813 RefPtr<MediaList> media = new MediaList((CSSStyleSheet*)0, source->media(), true); 814 814 if (!screenEval.eval(media.get())) -
trunk/WebCore/loader/CachedCSSStyleSheet.cpp
r29805 r30147 57 57 58 58 if (!m_loading) 59 c->setCSSStyleSheet(m_url, m_decoder->encoding().name(), errorOccurred() ? "" : m_sheet);59 c->setCSSStyleSheet(m_url, m_decoder->encoding().name(), this); 60 60 } 61 61 … … 92 92 CachedResourceClientWalker w(m_clients); 93 93 while (CachedResourceClient *c = w.next()) 94 c->setCSSStyleSheet(m_response.url().string(), m_decoder->encoding().name(), m_sheet);94 c->setCSSStyleSheet(m_response.url().string(), m_decoder->encoding().name(), this); 95 95 96 96 #if USE(LOW_BANDWIDTH_DISPLAY) … … 111 111 } 112 112 113 bool CachedCSSStyleSheet::canUseSheet(bool strict) const 114 { 115 if (errorOccurred()) 116 return false; 117 118 if (!strict) 119 return true; 120 121 // This check exactly matches Firefox. 122 String mimeType = response().mimeType(); 123 return mimeType.isEmpty() || equalIgnoringCase(mimeType, "text/css") || equalIgnoringCase(mimeType, "application/x-unknown-content-type"); 113 124 } 125 126 } -
trunk/WebCore/loader/CachedCSSStyleSheet.h
r27937 r30147 43 43 virtual ~CachedCSSStyleSheet(); 44 44 45 const String & sheet() const { return m_sheet; }45 const String sheetText(bool strict = true) const { return canUseSheet(strict) ? m_sheet : ""; } 46 46 47 47 virtual void ref(CachedResourceClient*); … … 55 55 56 56 void checkNotify(); 57 58 private: 59 bool canUseSheet(bool strict) const; 57 60 58 61 protected: -
trunk/WebCore/loader/CachedResourceClient.h
r26484 r30147 36 36 namespace WebCore { 37 37 38 class CachedCSSStyleSheet; 38 39 class CachedFont; 39 40 class CachedResource; … … 65 66 virtual bool willRenderImage(CachedImage*) { return false; } 66 67 67 virtual void setCSSStyleSheet(const String& /*URL*/, const String& /*charset*/, const String& /*sheet*/) { }68 virtual void setCSSStyleSheet(const String& /*URL*/, const String& /*charset*/, const CachedCSSStyleSheet*) { } 68 69 virtual void setXSLStyleSheet(const String& /*URL*/, const String& /*sheet*/) { } 69 70 -
trunk/WebCore/loader/mac/UserStyleSheetLoader.cpp
r30079 r30147 55 55 } 56 56 57 void UserStyleSheetLoader::setCSSStyleSheet(const String& /*URL*/, const String& /*charset*/, const String&sheet)57 void UserStyleSheetLoader::setCSSStyleSheet(const String& /*URL*/, const String& /*charset*/, const CachedCSSStyleSheet* sheet) 58 58 { 59 59 m_document->removePendingSheet(); 60 60 if (Frame* frame = m_document->frame()) 61 frame->setUserStyleSheet(sheet );61 frame->setUserStyleSheet(sheet->sheetText()); 62 62 } -
trunk/WebCore/loader/mac/UserStyleSheetLoader.h
r30079 r30147 46 46 47 47 private: 48 virtual void setCSSStyleSheet(const String& URL, const String& charset, const String&sheet);48 virtual void setCSSStyleSheet(const String& URL, const String& charset, const CachedCSSStyleSheet* sheet); 49 49 50 50 RefPtr<Document> m_document;
Note: See TracChangeset
for help on using the changeset viewer.