summaryrefslogtreecommitdiffstats
path: root/cc/pinch_zoom_viewport.cc
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-21 07:54:54 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-21 07:54:54 +0000
commit42ccdbef1f431fd79495854618527c21cd6c2085 (patch)
treef0848fac7905db6982e5a9a848c00e90e8f24436 /cc/pinch_zoom_viewport.cc
parent1b4b59eddc2daadbddf268c03179d2f23d7f4bdc (diff)
downloadchromium_src-42ccdbef1f431fd79495854618527c21cd6c2085.zip
chromium_src-42ccdbef1f431fd79495854618527c21cd6c2085.tar.gz
chromium_src-42ccdbef1f431fd79495854618527c21cd6c2085.tar.bz2
Make new-style page scale work on Android.
- Fix CC's PinchZoomViewport and MaxScrollOffset logic to work in fixed layout mode. Root layer max scroll offset is based on WebKit-perceived outer viewport and therefore should logically use layout_viewport_size_, whereas the inner one is the true user-visible viewport and therefore should use device_viewport_size_. - Fix Android to send down viewport size in DIP when --enable-css-transform-pinch is not specified. Default to non-CSS-transform mode when in impl-side painting. - Make ContentSize() return bounds() instead of contentBounds() and rename to ScrollableSize for clarity. This lets us avoid coordinate space conversions when computing max scroll offset. BUG=152505 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11958004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177896 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/pinch_zoom_viewport.cc')
-rw-r--r--cc/pinch_zoom_viewport.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/cc/pinch_zoom_viewport.cc b/cc/pinch_zoom_viewport.cc
index dab6c9c..3f3e3a1 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());