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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 281723010: Bundle DidOverscrollParams with the InputEventAck (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix browser tests Created 6 years, 7 months 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/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/android/sys_utils.h" 9 #include "base/android/sys_utils.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
211 211
212 bool RenderWidgetHostViewAndroid::OnMessageReceived( 212 bool RenderWidgetHostViewAndroid::OnMessageReceived(
213 const IPC::Message& message) { 213 const IPC::Message& message) {
214 bool handled = true; 214 bool handled = true;
215 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) 215 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message)
216 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) 216 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent)
217 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor, 217 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor,
218 OnDidChangeBodyBackgroundColor) 218 OnDidChangeBodyBackgroundColor)
219 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnDidOverscroll)
220 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrame, 219 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrame,
221 OnSetNeedsBeginFrame) 220 OnSetNeedsBeginFrame)
222 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 221 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
223 OnTextInputStateChanged) 222 OnTextInputStateChanged)
224 IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted, 223 IPC_MESSAGE_HANDLER(ViewHostMsg_SmartClipDataExtracted,
225 OnSmartClipDataExtracted) 224 OnSmartClipDataExtracted)
226 IPC_MESSAGE_UNHANDLED(handled = false) 225 IPC_MESSAGE_UNHANDLED(handled = false)
227 IPC_END_MESSAGE_MAP() 226 IPC_END_MESSAGE_MAP()
228 return handled; 227 return handled;
229 } 228 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 void RenderWidgetHostViewAndroid::OnDidChangeBodyBackgroundColor( 510 void RenderWidgetHostViewAndroid::OnDidChangeBodyBackgroundColor(
512 SkColor color) { 511 SkColor color) {
513 if (cached_background_color_ == color) 512 if (cached_background_color_ == color)
514 return; 513 return;
515 514
516 cached_background_color_ = color; 515 cached_background_color_ = color;
517 if (content_view_core_) 516 if (content_view_core_)
518 content_view_core_->OnBackgroundColorChanged(color); 517 content_view_core_->OnBackgroundColorChanged(color);
519 } 518 }
520 519
521 void RenderWidgetHostViewAndroid::OnDidOverscroll(
522 const DidOverscrollParams& params) {
523 if (!content_view_core_ || !layer_ || !is_showing_)
524 return;
525
526 const float device_scale_factor = content_view_core_->GetDpiScale();
527 if (overscroll_effect_->OnOverscrolled(
528 content_view_core_->GetLayer(),
529 base::TimeTicks::Now(),
530 gfx::ScaleVector2d(params.accumulated_overscroll,
531 device_scale_factor),
532 gfx::ScaleVector2d(params.latest_overscroll_delta,
533 device_scale_factor),
534 gfx::ScaleVector2d(params.current_fling_velocity,
535 device_scale_factor))) {
536 SetNeedsAnimate();
537 }
538 }
539
540 void RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame(bool enabled) { 520 void RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame(bool enabled) {
541 if (enabled == needs_begin_frame_) 521 if (enabled == needs_begin_frame_)
542 return; 522 return;
543 523
544 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame", 524 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::OnSetNeedsBeginFrame",
545 "enabled", enabled); 525 "enabled", enabled);
546 if (content_view_core_ && enabled) 526 if (content_view_core_ && enabled)
547 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); 527 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate();
548 528
549 needs_begin_frame_ = enabled; 529 needs_begin_frame_ = enabled;
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 1218
1239 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) { 1219 void RenderWidgetHostViewAndroid::MoveCaret(const gfx::Point& point) {
1240 if (host_) 1220 if (host_)
1241 host_->MoveCaret(point); 1221 host_->MoveCaret(point);
1242 } 1222 }
1243 1223
1244 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { 1224 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const {
1245 return cached_background_color_; 1225 return cached_background_color_;
1246 } 1226 }
1247 1227
1228 void RenderWidgetHostViewAndroid::DidOverscroll(
1229 const DidOverscrollParams& params) {
1230 if (!content_view_core_ || !layer_ || !is_showing_)
1231 return;
1232
1233 const float device_scale_factor = content_view_core_->GetDpiScale();
1234 if (overscroll_effect_->OnOverscrolled(
1235 content_view_core_->GetLayer(),
1236 base::TimeTicks::Now(),
1237 gfx::ScaleVector2d(params.accumulated_overscroll,
1238 device_scale_factor),
1239 gfx::ScaleVector2d(params.latest_overscroll_delta,
1240 device_scale_factor),
1241 gfx::ScaleVector2d(params.current_fling_velocity,
1242 device_scale_factor))) {
1243 SetNeedsAnimate();
1244 }
1245 }
1246
1248 void RenderWidgetHostViewAndroid::DidStopFlinging() { 1247 void RenderWidgetHostViewAndroid::DidStopFlinging() {
1249 if (content_view_core_) 1248 if (content_view_core_)
1250 content_view_core_->DidStopFlinging(); 1249 content_view_core_->DidStopFlinging();
1251 } 1250 }
1252 1251
1253 void RenderWidgetHostViewAndroid::SetContentViewCore( 1252 void RenderWidgetHostViewAndroid::SetContentViewCore(
1254 ContentViewCoreImpl* content_view_core) { 1253 ContentViewCoreImpl* content_view_core) {
1255 RemoveLayers(); 1254 RemoveLayers();
1256 if (observing_root_window_ && content_view_core_) { 1255 if (observing_root_window_ && content_view_core_) {
1257 content_view_core_->GetWindowAndroid()->RemoveObserver(this); 1256 content_view_core_->GetWindowAndroid()->RemoveObserver(this);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 results->availableRect = display.work_area(); 1454 results->availableRect = display.work_area();
1456 results->deviceScaleFactor = display.device_scale_factor(); 1455 results->deviceScaleFactor = display.device_scale_factor();
1457 results->orientationAngle = display.RotationAsDegree(); 1456 results->orientationAngle = display.RotationAsDegree();
1458 gfx::DeviceDisplayInfo info; 1457 gfx::DeviceDisplayInfo info;
1459 results->depth = info.GetBitsPerPixel(); 1458 results->depth = info.GetBitsPerPixel();
1460 results->depthPerComponent = info.GetBitsPerComponent(); 1459 results->depthPerComponent = info.GetBitsPerComponent();
1461 results->isMonochrome = (results->depthPerComponent == 0); 1460 results->isMonochrome = (results->depthPerComponent == 0);
1462 } 1461 }
1463 1462
1464 } // namespace content 1463 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698