Index: Source/core/page/PageSerializer.cpp |
diff --git a/Source/core/page/PageSerializer.cpp b/Source/core/page/PageSerializer.cpp |
index 31549449cf3cdf357dd93512cc09a9bae731148d..d9c503590cc4b43184d401e4073e33c41069c0dd 100644 |
--- a/Source/core/page/PageSerializer.cpp |
+++ b/Source/core/page/PageSerializer.cpp |
@@ -242,13 +242,13 @@ void PageSerializer::serializeFrame(LocalFrame* frame) |
HTMLLinkElement& linkElement = toHTMLLinkElement(element); |
if (CSSStyleSheet* sheet = linkElement.sheet()) { |
KURL url = document.completeURL(linkElement.getAttribute(HTMLNames::hrefAttr)); |
- serializeCSSStyleSheet(sheet, url); |
+ serializeCSSStyleSheet(*sheet, url); |
ASSERT(m_resourceURLs.contains(url)); |
} |
} else if (isHTMLStyleElement(element)) { |
HTMLStyleElement& styleElement = toHTMLStyleElement(element); |
if (CSSStyleSheet* sheet = styleElement.sheet()) |
- serializeCSSStyleSheet(sheet, KURL()); |
+ serializeCSSStyleSheet(*sheet, KURL()); |
} |
} |
@@ -258,26 +258,27 @@ void PageSerializer::serializeFrame(LocalFrame* frame) |
} |
} |
-void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KURL& url) |
+void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet& styleSheet, const KURL& url) |
{ |
StringBuilder cssText; |
- for (unsigned i = 0; i < styleSheet->length(); ++i) { |
- CSSRule* rule = styleSheet->item(i); |
+ for (unsigned i = 0; i < styleSheet.length(); ++i) { |
+ CSSRule* rule = styleSheet.item(i); |
String itemText = rule->cssText(); |
if (!itemText.isEmpty()) { |
cssText.append(itemText); |
- if (i < styleSheet->length() - 1) |
+ if (i < styleSheet.length() - 1) |
cssText.append("\n\n"); |
} |
- ASSERT(styleSheet->ownerDocument()); |
- Document& document = *styleSheet->ownerDocument(); |
+ ASSERT(styleSheet.ownerDocument()); |
+ Document& document = *styleSheet.ownerDocument(); |
// Some rules have resources associated with them that we need to retrieve. |
if (rule->type() == CSSRule::IMPORT_RULE) { |
CSSImportRule* importRule = toCSSImportRule(rule); |
KURL importURL = document.completeURL(importRule->href()); |
if (m_resourceURLs.contains(importURL)) |
continue; |
- serializeCSSStyleSheet(importRule->styleSheet(), importURL); |
+ if (importRule->styleSheet()) |
+ serializeCSSStyleSheet(*importRule->styleSheet(), importURL); |
} else if (rule->type() == CSSRule::FONT_FACE_RULE) { |
retrieveResourcesForProperties(&toCSSFontFaceRule(rule)->styleRule()->properties(), document); |
} else if (rule->type() == CSSRule::STYLE_RULE) { |
@@ -287,7 +288,7 @@ void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KUR |
if (url.isValid() && !m_resourceURLs.contains(url)) { |
// FIXME: We should check whether a charset has been specified and if none was found add one. |
- WTF::TextEncoding textEncoding(styleSheet->contents()->charset()); |
+ WTF::TextEncoding textEncoding(styleSheet.contents()->charset()); |
ASSERT(textEncoding.isValid()); |
String textString = cssText.toString(); |
CString text = textEncoding.normalizeAndEncode(textString, WTF::EntitiesForUnencodables); |