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

Side by Side Diff: Source/core/page/PageSerializer.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) 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 namespace blink { 70 namespace blink {
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 attributeList; 78 HTMLAttributeList attributeList;
79 if (element.hasAttributes()) { 79 AttributeCollection attributes = element.attributes();
80 AttributeCollection attributes = element.attributes(); 80 AttributeCollection::const_iterator end = attributes.end();
81 AttributeCollection::const_iterator end = attributes.end(); 81 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) {
82 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 82 // FIXME: We should deal appropriately with the attribute if they have a namespace.
83 // FIXME: We should deal appropriately with the attribute if they ha ve a namespace. 83 attributeList.append(std::make_pair(it->name().localName(), it->value(). string()));
84 attributeList.append(std::make_pair(it->name().localName(), it->valu e().string()));
85 }
86 } 84 }
87 WTF::TextEncoding textEncoding = encodingFromMetaAttributes(attributeList); 85 WTF::TextEncoding textEncoding = encodingFromMetaAttributes(attributeList);
88 return textEncoding.isValid(); 86 return textEncoding.isValid();
89 } 87 }
90 88
91 static bool shouldIgnoreElement(const Element& element) 89 static bool shouldIgnoreElement(const Element& element)
92 { 90 {
93 return isHTMLScriptElement(element) || isHTMLNoScriptElement(element) || isC harsetSpecifyingNode(element); 91 return isHTMLScriptElement(element) || isHTMLNoScriptElement(element) || isC harsetSpecifyingNode(element);
94 } 92 }
95 93
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (iter != m_blankFrameURLs.end()) 382 if (iter != m_blankFrameURLs.end())
385 return iter->value; 383 return iter->value;
386 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); 384 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++);
387 KURL fakeURL(ParsedURLString, url); 385 KURL fakeURL(ParsedURLString, url);
388 m_blankFrameURLs.add(frame, fakeURL); 386 m_blankFrameURLs.add(frame, fakeURL);
389 387
390 return fakeURL; 388 return fakeURL;
391 } 389 }
392 390
393 } 391 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698