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

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

Issue 436603003: Make Element::attributes() less error-prone and simplify call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Keep synchronizeAllAttributes() in hasAttributes() Created 6 years, 4 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
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(target); 378 result.append(target);
379 result.append(' '); 379 result.append(' ');
380 result.append(data); 380 result.append(data);
381 result.appendLiteral("?>"); 381 result.appendLiteral("?>");
382 } 382 }
383 383
384 void MarkupAccumulator::appendElement(StringBuilder& result, Element& element, N amespaces* namespaces) 384 void MarkupAccumulator::appendElement(StringBuilder& result, Element& element, N amespaces* namespaces)
385 { 385 {
386 appendOpenTag(result, element, namespaces); 386 appendOpenTag(result, element, namespaces);
387 387
388 if (element.hasAttributes()) { 388 AttributeCollection attributes = element.attributes();
389 AttributeCollection attributes = element.attributes(); 389 AttributeCollection::const_iterator end = attributes.end();
390 AttributeCollection::const_iterator end = attributes.end(); 390 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it)
391 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) 391 appendAttribute(result, element, *it, namespaces);
392 appendAttribute(result, element, *it, namespaces);
393 }
394 392
395 // Give an opportunity to subclasses to add their own attributes. 393 // Give an opportunity to subclasses to add their own attributes.
396 appendCustomAttributes(result, element, namespaces); 394 appendCustomAttributes(result, element, namespaces);
397 395
398 appendCloseTag(result, element); 396 appendCloseTag(result, element);
399 } 397 }
400 398
401 static String nodeNamePreservingCase(const Element& element) 399 static String nodeNamePreservingCase(const Element& element)
402 { 400 {
403 return element.tagQName().toString(); 401 return element.tagQName().toString();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 559 }
562 560
563 bool MarkupAccumulator::serializeAsHTMLDocument(const Node& node) const 561 bool MarkupAccumulator::serializeAsHTMLDocument(const Node& node) const
564 { 562 {
565 if (m_serializationType == ForcedXML) 563 if (m_serializationType == ForcedXML)
566 return false; 564 return false;
567 return node.document().isHTMLDocument(); 565 return node.document().isHTMLDocument();
568 } 566 }
569 567
570 } 568 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698