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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 EntityMask MarkupAccumulator::entityMaskForText(Text* text) const | 304 EntityMask MarkupAccumulator::entityMaskForText(Text* text) const |
305 { | 305 { |
306 const QualifiedName* parentName = 0; | 306 const QualifiedName* parentName = 0; |
307 if (text->parentElement()) | 307 if (text->parentElement()) |
308 parentName = &(text->parentElement())->tagQName(); | 308 parentName = &(text->parentElement())->tagQName(); |
309 | 309 |
310 if (parentName && (*parentName == scriptTag || *parentName == styleTag || *p arentName == xmpTag)) | 310 if (parentName && (*parentName == scriptTag || *parentName == styleTag || *p arentName == xmpTag)) |
311 return EntityMaskInCDATA; | 311 return text->document().isHTMLDocument() ? EntityMaskInCDATA : EntityMas kInPCDATA; |
312 | 312 |
313 return text->document().isHTMLDocument() ? EntityMaskInHTMLPCDATA : EntityMa skInPCDATA; | 313 return text->document().isHTMLDocument() ? EntityMaskInHTMLPCDATA : EntityMa skInPCDATA; |
jochen (gone - plz use gerrit)
2013/11/06 16:17:49
can you simplilfy this method a bit?
if (!text->d
pwnall-personal
2013/11/06 17:34:30
Done.
Did you mean I should use a ? : in a return
| |
314 } | 314 } |
315 | 315 |
316 void MarkupAccumulator::appendText(StringBuilder& result, Text* text) | 316 void MarkupAccumulator::appendText(StringBuilder& result, Text* text) |
317 { | 317 { |
318 appendNodeValue(result, text, m_range, entityMaskForText(text)); | 318 appendNodeValue(result, text, m_range, entityMaskForText(text)); |
319 } | 319 } |
320 | 320 |
321 void MarkupAccumulator::appendComment(StringBuilder& result, const String& comme nt) | 321 void MarkupAccumulator::appendComment(StringBuilder& result, const String& comme nt) |
322 { | 322 { |
323 // FIXME: Comment content is not escaped, but XMLSerializer (and possibly ot her callers) should raise an exception if it includes "-->". | 323 // FIXME: Comment content is not escaped, but XMLSerializer (and possibly ot her callers) should raise an exception if it includes "-->". |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 if (!node->isElementNode() || shouldSelfClose(node) || (!node->hasChildNodes () && elementCannotHaveEndTag(node))) | 546 if (!node->isElementNode() || shouldSelfClose(node) || (!node->hasChildNodes () && elementCannotHaveEndTag(node))) |
547 return; | 547 return; |
548 | 548 |
549 result.append('<'); | 549 result.append('<'); |
550 result.append('/'); | 550 result.append('/'); |
551 result.append(toElement(node)->nodeNamePreservingCase()); | 551 result.append(toElement(node)->nodeNamePreservingCase()); |
552 result.append('>'); | 552 result.append('>'); |
553 } | 553 } |
554 | 554 |
555 } | 555 } |
OLD | NEW |