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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 result.appendLiteral("?>"); | 374 result.appendLiteral("?>"); |
375 } | 375 } |
376 | 376 |
377 void MarkupAccumulator::appendElement(StringBuilder& result, Element& element, N
amespaces* namespaces) | 377 void MarkupAccumulator::appendElement(StringBuilder& result, Element& element, N
amespaces* namespaces) |
378 { | 378 { |
379 appendOpenTag(result, element, namespaces); | 379 appendOpenTag(result, element, namespaces); |
380 | 380 |
381 if (element.hasAttributes()) { | 381 if (element.hasAttributes()) { |
382 unsigned length = element.attributeCount(); | 382 unsigned length = element.attributeCount(); |
383 for (unsigned int i = 0; i < length; i++) | 383 for (unsigned int i = 0; i < length; i++) |
384 appendAttribute(result, element, *element.attributeItem(i), namespac
es); | 384 appendAttribute(result, element, element.attributeItem(i), namespace
s); |
385 } | 385 } |
386 | 386 |
387 // Give an opportunity to subclasses to add their own attributes. | 387 // Give an opportunity to subclasses to add their own attributes. |
388 appendCustomAttributes(result, element, namespaces); | 388 appendCustomAttributes(result, element, namespaces); |
389 | 389 |
390 appendCloseTag(result, element); | 390 appendCloseTag(result, element); |
391 } | 391 } |
392 | 392 |
393 static String nodeNamePreservingCase(const Element& element) | 393 static String nodeNamePreservingCase(const Element& element) |
394 { | 394 { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 { | 529 { |
530 if (!node.isElementNode() || shouldSelfClose(node) || (!node.hasChildren() &
& elementCannotHaveEndTag(node))) | 530 if (!node.isElementNode() || shouldSelfClose(node) || (!node.hasChildren() &
& elementCannotHaveEndTag(node))) |
531 return; | 531 return; |
532 | 532 |
533 result.appendLiteral("</"); | 533 result.appendLiteral("</"); |
534 result.append(nodeNamePreservingCase(toElement(node))); | 534 result.append(nodeNamePreservingCase(toElement(node))); |
535 result.append('>'); | 535 result.append('>'); |
536 } | 536 } |
537 | 537 |
538 } | 538 } |
OLD | NEW |