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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |