| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); | 1196 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); |
| 1197 | 1197 |
| 1198 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get()); | 1198 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get()); |
| 1199 | 1199 |
| 1200 // The following two can result in further layout and possibly | 1200 // The following two can result in further layout and possibly |
| 1201 // enable GPU acceleration so they need to be called before any painting | 1201 // enable GPU acceleration so they need to be called before any painting |
| 1202 // is done. | 1202 // is done. |
| 1203 UpdateTextInputType(); | 1203 UpdateTextInputType(); |
| 1204 #if defined(OS_ANDROID) | 1204 #if defined(OS_ANDROID) |
| 1205 UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME); | 1205 UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME); |
| 1206 UpdateSelectionRootBounds(); | |
| 1207 #endif | 1206 #endif |
| 1208 UpdateSelectionBounds(); | 1207 UpdateSelectionBounds(); |
| 1209 } | 1208 } |
| 1210 | 1209 |
| 1211 void RenderWidget::didBecomeReadyForAdditionalInput() { | 1210 void RenderWidget::didBecomeReadyForAdditionalInput() { |
| 1212 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); | 1211 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); |
| 1213 FlushPendingInputEventAck(); | 1212 FlushPendingInputEventAck(); |
| 1214 } | 1213 } |
| 1215 | 1214 |
| 1216 void RenderWidget::DidCommitCompositorFrame() { | 1215 void RenderWidget::DidCommitCompositorFrame() { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 DCHECK(!handling_ime_event_); | 1634 DCHECK(!handling_ime_event_); |
| 1636 handling_ime_event_ = true; | 1635 handling_ime_event_ = true; |
| 1637 } | 1636 } |
| 1638 | 1637 |
| 1639 void RenderWidget::FinishHandlingImeEvent() { | 1638 void RenderWidget::FinishHandlingImeEvent() { |
| 1640 DCHECK(handling_ime_event_); | 1639 DCHECK(handling_ime_event_); |
| 1641 handling_ime_event_ = false; | 1640 handling_ime_event_ = false; |
| 1642 // While handling an ime event, text input state and selection bounds updates | 1641 // While handling an ime event, text input state and selection bounds updates |
| 1643 // are ignored. These must explicitly be updated once finished handling the | 1642 // are ignored. These must explicitly be updated once finished handling the |
| 1644 // ime event. | 1643 // ime event. |
| 1645 #if defined(OS_ANDROID) | |
| 1646 UpdateSelectionRootBounds(); | |
| 1647 #endif | |
| 1648 UpdateSelectionBounds(); | 1644 UpdateSelectionBounds(); |
| 1649 #if defined(OS_ANDROID) | 1645 #if defined(OS_ANDROID) |
| 1650 UpdateTextInputState(NO_SHOW_IME, FROM_IME); | 1646 UpdateTextInputState(NO_SHOW_IME, FROM_IME); |
| 1651 #endif | 1647 #endif |
| 1652 } | 1648 } |
| 1653 | 1649 |
| 1654 void RenderWidget::UpdateTextInputType() { | 1650 void RenderWidget::UpdateTextInputType() { |
| 1655 // On Windows, not only an IME but also an on-screen keyboard relies on the | 1651 // On Windows, not only an IME but also an on-screen keyboard relies on the |
| 1656 // latest TextInputType to optimize its layout and functionality. Thus | 1652 // latest TextInputType to optimize its layout and functionality. Thus |
| 1657 // |input_method_is_active_| is no longer an appropriate condition to suppress | 1653 // |input_method_is_active_| is no longer an appropriate condition to suppress |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 static_cast<content::TouchAction>(web_touch_action); | 2032 static_cast<content::TouchAction>(web_touch_action); |
| 2037 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); | 2033 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); |
| 2038 } | 2034 } |
| 2039 | 2035 |
| 2040 void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { | 2036 void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { |
| 2041 #if defined(OS_ANDROID) | 2037 #if defined(OS_ANDROID) |
| 2042 text_field_is_dirty_ = true; | 2038 text_field_is_dirty_ = true; |
| 2043 #endif | 2039 #endif |
| 2044 } | 2040 } |
| 2045 | 2041 |
| 2046 #if defined(OS_ANDROID) | |
| 2047 void RenderWidget::UpdateSelectionRootBounds() { | |
| 2048 } | |
| 2049 #endif | |
| 2050 | |
| 2051 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2042 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
| 2052 return true; | 2043 return true; |
| 2053 } | 2044 } |
| 2054 | 2045 |
| 2055 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 2046 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 2056 RenderWidget::CreateGraphicsContext3D() { | 2047 RenderWidget::CreateGraphicsContext3D() { |
| 2057 if (!webwidget_) | 2048 if (!webwidget_) |
| 2058 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2049 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
| 2059 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2050 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 2060 switches::kDisableGpuCompositing)) | 2051 switches::kDisableGpuCompositing)) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2131 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2141 video_hole_frames_.AddObserver(frame); | 2132 video_hole_frames_.AddObserver(frame); |
| 2142 } | 2133 } |
| 2143 | 2134 |
| 2144 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2135 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2145 video_hole_frames_.RemoveObserver(frame); | 2136 video_hole_frames_.RemoveObserver(frame); |
| 2146 } | 2137 } |
| 2147 #endif // defined(VIDEO_HOLE) | 2138 #endif // defined(VIDEO_HOLE) |
| 2148 | 2139 |
| 2149 } // namespace content | 2140 } // namespace content |
| OLD | NEW |