| Index: third_party/WebKit/Source/core/page/PageSerializer.cpp
|
| diff --git a/third_party/WebKit/Source/core/page/PageSerializer.cpp b/third_party/WebKit/Source/core/page/PageSerializer.cpp
|
| index 2c395efe5cb3fe8639465467bddf775269af8d69..28ac4e0564ee129c437ae60281354dd5e06b5697 100644
|
| --- a/third_party/WebKit/Source/core/page/PageSerializer.cpp
|
| +++ b/third_party/WebKit/Source/core/page/PageSerializer.cpp
|
| @@ -397,6 +397,10 @@ void PageSerializer::serializeFrame(LocalFrame* frame)
|
| void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet& styleSheet, const KURL& url)
|
| {
|
| StringBuilder cssText;
|
| + cssText.appendLiteral("@charset \"");
|
| + cssText.append(styleSheet.contents()->charset().lower());
|
| + cssText.appendLiteral("\";\n\n");
|
| +
|
| for (unsigned i = 0; i < styleSheet.length(); ++i) {
|
| CSSRule* rule = styleSheet.item(i);
|
| String itemText = rule->cssText();
|
| @@ -411,10 +415,8 @@ 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());
|
| ASSERT(textEncoding.isValid());
|
| - // TODO(jsbell): Ensure @charset is written out if non-UTF-8.
|
| String textString = cssText.toString();
|
| CString text = textEncoding.encode(textString, WTF::EntitiesForUnencodables);
|
| m_resources->append(SerializedResource(url, String("text/css"), SharedBuffer::create(text.data(), text.length())));
|
|
|