Index: cc/layers/picture_layer_impl.cc |
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
index 0849c516bab58e63b183c957eb877e748f85187a..732b822aa8b78486622b95429e3d29e35c7b14cd 100644 |
--- a/cc/layers/picture_layer_impl.cc |
+++ b/cc/layers/picture_layer_impl.cc |
@@ -69,6 +69,7 @@ |
raster_source_scale_(0.f), |
raster_contents_scale_(0.f), |
low_res_raster_contents_scale_(0.f), |
+ raster_source_scale_is_fixed_(false), |
was_screen_space_transform_animating_(false), |
only_used_low_res_last_append_quads_(false), |
is_mask_(is_mask), |
@@ -889,8 +890,10 @@ |
if (raster_device_scale_ != ideal_device_scale_) |
return true; |
- // When the source scale changes we want to match it, but not when animating. |
+ // When the source scale changes we want to match it, but not when animating |
+ // or when we've fixed the scale in place. |
if (!draw_properties().screen_space_transform_is_animating && |
+ !raster_source_scale_is_fixed_ && |
raster_source_scale_ != ideal_source_scale_) |
return true; |
@@ -931,13 +934,32 @@ |
} |
void PictureLayerImpl::RecalculateRasterScales() { |
- const float old_raster_contents_scale = raster_contents_scale_; |
- const float old_raster_page_scale = raster_page_scale_; |
+ float old_raster_contents_scale = raster_contents_scale_; |
+ float old_raster_page_scale = raster_page_scale_; |
+ float old_raster_source_scale = raster_source_scale_; |
raster_device_scale_ = ideal_device_scale_; |
raster_page_scale_ = ideal_page_scale_; |
raster_source_scale_ = ideal_source_scale_; |
raster_contents_scale_ = ideal_contents_scale_; |
+ |
+ // If we're not animating, or leaving an animation, and the |
+ // ideal_source_scale_ changes, then things are unpredictable, and we fix |
+ // the raster_source_scale_ in place. |
+ if (old_raster_source_scale && |
+ !draw_properties().screen_space_transform_is_animating && |
+ !was_screen_space_transform_animating_ && |
+ old_raster_source_scale != ideal_source_scale_) |
+ raster_source_scale_is_fixed_ = true; |
+ |
+ // TODO(danakj): Adjust raster source scale closer to ideal source scale at |
+ // a throttled rate. Possibly make use of invalidation_.IsEmpty() on pending |
+ // tree. This will allow CSS scale changes to get re-rastered at an |
+ // appropriate rate. (crbug.com/413636) |
+ if (raster_source_scale_is_fixed_) { |
+ raster_contents_scale_ /= raster_source_scale_; |
+ raster_source_scale_ = 1.f; |
+ } |
// During pinch we completely ignore the current ideal scale, and just use |
// a multiple of the previous scale. |
@@ -1107,6 +1129,7 @@ |
raster_source_scale_ = 0.f; |
raster_contents_scale_ = 0.f; |
low_res_raster_contents_scale_ = 0.f; |
+ raster_source_scale_is_fixed_ = false; |
} |
bool PictureLayerImpl::CanHaveTilings() const { |
@@ -1190,7 +1213,6 @@ |
base::trace_event::TracedValue* state) const { |
LayerImpl::AsValueInto(state); |
state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
- state->SetDouble("raster_contents_scale", raster_contents_scale_); |
state->SetDouble("geometry_contents_scale", MaximumTilingContentsScale()); |
state->BeginArray("tilings"); |
tilings_->AsValueInto(state); |