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

Side by Side Diff: Source/web/WebPageSerializerImpl.cpp

Issue 337753005: Make iterator for Element's attributes more lightweight (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Proper 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/xml/parser/XMLDocumentParser.cpp ('k') | no next file » | 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 StringBuilder result; 296 StringBuilder result;
297 // Do pre action for open tag. 297 // Do pre action for open tag.
298 result.append(preActionBeforeSerializeOpenTag(element, param, &needSkip)); 298 result.append(preActionBeforeSerializeOpenTag(element, param, &needSkip));
299 if (needSkip) 299 if (needSkip)
300 return; 300 return;
301 // Add open tag 301 // Add open tag
302 result.append('<'); 302 result.append('<');
303 result.append(element->nodeName().lower()); 303 result.append(element->nodeName().lower());
304 // Go through all attributes and serialize them. 304 // Go through all attributes and serialize them.
305 if (element->hasAttributes()) { 305 if (element->hasAttributes()) {
306 AttributeIteratorAccessor attributes = element->attributesIterator(); 306 AttributeCollection attributes = element->attributes();
307 AttributeConstIterator end = attributes.end(); 307 AttributeCollection::const_iterator end = attributes.end();
308 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) { 308 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) {
309 result.append(' '); 309 result.append(' ');
310 // Add attribute pair 310 // Add attribute pair
311 result.append(it->name().toString()); 311 result.append(it->name().toString());
312 result.appendLiteral("=\""); 312 result.appendLiteral("=\"");
313 if (!it->value().isEmpty()) { 313 if (!it->value().isEmpty()) {
314 const String& attrValue = it->value(); 314 const String& attrValue = it->value();
315 315
316 // Check whether we need to replace some resource links 316 // Check whether we need to replace some resource links
317 // with local resource paths. 317 // with local resource paths.
318 const QualifiedName& attrName = it->name(); 318 const QualifiedName& attrName = it->name();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 515
516 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p aram, ForceFlush); 516 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p aram, ForceFlush);
517 } 517 }
518 518
519 ASSERT(m_dataBuffer.isEmpty()); 519 ASSERT(m_dataBuffer.isEmpty());
520 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali zerClient::AllFramesAreFinished); 520 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali zerClient::AllFramesAreFinished);
521 return didSerialization; 521 return didSerialization;
522 } 522 }
523 523
524 } // namespace blink 524 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/xml/parser/XMLDocumentParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698