| 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 r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 case CDATA_SECTION_NODE: | 1508 case CDATA_SECTION_NODE: |
| 1509 case COMMENT_NODE: | 1509 case COMMENT_NODE: |
| 1510 case PROCESSING_INSTRUCTION_NODE: | 1510 case PROCESSING_INSTRUCTION_NODE: |
| 1511 setNodeValue(text); | 1511 setNodeValue(text); |
| 1512 return; | 1512 return; |
| 1513 case ELEMENT_NODE: | 1513 case ELEMENT_NODE: |
| 1514 case ATTRIBUTE_NODE: | 1514 case ATTRIBUTE_NODE: |
| 1515 case DOCUMENT_FRAGMENT_NODE: { | 1515 case DOCUMENT_FRAGMENT_NODE: { |
| 1516 // FIXME: Merge this logic into replaceChildrenWithText. | 1516 // FIXME: Merge this logic into replaceChildrenWithText. |
| 1517 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this); | 1517 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this); |
| 1518 |
| 1519 // Note: This is an intentional optimization. |
| 1520 // See crbug.com/352836 also. |
| 1518 // No need to do anything if the text is identical. | 1521 // No need to do anything if the text is identical. |
| 1519 if (container->hasOneTextChild() && toText(container->firstChild())-
>data() == text) | 1522 if (container->hasOneTextChild() && toText(container->firstChild())-
>data() == text) |
| 1520 return; | 1523 return; |
| 1524 |
| 1521 ChildListMutationScope mutation(*this); | 1525 ChildListMutationScope mutation(*this); |
| 1522 container->removeChildren(); | 1526 container->removeChildren(); |
| 1523 // Note: This API will not insert empty text nodes: | 1527 // Note: This API will not insert empty text nodes: |
| 1524 // http://dom.spec.whatwg.org/#dom-node-textcontent | 1528 // http://dom.spec.whatwg.org/#dom-node-textcontent |
| 1525 if (!text.isEmpty()) | 1529 if (!text.isEmpty()) |
| 1526 container->appendChild(document().createTextNode(text), ASSERT_N
O_EXCEPTION); | 1530 container->appendChild(document().createTextNode(text), ASSERT_N
O_EXCEPTION); |
| 1527 return; | 1531 return; |
| 1528 } | 1532 } |
| 1529 case DOCUMENT_NODE: | 1533 case DOCUMENT_NODE: |
| 1530 case DOCUMENT_TYPE_NODE: | 1534 case DOCUMENT_TYPE_NODE: |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2557 node->showTreeForThis(); | 2561 node->showTreeForThis(); |
| 2558 } | 2562 } |
| 2559 | 2563 |
| 2560 void showNodePath(const WebCore::Node* node) | 2564 void showNodePath(const WebCore::Node* node) |
| 2561 { | 2565 { |
| 2562 if (node) | 2566 if (node) |
| 2563 node->showNodePathForThis(); | 2567 node->showNodePathForThis(); |
| 2564 } | 2568 } |
| 2565 | 2569 |
| 2566 #endif | 2570 #endif |
| OLD | NEW |