OLD | NEW |
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 m_editor->frame().selection().revealSelection( | 149 m_editor->frame().selection().revealSelection( |
150 ScrollAlignment::alignToEdgeIfNeeded, RevealExtent); | 150 ScrollAlignment::alignToEdgeIfNeeded, RevealExtent); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 // When an event handler has moved the selection outside of a text control | 154 // When an event handler has moved the selection outside of a text control |
155 // we should use the target control's selection for this editing operation. | 155 // we should use the target control's selection for this editing operation. |
156 // TODO(yosin): We should make |Editor::selectionForCommand()| to return | 156 // TODO(yosin): We should make |Editor::selectionForCommand()| to return |
157 // |SelectionInDOMTree| instead of |VisibleSelection|. | 157 // |SelectionInDOMTree| instead of |VisibleSelection|. |
158 VisibleSelection Editor::selectionForCommand(Event* event) { | 158 VisibleSelection Editor::selectionForCommand(Event* event) { |
159 frame().selection().updateIfNeeded(); | |
160 VisibleSelection selection = | 159 VisibleSelection selection = |
161 frame().selection().computeVisibleSelectionInDOMTreeDeprecated(); | 160 frame().selection().computeVisibleSelectionInDOMTreeDeprecated(); |
162 if (!event) | 161 if (!event) |
163 return selection; | 162 return selection; |
164 // If the target is a text control, and the current selection is outside of | 163 // If the target is a text control, and the current selection is outside of |
165 // 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. |
166 TextControlElement* textControlOfSelectionStart = | 165 TextControlElement* textControlOfSelectionStart = |
167 enclosingTextControl(selection.start()); | 166 enclosingTextControl(selection.start()); |
168 TextControlElement* textControlOfTarget = | 167 TextControlElement* textControlOfTarget = |
169 isTextControlElement(*event->target()->toNode()) | 168 isTextControlElement(*event->target()->toNode()) |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 | 1765 |
1767 DEFINE_TRACE(Editor) { | 1766 DEFINE_TRACE(Editor) { |
1768 visitor->trace(m_frame); | 1767 visitor->trace(m_frame); |
1769 visitor->trace(m_lastEditCommand); | 1768 visitor->trace(m_lastEditCommand); |
1770 visitor->trace(m_undoStack); | 1769 visitor->trace(m_undoStack); |
1771 visitor->trace(m_mark); | 1770 visitor->trace(m_mark); |
1772 visitor->trace(m_typingStyle); | 1771 visitor->trace(m_typingStyle); |
1773 } | 1772 } |
1774 | 1773 |
1775 } // namespace blink | 1774 } // namespace blink |
OLD | NEW |