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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 57 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
58 #include "third_party/WebKit/public/platform/WebRect.h" | 58 #include "third_party/WebKit/public/platform/WebRect.h" |
59 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 59 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
60 #include "third_party/WebKit/public/platform/WebSize.h" | 60 #include "third_party/WebKit/public/platform/WebSize.h" |
61 #include "third_party/WebKit/public/platform/WebString.h" | 61 #include "third_party/WebKit/public/platform/WebString.h" |
62 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" | 62 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" |
63 #include "third_party/WebKit/public/web/WebPagePopup.h" | 63 #include "third_party/WebKit/public/web/WebPagePopup.h" |
64 #include "third_party/WebKit/public/web/WebPopupMenu.h" | 64 #include "third_party/WebKit/public/web/WebPopupMenu.h" |
65 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h" | 65 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h" |
66 #include "third_party/WebKit/public/web/WebRange.h" | 66 #include "third_party/WebKit/public/web/WebRange.h" |
| 67 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
67 #include "third_party/skia/include/core/SkShader.h" | 68 #include "third_party/skia/include/core/SkShader.h" |
68 #include "ui/base/ui_base_switches.h" | 69 #include "ui/base/ui_base_switches.h" |
69 #include "ui/gfx/frame_time.h" | 70 #include "ui/gfx/frame_time.h" |
70 #include "ui/gfx/point_conversions.h" | 71 #include "ui/gfx/point_conversions.h" |
71 #include "ui/gfx/rect_conversions.h" | 72 #include "ui/gfx/rect_conversions.h" |
72 #include "ui/gfx/size_conversions.h" | 73 #include "ui/gfx/size_conversions.h" |
73 #include "ui/gfx/skia_util.h" | 74 #include "ui/gfx/skia_util.h" |
74 #include "ui/gl/gl_switches.h" | 75 #include "ui/gl/gl_switches.h" |
75 #include "ui/surface/transport_dib.h" | 76 #include "ui/surface/transport_dib.h" |
76 | 77 |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 *focus = focus_webrect; | 1812 *focus = focus_webrect; |
1812 *anchor = anchor_webrect; | 1813 *anchor = anchor_webrect; |
1813 } | 1814 } |
1814 | 1815 |
1815 void RenderWidget::UpdateSelectionBounds() { | 1816 void RenderWidget::UpdateSelectionBounds() { |
1816 if (!webwidget_) | 1817 if (!webwidget_) |
1817 return; | 1818 return; |
1818 if (handling_ime_event_) | 1819 if (handling_ime_event_) |
1819 return; | 1820 return; |
1820 | 1821 |
1821 ViewHostMsg_SelectionBounds_Params params; | 1822 // With composited selection updates, the selection bounds will be reported |
1822 GetSelectionBounds(¶ms.anchor_rect, ¶ms.focus_rect); | 1823 // directly by the compositor, in which case explicit IPC selection |
1823 if (selection_anchor_rect_ != params.anchor_rect || | 1824 // notifications should be suppressed. |
1824 selection_focus_rect_ != params.focus_rect) { | 1825 if (!blink::WebRuntimeFeatures::isCompositedSelectionUpdateEnabled()) { |
1825 selection_anchor_rect_ = params.anchor_rect; | 1826 ViewHostMsg_SelectionBounds_Params params; |
1826 selection_focus_rect_ = params.focus_rect; | 1827 GetSelectionBounds(¶ms.anchor_rect, ¶ms.focus_rect); |
1827 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); | 1828 if (selection_anchor_rect_ != params.anchor_rect || |
1828 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); | 1829 selection_focus_rect_ != params.focus_rect) { |
1829 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); | 1830 selection_anchor_rect_ = params.anchor_rect; |
| 1831 selection_focus_rect_ = params.focus_rect; |
| 1832 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); |
| 1833 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); |
| 1834 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); |
| 1835 } |
1830 } | 1836 } |
| 1837 |
1831 #if defined(OS_MACOSX) || defined(USE_AURA) | 1838 #if defined(OS_MACOSX) || defined(USE_AURA) |
1832 UpdateCompositionInfo(false); | 1839 UpdateCompositionInfo(false); |
1833 #endif | 1840 #endif |
1834 } | 1841 } |
1835 | 1842 |
1836 // Check blink::WebTextInputType and ui::TextInputType is kept in sync. | 1843 // Check blink::WebTextInputType and ui::TextInputType is kept in sync. |
1837 COMPILE_ASSERT(int(blink::WebTextInputTypeNone) == \ | 1844 COMPILE_ASSERT(int(blink::WebTextInputTypeNone) == \ |
1838 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); | 1845 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); |
1839 COMPILE_ASSERT(int(blink::WebTextInputTypeText) == \ | 1846 COMPILE_ASSERT(int(blink::WebTextInputTypeText) == \ |
1840 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); | 1847 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2188 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
2182 video_hole_frames_.AddObserver(frame); | 2189 video_hole_frames_.AddObserver(frame); |
2183 } | 2190 } |
2184 | 2191 |
2185 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2192 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
2186 video_hole_frames_.RemoveObserver(frame); | 2193 video_hole_frames_.RemoveObserver(frame); |
2187 } | 2194 } |
2188 #endif // defined(VIDEO_HOLE) | 2195 #endif // defined(VIDEO_HOLE) |
2189 | 2196 |
2190 } // namespace content | 2197 } // namespace content |
OLD | NEW |