| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (parent && !shouldIgnoreElement(*parent)) | 130 if (parent && !shouldIgnoreElement(*parent)) |
| 131 MarkupAccumulator::appendText(out, text); | 131 MarkupAccumulator::appendText(out, text); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void SerializerMarkupAccumulator::appendElement(StringBuilder& out, Element& ele
ment, Namespaces* namespaces) | 134 void SerializerMarkupAccumulator::appendElement(StringBuilder& out, Element& ele
ment, Namespaces* namespaces) |
| 135 { | 135 { |
| 136 if (!shouldIgnoreElement(element)) | 136 if (!shouldIgnoreElement(element)) |
| 137 MarkupAccumulator::appendElement(out, element, namespaces); | 137 MarkupAccumulator::appendElement(out, element, namespaces); |
| 138 | 138 |
| 139 if (isHTMLHeadElement(element)) { | 139 if (isHTMLHeadElement(element)) { |
| 140 out.append("<meta charset=\""); | 140 out.appendLiteral("<meta charset=\""); |
| 141 out.append(m_document.charset()); | 141 out.append(m_document.charset()); |
| 142 out.append("\">"); | 142 out.appendLiteral("\">"); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // FIXME: For object (plugins) tags and video tag we could replace them by a
n image of their current contents. | 145 // FIXME: For object (plugins) tags and video tag we could replace them by a
n image of their current contents. |
| 146 } | 146 } |
| 147 | 147 |
| 148 void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& out, con
st Element& element, Namespaces* namespaces) | 148 void SerializerMarkupAccumulator::appendCustomAttributes(StringBuilder& out, con
st Element& element, Namespaces* namespaces) |
| 149 { | 149 { |
| 150 if (!element.isFrameOwnerElement()) | 150 if (!element.isFrameOwnerElement()) |
| 151 return; | 151 return; |
| 152 | 152 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet& styleSheet, const KUR
L& url) | 259 void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet& styleSheet, const KUR
L& url) |
| 260 { | 260 { |
| 261 StringBuilder cssText; | 261 StringBuilder cssText; |
| 262 for (unsigned i = 0; i < styleSheet.length(); ++i) { | 262 for (unsigned i = 0; i < styleSheet.length(); ++i) { |
| 263 CSSRule* rule = styleSheet.item(i); | 263 CSSRule* rule = styleSheet.item(i); |
| 264 String itemText = rule->cssText(); | 264 String itemText = rule->cssText(); |
| 265 if (!itemText.isEmpty()) { | 265 if (!itemText.isEmpty()) { |
| 266 cssText.append(itemText); | 266 cssText.append(itemText); |
| 267 if (i < styleSheet.length() - 1) | 267 if (i < styleSheet.length() - 1) |
| 268 cssText.append("\n\n"); | 268 cssText.appendLiteral("\n\n"); |
| 269 } | 269 } |
| 270 ASSERT(styleSheet.ownerDocument()); | 270 ASSERT(styleSheet.ownerDocument()); |
| 271 Document& document = *styleSheet.ownerDocument(); | 271 Document& document = *styleSheet.ownerDocument(); |
| 272 // Some rules have resources associated with them that we need to retrie
ve. | 272 // Some rules have resources associated with them that we need to retrie
ve. |
| 273 if (rule->type() == CSSRule::IMPORT_RULE) { | 273 if (rule->type() == CSSRule::IMPORT_RULE) { |
| 274 CSSImportRule* importRule = toCSSImportRule(rule); | 274 CSSImportRule* importRule = toCSSImportRule(rule); |
| 275 KURL importURL = document.completeURL(importRule->href()); | 275 KURL importURL = document.completeURL(importRule->href()); |
| 276 if (m_resourceURLs.contains(importURL)) | 276 if (m_resourceURLs.contains(importURL)) |
| 277 continue; | 277 continue; |
| 278 if (importRule->styleSheet()) | 278 if (importRule->styleSheet()) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 if (iter != m_blankFrameURLs.end()) | 382 if (iter != m_blankFrameURLs.end()) |
| 383 return iter->value; | 383 return iter->value; |
| 384 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); | 384 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); |
| 385 KURL fakeURL(ParsedURLString, url); | 385 KURL fakeURL(ParsedURLString, url); |
| 386 m_blankFrameURLs.add(frame, fakeURL); | 386 m_blankFrameURLs.add(frame, fakeURL); |
| 387 | 387 |
| 388 return fakeURL; | 388 return fakeURL; |
| 389 } | 389 } |
| 390 | 390 |
| 391 } | 391 } |
| OLD | NEW |