Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: Source/core/editing/MarkupAccumulator.cpp

Issue 298253009: Add iterator object to iterate efficiently over an Element's attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/PresentationAttributeStyle.cpp ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 result.append(' '); 378 result.append(' ');
379 result.append(data); 379 result.append(data);
380 result.appendLiteral("?>"); 380 result.appendLiteral("?>");
381 } 381 }
382 382
383 void MarkupAccumulator::appendElement(StringBuilder& result, Element& element, N amespaces* namespaces) 383 void MarkupAccumulator::appendElement(StringBuilder& result, Element& element, N amespaces* namespaces)
384 { 384 {
385 appendOpenTag(result, element, namespaces); 385 appendOpenTag(result, element, namespaces);
386 386
387 if (element.hasAttributes()) { 387 if (element.hasAttributes()) {
388 unsigned length = element.attributeCount(); 388 AttributeIteratorAccessor attributes = element.attributesIterator();
389 for (unsigned i = 0; i < length; i++) 389 AttributeConstIterator end = attributes.end();
390 appendAttribute(result, element, element.attributeItem(i), namespace s); 390 for (AttributeConstIterator it = attributes.begin(); it != end; ++it)
391 appendAttribute(result, element, **it, namespaces);
391 } 392 }
392 393
393 // Give an opportunity to subclasses to add their own attributes. 394 // Give an opportunity to subclasses to add their own attributes.
394 appendCustomAttributes(result, element, namespaces); 395 appendCustomAttributes(result, element, namespaces);
395 396
396 appendCloseTag(result, element); 397 appendCloseTag(result, element);
397 } 398 }
398 399
399 static String nodeNamePreservingCase(const Element& element) 400 static String nodeNamePreservingCase(const Element& element)
400 { 401 {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 } 560 }
560 561
561 bool MarkupAccumulator::serializeAsHTMLDocument(const Node& node) const 562 bool MarkupAccumulator::serializeAsHTMLDocument(const Node& node) const
562 { 563 {
563 if (m_serializationType == ForcedXML) 564 if (m_serializationType == ForcedXML)
564 return false; 565 return false;
565 return node.document().isHTMLDocument(); 566 return node.document().isHTMLDocument();
566 } 567 }
567 568
568 } 569 }
OLDNEW
« no previous file with comments | « Source/core/dom/PresentationAttributeStyle.cpp ('k') | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698