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

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

Issue 2641803002: Move EditCommand::starting/endingSelection() to CompositeEditCommand (1/2) (Closed)
Patch Set: Created 3 years, 11 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, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "core/layout/LayoutListItem.h" 73 #include "core/layout/LayoutListItem.h"
74 #include "core/layout/LayoutText.h" 74 #include "core/layout/LayoutText.h"
75 #include "core/layout/line/InlineTextBox.h" 75 #include "core/layout/line/InlineTextBox.h"
76 #include <algorithm> 76 #include <algorithm>
77 77
78 namespace blink { 78 namespace blink {
79 79
80 using namespace HTMLNames; 80 using namespace HTMLNames;
81 81
82 CompositeEditCommand::CompositeEditCommand(Document& document) 82 CompositeEditCommand::CompositeEditCommand(Document& document)
83 : EditCommand(document) {} 83 : EditCommand(document) {
84 setStartingSelection(document.frame()->selection().selection());
85 setEndingVisibleSelection(m_startingSelection);
86 }
84 87
85 CompositeEditCommand::~CompositeEditCommand() { 88 CompositeEditCommand::~CompositeEditCommand() {
86 DCHECK(isTopLevelCommand() || !m_undoStep); 89 DCHECK(isTopLevelCommand() || !m_undoStep);
87 } 90 }
88 91
89 bool CompositeEditCommand::apply() { 92 bool CompositeEditCommand::apply() {
90 DCHECK(!isCommandGroupWrapper()); 93 DCHECK(!isCommandGroupWrapper());
91 if (!endingSelection().isContentRichlyEditable()) { 94 if (!endingSelection().isContentRichlyEditable()) {
92 switch (inputType()) { 95 switch (inputType()) {
93 case InputEvent::InputType::InsertText: 96 case InputEvent::InputType::InsertText:
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 createVisiblePosition(firstPositionInOrBeforeNode(node)); 1928 createVisiblePosition(firstPositionInOrBeforeNode(node));
1926 if (positionInParent.deepEquivalent() != positionInNode.deepEquivalent()) 1929 if (positionInParent.deepEquivalent() != positionInNode.deepEquivalent())
1927 splitElement(parentElement, node); 1930 splitElement(parentElement, node);
1928 } 1931 }
1929 1932
1930 return node; 1933 return node;
1931 } 1934 }
1932 1935
1933 DEFINE_TRACE(CompositeEditCommand) { 1936 DEFINE_TRACE(CompositeEditCommand) {
1934 visitor->trace(m_commands); 1937 visitor->trace(m_commands);
1938 visitor->trace(m_startingSelection);
1939 visitor->trace(m_endingSelection);
1935 visitor->trace(m_undoStep); 1940 visitor->trace(m_undoStep);
1936 EditCommand::trace(visitor); 1941 EditCommand::trace(visitor);
1937 } 1942 }
1938 1943
1939 } // namespace blink 1944 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698