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

Side by Side Diff: Source/core/page/PageSerializer.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/inspector/InspectorDOMAgent.cpp ('k') | Source/core/xml/XPathNodeSet.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "wtf/text/WTFString.h" 68 #include "wtf/text/WTFString.h"
69 69
70 namespace WebCore { 70 namespace WebCore {
71 71
72 static bool isCharsetSpecifyingNode(const Node& node) 72 static bool isCharsetSpecifyingNode(const Node& node)
73 { 73 {
74 if (!isHTMLMetaElement(node)) 74 if (!isHTMLMetaElement(node))
75 return false; 75 return false;
76 76
77 const HTMLMetaElement& element = toHTMLMetaElement(node); 77 const HTMLMetaElement& element = toHTMLMetaElement(node);
78 HTMLAttributeList attributes; 78 HTMLAttributeList attributeList;
79 if (element.hasAttributes()) { 79 if (element.hasAttributes()) {
80 unsigned attributeCount = element.attributeCount(); 80 AttributeIteratorAccessor attributes = element.attributesIterator();
81 for (unsigned i = 0; i < attributeCount; ++i) { 81 AttributeConstIterator end = attributes.end();
82 const Attribute& attribute = element.attributeItem(i); 82 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) {
83 // FIXME: We should deal appropriately with the attribute if they ha ve a namespace. 83 // FIXME: We should deal appropriately with the attribute if they ha ve a namespace.
84 attributes.append(std::make_pair(attribute.name().localName(), attri bute.value().string())); 84 attributeList.append(std::make_pair(it->name().localName(), it->valu e().string()));
85 } 85 }
86 } 86 }
87 WTF::TextEncoding textEncoding = encodingFromMetaAttributes(attributes); 87 WTF::TextEncoding textEncoding = encodingFromMetaAttributes(attributeList);
88 return textEncoding.isValid(); 88 return textEncoding.isValid();
89 } 89 }
90 90
91 static bool shouldIgnoreElement(const Element& element) 91 static bool shouldIgnoreElement(const Element& element)
92 { 92 {
93 return isHTMLScriptElement(element) || isHTMLNoScriptElement(element) || isC harsetSpecifyingNode(element); 93 return isHTMLScriptElement(element) || isHTMLNoScriptElement(element) || isC harsetSpecifyingNode(element);
94 } 94 }
95 95
96 static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerEleme nt& frameOwner) 96 static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerEleme nt& frameOwner)
97 { 97 {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (iter != m_blankFrameURLs.end()) 383 if (iter != m_blankFrameURLs.end())
384 return iter->value; 384 return iter->value;
385 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); 385 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++);
386 KURL fakeURL(ParsedURLString, url); 386 KURL fakeURL(ParsedURLString, url);
387 m_blankFrameURLs.add(frame, fakeURL); 387 m_blankFrameURLs.add(frame, fakeURL);
388 388
389 return fakeURL; 389 return fakeURL;
390 } 390 }
391 391
392 } 392 }
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.cpp ('k') | Source/core/xml/XPathNodeSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698