| 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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 // FIXME: Merge this logic into replaceChildrenWithText. | 1394 // FIXME: Merge this logic into replaceChildrenWithText. |
| 1395 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this); | 1395 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this); |
| 1396 | 1396 |
| 1397 // Note: This is an intentional optimization. | 1397 // Note: This is an intentional optimization. |
| 1398 // See crbug.com/352836 also. | 1398 // See crbug.com/352836 also. |
| 1399 // No need to do anything if the text is identical. | 1399 // No need to do anything if the text is identical. |
| 1400 if (container->hasOneTextChild() && toText(container->firstChild())-
>data() == text) | 1400 if (container->hasOneTextChild() && toText(container->firstChild())-
>data() == text) |
| 1401 return; | 1401 return; |
| 1402 | 1402 |
| 1403 ChildListMutationScope mutation(*this); | 1403 ChildListMutationScope mutation(*this); |
| 1404 container->removeChildren(); | |
| 1405 // Note: This API will not insert empty text nodes: | 1404 // Note: This API will not insert empty text nodes: |
| 1406 // http://dom.spec.whatwg.org/#dom-node-textcontent | 1405 // http://dom.spec.whatwg.org/#dom-node-textcontent |
| 1407 if (!text.isEmpty()) | 1406 if (text.isEmpty()) { |
| 1407 container->removeChildren(DispatchSubtreeModifiedEvent); |
| 1408 } else { |
| 1409 container->removeChildren(OmitSubtreeModifiedEvent); |
| 1408 container->appendChild(document().createTextNode(text), ASSERT_N
O_EXCEPTION); | 1410 container->appendChild(document().createTextNode(text), ASSERT_N
O_EXCEPTION); |
| 1411 } |
| 1409 return; | 1412 return; |
| 1410 } | 1413 } |
| 1411 case DOCUMENT_NODE: | 1414 case DOCUMENT_NODE: |
| 1412 case DOCUMENT_TYPE_NODE: | 1415 case DOCUMENT_TYPE_NODE: |
| 1413 // Do nothing. | 1416 // Do nothing. |
| 1414 return; | 1417 return; |
| 1415 } | 1418 } |
| 1416 ASSERT_NOT_REACHED(); | 1419 ASSERT_NOT_REACHED(); |
| 1417 } | 1420 } |
| 1418 | 1421 |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 node->showTreeForThis(); | 2461 node->showTreeForThis(); |
| 2459 } | 2462 } |
| 2460 | 2463 |
| 2461 void showNodePath(const blink::Node* node) | 2464 void showNodePath(const blink::Node* node) |
| 2462 { | 2465 { |
| 2463 if (node) | 2466 if (node) |
| 2464 node->showNodePathForThis(); | 2467 node->showNodePathForThis(); |
| 2465 } | 2468 } |
| 2466 | 2469 |
| 2467 #endif | 2470 #endif |
| OLD | NEW |