OLD | NEW |
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 Loading... |
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 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 if (frame_ != render_view_->GetWebView()->focusedFrame() || | 2289 if (frame_ != render_view_->GetWebView()->focusedFrame() || |
2289 frame_->document().focusedElement().isNull()) { | 2290 frame_->document().focusedElement().isNull()) { |
2290 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, | 2291 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, |
2291 FormFieldData())); | 2292 FormFieldData())); |
2292 return; | 2293 return; |
2293 } | 2294 } |
2294 | 2295 |
2295 WebElement element = frame_->document().focusedElement(); | 2296 WebElement element = frame_->document().focusedElement(); |
2296 | 2297 |
2297 DCHECK(GetRenderWidget()->GetWebWidget()); | 2298 DCHECK(GetRenderWidget()->GetWebWidget()); |
| 2299 blink::WebInputMethodController* controller = |
| 2300 frame_->frameWidget()->getActiveWebInputMethodController(); |
2298 blink::WebTextInputInfo info = | 2301 blink::WebTextInputInfo info = |
2299 GetRenderWidget()->GetWebWidget()->textInputInfo(); | 2302 controller ? controller->textInputInfo() : blink::WebTextInputInfo(); |
2300 FormFieldData field; | 2303 FormFieldData field; |
2301 field.text = info.value.utf8(); | 2304 field.text = info.value.utf8(); |
2302 field.placeholder = element.getAttribute("placeholder").utf8(); | 2305 field.placeholder = element.getAttribute("placeholder").utf8(); |
2303 field.text_input_type = GetRenderWidget()->GetTextInputType(); | 2306 field.text_input_type = GetRenderWidget()->GetTextInputType(); |
2304 | 2307 |
2305 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, | 2308 Send(new FrameHostMsg_FocusedFormFieldDataResponse(routing_id_, request_id, |
2306 field)); | 2309 field)); |
2307 } | 2310 } |
2308 | 2311 |
2309 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, | 2312 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type, |
(...skipping 3693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6003 } else | 6006 } else |
6004 #endif | 6007 #endif |
6005 { | 6008 { |
6006 WebRange selection = | 6009 WebRange selection = |
6007 GetRenderWidget()->GetWebWidget()->caretOrSelectionRange(); | 6010 GetRenderWidget()->GetWebWidget()->caretOrSelectionRange(); |
6008 if (selection.isNull()) | 6011 if (selection.isNull()) |
6009 return; | 6012 return; |
6010 | 6013 |
6011 range = gfx::Range(selection.startOffset(), selection.endOffset()); | 6014 range = gfx::Range(selection.startOffset(), selection.endOffset()); |
6012 | 6015 |
6013 if (GetRenderWidget()->GetWebWidget()->textInputType() != | 6016 if (frame_->inputMethodController()->textInputType() != |
6014 blink::WebTextInputTypeNone) { | 6017 blink::WebTextInputTypeNone) { |
6015 // If current focused element is editable, we will send 100 more chars | 6018 // If current focused element is editable, we will send 100 more chars |
6016 // before and after selection. It is for input method surrounding text | 6019 // before and after selection. It is for input method surrounding text |
6017 // feature. | 6020 // feature. |
6018 if (selection.startOffset() > kExtraCharsBeforeAndAfterSelection) | 6021 if (selection.startOffset() > kExtraCharsBeforeAndAfterSelection) |
6019 offset = selection.startOffset() - kExtraCharsBeforeAndAfterSelection; | 6022 offset = selection.startOffset() - kExtraCharsBeforeAndAfterSelection; |
6020 else | 6023 else |
6021 offset = 0; | 6024 offset = 0; |
6022 size_t length = | 6025 size_t length = |
6023 selection.endOffset() - offset + kExtraCharsBeforeAndAfterSelection; | 6026 selection.endOffset() - offset + kExtraCharsBeforeAndAfterSelection; |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6727 // event target. Potentially a Pepper plugin will receive the event. | 6730 // event target. Potentially a Pepper plugin will receive the event. |
6728 // In order to tell whether a plugin gets the last mouse event and which it | 6731 // In order to tell whether a plugin gets the last mouse event and which it |
6729 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6732 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6730 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6733 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6731 // |pepper_last_mouse_event_target_|. | 6734 // |pepper_last_mouse_event_target_|. |
6732 pepper_last_mouse_event_target_ = nullptr; | 6735 pepper_last_mouse_event_target_ = nullptr; |
6733 #endif | 6736 #endif |
6734 } | 6737 } |
6735 | 6738 |
6736 } // namespace content | 6739 } // namespace content |
OLD | NEW |