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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "core/dom/StaticNodeList.h" | 52 #include "core/dom/StaticNodeList.h" |
53 #include "core/dom/TemplateContentDocumentFragment.h" | 53 #include "core/dom/TemplateContentDocumentFragment.h" |
54 #include "core/dom/Text.h" | 54 #include "core/dom/Text.h" |
55 #include "core/dom/TreeScopeAdopter.h" | 55 #include "core/dom/TreeScopeAdopter.h" |
56 #include "core/dom/UserActionElementSet.h" | 56 #include "core/dom/UserActionElementSet.h" |
57 #include "core/dom/WheelController.h" | 57 #include "core/dom/WheelController.h" |
58 #include "core/dom/shadow/ElementShadow.h" | 58 #include "core/dom/shadow/ElementShadow.h" |
59 #include "core/dom/shadow/InsertionPoint.h" | 59 #include "core/dom/shadow/InsertionPoint.h" |
60 #include "core/dom/shadow/ShadowRoot.h" | 60 #include "core/dom/shadow/ShadowRoot.h" |
61 #include "core/editing/htmlediting.h" | 61 #include "core/editing/htmlediting.h" |
| 62 #include "core/editing/markup.h" |
62 #include "core/events/BeforeLoadEvent.h" | 63 #include "core/events/BeforeLoadEvent.h" |
63 #include "core/events/Event.h" | 64 #include "core/events/Event.h" |
64 #include "core/events/EventDispatchMediator.h" | 65 #include "core/events/EventDispatchMediator.h" |
65 #include "core/events/EventDispatcher.h" | 66 #include "core/events/EventDispatcher.h" |
66 #include "core/events/EventListener.h" | 67 #include "core/events/EventListener.h" |
67 #include "core/events/GestureEvent.h" | 68 #include "core/events/GestureEvent.h" |
68 #include "core/events/KeyboardEvent.h" | 69 #include "core/events/KeyboardEvent.h" |
69 #include "core/events/MouseEvent.h" | 70 #include "core/events/MouseEvent.h" |
70 #include "core/events/MutationEvent.h" | 71 #include "core/events/MutationEvent.h" |
71 #include "core/events/TextEvent.h" | 72 #include "core/events/TextEvent.h" |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 switch (nodeType()) { | 1490 switch (nodeType()) { |
1490 case TEXT_NODE: | 1491 case TEXT_NODE: |
1491 case CDATA_SECTION_NODE: | 1492 case CDATA_SECTION_NODE: |
1492 case COMMENT_NODE: | 1493 case COMMENT_NODE: |
1493 case PROCESSING_INSTRUCTION_NODE: | 1494 case PROCESSING_INSTRUCTION_NODE: |
1494 setNodeValue(text); | 1495 setNodeValue(text); |
1495 return; | 1496 return; |
1496 case ELEMENT_NODE: | 1497 case ELEMENT_NODE: |
1497 case ATTRIBUTE_NODE: | 1498 case ATTRIBUTE_NODE: |
1498 case DOCUMENT_FRAGMENT_NODE: { | 1499 case DOCUMENT_FRAGMENT_NODE: { |
| 1500 // FIXME: Merge this logic into replaceChildrenWithText. |
1499 RefPtr<ContainerNode> container = toContainerNode(this); | 1501 RefPtr<ContainerNode> container = toContainerNode(this); |
| 1502 // No need to do anything if the text is identical. |
| 1503 if (container->hasOneTextChild() && toText(container->firstChild())-
>data() == text) |
| 1504 return; |
1500 ChildListMutationScope mutation(*this); | 1505 ChildListMutationScope mutation(*this); |
1501 container->removeChildren(); | 1506 container->removeChildren(); |
| 1507 // Note: This API will not insert empty text nodes: |
| 1508 // http://dom.spec.whatwg.org/#dom-node-textcontent |
1502 if (!text.isEmpty()) | 1509 if (!text.isEmpty()) |
1503 container->appendChild(document().createTextNode(text), ASSERT_N
O_EXCEPTION); | 1510 container->appendChild(document().createTextNode(text), ASSERT_N
O_EXCEPTION); |
1504 return; | 1511 return; |
1505 } | 1512 } |
1506 case DOCUMENT_NODE: | 1513 case DOCUMENT_NODE: |
1507 case DOCUMENT_TYPE_NODE: | 1514 case DOCUMENT_TYPE_NODE: |
1508 // Do nothing. | 1515 // Do nothing. |
1509 return; | 1516 return; |
1510 } | 1517 } |
1511 ASSERT_NOT_REACHED(); | 1518 ASSERT_NOT_REACHED(); |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 node->showTreeForThis(); | 2541 node->showTreeForThis(); |
2535 } | 2542 } |
2536 | 2543 |
2537 void showNodePath(const WebCore::Node* node) | 2544 void showNodePath(const WebCore::Node* node) |
2538 { | 2545 { |
2539 if (node) | 2546 if (node) |
2540 node->showNodePathForThis(); | 2547 node->showNodePathForThis(); |
2541 } | 2548 } |
2542 | 2549 |
2543 #endif | 2550 #endif |
OLD | NEW |