Chromium Code Reviews| 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1023 | 1023 |
| 1024 WebTextInputInfo InputMethodController::textInputInfo() const { | 1024 WebTextInputInfo InputMethodController::textInputInfo() const { |
| 1025 WebTextInputInfo info; | 1025 WebTextInputInfo info; |
| 1026 if (!isAvailable()) | 1026 if (!isAvailable()) |
| 1027 return info; | 1027 return info; |
| 1028 | 1028 |
| 1029 if (!frame().selection().isAvailable()) { | 1029 if (!frame().selection().isAvailable()) { |
| 1030 // plugins/mouse-capture-inside-shadow.html reaches here. | 1030 // plugins/mouse-capture-inside-shadow.html reaches here. |
| 1031 return info; | 1031 return info; |
| 1032 } | 1032 } |
| 1033 Element* element = frame() | 1033 Element* element = |
| 1034 .selection() | 1034 rootEditableElementOf(frame().selection().selectionInDOMTree().base()); |
| 1035 .computeVisibleSelectionInDOMTreeDeprecated() | |
|
yosin_UTC9
2017/03/16 02:30:05
Let's do mechanical change for
computeVisibleSele
yoichio
2017/03/16 04:10:59
Acknowledged.
| |
| 1036 .rootEditableElement(); | |
| 1037 if (!element) | 1035 if (!element) |
| 1038 return info; | 1036 return info; |
| 1039 | 1037 |
| 1040 info.inputMode = inputModeOfFocusedElement(); | 1038 info.inputMode = inputModeOfFocusedElement(); |
| 1041 info.type = textInputType(); | 1039 info.type = textInputType(); |
| 1042 info.flags = textInputFlags(); | 1040 info.flags = textInputFlags(); |
| 1043 if (info.type == WebTextInputTypeNone) | 1041 if (info.type == WebTextInputTypeNone) |
| 1044 return info; | 1042 return info; |
| 1045 | 1043 |
| 1046 if (!frame().editor().canEdit()) | 1044 if (!frame().editor().canEdit()) |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1172 return kWebTextInputModeUrl; | 1170 return kWebTextInputModeUrl; |
| 1173 return kWebTextInputModeDefault; | 1171 return kWebTextInputModeDefault; |
| 1174 } | 1172 } |
| 1175 | 1173 |
| 1176 WebTextInputType InputMethodController::textInputType() const { | 1174 WebTextInputType InputMethodController::textInputType() const { |
| 1177 if (!frame().selection().isAvailable()) { | 1175 if (!frame().selection().isAvailable()) { |
| 1178 // "mouse-capture-inside-shadow.html" reaches here. | 1176 // "mouse-capture-inside-shadow.html" reaches here. |
| 1179 return WebTextInputTypeNone; | 1177 return WebTextInputTypeNone; |
| 1180 } | 1178 } |
| 1181 | 1179 |
| 1182 // It's important to preserve the equivalence of textInputInfo().type and | |
| 1183 // textInputType(), so perform the same rootEditableElement() existence check | |
| 1184 // here for consistency. | |
| 1185 if (!frame() | |
| 1186 .selection() | |
| 1187 .computeVisibleSelectionInDOMTreeDeprecated() | |
| 1188 .rootEditableElement()) | |
| 1189 return WebTextInputTypeNone; | |
| 1190 | |
| 1191 if (!isAvailable()) | 1180 if (!isAvailable()) |
| 1192 return WebTextInputTypeNone; | 1181 return WebTextInputTypeNone; |
| 1193 | 1182 |
| 1194 Element* element = document().focusedElement(); | 1183 Element* element = document().focusedElement(); |
| 1195 if (!element) | 1184 if (!element) |
| 1196 return WebTextInputTypeNone; | 1185 return WebTextInputTypeNone; |
| 1197 | 1186 |
| 1187 // It's important to preserve the equivalence of textInputInfo().type and | |
|
yosin_UTC9
2017/03/16 02:30:05
Please have another patch to moving this block.
yoichio
2017/03/16 04:10:59
Acknowledged.
| |
| 1188 // textInputType(), so perform the same rootEditableElement() existence check | |
| 1189 // here for consistency. | |
| 1190 if (!rootEditableElementOf(frame().selection().selectionInDOMTree().base())) | |
| 1191 return WebTextInputTypeNone; | |
| 1192 | |
| 1198 if (isHTMLInputElement(*element)) { | 1193 if (isHTMLInputElement(*element)) { |
| 1199 HTMLInputElement& input = toHTMLInputElement(*element); | 1194 HTMLInputElement& input = toHTMLInputElement(*element); |
| 1200 const AtomicString& type = input.type(); | 1195 const AtomicString& type = input.type(); |
| 1201 | 1196 |
| 1202 if (input.isDisabledOrReadOnly()) | 1197 if (input.isDisabledOrReadOnly()) |
| 1203 return WebTextInputTypeNone; | 1198 return WebTextInputTypeNone; |
| 1204 | 1199 |
| 1205 if (type == InputTypeNames::password) | 1200 if (type == InputTypeNames::password) |
| 1206 return WebTextInputTypePassword; | 1201 return WebTextInputTypePassword; |
| 1207 if (type == InputTypeNames::search) | 1202 if (type == InputTypeNames::search) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1242 finishComposingText(KeepSelection); | 1237 finishComposingText(KeepSelection); |
| 1243 } | 1238 } |
| 1244 | 1239 |
| 1245 DEFINE_TRACE(InputMethodController) { | 1240 DEFINE_TRACE(InputMethodController) { |
| 1246 visitor->trace(m_frame); | 1241 visitor->trace(m_frame); |
| 1247 visitor->trace(m_compositionRange); | 1242 visitor->trace(m_compositionRange); |
| 1248 SynchronousMutationObserver::trace(visitor); | 1243 SynchronousMutationObserver::trace(visitor); |
| 1249 } | 1244 } |
| 1250 | 1245 |
| 1251 } // namespace blink | 1246 } // namespace blink |
| OLD | NEW |