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

Unified Diff: cc/layers/layer_impl.cc

Issue 641873003: Made top controls work with virtual viewport pinch-to-zoom. (Chromium) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added warning in comment about lossy bounds. Created 6 years, 2 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/layers/layer_impl.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 6dfec0e7d71c2069e3666f34d1371dbd275128fc..35b88ec94c4e1406644a6f6c0c2c7d141f3c2b89 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -771,10 +771,15 @@ bool LayerImpl::IsActive() const {
return layer_tree_impl_->IsActiveTree();
}
-// TODO(aelias): Convert so that bounds returns SizeF.
gfx::Size LayerImpl::bounds() const {
- return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(),
- bounds_.height() + bounds_delta_.y()));
+ gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_);
+ return gfx::Size(bounds_.width() + delta.x(),
+ bounds_.height() + delta.y());
+}
+
+gfx::SizeF LayerImpl::BoundsForScrolling() const {
+ return gfx::SizeF(bounds_.width() + bounds_delta_.x(),
+ bounds_.height() + bounds_delta_.y());
}
void LayerImpl::SetBounds(const gfx::Size& bounds) {
@@ -1170,7 +1175,7 @@ gfx::ScrollOffset LayerImpl::MaxScrollOffset() const {
DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() ||
IsContainerForFixedPositionLayers());
- gfx::SizeF scaled_scroll_bounds(bounds());
+ gfx::SizeF scaled_scroll_bounds(BoundsForScrolling());
float scale_factor = 1.f;
for (LayerImpl const* current_layer = this;
@@ -1238,11 +1243,12 @@ void LayerImpl::SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
DCHECK(scrollbar_clip_layer);
DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() ||
IsContainerForFixedPositionLayers());
- gfx::RectF clip_rect(gfx::PointF(), scrollbar_clip_layer->bounds());
+ gfx::RectF clip_rect(gfx::PointF(),
+ scrollbar_clip_layer->BoundsForScrolling());
// See comment in MaxScrollOffset() regarding the use of the content layer
// bounds here.
- gfx::RectF scroll_rect(gfx::PointF(), bounds());
+ gfx::RectF scroll_rect(gfx::PointF(), BoundsForScrolling());
if (scroll_rect.size().IsEmpty())
return;
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698