Changeset 54645 in webkit
- Timestamp:
- Feb 10, 2010 11:32:08 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r54644 r54645 1 2010-02-10 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Address last round of review comments on r53607 6 https://bugs.webkit.org/show_bug.cgi?id=33940 7 8 Mostly renaming and cleaning up. 9 10 * css/CSSImportRule.cpp: 11 (WebCore::CSSImportRule::insertedIntoParent): 12 * css/CSSStyleSheet.h: 13 (WebCore::CSSStyleSheet::create): 14 (WebCore::CSSStyleSheet::createInline): 15 * css/StyleBase.cpp: 16 (WebCore::StyleBase::baseURL): 17 * css/StyleSheet.cpp: 18 (WebCore::StyleSheet::StyleSheet): 19 * css/StyleSheet.h: 20 (WebCore::StyleSheet::href): 21 (WebCore::StyleSheet::setFinalURL): 22 (WebCore::StyleSheet::finalURL): 23 * dom/Document.cpp: 24 (WebCore::Document::updateBaseURL): 25 * dom/ProcessingInstruction.cpp: 26 (WebCore::ProcessingInstruction::checkStyleSheet): 27 * xml/XSLImportRule.cpp: 28 (WebCore::XSLImportRule::loadSheet): 29 * xml/XSLStyleSheet.h: 30 (WebCore::XSLStyleSheet::create): 31 (WebCore::XSLStyleSheet::createInline): 32 * xml/XSLStyleSheetLibxslt.cpp: 33 (WebCore::XSLStyleSheet::XSLStyleSheet): 34 (WebCore::XSLStyleSheet::parseString): 35 (WebCore::XSLStyleSheet::loadChildSheets): 36 * xml/XSLStyleSheetQt.cpp: 37 (WebCore::XSLStyleSheet::XSLStyleSheet): 38 1 39 2010-02-10 Noam Rosenthal <noam.rosenthal@nokia.com> 2 40 -
trunk/WebCore/css/CSSImportRule.cpp
r53607 r54645 118 118 119 119 String absHref = m_strHref; 120 if (!parentSheet-> putativeBaseURL().isNull())120 if (!parentSheet->finalURL().isNull()) 121 121 // use parent styleheet's URL as the base URL 122 absHref = KURL(parentSheet-> putativeBaseURL(), m_strHref).string();122 absHref = KURL(parentSheet->finalURL(), m_strHref).string(); 123 123 124 124 // Check for a cycle in our import chain. If we encounter a stylesheet … … 126 126 StyleBase* root = this; 127 127 for (StyleBase* curr = parent(); curr; curr = curr->parent()) { 128 // FIXME: This is wrong if the putativeBaseURL was updated via document::updateBaseURL.129 if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)-> putativeBaseURL().string())128 // FIXME: This is wrong if the finalURL was updated via document::updateBaseURL. 129 if (curr->isCSSStyleSheet() && absHref == static_cast<CSSStyleSheet*>(curr)->finalURL().string()) 130 130 return; 131 131 root = curr; -
trunk/WebCore/css/CSSStyleSheet.h
r53607 r54645 45 45 return adoptRef(new CSSStyleSheet(ownerNode, String(), KURL(), String())); 46 46 } 47 static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const KURL& baseURL)47 static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& originalURL, const KURL& finalURL) 48 48 { 49 return adoptRef(new CSSStyleSheet(ownerNode, href, baseURL, String()));49 return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, String())); 50 50 } 51 static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& href, const KURL& baseURL, const String& charset)51 static PassRefPtr<CSSStyleSheet> create(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset) 52 52 { 53 return adoptRef(new CSSStyleSheet(ownerNode, href, baseURL, charset));53 return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, charset)); 54 54 } 55 static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)55 static PassRefPtr<CSSStyleSheet> create(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset) 56 56 { 57 return adoptRef(new CSSStyleSheet(ownerRule, href, baseURL, charset));57 return adoptRef(new CSSStyleSheet(ownerRule, originalURL, finalURL, charset)); 58 58 } 59 static PassRefPtr<CSSStyleSheet> createInline(Node* ownerNode, const KURL& baseURL)59 static PassRefPtr<CSSStyleSheet> createInline(Node* ownerNode, const KURL& finalURL) 60 60 { 61 return adoptRef(new CSSStyleSheet(ownerNode, baseURL.string(), baseURL, String()));61 return adoptRef(new CSSStyleSheet(ownerNode, finalURL.string(), finalURL, String())); 62 62 } 63 63 … … 104 104 105 105 private: 106 CSSStyleSheet(Node* ownerNode, const String& href, const KURL& baseURL, const String& charset);107 CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset);108 CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset);106 CSSStyleSheet(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset); 107 CSSStyleSheet(CSSStyleSheet* parentSheet, const String& originalURL, const KURL& finalURL, const String& charset); 108 CSSStyleSheet(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset); 109 109 110 110 virtual bool isCSSStyleSheet() const { return true; } -
trunk/WebCore/css/StyleBase.cpp
r53607 r54645 57 57 if (!sheet) 58 58 return KURL(); 59 if (!sheet-> putativeBaseURL().isNull())60 return sheet-> putativeBaseURL();59 if (!sheet->finalURL().isNull()) 60 return sheet->finalURL(); 61 61 if (sheet->parent()) 62 62 return sheet->parent()->baseURL(); -
trunk/WebCore/css/StyleSheet.cpp
r53607 r54645 25 25 namespace WebCore { 26 26 27 StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& baseURL)27 StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& originalURL, const KURL& finalURL) 28 28 : StyleList(parentSheet) 29 29 , m_parentNode(0) 30 , m_ href(href)31 , m_ baseURL(baseURL)30 , m_originalURL(originalURL) 31 , m_finalURL(finalURL) 32 32 , m_disabled(false) 33 33 { 34 34 } 35 35 36 37 StyleSheet::StyleSheet(Node* parentNode, const String& href, const KURL& baseURL) 36 StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL) 38 37 : StyleList(0) 39 38 , m_parentNode(parentNode) 40 , m_ href(href)41 , m_ baseURL(baseURL)39 , m_originalURL(originalURL) 40 , m_finalURL(finalURL) 42 41 , m_disabled(false) 43 42 { 44 43 } 45 44 46 StyleSheet::StyleSheet(StyleBase* owner, const String& href, const KURL& baseURL)45 StyleSheet::StyleSheet(StyleBase* owner, const String& originalURL, const KURL& finalURL) 47 46 : StyleList(owner) 48 47 , m_parentNode(0) 49 , m_ href(href)50 , m_ baseURL(baseURL)48 , m_originalURL(originalURL) 49 , m_finalURL(finalURL) 51 50 , m_disabled(false) 52 51 { -
trunk/WebCore/css/StyleSheet.h
r53607 r54645 46 46 // this style sheet. This property probably isn't useful for much except 47 47 // the JavaScript binding (which needs to use this value for security). 48 const String& href() const { return m_ href; }48 const String& href() const { return m_originalURL; } 49 49 50 void setBaseURL(const KURL& baseURL) { m_baseURL = baseURL; } 51 52 // Notice that this object inherits a baseURL function from StyleBase that 53 // crawls the parent() relation looking for a non-0 putativeBaseURL. 54 const KURL& putativeBaseURL() const { return m_baseURL; } 50 void setFinalURL(const KURL& finalURL) { m_finalURL = finalURL; } 51 const KURL& finalURL() const { return m_finalURL; } 55 52 56 53 const String& title() const { return m_strTitle; } … … 69 66 70 67 protected: 71 StyleSheet(Node* ownerNode, const String& href, const KURL& baseURL);72 StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& baseURL);73 StyleSheet(StyleBase* owner, const String& href, const KURL& baseURL);68 StyleSheet(Node* ownerNode, const String& href, const KURL& finalURL); 69 StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& finalURL); 70 StyleSheet(StyleBase* owner, const String& href, const KURL& finalURL); 74 71 75 72 private: … … 77 74 78 75 Node* m_parentNode; 79 String m_ href;80 KURL m_ baseURL;76 String m_originalURL; 77 KURL m_finalURL; 81 78 String m_strTitle; 82 79 RefPtr<MediaList> m_media; -
trunk/WebCore/dom/Document.cpp
r54636 r54645 2002 2002 2003 2003 if (m_elemSheet) 2004 m_elemSheet->set BaseURL(m_baseURL);2004 m_elemSheet->setFinalURL(m_baseURL); 2005 2005 if (m_mappedElementSheet) 2006 m_mappedElementSheet->set BaseURL(m_baseURL);2006 m_mappedElementSheet->setFinalURL(m_baseURL); 2007 2007 } 2008 2008 -
trunk/WebCore/dom/ProcessingInstruction.cpp
r53607 r54645 140 140 // to kick off import/include loads that can hang off some parent sheet. 141 141 if (m_isXSL) { 142 KURL baseURL = KURL(ParsedURLString, m_localHref);143 m_sheet = XSLStyleSheet::create Embedded(this, m_localHref, baseURL);142 KURL finalURL(ParsedURLString, m_localHref); 143 m_sheet = XSLStyleSheet::createInline(this, finalURL); 144 144 m_loading = false; 145 145 } -
trunk/WebCore/xml/XSLImportRule.cpp
r53607 r54645 88 88 String absHref = m_strHref; 89 89 XSLStyleSheet* parentSheet = parentStyleSheet(); 90 if (!parentSheet-> putativeBaseURL().isNull())90 if (!parentSheet->finalURL().isNull()) 91 91 // use parent styleheet's URL as the base URL 92 absHref = KURL(parentSheet-> putativeBaseURL(), m_strHref).string();92 absHref = KURL(parentSheet->finalURL(), m_strHref).string(); 93 93 94 94 // Check for a cycle in our import chain. If we encounter a stylesheet 95 95 // in our parent chain with the same URL, then just bail. 96 96 for (parent = this->parent(); parent; parent = parent->parent()) { 97 if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)-> putativeBaseURL().string())97 if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->finalURL().string()) 98 98 return; 99 99 } -
trunk/WebCore/xml/XSLStyleSheet.h
r53607 r54645 44 44 public: 45 45 #if !USE(QXMLQUERY) 46 static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& href, const KURL& baseURL)46 static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL) 47 47 { 48 return adoptRef(new XSLStyleSheet(parentImport, href, baseURL));48 return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL)); 49 49 } 50 50 #endif 51 static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& href, const KURL& baseURL)51 static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& originalURL, const KURL& finalURL) 52 52 { 53 return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, false));53 return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false)); 54 54 } 55 static PassRefPtr<XSLStyleSheet> create Embedded(Node* parentNode, const String& href, const KURL& baseURL)55 static PassRefPtr<XSLStyleSheet> createInline(Node* parentNode, const KURL& finalURL) 56 56 { 57 return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, true));57 return adoptRef(new XSLStyleSheet(parentNode, finalURL.string(), finalURL, true)); 58 58 } 59 59 … … 91 91 92 92 private: 93 XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded);93 XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded); 94 94 #if !USE(QXMLQUERY) 95 XSLStyleSheet(XSLImportRule* parentImport, const String& href, const KURL& baseURL);95 XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL); 96 96 #endif 97 97 -
trunk/WebCore/xml/XSLStyleSheetLibxslt.cpp
r53607 r54645 56 56 namespace WebCore { 57 57 58 XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href, const KURL& baseURL)59 : StyleSheet(parentRule, href, baseURL)58 XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& originalURL, const KURL& finalURL) 59 : StyleSheet(parentRule, originalURL, finalURL) 60 60 , m_ownerDocument(0) 61 61 , m_embedded(false) … … 67 67 } 68 68 69 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded)70 : StyleSheet(parentNode, href, baseURL)69 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded) 70 : StyleSheet(parentNode, originalURL, finalURL) 71 71 , m_ownerDocument(parentNode->document()) 72 72 , m_embedded(embedded) … … 169 169 170 170 m_stylesheetDoc = xmlCtxtReadMemory(ctxt, buffer, size, 171 putativeBaseURL().string().utf8().data(),171 finalURL().string().utf8().data(), 172 172 BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE", 173 173 XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA); … … 193 193 // We have to locate (by ID) the appropriate embedded stylesheet element, so that we can walk the 194 194 // import/include list. 195 xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)( putativeBaseURL().string().utf8().data()));195 xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(finalURL().string().utf8().data())); 196 196 if (!idNode) 197 197 return; -
trunk/WebCore/xml/XSLStyleSheetQt.cpp
r53607 r54645 34 34 namespace WebCore { 35 35 36 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded)37 : StyleSheet(parentNode, href, baseURL)36 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded) 37 : StyleSheet(parentNode, originalURL, finalURL) 38 38 , m_ownerDocument(parentNode->document()) 39 39 , m_embedded(embedded)
Note: See TracChangeset
for help on using the changeset viewer.