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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2608293002: [reland, refactor] - Move textInputInfo() and textInputType() from WebWidget to WebInputMethodContr… (Closed)
Patch Set: Addressing wjmaclean@'s comments Created 3 years, 11 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 | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 #include "third_party/WebKit/public/platform/WebVector.h" 182 #include "third_party/WebKit/public/platform/WebVector.h"
183 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h" 183 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h"
184 #include "third_party/WebKit/public/web/WebColorSuggestion.h" 184 #include "third_party/WebKit/public/web/WebColorSuggestion.h"
185 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 185 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
186 #include "third_party/WebKit/public/web/WebDocument.h" 186 #include "third_party/WebKit/public/web/WebDocument.h"
187 #include "third_party/WebKit/public/web/WebFindOptions.h" 187 #include "third_party/WebKit/public/web/WebFindOptions.h"
188 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" 188 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h"
189 #include "third_party/WebKit/public/web/WebFrameSerializer.h" 189 #include "third_party/WebKit/public/web/WebFrameSerializer.h"
190 #include "third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h" 190 #include "third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h"
191 #include "third_party/WebKit/public/web/WebFrameWidget.h" 191 #include "third_party/WebKit/public/web/WebFrameWidget.h"
192 #include "third_party/WebKit/public/web/WebInputMethodController.h"
192 #include "third_party/WebKit/public/web/WebKit.h" 193 #include "third_party/WebKit/public/web/WebKit.h"
193 #include "third_party/WebKit/public/web/WebLocalFrame.h" 194 #include "third_party/WebKit/public/web/WebLocalFrame.h"
194 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" 195 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
195 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" 196 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
196 #include "third_party/WebKit/public/web/WebPlugin.h" 197 #include "third_party/WebKit/public/web/WebPlugin.h"
197 #include "third_party/WebKit/public/web/WebPluginContainer.h" 198 #include "third_party/WebKit/public/web/WebPluginContainer.h"
198 #include "third_party/WebKit/public/web/WebPluginDocument.h" 199 #include "third_party/WebKit/public/web/WebPluginDocument.h"
199 #include "third_party/WebKit/public/web/WebPluginParams.h" 200 #include "third_party/WebKit/public/web/WebPluginParams.h"
200 #include "third_party/WebKit/public/web/WebRange.h" 201 #include "third_party/WebKit/public/web/WebRange.h"
201 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 202 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 if (frame_ != render_view_->GetWebView()->focusedFrame() || 2284 if (frame_ != render_view_->GetWebView()->focusedFrame() ||
2284 frame_->document().focusedElement().isNull()) { 2285 frame_->document().focusedElement().isNull()) {
2285 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, 2286 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id,
2286 FormFieldData())); 2287 FormFieldData()));
2287 return; 2288 return;
2288 } 2289 }
2289 2290
2290 WebElement element = frame_->document().focusedElement(); 2291 WebElement element = frame_->document().focusedElement();
2291 2292
2292 DCHECK(GetRenderWidget()->GetWebWidget()); 2293 DCHECK(GetRenderWidget()->GetWebWidget());
2294 blink::WebInputMethodController* controller =
2295 frame_->frameWidget()->getActiveWebInputMethodController();
2293 blink::WebTextInputInfo info = 2296 blink::WebTextInputInfo info =
2294 GetRenderWidget()->GetWebWidget()->textInputInfo(); 2297 controller ? controller->textInputInfo() : blink::WebTextInputInfo();
2295 FormFieldData field; 2298 FormFieldData field;
2296 field.text = info.value.utf8(); 2299 field.text = info.value.utf8();
2297 field.placeholder = element.getAttribute("placeholder").utf8(); 2300 field.placeholder = element.getAttribute("placeholder").utf8();
2298 field.text_input_type = GetRenderWidget()->GetTextInputType(); 2301 field.text_input_type = GetRenderWidget()->GetTextInputType();
2299 2302
2300 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, 2303 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id,
2301 field)); 2304 field));
2302 } 2305 }
2303 2306
2304 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, 2307 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type,
(...skipping 3728 matching lines...) Expand 10 before | Expand all | Expand 10 after
6033 } else 6036 } else
6034 #endif 6037 #endif
6035 { 6038 {
6036 WebRange selection = 6039 WebRange selection =
6037 GetRenderWidget()->GetWebWidget()->caretOrSelectionRange(); 6040 GetRenderWidget()->GetWebWidget()->caretOrSelectionRange();
6038 if (selection.isNull()) 6041 if (selection.isNull())
6039 return; 6042 return;
6040 6043
6041 range = gfx::Range(selection.startOffset(), selection.endOffset()); 6044 range = gfx::Range(selection.startOffset(), selection.endOffset());
6042 6045
6043 if (GetRenderWidget()->GetWebWidget()->textInputType() != 6046 if (frame_->inputMethodController()->textInputType() !=
6044 blink::WebTextInputTypeNone) { 6047 blink::WebTextInputTypeNone) {
6045 // If current focused element is editable, we will send 100 more chars 6048 // If current focused element is editable, we will send 100 more chars
6046 // before and after selection. It is for input method surrounding text 6049 // before and after selection. It is for input method surrounding text
6047 // feature. 6050 // feature.
6048 if (selection.startOffset() > kExtraCharsBeforeAndAfterSelection) 6051 if (selection.startOffset() > kExtraCharsBeforeAndAfterSelection)
6049 offset = selection.startOffset() - kExtraCharsBeforeAndAfterSelection; 6052 offset = selection.startOffset() - kExtraCharsBeforeAndAfterSelection;
6050 else 6053 else
6051 offset = 0; 6054 offset = 0;
6052 size_t length = 6055 size_t length =
6053 selection.endOffset() - offset + kExtraCharsBeforeAndAfterSelection; 6056 selection.endOffset() - offset + kExtraCharsBeforeAndAfterSelection;
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
6761 // event target. Potentially a Pepper plugin will receive the event. 6764 // event target. Potentially a Pepper plugin will receive the event.
6762 // In order to tell whether a plugin gets the last mouse event and which it 6765 // In order to tell whether a plugin gets the last mouse event and which it
6763 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6766 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6764 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6767 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6765 // |pepper_last_mouse_event_target_|. 6768 // |pepper_last_mouse_event_target_|.
6766 pepper_last_mouse_event_target_ = nullptr; 6769 pepper_last_mouse_event_target_ = nullptr;
6767 #endif 6770 #endif
6768 } 6771 }
6769 6772
6770 } // namespace content 6773 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698