Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: content/renderer/render_widget.cc

Issue 2417783005: [Master/Overview CL] Make PageScaleFactor work for oopif subframe.
Patch Set: Rebase to master@{#429656}. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "ui/base/ui_base_switches.h" 77 #include "ui/base/ui_base_switches.h"
78 #include "ui/gfx/geometry/point_conversions.h" 78 #include "ui/gfx/geometry/point_conversions.h"
79 #include "ui/gfx/geometry/rect_conversions.h" 79 #include "ui/gfx/geometry/rect_conversions.h"
80 #include "ui/gfx/geometry/size_conversions.h" 80 #include "ui/gfx/geometry/size_conversions.h"
81 #include "ui/gfx/skia_util.h" 81 #include "ui/gfx/skia_util.h"
82 #include "ui/gl/gl_switches.h" 82 #include "ui/gl/gl_switches.h"
83 #include "ui/surface/transport_dib.h" 83 #include "ui/surface/transport_dib.h"
84 84
85 #if defined(OS_ANDROID) 85 #if defined(OS_ANDROID)
86 #include <android/keycodes.h> 86 #include <android/keycodes.h>
87 #include "base/time/time.h"
87 #endif 88 #endif
88 89
89 #if defined(OS_POSIX) 90 #if defined(OS_POSIX)
90 #include "ipc/ipc_channel_posix.h" 91 #include "ipc/ipc_channel_posix.h"
91 #include "third_party/skia/include/core/SkMallocPixelRef.h" 92 #include "third_party/skia/include/core/SkMallocPixelRef.h"
92 #include "third_party/skia/include/core/SkPixelRef.h" 93 #include "third_party/skia/include/core/SkPixelRef.h"
93 #endif // defined(OS_POSIX) 94 #endif // defined(OS_POSIX)
94 95
95 #if defined(USE_AURA) 96 #if defined(USE_AURA)
96 #include "content/public/common/service_manager_connection.h" 97 #include "content/public/common/service_manager_connection.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Check the mode is in the range representable by ui::TextInputMode. 193 // Check the mode is in the range representable by ui::TextInputMode.
193 DCHECK_LE(mode, static_cast<int>(ui::TEXT_INPUT_MODE_MAX)) 194 DCHECK_LE(mode, static_cast<int>(ui::TEXT_INPUT_MODE_MAX))
194 << "blink::WebTextInputMode and ui::TextInputMode not synchronized"; 195 << "blink::WebTextInputMode and ui::TextInputMode not synchronized";
195 return static_cast<ui::TextInputMode>(mode); 196 return static_cast<ui::TextInputMode>(mode);
196 } 197 }
197 198
198 } // namespace 199 } // namespace
199 200
200 namespace content { 201 namespace content {
201 202
203 #if defined(OS_ANDROID)
204 // Delay between tapping in content and launching the associated android intent.
205 // Used to allow users see what has been recognized as content.
206 const size_t kContentIntentDelayMilliseconds = 700;
207 #endif
208
202 // RenderWidget --------------------------------------------------------------- 209 // RenderWidget ---------------------------------------------------------------
203 210
204 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, 211 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
205 blink::WebPopupType popup_type, 212 blink::WebPopupType popup_type,
206 const ScreenInfo& screen_info, 213 const ScreenInfo& screen_info,
207 bool swapped_out, 214 bool swapped_out,
208 bool hidden, 215 bool hidden,
209 bool never_visible) 216 bool never_visible)
210 : routing_id_(MSG_ROUTING_NONE), 217 : routing_id_(MSG_ROUTING_NONE),
211 compositor_deps_(compositor_deps), 218 compositor_deps_(compositor_deps),
(...skipping 24 matching lines...) Expand all
236 screen_info_(screen_info), 243 screen_info_(screen_info),
237 device_scale_factor_(screen_info_.device_scale_factor), 244 device_scale_factor_(screen_info_.device_scale_factor),
238 #if defined(OS_ANDROID) 245 #if defined(OS_ANDROID)
239 text_field_is_dirty_(false), 246 text_field_is_dirty_(false),
240 #endif 247 #endif
241 monitor_composition_info_(false), 248 monitor_composition_info_(false),
242 popup_origin_scale_for_emulation_(0.f), 249 popup_origin_scale_for_emulation_(0.f),
243 frame_swap_message_queue_(new FrameSwapMessageQueue()), 250 frame_swap_message_queue_(new FrameSwapMessageQueue()),
244 resizing_mode_selector_(new ResizingModeSelector()), 251 resizing_mode_selector_(new ResizingModeSelector()),
245 has_host_context_menu_location_(false), 252 has_host_context_menu_location_(false),
253 has_added_input_handler_(false),
246 has_focus_(false), 254 has_focus_(false),
247 #if defined(OS_MACOSX) 255 #if defined(OS_MACOSX)
248 text_input_client_observer_(new TextInputClientObserver(this)), 256 text_input_client_observer_(new TextInputClientObserver(this)),
249 #endif 257 #endif
250 focused_pepper_plugin_(nullptr) { 258 focused_pepper_plugin_(nullptr) {
251 if (!swapped_out) 259 if (!swapped_out)
252 RenderProcess::current()->AddRefProcess(); 260 RenderProcess::current()->AddRefProcess();
253 DCHECK(RenderThread::Get()); 261 DCHECK(RenderThread::Get());
254 device_color_profile_.push_back('0'); 262 device_color_profile_.push_back('0');
255 #if defined(OS_ANDROID) 263 #if defined(OS_ANDROID)
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 compositor_deps_); 1121 compositor_deps_);
1114 compositor_->setViewportSize(physical_backing_size_); 1122 compositor_->setViewportSize(physical_backing_size_);
1115 OnDeviceScaleFactorChanged(); 1123 OnDeviceScaleFactorChanged();
1116 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace()); 1124 compositor_->SetDeviceColorSpace(screen_info_.icc_profile.GetColorSpace());
1117 // For background pages and certain tests, we don't want to trigger 1125 // For background pages and certain tests, we don't want to trigger
1118 // CompositorFrameSink creation. 1126 // CompositorFrameSink creation.
1119 if (compositor_never_visible_ || !RenderThreadImpl::current()) 1127 if (compositor_never_visible_ || !RenderThreadImpl::current())
1120 compositor_->SetNeverVisible(); 1128 compositor_->SetNeverVisible();
1121 1129
1122 StartCompositor(); 1130 StartCompositor();
1131
1132 bool use_threaded_event_handling = true;
1133 #if defined(OS_MACOSX)
1134 // Disable threaded event handling if content is not handling the elastic
1135 // overscroll effect. This includes the cases where the elastic overscroll
1136 // effect is being handled by Blink (because of command line flags) and older
1137 // operating system versions which do not have an elastic overscroll effect
1138 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates).
1139 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled();
1140 #endif
1141 if (!use_threaded_event_handling)
1142 return;
1143
1144 RenderThreadImpl* render_thread = RenderThreadImpl::current();
1145 // render_thread may be NULL in tests.
1146 InputHandlerManager* input_handler_manager =
1147 render_thread ? render_thread->input_handler_manager() : NULL;
1148 if (input_handler_manager) {
1149 input_handler_manager->AddInputHandler(
1150 routing_id_, compositor()->GetInputHandler(), AsWeakPtr(), true);
1151 has_added_input_handler_ = true;
1152 }
1123 } 1153 }
1124 1154
1125 void RenderWidget::WillCloseLayerTreeView() { 1155 void RenderWidget::WillCloseLayerTreeView() {
1126 if (host_closing_) 1156 if (host_closing_)
1127 return; 1157 return;
1128 1158
1129 // Prevent new compositors or output surfaces from being created. 1159 // Prevent new compositors or output surfaces from being created.
1130 host_closing_ = true; 1160 host_closing_ = true;
1131 1161
1132 // Always send this notification to prevent new layer tree views from 1162 // Always send this notification to prevent new layer tree views from
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 ime_in_batch_edit_ = true; 1650 ime_in_batch_edit_ = true;
1621 return; 1651 return;
1622 } 1652 }
1623 if (!ime_in_batch_edit_) 1653 if (!ime_in_batch_edit_)
1624 return; 1654 return;
1625 ime_in_batch_edit_ = false; 1655 ime_in_batch_edit_ = false;
1626 DCHECK(!ime_event_guard_); 1656 DCHECK(!ime_event_guard_);
1627 UpdateSelectionBounds(); 1657 UpdateSelectionBounds();
1628 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); 1658 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME);
1629 } 1659 }
1660
1661 void RenderWidget::scheduleContentIntentForRenderView(
1662 const blink::WebURL& intent,
1663 bool is_main_frame,
1664 size_t expected_content_intent_id) {
1665 // Introduce a short delay so that the user can notice the content.
1666 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1667 FROM_HERE,
1668 base::Bind(&RenderWidget::LaunchAndroidContentIntent,
1669 static_cast<RenderWidget*>(this)->AsWeakPtr(),
1670 intent, expected_content_intent_id, is_main_frame),
1671 base::TimeDelta::FromMilliseconds(kContentIntentDelayMilliseconds));
1672 }
1630 #endif 1673 #endif
1631 1674
1632 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, 1675 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request,
1633 bool monitor_request) { 1676 bool monitor_request) {
1634 monitor_composition_info_ = monitor_request; 1677 monitor_composition_info_ = monitor_request;
1635 if (!immediate_request) 1678 if (!immediate_request)
1636 return; 1679 return;
1637 UpdateCompositionInfo(true /* immediate request */); 1680 UpdateCompositionInfo(true /* immediate request */);
1638 } 1681 }
1639 1682
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 bool RenderWidget::isPointerLocked() { 2132 bool RenderWidget::isPointerLocked() {
2090 return mouse_lock_dispatcher_->IsMouseLockedTo( 2133 return mouse_lock_dispatcher_->IsMouseLockedTo(
2091 webwidget_mouse_lock_target_.get()); 2134 webwidget_mouse_lock_target_.get());
2092 } 2135 }
2093 2136
2094 blink::WebWidget* RenderWidget::GetWebWidget() const { 2137 blink::WebWidget* RenderWidget::GetWebWidget() const {
2095 return webwidget_internal_; 2138 return webwidget_internal_;
2096 } 2139 }
2097 2140
2098 } // namespace content 2141 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | third_party/WebKit/Source/core/frame/EventHandlerRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698