| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); | 1880 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); |
| 1878 | 1881 |
| 1879 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get()); | 1882 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get()); |
| 1880 | 1883 |
| 1881 // The following two can result in further layout and possibly | 1884 // The following two can result in further layout and possibly |
| 1882 // enable GPU acceleration so they need to be called before any painting | 1885 // enable GPU acceleration so they need to be called before any painting |
| 1883 // is done. | 1886 // is done. |
| 1884 UpdateTextInputType(); | 1887 UpdateTextInputType(); |
| 1885 #if defined(OS_ANDROID) | 1888 #if defined(OS_ANDROID) |
| 1886 UpdateTextInputState(false, true); | 1889 UpdateTextInputState(false, true); |
| 1890 UpdateSelectionRootBounds(); |
| 1887 #endif | 1891 #endif |
| 1888 UpdateSelectionBounds(); | 1892 UpdateSelectionBounds(); |
| 1889 } | 1893 } |
| 1890 | 1894 |
| 1891 void RenderWidget::didBecomeReadyForAdditionalInput() { | 1895 void RenderWidget::didBecomeReadyForAdditionalInput() { |
| 1892 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); | 1896 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); |
| 1893 FlushPendingInputEventAck(); | 1897 FlushPendingInputEventAck(); |
| 1894 } | 1898 } |
| 1895 | 1899 |
| 1896 void RenderWidget::DidCommitCompositorFrame() { | 1900 void RenderWidget::DidCommitCompositorFrame() { |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 DCHECK(!handling_ime_event_); | 2384 DCHECK(!handling_ime_event_); |
| 2381 handling_ime_event_ = true; | 2385 handling_ime_event_ = true; |
| 2382 } | 2386 } |
| 2383 | 2387 |
| 2384 void RenderWidget::FinishHandlingImeEvent() { | 2388 void RenderWidget::FinishHandlingImeEvent() { |
| 2385 DCHECK(handling_ime_event_); | 2389 DCHECK(handling_ime_event_); |
| 2386 handling_ime_event_ = false; | 2390 handling_ime_event_ = false; |
| 2387 // While handling an ime event, text input state and selection bounds updates | 2391 // While handling an ime event, text input state and selection bounds updates |
| 2388 // are ignored. These must explicitly be updated once finished handling the | 2392 // are ignored. These must explicitly be updated once finished handling the |
| 2389 // ime event. | 2393 // ime event. |
| 2394 #if defined(OS_ANDROID) |
| 2395 UpdateSelectionRootBounds(); |
| 2396 #endif |
| 2390 UpdateSelectionBounds(); | 2397 UpdateSelectionBounds(); |
| 2391 #if defined(OS_ANDROID) | 2398 #if defined(OS_ANDROID) |
| 2392 UpdateTextInputState(false, false); | 2399 UpdateTextInputState(false, false); |
| 2393 #endif | 2400 #endif |
| 2394 } | 2401 } |
| 2395 | 2402 |
| 2396 void RenderWidget::UpdateTextInputType() { | 2403 void RenderWidget::UpdateTextInputType() { |
| 2397 // On Windows, not only an IME but also an on-screen keyboard relies on the | 2404 // On Windows, not only an IME but also an on-screen keyboard relies on the |
| 2398 // latest TextInputType to optimize its layout and functionality. Thus | 2405 // latest TextInputType to optimize its layout and functionality. Thus |
| 2399 // |input_method_is_active_| is no longer an appropriate condition to suppress | 2406 // |input_method_is_active_| is no longer an appropriate condition to suppress |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2784 | 2791 |
| 2785 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2792 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
| 2786 swapped_out_frames_.AddObserver(frame); | 2793 swapped_out_frames_.AddObserver(frame); |
| 2787 } | 2794 } |
| 2788 | 2795 |
| 2789 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { | 2796 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { |
| 2790 swapped_out_frames_.RemoveObserver(frame); | 2797 swapped_out_frames_.RemoveObserver(frame); |
| 2791 } | 2798 } |
| 2792 | 2799 |
| 2793 } // namespace content | 2800 } // namespace content |
| OLD | NEW |