Changeset 31578 in webkit
- Timestamp:
- Apr 2, 2008, 10:56:21 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r31566 r31578 1 2008-04-02 Brady Eidson <beidson@apple.com> 2 3 Written by David Kilzer, tweaked by Brady, Reviewed by Mitz Pettel 4 5 - test for http://bugs.webkit.org/show_bug.cgi?id=11839 6 Webarchive fails to save CSS files in @import statements 7 8 The idea is to <link> to a CSS file which @imports another CSS file, 9 and also @import a CSS file inside a <style> element, which also @imports another CSS file 10 11 Then make sure all 4 of the css files are in the resulting webarchive 12 13 * webarchive/resources/test-css-import-recurse.css: Added. 14 * webarchive/resources/test-css-import.css: Added. 15 * webarchive/resources/test-css-link-recurse.css: Added. 16 * webarchive/resources/test-css-link.css: Added. 17 * webarchive/test-css-import-expected.txt: Added. 18 * webarchive/test-css-import.html: Added. 19 1 20 2008-04-02 Nikolas Zimmermann <zimmermann@kde.org> 2 21 -
trunk/WebCore/ChangeLog
r31577 r31578 1 2008-04-02 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Mitz Pettel 4 5 <rdar://problem/5838347> and http://bugs.webkit.org/show_bug.cgi?id=11839 6 Webarchive fails to save CSS files in @import statements 7 8 * css/CSSStyleSheet.cpp: 9 (WebCore::CSSStyleSheet::addSubresourceURLStrings): Recursively add the URL each @import rule under the current style sheet. 10 * css/CSSStyleSheet.h: 11 * css/StyleSheet.h: 12 (WebCore::StyleSheet::addSubresourceURLStrings): 13 14 * html/HTMLLinkElement.cpp: 15 (WebCore::HTMLLinkElement::getSubresourceAttributeStrings): Add the linked URL as well as all @import 16 rules rooted at the linked stylesheet. 17 18 * html/HTMLStyleElement.cpp: 19 (WebCore::HTMLStyleElement::getSubresourceAttributeStrings): Walk all @import rules rooted at this 20 stylesheet to add to the list. 21 * html/HTMLStyleElement.h: 22 1 23 2008-04-02 Mark Rowe <mrowe@apple.com> 2 24 -
trunk/WebCore/css/CSSStyleSheet.cpp
r25754 r31578 204 204 } 205 205 206 } 206 void CSSStyleSheet::addSubresourceURLStrings(HashSet<String>& urls, const String& base) const 207 { 208 OwnPtr<CSSRuleList> ruleList(const_cast<CSSStyleSheet*>(this)->cssRules()); 209 210 // Add the URLs for each child import rule, and recurse for the stylesheet belonging to each of those rules. 211 for (unsigned i = 0; i < ruleList->length(); ++i) { 212 CSSRule* rule = ruleList->item(i); 213 if (rule->type() != CSSRule::IMPORT_RULE) 214 continue; 215 216 CSSImportRule* importRule = static_cast<CSSImportRule*>(rule); 217 CSSStyleSheet* ruleSheet = importRule->styleSheet(); 218 if (!ruleSheet) 219 continue; 220 221 KURL fullURL(KURL(base), importRule->href()); 222 urls.add(fullURL.string()); 223 ruleSheet->addSubresourceURLStrings(urls, fullURL.string()); 224 } 225 } 226 227 } -
trunk/WebCore/css/CSSStyleSheet.h
r29963 r31578 73 73 74 74 bool loadCompleted() const { return m_loadCompleted; } 75 76 virtual void addSubresourceURLStrings(HashSet<String>&, const String& baseURL) const; 75 77 76 78 protected: -
trunk/WebCore/css/StyleSheet.h
r31405 r31578 26 26 #include "StyleList.h" 27 27 #include "PlatformString.h" 28 29 #include <wtf/HashSet.h> 28 30 29 31 namespace WebCore { … … 60 62 virtual void styleSheetChanged() { } 61 63 64 virtual void addSubresourceURLStrings(HashSet<String>&, const String& baseURL) const { } 65 62 66 protected: 63 67 Node* m_parentNode; -
trunk/WebCore/html/HTMLLinkElement.cpp
r31357 r31578 349 349 350 350 void HTMLLinkElement::getSubresourceAttributeStrings(Vector<String>& urls) const 351 { 352 if (!m_isStyleSheet && !m_isIcon) 351 { 352 if (m_isIcon) { 353 urls.append(href().string()); 353 354 return; 355 } 354 356 357 if (!m_isStyleSheet) 358 return; 359 360 // Append the URL of this link element. 355 361 urls.append(href().string()); 356 } 357 358 } 362 363 // Walk the URLs linked by the linked-to stylesheet. 364 HashSet<String> styleURLs; 365 StyleSheet* styleSheet = const_cast<HTMLLinkElement*>(this)->sheet(); 366 if (styleSheet) 367 styleSheet->addSubresourceURLStrings(styleURLs, href()); 368 369 HashSet<String>::iterator end = styleURLs.end(); 370 for (HashSet<String>::iterator i = styleURLs.begin(); i != end; ++i) 371 urls.append(*i); 372 } 373 374 } -
trunk/WebCore/html/HTMLStyleElement.cpp
r30633 r31578 131 131 } 132 132 133 void HTMLStyleElement::getSubresourceAttributeStrings(Vector<String>& urls) const 134 { 135 HashSet<String> styleURLs; 136 StyleSheet* styleSheet = const_cast<HTMLStyleElement*>(this)->sheet(); 137 if (styleSheet) 138 styleSheet->addSubresourceURLStrings(styleURLs, ownerDocument()->baseURL()); 139 140 HashSet<String>::iterator end = styleURLs.end(); 141 for (HashSet<String>::iterator i = styleURLs.begin(); i != end; ++i) 142 urls.append(*i); 133 143 } 144 145 } -
trunk/WebCore/html/HTMLStyleElement.h
r30633 r31578 65 65 virtual void setLoading(bool loading) { m_loading = loading; } 66 66 67 virtual void getSubresourceAttributeStrings(Vector<String>&) const; 68 67 69 protected: 68 70 String m_media;
Note:
See TracChangeset
for help on using the changeset viewer.