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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 11293194: ui: Prefer +/- operators to apply offsets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 4739e9aa36a162bddbfe77b07101393800564c1c..dad0c9684ddbf0e7c3c5b291d0ea48f8c295defd 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -102,16 +102,15 @@ gfx::RectF PinchZoomViewport::bounds() const
{
gfx::RectF bounds(gfx::PointF(), m_layoutViewportSize);
bounds.Scale(1 / totalPageScaleFactor());
- bounds.Offset(m_pinchViewportScrollDelta);
+ bounds += m_pinchViewportScrollDelta;
return bounds;
}
gfx::Vector2dF PinchZoomViewport::applyScroll(const gfx::Vector2dF& delta)
{
gfx::Vector2dF overflow;
- gfx::RectF pinchedBounds = bounds();
+ gfx::RectF pinchedBounds = bounds() + delta;
- pinchedBounds.Offset(delta);
if (pinchedBounds.x() < 0) {
overflow.set_x(pinchedBounds.x());
pinchedBounds.set_x(0);
@@ -124,12 +123,12 @@ gfx::Vector2dF PinchZoomViewport::applyScroll(const gfx::Vector2dF& delta)
if (pinchedBounds.right() > m_layoutViewportSize.width()) {
overflow.set_x(pinchedBounds.right() - m_layoutViewportSize.width());
- pinchedBounds.Offset(m_layoutViewportSize.width() - pinchedBounds.right(), 0);
+ pinchedBounds += gfx::Vector2d(m_layoutViewportSize.width() - pinchedBounds.right(), 0);
}
if (pinchedBounds.bottom() > m_layoutViewportSize.height()) {
overflow.set_y(pinchedBounds.bottom() - m_layoutViewportSize.height());
- pinchedBounds.Offset(0, m_layoutViewportSize.height() - pinchedBounds.bottom());
+ pinchedBounds += gfx::Vector2d(0, m_layoutViewportSize.height() - pinchedBounds.bottom());
}
m_pinchViewportScrollDelta = pinchedBounds.OffsetFromOrigin();
« no previous file with comments | « cc/layer_tree_host_common_unittest.cc ('k') | cc/math_util.cc » ('j') | ui/gfx/rect_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698