| OLD | NEW |
| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 if (oldElement->hasAttributesWithoutUpdate()) { | 190 if (oldElement->hasAttributesWithoutUpdate()) { |
| 191 while (oldElement->attributeCount()) { | 191 while (oldElement->attributeCount()) { |
| 192 const Attribute& attribute = oldElement->attributeAt(0); | 192 const Attribute& attribute = oldElement->attributeAt(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 AttributeIteratorAccessor attributes = newElement->attributesIterato
r(); | 200 AttributeCollection attributes = newElement->attributes(); |
| 201 AttributeConstIterator end = attributes.end(); | 201 AttributeCollection::const_iterator end = attributes.end(); |
| 202 for (AttributeConstIterator it = attributes.begin(); it != end; ++it
) { | 202 for (AttributeCollection::const_iterator it = attributes.begin(); it
!= end; ++it) { |
| 203 if (!m_domEditor->setAttribute(oldElement, it->name().localName(
), it->value(), exceptionState)) | 203 if (!m_domEditor->setAttribute(oldElement, it->name().localName(
), it->value(), exceptionState)) |
| 204 return false; | 204 return false; |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool result = innerPatchChildren(oldElement, oldDigest->m_children, newDiges
t->m_children, exceptionState); | 209 bool result = innerPatchChildren(oldElement, oldDigest->m_children, newDiges
t->m_children, exceptionState); |
| 210 m_unusedNodesMap.remove(newDigest->m_sha1); | 210 m_unusedNodesMap.remove(newDigest->m_sha1); |
| 211 return result; | 211 return result; |
| 212 } | 212 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 Node* child = element.firstChild(); | 423 Node* child = element.firstChild(); |
| 424 while (child) { | 424 while (child) { |
| 425 OwnPtr<Digest> childInfo = createDigest(child, unusedNodesMap); | 425 OwnPtr<Digest> childInfo = createDigest(child, unusedNodesMap); |
| 426 addStringToDigestor(digestor.get(), childInfo->m_sha1); | 426 addStringToDigestor(digestor.get(), childInfo->m_sha1); |
| 427 child = child->nextSibling(); | 427 child = child->nextSibling(); |
| 428 digest->m_children.append(childInfo.release()); | 428 digest->m_children.append(childInfo.release()); |
| 429 } | 429 } |
| 430 | 430 |
| 431 if (element.hasAttributesWithoutUpdate()) { | 431 if (element.hasAttributesWithoutUpdate()) { |
| 432 OwnPtr<blink::WebCryptoDigestor> attrsDigestor = createDigestor(Hash
AlgorithmSha1); | 432 OwnPtr<blink::WebCryptoDigestor> attrsDigestor = createDigestor(Hash
AlgorithmSha1); |
| 433 AttributeIteratorAccessor attributes = element.attributesIterator(); | 433 AttributeCollection attributes = element.attributes(); |
| 434 AttributeConstIterator end = attributes.end(); | 434 AttributeCollection::const_iterator end = attributes.end(); |
| 435 for (AttributeConstIterator it = attributes.begin(); it != end; ++it
) { | 435 for (AttributeCollection::const_iterator it = attributes.begin(); it
!= end; ++it) { |
| 436 addStringToDigestor(attrsDigestor.get(), it->name().toString()); | 436 addStringToDigestor(attrsDigestor.get(), it->name().toString()); |
| 437 addStringToDigestor(attrsDigestor.get(), it->value().string()); | 437 addStringToDigestor(attrsDigestor.get(), it->value().string()); |
| 438 } | 438 } |
| 439 finishDigestor(attrsDigestor.get(), digestResult); | 439 finishDigestor(attrsDigestor.get(), digestResult); |
| 440 digest->m_attrsSHA1 = base64Encode(reinterpret_cast<const char*>(dig
estResult.data()), 10); | 440 digest->m_attrsSHA1 = base64Encode(reinterpret_cast<const char*>(dig
estResult.data()), 10); |
| 441 addStringToDigestor(digestor.get(), digest->m_attrsSHA1); | 441 addStringToDigestor(digestor.get(), digest->m_attrsSHA1); |
| 442 digestResult.clear(); | 442 digestResult.clear(); |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 finishDigestor(digestor.get(), digestResult); | 445 finishDigestor(digestor.get(), digestResult); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |