Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(975)

Side by Side Diff: trunk/Source/core/dom/Node.cpp

Issue 202883002: Revert 169394 "Node::setTextContent should avoid work when nothi..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/LayoutTests/fast/repaint/set-text-content-same-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
63 #include "core/events/BeforeLoadEvent.h" 62 #include "core/events/BeforeLoadEvent.h"
64 #include "core/events/Event.h" 63 #include "core/events/Event.h"
65 #include "core/events/EventDispatchMediator.h" 64 #include "core/events/EventDispatchMediator.h"
66 #include "core/events/EventDispatcher.h" 65 #include "core/events/EventDispatcher.h"
67 #include "core/events/EventListener.h" 66 #include "core/events/EventListener.h"
68 #include "core/events/GestureEvent.h" 67 #include "core/events/GestureEvent.h"
69 #include "core/events/KeyboardEvent.h" 68 #include "core/events/KeyboardEvent.h"
70 #include "core/events/MouseEvent.h" 69 #include "core/events/MouseEvent.h"
71 #include "core/events/MutationEvent.h" 70 #include "core/events/MutationEvent.h"
72 #include "core/events/TextEvent.h" 71 #include "core/events/TextEvent.h"
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 switch (nodeType()) { 1490 switch (nodeType()) {
1492 case TEXT_NODE: 1491 case TEXT_NODE:
1493 case CDATA_SECTION_NODE: 1492 case CDATA_SECTION_NODE:
1494 case COMMENT_NODE: 1493 case COMMENT_NODE:
1495 case PROCESSING_INSTRUCTION_NODE: 1494 case PROCESSING_INSTRUCTION_NODE:
1496 setNodeValue(text); 1495 setNodeValue(text);
1497 return; 1496 return;
1498 case ELEMENT_NODE: 1497 case ELEMENT_NODE:
1499 case ATTRIBUTE_NODE: 1498 case ATTRIBUTE_NODE:
1500 case DOCUMENT_FRAGMENT_NODE: { 1499 case DOCUMENT_FRAGMENT_NODE: {
1501 replaceChildrenWithText(toContainerNode(this), text, ASSERT_NO_EXCEP TION); 1500 RefPtr<ContainerNode> container = toContainerNode(this);
1501 ChildListMutationScope mutation(*this);
1502 container->removeChildren();
1503 if (!text.isEmpty())
1504 container->appendChild(document().createTextNode(text), ASSERT_N O_EXCEPTION);
1502 return; 1505 return;
1503 } 1506 }
1504 case DOCUMENT_NODE: 1507 case DOCUMENT_NODE:
1505 case DOCUMENT_TYPE_NODE: 1508 case DOCUMENT_TYPE_NODE:
1506 // Do nothing. 1509 // Do nothing.
1507 return; 1510 return;
1508 } 1511 }
1509 ASSERT_NOT_REACHED(); 1512 ASSERT_NOT_REACHED();
1510 } 1513 }
1511 1514
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 node->showTreeForThis(); 2535 node->showTreeForThis();
2533 } 2536 }
2534 2537
2535 void showNodePath(const WebCore::Node* node) 2538 void showNodePath(const WebCore::Node* node)
2536 { 2539 {
2537 if (node) 2540 if (node)
2538 node->showNodePathForThis(); 2541 node->showNodePathForThis();
2539 } 2542 }
2540 2543
2541 #endif 2544 #endif
OLDNEW
« no previous file with comments | « trunk/LayoutTests/fast/repaint/set-text-content-same-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698