OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. |
3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 bool EditorClientImpl::isSelectTrailingWhitespaceEnabled() | 93 bool EditorClientImpl::isSelectTrailingWhitespaceEnabled() |
94 { | 94 { |
95 if (m_webView->page()) | 95 if (m_webView->page()) |
96 return m_webView->page()->settings()->selectTrailingWhitespaceEnabled(); | 96 return m_webView->page()->settings()->selectTrailingWhitespaceEnabled(); |
97 return false; | 97 return false; |
98 } | 98 } |
99 | 99 |
100 bool EditorClientImpl::shouldSpellcheckByDefault() | 100 bool EditorClientImpl::shouldSpellcheckByDefault() |
101 { | 101 { |
102 // Spellcheck should be enabled for all editable areas (such as textareas, | 102 // Spellcheck should be enabled for all editable areas (such as textareas, |
103 // contentEditable regions, and designMode docs), except text inputs. | 103 // contentEditable regions, designMode docs and inputs). |
104 const Frame* frame = m_webView->focusedWebCoreFrame(); | 104 const Frame* frame = m_webView->focusedWebCoreFrame(); |
105 if (!frame) | 105 if (!frame) |
106 return false; | 106 return false; |
107 const Editor* editor = frame->editor(); | 107 const Editor* editor = frame->editor(); |
108 if (!editor) | 108 if (!editor) |
109 return false; | 109 return false; |
110 if (editor->isSpellCheckingEnabledInFocusedNode()) | 110 if (editor->isSpellCheckingEnabledInFocusedNode()) |
111 return true; | 111 return true; |
tony
2013/07/31 20:59:29
It looks like we already spellcheck inputs by defa
| |
112 const Document* document = frame->document(); | 112 const Document* document = frame->document(); |
113 if (!document) | 113 if (!document) |
114 return false; | 114 return false; |
115 const Element* element = document->focusedElement(); | 115 const Element* element = document->focusedElement(); |
116 // If |element| is null, we default to allowing spellchecking. This is done | 116 // If |element| is null, we default to allowing spellchecking. This is done |
117 // in order to mitigate the issue when the user clicks outside the textbox, | 117 // in order to mitigate the issue when the user clicks outside the textbox, |
118 // as a result of which |element| becomes null, resulting in all the spell | 118 // as a result of which |element| becomes null, resulting in all the spell |
119 // check markers being deleted. Also, the Frame will decide not to do | 119 // check markers being deleted. Also, the Frame will decide not to do |
120 // spellchecking if the user can't edit - so returning true here will not | 120 // spellchecking if the user can't edit - so returning true here will not |
121 // cause any problems to the Frame's behavior. | 121 // cause any problems to the Frame's behavior. |
122 if (!element) | 122 if (!element) |
123 return true; | 123 return true; |
124 const RenderObject* renderer = element->renderer(); | 124 const RenderObject* renderer = element->renderer(); |
125 if (!renderer) | 125 if (!renderer) |
126 return false; | 126 return false; |
127 | 127 |
128 return !renderer->isTextField(); | 128 return true; |
129 } | 129 } |
130 | 130 |
131 bool EditorClientImpl::isContinuousSpellCheckingEnabled() | 131 bool EditorClientImpl::isContinuousSpellCheckingEnabled() |
132 { | 132 { |
133 if (m_spellCheckThisFieldStatus == SpellCheckForcedOff) | 133 if (m_spellCheckThisFieldStatus == SpellCheckForcedOff) |
134 return false; | 134 return false; |
135 if (m_spellCheckThisFieldStatus == SpellCheckForcedOn) | 135 if (m_spellCheckThisFieldStatus == SpellCheckForcedOn) |
136 return true; | 136 return true; |
137 return shouldSpellcheckByDefault(); | 137 return shouldSpellcheckByDefault(); |
138 } | 138 } |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 #endif | 763 #endif |
764 } | 764 } |
765 | 765 |
766 void EditorClientImpl::willSetInputMethodState() | 766 void EditorClientImpl::willSetInputMethodState() |
767 { | 767 { |
768 if (m_webView->client()) | 768 if (m_webView->client()) |
769 m_webView->client()->resetInputMethod(); | 769 m_webView->client()->resetInputMethod(); |
770 } | 770 } |
771 | 771 |
772 } // namesace WebKit | 772 } // namesace WebKit |
OLD | NEW |