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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/RemoveNodePreservingChildrenCommand.cpp

Issue 2171493003: [Editing][DOM][CodeHealth] Make Node::hasEditableStyle global functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 23 matching lines...) Expand all
34 : CompositeEditCommand(node->document()) 34 : CompositeEditCommand(node->document())
35 , m_node(node) 35 , m_node(node)
36 , m_shouldAssumeContentIsAlwaysEditable(shouldAssumeContentIsAlwaysEditable) 36 , m_shouldAssumeContentIsAlwaysEditable(shouldAssumeContentIsAlwaysEditable)
37 { 37 {
38 DCHECK(m_node); 38 DCHECK(m_node);
39 } 39 }
40 40
41 void RemoveNodePreservingChildrenCommand::doApply(EditingState* editingState) 41 void RemoveNodePreservingChildrenCommand::doApply(EditingState* editingState)
42 { 42 {
43 ABORT_EDITING_COMMAND_IF(!m_node->parentNode()); 43 ABORT_EDITING_COMMAND_IF(!m_node->parentNode());
44 ABORT_EDITING_COMMAND_IF(!m_node->parentNode()->hasEditableStyle()); 44 ABORT_EDITING_COMMAND_IF(!hasEditableStyle(*m_node->parentNode()));
45 if (m_node->isContainerNode()) { 45 if (m_node->isContainerNode()) {
46 NodeVector children; 46 NodeVector children;
47 getChildNodes(toContainerNode(*m_node), children); 47 getChildNodes(toContainerNode(*m_node), children);
48 48
49 for (auto& currentChild : children) { 49 for (auto& currentChild : children) {
50 Node* child = currentChild.release(); 50 Node* child = currentChild.release();
51 removeNode(child, editingState, m_shouldAssumeContentIsAlwaysEditabl e); 51 removeNode(child, editingState, m_shouldAssumeContentIsAlwaysEditabl e);
52 if (editingState->isAborted()) 52 if (editingState->isAborted())
53 return; 53 return;
54 insertNodeBefore(child, m_node, editingState, m_shouldAssumeContentI sAlwaysEditable); 54 insertNodeBefore(child, m_node, editingState, m_shouldAssumeContentI sAlwaysEditable);
55 if (editingState->isAborted()) 55 if (editingState->isAborted())
56 return; 56 return;
57 } 57 }
58 } 58 }
59 removeNode(m_node, editingState, m_shouldAssumeContentIsAlwaysEditable); 59 removeNode(m_node, editingState, m_shouldAssumeContentIsAlwaysEditable);
60 } 60 }
61 61
62 DEFINE_TRACE(RemoveNodePreservingChildrenCommand) 62 DEFINE_TRACE(RemoveNodePreservingChildrenCommand)
63 { 63 {
64 visitor->trace(m_node); 64 visitor->trace(m_node);
65 CompositeEditCommand::trace(visitor); 65 CompositeEditCommand::trace(visitor);
66 } 66 }
67 67
68 } // namespace blink 68 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698