Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: third_party/WebKit/Source/core/editing/InputMethodController.cpp

Issue 2794803002: Suppress frame requests in InputMethodController::textInputType() (Closed)
Patch Set: InputMethodController::textInputType() Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/PageAnimator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 #include "core/editing/state_machines/BackwardCodePointStateMachine.h" 38 #include "core/editing/state_machines/BackwardCodePointStateMachine.h"
39 #include "core/editing/state_machines/ForwardCodePointStateMachine.h" 39 #include "core/editing/state_machines/ForwardCodePointStateMachine.h"
40 #include "core/events/CompositionEvent.h" 40 #include "core/events/CompositionEvent.h"
41 #include "core/frame/LocalFrame.h" 41 #include "core/frame/LocalFrame.h"
42 #include "core/html/HTMLInputElement.h" 42 #include "core/html/HTMLInputElement.h"
43 #include "core/html/HTMLTextAreaElement.h" 43 #include "core/html/HTMLTextAreaElement.h"
44 #include "core/input/EventHandler.h" 44 #include "core/input/EventHandler.h"
45 #include "core/layout/LayoutObject.h" 45 #include "core/layout/LayoutObject.h"
46 #include "core/layout/LayoutTheme.h" 46 #include "core/layout/LayoutTheme.h"
47 #include "core/page/ChromeClient.h" 47 #include "core/page/ChromeClient.h"
48 #include "core/page/Page.h"
49 #include "core/page/PageAnimator.h"
48 50
49 namespace blink { 51 namespace blink {
50 52
51 namespace { 53 namespace {
52 54
53 void dispatchCompositionUpdateEvent(LocalFrame& frame, const String& text) { 55 void dispatchCompositionUpdateEvent(LocalFrame& frame, const String& text) {
54 Element* target = frame.document()->focusedElement(); 56 Element* target = frame.document()->focusedElement();
55 if (!target) 57 if (!target)
56 return; 58 return;
57 59
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 1177
1176 WebTextInputType InputMethodController::textInputType() const { 1178 WebTextInputType InputMethodController::textInputType() const {
1177 if (!frame().selection().isAvailable()) { 1179 if (!frame().selection().isAvailable()) {
1178 // "mouse-capture-inside-shadow.html" reaches here. 1180 // "mouse-capture-inside-shadow.html" reaches here.
1179 return WebTextInputTypeNone; 1181 return WebTextInputTypeNone;
1180 } 1182 }
1181 1183
1182 // It's important to preserve the equivalence of textInputInfo().type and 1184 // It's important to preserve the equivalence of textInputInfo().type and
1183 // textInputType(), so perform the same rootEditableElement() existence check 1185 // textInputType(), so perform the same rootEditableElement() existence check
1184 // here for consistency. 1186 // here for consistency.
1185 if (!frame() 1187 {
1186 .selection() 1188 // TODO(alancutter): Move this frame request supression logic up into
1187 .computeVisibleSelectionInDOMTreeDeprecated() 1189 // BeginMainFrame.
1188 .rootEditableElement()) 1190 PageAnimator::FrameRequestSuppressionScope suppressFrameRequests(
1189 return WebTextInputTypeNone; 1191 frame().page() ? &frame().page()->animator() : nullptr);
1192
1193 if (!frame()
1194 .selection()
1195 .computeVisibleSelectionInDOMTreeDeprecated()
1196 .rootEditableElement()) {
1197 return WebTextInputTypeNone;
1198 }
1199 }
1190 1200
1191 if (!isAvailable()) 1201 if (!isAvailable())
1192 return WebTextInputTypeNone; 1202 return WebTextInputTypeNone;
1193 1203
1194 Element* element = document().focusedElement(); 1204 Element* element = document().focusedElement();
1195 if (!element) 1205 if (!element)
1196 return WebTextInputTypeNone; 1206 return WebTextInputTypeNone;
1197 1207
1198 if (isHTMLInputElement(*element)) { 1208 if (isHTMLInputElement(*element)) {
1199 HTMLInputElement& input = toHTMLInputElement(*element); 1209 HTMLInputElement& input = toHTMLInputElement(*element);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 finishComposingText(KeepSelection); 1252 finishComposingText(KeepSelection);
1243 } 1253 }
1244 1254
1245 DEFINE_TRACE(InputMethodController) { 1255 DEFINE_TRACE(InputMethodController) {
1246 visitor->trace(m_frame); 1256 visitor->trace(m_frame);
1247 visitor->trace(m_compositionRange); 1257 visitor->trace(m_compositionRange);
1248 SynchronousMutationObserver::trace(visitor); 1258 SynchronousMutationObserver::trace(visitor);
1249 } 1259 }
1250 1260
1251 } // namespace blink 1261 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/PageAnimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698