| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 for (Node* child = parentNode->firstChild(); child; child = child->nextSibli
ng()) | 137 for (Node* child = parentNode->firstChild(); child; child = child->nextSibli
ng()) |
| 138 oldList.append(createDigest(child, 0)); | 138 oldList.append(createDigest(child, 0)); |
| 139 | 139 |
| 140 // Compose the new list. | 140 // Compose the new list. |
| 141 String markupCopy = markup; | 141 String markupCopy = markup; |
| 142 markupCopy.makeLower(); | 142 markupCopy.makeLower(); |
| 143 Vector<OwnPtr<Digest> > newList; | 143 Vector<OwnPtr<Digest> > newList; |
| 144 for (Node* child = parentNode->firstChild(); child != node; child = child->n
extSibling()) | 144 for (Node* child = parentNode->firstChild(); child != node; child = child->n
extSibling()) |
| 145 newList.append(createDigest(child, 0)); | 145 newList.append(createDigest(child, 0)); |
| 146 for (Node* child = fragment->firstChild(); child; child = child->nextSibling
()) { | 146 for (Node* child = fragment->firstChild(); child; child = child->nextSibling
()) { |
| 147 if (child->hasTagName(headTag) && !child->firstChild() && markupCopy.fin
d("</head>") == notFound) | 147 if (child->hasTagName(headTag) && !child->firstChild() && markupCopy.fin
d("</head>") == kNotFound) |
| 148 continue; // HTML5 parser inserts empty <head> tag whenever it parse
s <body> | 148 continue; // HTML5 parser inserts empty <head> tag whenever it parse
s <body> |
| 149 if (child->hasTagName(bodyTag) && !child->firstChild() && markupCopy.fin
d("</body>") == notFound) | 149 if (child->hasTagName(bodyTag) && !child->firstChild() && markupCopy.fin
d("</body>") == kNotFound) |
| 150 continue; // HTML5 parser inserts empty <body> tag whenever it parse
s </head> | 150 continue; // HTML5 parser inserts empty <body> tag whenever it parse
s </head> |
| 151 newList.append(createDigest(child, &m_unusedNodesMap)); | 151 newList.append(createDigest(child, &m_unusedNodesMap)); |
| 152 } | 152 } |
| 153 for (Node* child = node->nextSibling(); child; child = child->nextSibling()) | 153 for (Node* child = node->nextSibling(); child; child = child->nextSibling()) |
| 154 newList.append(createDigest(child, 0)); | 154 newList.append(createDigest(child, 0)); |
| 155 | 155 |
| 156 if (!innerPatchChildren(parentNode, oldList, newList, es)) { | 156 if (!innerPatchChildren(parentNode, oldList, newList, es)) { |
| 157 // Fall back to total replace. | 157 // Fall back to total replace. |
| 158 if (!m_domEditor->replaceChild(parentNode, fragment.release(), node, es)
) | 158 if (!m_domEditor->replaceChild(parentNode, fragment.release(), node, es)
) |
| 159 return 0; | 159 return 0; |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) | 510 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) |
| 511 { | 511 { |
| 512 fprintf(stderr, "\n\n"); | 512 fprintf(stderr, "\n\n"); |
| 513 for (size_t i = 0; i < map.size(); ++i) | 513 for (size_t i = 0; i < map.size(); ++i) |
| 514 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 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); |
| 515 } | 515 } |
| 516 #endif | 516 #endif |
| 517 | 517 |
| 518 } // namespace WebCore | 518 } // namespace WebCore |
| 519 | 519 |
| OLD | NEW |