OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights
reserved. |
3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 void MarkupFormatter::appendQuotedURLAttributeValue(StringBuilder& result, const
Element& element, const Attribute& attribute) | 192 void MarkupFormatter::appendQuotedURLAttributeValue(StringBuilder& result, const
Element& element, const Attribute& attribute) |
193 { | 193 { |
194 ASSERT(element.isURLAttribute(attribute)); | 194 ASSERT(element.isURLAttribute(attribute)); |
195 const String resolvedURLString = resolveURLIfNeeded(element, attribute.value
()); | 195 const String resolvedURLString = resolveURLIfNeeded(element, attribute.value
()); |
196 UChar quoteChar = '"'; | 196 UChar quoteChar = '"'; |
197 String strippedURLString = resolvedURLString.stripWhiteSpace(); | 197 String strippedURLString = resolvedURLString.stripWhiteSpace(); |
198 if (protocolIsJavaScript(strippedURLString)) { | 198 if (protocolIsJavaScript(strippedURLString)) { |
199 // minimal escaping for javascript urls | 199 // minimal escaping for javascript urls |
200 if (strippedURLString.contains('&')) | 200 if (strippedURLString.contains('&')) |
201 strippedURLString.replaceWithLiteral('&', "&"); | 201 strippedURLString.replace('&', "&"); |
202 | 202 |
203 if (strippedURLString.contains('"')) { | 203 if (strippedURLString.contains('"')) { |
204 if (strippedURLString.contains('\'')) | 204 if (strippedURLString.contains('\'')) |
205 strippedURLString.replaceWithLiteral('"', """); | 205 strippedURLString.replace('"', """); |
206 else | 206 else |
207 quoteChar = '\''; | 207 quoteChar = '\''; |
208 } | 208 } |
209 result.append(quoteChar); | 209 result.append(quoteChar); |
210 result.append(strippedURLString); | 210 result.append(strippedURLString); |
211 result.append(quoteChar); | 211 result.append(quoteChar); |
212 return; | 212 return; |
213 } | 213 } |
214 | 214 |
215 // FIXME: This does not fully match other browsers. Firefox percent-escapes
non-ASCII characters for innerHTML. | 215 // FIXME: This does not fully match other browsers. Firefox percent-escapes
non-ASCII characters for innerHTML. |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } | 465 } |
466 | 466 |
467 bool MarkupFormatter::serializeAsHTMLDocument(const Node& node) const | 467 bool MarkupFormatter::serializeAsHTMLDocument(const Node& node) const |
468 { | 468 { |
469 if (m_serializationType == SerializationType::ForcedXML) | 469 if (m_serializationType == SerializationType::ForcedXML) |
470 return false; | 470 return false; |
471 return node.document().isHTMLDocument(); | 471 return node.document().isHTMLDocument(); |
472 } | 472 } |
473 | 473 |
474 } // namespace blink | 474 } // namespace blink |
OLD | NEW |