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

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

Issue 357033002: Remove attributeCount() / attributeAt() API from Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Clean up Created 6 years, 5 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/editing/EditingStyle.cpp ('k') | Source/web/WebElement.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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 if (!oldNode->isElementNode()) 182 if (!oldNode->isElementNode())
183 return true; 183 return true;
184 184
185 // Patch attributes 185 // Patch attributes
186 Element* oldElement = toElement(oldNode); 186 Element* oldElement = toElement(oldNode);
187 Element* newElement = toElement(newNode); 187 Element* newElement = toElement(newNode);
188 if (oldDigest->m_attrsSHA1 != newDigest->m_attrsSHA1) { 188 if (oldDigest->m_attrsSHA1 != newDigest->m_attrsSHA1) {
189 // FIXME: Create a function in Element for removing all properties. Take in account whether did/willModifyAttribute are important. 189 // FIXME: Create a function in Element for removing all properties. Take in account whether did/willModifyAttribute are important.
190 if (oldElement->hasAttributesWithoutUpdate()) { 190 if (oldElement->hasAttributesWithoutUpdate()) {
191 while (oldElement->attributeCount()) { 191 while (oldElement->attributes().size()) {
192 const Attribute& attribute = oldElement->attributeAt(0); 192 const Attribute& attribute = oldElement->attributes().at(0);
193 if (!m_domEditor->removeAttribute(oldElement, attribute.localNam e(), exceptionState)) 193 if (!m_domEditor->removeAttribute(oldElement, attribute.localNam e(), exceptionState))
194 return false; 194 return false;
195 } 195 }
196 } 196 }
197 197
198 // FIXME: Create a function in Element for copying properties. cloneData FromElement() is close but not enough for this case. 198 // FIXME: Create a function in Element for copying properties. cloneData FromElement() is close but not enough for this case.
199 if (newElement->hasAttributesWithoutUpdate()) { 199 if (newElement->hasAttributesWithoutUpdate()) {
200 AttributeCollection attributes = newElement->attributes(); 200 AttributeCollection attributes = newElement->attributes();
201 AttributeCollection::const_iterator end = attributes.end(); 201 AttributeCollection::const_iterator end = attributes.end();
202 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 202 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) 509 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name)
510 { 510 {
511 fprintf(stderr, "\n\n"); 511 fprintf(stderr, "\n\n");
512 for (size_t i = 0; i < map.size(); ++i) 512 for (size_t i = 0; i < map.size(); ++i)
513 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); 513 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);
514 } 514 }
515 #endif 515 #endif
516 516
517 } // namespace WebCore 517 } // namespace WebCore
518 518
OLDNEW
« no previous file with comments | « Source/core/editing/EditingStyle.cpp ('k') | Source/web/WebElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698