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

Unified Diff: cc/pinch_zoom_viewport.cc

Issue 11958004: Make new-style page scale work on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 177887 Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/pinch_zoom_viewport.h ('k') | content/browser/android/content_startup_flags.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/pinch_zoom_viewport.cc
diff --git a/cc/pinch_zoom_viewport.cc b/cc/pinch_zoom_viewport.cc
index dab6c9ca823cc57b18ef53eb3c503f41a5948813..3f3e3a1d0cbb752ae63bed9028b547af90347f97 100644
--- a/cc/pinch_zoom_viewport.cc
+++ b/cc/pinch_zoom_viewport.cc
@@ -50,16 +50,17 @@ bool PinchZoomViewport::SetPageScaleFactorAndLimits(
return true;
}
-gfx::RectF PinchZoomViewport::Bounds() const {
- gfx::RectF bounds(gfx::PointF(), layout_viewport_size_);
- bounds.Scale(1 / total_page_scale_factor());
- bounds += zoomed_viewport_offset_;
- return bounds;
+gfx::RectF PinchZoomViewport::ZoomedViewport() const {
+ gfx::SizeF layout_space_device_viewport_size = gfx::ScaleSize(
+ device_viewport_size_,
+ 1 / (device_scale_factor_ * total_page_scale_factor()));
+ return gfx::RectF(gfx::PointAtOffsetFromOrigin(zoomed_viewport_offset_),
+ layout_space_device_viewport_size);
}
gfx::Vector2dF PinchZoomViewport::ApplyScroll(const gfx::Vector2dF delta) {
gfx::Vector2dF overflow;
- gfx::RectF pinched_bounds = Bounds() + delta;
+ gfx::RectF pinched_bounds = ZoomedViewport() + delta;
if (pinched_bounds.x() < 0) {
overflow.set_x(pinched_bounds.x());
« no previous file with comments | « cc/pinch_zoom_viewport.h ('k') | content/browser/android/content_startup_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698