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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 // When an event handler has moved the selection outside of a text control | 105 // When an event handler has moved the selection outside of a text control |
106 // we should use the target control's selection for this editing operation. | 106 // we should use the target control's selection for this editing operation. |
107 VisibleSelection Editor::selectionForCommand(Event* event) | 107 VisibleSelection Editor::selectionForCommand(Event* event) |
108 { | 108 { |
109 VisibleSelection selection = m_frame->selection()->selection(); | 109 VisibleSelection selection = m_frame->selection()->selection(); |
110 if (!event) | 110 if (!event) |
111 return selection; | 111 return selection; |
112 // If the target is a text control, and the current selection is outside of
its shadow tree, | 112 // If the target is a text control, and the current selection is outside of
its shadow tree, |
113 // then use the saved selection for that text control. | 113 // then use the saved selection for that text control. |
114 HTMLTextFormControlElement* textFormControlOfSelectionStart = enclosingTextF
ormControl(selection.start()); | 114 Handle<HTMLTextFormControlElement> textFormControlOfSelectionStart = enclosi
ngTextFormControl(selection.start()); |
115 HTMLTextFormControlElement* textFromControlOfTarget = isHTMLTextFormControlE
lement(event->target()->toNode()) ? toHTMLTextFormControlElement(event->target()
->toNode()) : 0; | 115 Handle<HTMLTextFormControlElement> textFromControlOfTarget = isHTMLTextFormC
ontrolElement(event->target()->toNode()) ? toHTMLTextFormControlElement(event->t
arget()->toNode()) : nullptr; |
116 if (textFromControlOfTarget && (selection.start().isNull() || textFromContro
lOfTarget != textFormControlOfSelectionStart)) { | 116 if (textFromControlOfTarget && (selection.start().isNull() || textFromContro
lOfTarget != textFormControlOfSelectionStart)) { |
117 if (RefPtr<Range> range = textFromControlOfTarget->selection()) | 117 if (RefPtr<Range> range = textFromControlOfTarget->selection()) |
118 return VisibleSelection(range.get(), DOWNSTREAM, selection.isDirecti
onal()); | 118 return VisibleSelection(range.get(), DOWNSTREAM, selection.isDirecti
onal()); |
119 } | 119 } |
120 return selection; | 120 return selection; |
121 } | 121 } |
122 | 122 |
123 // Function considers Mac editing behavior a fallback when Page or Settings is n
ot available. | 123 // Function considers Mac editing behavior a fallback when Page or Settings is n
ot available. |
124 EditingBehavior Editor::behavior() const | 124 EditingBehavior Editor::behavior() const |
125 { | 125 { |
(...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2907 { | 2907 { |
2908 return m_alternativeTextController->dictationAlternativesForMarker(marker); | 2908 return m_alternativeTextController->dictationAlternativesForMarker(marker); |
2909 } | 2909 } |
2910 | 2910 |
2911 void Editor::applyDictationAlternativelternative(const String& alternativeString
) | 2911 void Editor::applyDictationAlternativelternative(const String& alternativeString
) |
2912 { | 2912 { |
2913 m_alternativeTextController->applyDictationAlternative(alternativeString); | 2913 m_alternativeTextController->applyDictationAlternative(alternativeString); |
2914 } | 2914 } |
2915 | 2915 |
2916 } // namespace WebCore | 2916 } // namespace WebCore |
OLD | NEW |