Chromium Code Reviews

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1013753014: Re-introduce ScrollY trace event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revise trace category and comment. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 1304 matching lines...)
1315 if (scrollbar_layer->orientation() == HORIZONTAL) { 1315 if (scrollbar_layer->orientation() == HORIZONTAL) {
1316 float visible_ratio = clip_rect.width() / scroll_rect.width(); 1316 float visible_ratio = clip_rect.width() / scroll_rect.width();
1317 scrollbar_needs_animation |= 1317 scrollbar_needs_animation |=
1318 scrollbar_layer->SetCurrentPos(current_offset.x()); 1318 scrollbar_layer->SetCurrentPos(current_offset.x());
1319 scrollbar_needs_animation |= 1319 scrollbar_needs_animation |=
1320 scrollbar_layer->SetMaximum(scroll_rect.width() - clip_rect.width()); 1320 scrollbar_layer->SetMaximum(scroll_rect.width() - clip_rect.width());
1321 scrollbar_needs_animation |= 1321 scrollbar_needs_animation |=
1322 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); 1322 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
1323 } else { 1323 } else {
1324 float visible_ratio = clip_rect.height() / scroll_rect.height(); 1324 float visible_ratio = clip_rect.height() / scroll_rect.height();
1325 scrollbar_needs_animation |= 1325 bool y_offset_did_change =
1326 scrollbar_layer->SetCurrentPos(current_offset.y()); 1326 scrollbar_layer->SetCurrentPos(current_offset.y());
1327 scrollbar_needs_animation |= y_offset_did_change;
1327 scrollbar_needs_animation |= 1328 scrollbar_needs_animation |=
1328 scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height()); 1329 scrollbar_layer->SetMaximum(scroll_rect.height() - clip_rect.height());
1329 scrollbar_needs_animation |= 1330 scrollbar_needs_animation |=
1330 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio); 1331 scrollbar_layer->SetVisibleToTotalLengthRatio(visible_ratio);
1332 // Record the current_offset.y() value so we can make sure
1333 // BasicMouseWheelSmoothScrollGesture has proper scroll curves.
enne (OOO) 2015/03/25 17:21:33 What is BasicMouseWheelSmoothScrollGesture? I can'
wjmaclean 2015/03/25 20:30:32 Revised the comment to reflect the rationale given
1334 if (y_offset_did_change && layer_tree_impl()->IsActiveTree())
wjmaclean 2015/03/25 20:30:32 Will limit this to the InnerViewportScrollLayer()
1335 TRACE_EVENT1("cc", "scroll_offset_y", this->id(), current_offset.y());
1331 } 1336 }
1332 if (scrollbar_needs_animation) { 1337 if (scrollbar_needs_animation) {
1333 layer_tree_impl()->set_needs_update_draw_properties(); 1338 layer_tree_impl()->set_needs_update_draw_properties();
1334 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars 1339 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars
1335 // should activate for every scroll on the main frame, not just the 1340 // should activate for every scroll on the main frame, not just the
1336 // scrolls that move the pinch virtual viewport (i.e. trigger from 1341 // scrolls that move the pinch virtual viewport (i.e. trigger from
1337 // either inner or outer viewport). 1342 // either inner or outer viewport).
1338 if (scrollbar_animation_controller_) { 1343 if (scrollbar_animation_controller_) {
1339 // Non-overlay scrollbars shouldn't trigger animations. 1344 // Non-overlay scrollbars shouldn't trigger animations.
1340 if (scrollbar_layer->is_overlay_scrollbar()) 1345 if (scrollbar_layer->is_overlay_scrollbar())
(...skipping 277 matching lines...)
1618 gfx::Transform scaled_draw_transform = 1623 gfx::Transform scaled_draw_transform =
1619 draw_properties_.target_space_transform; 1624 draw_properties_.target_space_transform;
1620 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); 1625 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale);
1621 gfx::Size scaled_content_bounds = 1626 gfx::Size scaled_content_bounds =
1622 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); 1627 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale));
1623 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, 1628 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform,
1624 gfx::Rect(scaled_content_bounds)); 1629 gfx::Rect(scaled_content_bounds));
1625 } 1630 }
1626 1631
1627 } // namespace cc 1632 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine