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

Side by Side Diff: Source/core/inspector/DOMPatchSupport.cpp

Issue 448043003: Drop const_iterator for AttributeCollection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/inspector/InspectorDOMAgent.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (oldDigest->m_attrsSHA1 != newDigest->m_attrsSHA1) { 189 if (oldDigest->m_attrsSHA1 != newDigest->m_attrsSHA1) {
190 // FIXME: Create a function in Element for removing all properties. Take in account whether did/willModifyAttribute are important. 190 // FIXME: Create a function in Element for removing all properties. Take in account whether did/willModifyAttribute are important.
191 while (oldElement->attributesWithoutUpdate().size()) { 191 while (oldElement->attributesWithoutUpdate().size()) {
192 const Attribute& attribute = oldElement->attributesWithoutUpdate().a t(0); 192 const Attribute& attribute = oldElement->attributesWithoutUpdate().a t(0);
193 if (!m_domEditor->removeAttribute(oldElement, attribute.localName(), exceptionState)) 193 if (!m_domEditor->removeAttribute(oldElement, attribute.localName(), exceptionState))
194 return false; 194 return false;
195 } 195 }
196 196
197 // FIXME: Create a function in Element for copying properties. cloneData FromElement() is close but not enough for this case. 197 // FIXME: Create a function in Element for copying properties. cloneData FromElement() is close but not enough for this case.
198 AttributeCollection attributes = newElement->attributesWithoutUpdate(); 198 AttributeCollection attributes = newElement->attributesWithoutUpdate();
199 AttributeCollection::const_iterator end = attributes.end(); 199 AttributeCollection::iterator end = attributes.end();
200 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 200 for (AttributeCollection::iterator it = attributes.begin(); it != end; + +it) {
201 if (!m_domEditor->setAttribute(oldElement, it->name().localName(), i t->value(), exceptionState)) 201 if (!m_domEditor->setAttribute(oldElement, it->name().localName(), i t->value(), exceptionState))
202 return false; 202 return false;
203 } 203 }
204 } 204 }
205 205
206 bool result = innerPatchChildren(oldElement, oldDigest->m_children, newDiges t->m_children, exceptionState); 206 bool result = innerPatchChildren(oldElement, oldDigest->m_children, newDiges t->m_children, exceptionState);
207 m_unusedNodesMap.remove(newDigest->m_sha1); 207 m_unusedNodesMap.remove(newDigest->m_sha1);
208 return result; 208 return result;
209 } 209 }
210 210
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 while (child) { 421 while (child) {
422 OwnPtr<Digest> childInfo = createDigest(child, unusedNodesMap); 422 OwnPtr<Digest> childInfo = createDigest(child, unusedNodesMap);
423 addStringToDigestor(digestor.get(), childInfo->m_sha1); 423 addStringToDigestor(digestor.get(), childInfo->m_sha1);
424 child = child->nextSibling(); 424 child = child->nextSibling();
425 digest->m_children.append(childInfo.release()); 425 digest->m_children.append(childInfo.release());
426 } 426 }
427 427
428 AttributeCollection attributes = element.attributesWithoutUpdate(); 428 AttributeCollection attributes = element.attributesWithoutUpdate();
429 if (!attributes.isEmpty()) { 429 if (!attributes.isEmpty()) {
430 OwnPtr<blink::WebCryptoDigestor> attrsDigestor = createDigestor(Hash AlgorithmSha1); 430 OwnPtr<blink::WebCryptoDigestor> attrsDigestor = createDigestor(Hash AlgorithmSha1);
431 AttributeCollection::const_iterator end = attributes.end(); 431 AttributeCollection::iterator end = attributes.end();
432 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 432 for (AttributeCollection::iterator it = attributes.begin(); it != en d; ++it) {
433 addStringToDigestor(attrsDigestor.get(), it->name().toString()); 433 addStringToDigestor(attrsDigestor.get(), it->name().toString());
434 addStringToDigestor(attrsDigestor.get(), it->value().string()); 434 addStringToDigestor(attrsDigestor.get(), it->value().string());
435 } 435 }
436 finishDigestor(attrsDigestor.get(), digestResult); 436 finishDigestor(attrsDigestor.get(), digestResult);
437 digest->m_attrsSHA1 = base64Encode(reinterpret_cast<const char*>(dig estResult.data()), 10); 437 digest->m_attrsSHA1 = base64Encode(reinterpret_cast<const char*>(dig estResult.data()), 10);
438 addStringToDigestor(digestor.get(), digest->m_attrsSHA1); 438 addStringToDigestor(digestor.get(), digest->m_attrsSHA1);
439 digestResult.clear(); 439 digestResult.clear();
440 } 440 }
441 } 441 }
442 finishDigestor(digestor.get(), digestResult); 442 finishDigestor(digestor.get(), digestResult);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) 506 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name)
507 { 507 {
508 fprintf(stderr, "\n\n"); 508 fprintf(stderr, "\n\n");
509 for (size_t i = 0; i < map.size(); ++i) 509 for (size_t i = 0; i < map.size(); ++i)
510 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map [i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map [i].second); 510 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map [i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map [i].second);
511 } 511 }
512 #endif 512 #endif
513 513
514 } // namespace blink 514 } // namespace blink
515 515
OLDNEW
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698