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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/debug/trace_event_synthetic_delay.h" | 10 #include "base/debug/trace_event_synthetic_delay.h" |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 | 1492 |
1493 // Check for whether we need to track swap buffers. We need to do that after | 1493 // Check for whether we need to track swap buffers. We need to do that after |
1494 // layout() because it may have switched us to accelerated compositing. | 1494 // layout() because it may have switched us to accelerated compositing. |
1495 if (is_accelerated_compositing_active_) | 1495 if (is_accelerated_compositing_active_) |
1496 using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers(); | 1496 using_asynchronous_swapbuffers_ = SupportsAsynchronousSwapBuffers(); |
1497 | 1497 |
1498 // The following two can result in further layout and possibly | 1498 // The following two can result in further layout and possibly |
1499 // enable GPU acceleration so they need to be called before any painting | 1499 // enable GPU acceleration so they need to be called before any painting |
1500 // is done. | 1500 // is done. |
1501 UpdateTextInputType(); | 1501 UpdateTextInputType(); |
| 1502 #if defined(OS_ANDROID) |
| 1503 UpdateSelectionRootBounds(); |
| 1504 #endif |
1502 UpdateSelectionBounds(); | 1505 UpdateSelectionBounds(); |
1503 | 1506 |
1504 // Suppress painting if nothing is dirty. This has to be done after updating | 1507 // Suppress painting if nothing is dirty. This has to be done after updating |
1505 // animations running layout as these may generate further invalidations. | 1508 // animations running layout as these may generate further invalidations. |
1506 if (!paint_aggregator_.HasPendingUpdate()) { | 1509 if (!paint_aggregator_.HasPendingUpdate()) { |
1507 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate"); | 1510 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate"); |
1508 InstrumentDidCancelFrame(); | 1511 InstrumentDidCancelFrame(); |
1509 return; | 1512 return; |
1510 } | 1513 } |
1511 | 1514 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); | 1912 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); |
1910 | 1913 |
1911 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get()); | 1914 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get()); |
1912 | 1915 |
1913 // The following two can result in further layout and possibly | 1916 // The following two can result in further layout and possibly |
1914 // enable GPU acceleration so they need to be called before any painting | 1917 // enable GPU acceleration so they need to be called before any painting |
1915 // is done. | 1918 // is done. |
1916 UpdateTextInputType(); | 1919 UpdateTextInputType(); |
1917 #if defined(OS_ANDROID) | 1920 #if defined(OS_ANDROID) |
1918 UpdateTextInputState(false, true); | 1921 UpdateTextInputState(false, true); |
| 1922 UpdateSelectionRootBounds(); |
1919 #endif | 1923 #endif |
1920 UpdateSelectionBounds(); | 1924 UpdateSelectionBounds(); |
1921 } | 1925 } |
1922 | 1926 |
1923 void RenderWidget::didBecomeReadyForAdditionalInput() { | 1927 void RenderWidget::didBecomeReadyForAdditionalInput() { |
1924 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); | 1928 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); |
1925 FlushPendingInputEventAck(); | 1929 FlushPendingInputEventAck(); |
1926 } | 1930 } |
1927 | 1931 |
1928 void RenderWidget::DidCommitCompositorFrame() { | 1932 void RenderWidget::DidCommitCompositorFrame() { |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 DCHECK(!handling_ime_event_); | 2416 DCHECK(!handling_ime_event_); |
2413 handling_ime_event_ = true; | 2417 handling_ime_event_ = true; |
2414 } | 2418 } |
2415 | 2419 |
2416 void RenderWidget::FinishHandlingImeEvent() { | 2420 void RenderWidget::FinishHandlingImeEvent() { |
2417 DCHECK(handling_ime_event_); | 2421 DCHECK(handling_ime_event_); |
2418 handling_ime_event_ = false; | 2422 handling_ime_event_ = false; |
2419 // While handling an ime event, text input state and selection bounds updates | 2423 // While handling an ime event, text input state and selection bounds updates |
2420 // are ignored. These must explicitly be updated once finished handling the | 2424 // are ignored. These must explicitly be updated once finished handling the |
2421 // ime event. | 2425 // ime event. |
| 2426 #if defined(OS_ANDROID) |
| 2427 UpdateSelectionRootBounds(); |
| 2428 #endif |
2422 UpdateSelectionBounds(); | 2429 UpdateSelectionBounds(); |
2423 #if defined(OS_ANDROID) | 2430 #if defined(OS_ANDROID) |
2424 UpdateTextInputState(false, false); | 2431 UpdateTextInputState(false, false); |
2425 #endif | 2432 #endif |
2426 } | 2433 } |
2427 | 2434 |
2428 void RenderWidget::UpdateTextInputType() { | 2435 void RenderWidget::UpdateTextInputType() { |
2429 // On Windows, not only an IME but also an on-screen keyboard relies on the | 2436 // On Windows, not only an IME but also an on-screen keyboard relies on the |
2430 // latest TextInputType to optimize its layout and functionality. Thus | 2437 // latest TextInputType to optimize its layout and functionality. Thus |
2431 // |input_method_is_active_| is no longer an appropriate condition to suppress | 2438 // |input_method_is_active_| is no longer an appropriate condition to suppress |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2754 COMPILE_ASSERT( | 2761 COMPILE_ASSERT( |
2755 static_cast<blink::WebTouchAction>(TOUCH_ACTION_PINCH_ZOOM) == | 2762 static_cast<blink::WebTouchAction>(TOUCH_ACTION_PINCH_ZOOM) == |
2756 blink::WebTouchActionPinchZoom, | 2763 blink::WebTouchActionPinchZoom, |
2757 enum_values_must_match_for_touch_action); | 2764 enum_values_must_match_for_touch_action); |
2758 | 2765 |
2759 content::TouchAction content_touch_action = | 2766 content::TouchAction content_touch_action = |
2760 static_cast<content::TouchAction>(web_touch_action); | 2767 static_cast<content::TouchAction>(web_touch_action); |
2761 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); | 2768 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); |
2762 } | 2769 } |
2763 | 2770 |
| 2771 #if defined(OS_ANDROID) |
| 2772 void RenderWidget::UpdateSelectionRootBounds() { |
| 2773 } |
| 2774 #endif |
| 2775 |
2764 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2776 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
2765 return true; | 2777 return true; |
2766 } | 2778 } |
2767 | 2779 |
2768 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 2780 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
2769 RenderWidget::CreateGraphicsContext3D( | 2781 RenderWidget::CreateGraphicsContext3D( |
2770 const blink::WebGraphicsContext3D::Attributes& attributes) { | 2782 const blink::WebGraphicsContext3D::Attributes& attributes) { |
2771 if (!webwidget_) | 2783 if (!webwidget_) |
2772 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2784 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
2773 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2785 if (CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 | 2832 |
2821 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2833 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
2822 swapped_out_frames_.AddObserver(frame); | 2834 swapped_out_frames_.AddObserver(frame); |
2823 } | 2835 } |
2824 | 2836 |
2825 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2837 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
2826 swapped_out_frames_.RemoveObserver(frame); | 2838 swapped_out_frames_.RemoveObserver(frame); |
2827 } | 2839 } |
2828 | 2840 |
2829 } // namespace content | 2841 } // namespace content |
OLD | NEW |