OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * | 10 * |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 return; | 1296 return; |
1297 case kElementNode: | 1297 case kElementNode: |
1298 case kDocumentFragmentNode: { | 1298 case kDocumentFragmentNode: { |
1299 // FIXME: Merge this logic into replaceChildrenWithText. | 1299 // FIXME: Merge this logic into replaceChildrenWithText. |
1300 ContainerNode* container = toContainerNode(this); | 1300 ContainerNode* container = toContainerNode(this); |
1301 | 1301 |
1302 // Note: This is an intentional optimization. | 1302 // Note: This is an intentional optimization. |
1303 // See crbug.com/352836 also. | 1303 // See crbug.com/352836 also. |
1304 // No need to do anything if the text is identical. | 1304 // No need to do anything if the text is identical. |
1305 if (container->hasOneTextChild() && | 1305 if (container->hasOneTextChild() && |
1306 toText(container->firstChild())->data() == text) | 1306 toText(container->firstChild())->data() == text && !text.isEmpty()) |
1307 return; | 1307 return; |
1308 | 1308 |
1309 ChildListMutationScope mutation(*this); | 1309 ChildListMutationScope mutation(*this); |
1310 // Note: This API will not insert empty text nodes: | 1310 // Note: This API will not insert empty text nodes: |
1311 // https://dom.spec.whatwg.org/#dom-node-textcontent | 1311 // https://dom.spec.whatwg.org/#dom-node-textcontent |
1312 if (text.isEmpty()) { | 1312 if (text.isEmpty()) { |
1313 container->removeChildren(DispatchSubtreeModifiedEvent); | 1313 container->removeChildren(DispatchSubtreeModifiedEvent); |
1314 } else { | 1314 } else { |
1315 container->removeChildren(OmitSubtreeModifiedEvent); | 1315 container->removeChildren(OmitSubtreeModifiedEvent); |
1316 container->appendChild(document().createTextNode(text), | 1316 container->appendChild(document().createTextNode(text), |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2467 if (node) { | 2467 if (node) { |
2468 std::stringstream stream; | 2468 std::stringstream stream; |
2469 node->printNodePathTo(stream); | 2469 node->printNodePathTo(stream); |
2470 LOG(INFO) << stream.str(); | 2470 LOG(INFO) << stream.str(); |
2471 } else { | 2471 } else { |
2472 LOG(INFO) << "Cannot showNodePath for <null>"; | 2472 LOG(INFO) << "Cannot showNodePath for <null>"; |
2473 } | 2473 } |
2474 } | 2474 } |
2475 | 2475 |
2476 #endif | 2476 #endif |
OLD | NEW |