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

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

Issue 2750833002: TextControlElement::selection() should return SelectionInDOMTree. (Closed)
Patch Set: Y Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/TextControlElement.h » ('j') | 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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // its shadow tree, then use the saved selection for that text control. 164 // its shadow tree, then use the saved selection for that text control.
165 TextControlElement* textControlOfSelectionStart = 165 TextControlElement* textControlOfSelectionStart =
166 enclosingTextControl(selection.start()); 166 enclosingTextControl(selection.start());
167 TextControlElement* textControlOfTarget = 167 TextControlElement* textControlOfTarget =
168 isTextControlElement(*event->target()->toNode()) 168 isTextControlElement(*event->target()->toNode())
169 ? toTextControlElement(event->target()->toNode()) 169 ? toTextControlElement(event->target()->toNode())
170 : nullptr; 170 : nullptr;
171 if (textControlOfTarget && 171 if (textControlOfTarget &&
172 (selection.start().isNull() || 172 (selection.start().isNull() ||
173 textControlOfTarget != textControlOfSelectionStart)) { 173 textControlOfTarget != textControlOfSelectionStart)) {
174 if (Range* range = textControlOfTarget->selection()) { 174 const SelectionInDOMTree& select = textControlOfTarget->selection();
175 return createVisibleSelection( 175 if (!select.isNone())
176 SelectionInDOMTree::Builder() 176 return createVisibleSelection(select);
177 .setBaseAndExtent(EphemeralRange(range))
178 .setIsDirectional(selection.isDirectional())
179 .build());
180 }
181 } 177 }
182 return selection; 178 return selection;
183 } 179 }
184 180
185 // Function considers Mac editing behavior a fallback when Page or Settings is 181 // Function considers Mac editing behavior a fallback when Page or Settings is
186 // not available. 182 // not available.
187 EditingBehavior Editor::behavior() const { 183 EditingBehavior Editor::behavior() const {
188 if (!frame().settings()) 184 if (!frame().settings())
189 return EditingBehavior(EditingMacBehavior); 185 return EditingBehavior(EditingMacBehavior);
190 186
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 1755
1760 DEFINE_TRACE(Editor) { 1756 DEFINE_TRACE(Editor) {
1761 visitor->trace(m_frame); 1757 visitor->trace(m_frame);
1762 visitor->trace(m_lastEditCommand); 1758 visitor->trace(m_lastEditCommand);
1763 visitor->trace(m_undoStack); 1759 visitor->trace(m_undoStack);
1764 visitor->trace(m_mark); 1760 visitor->trace(m_mark);
1765 visitor->trace(m_typingStyle); 1761 visitor->trace(m_typingStyle);
1766 } 1762 }
1767 1763
1768 } // namespace blink 1764 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/TextControlElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698