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

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: Limit trace to InnerViewportScrollLayer. Created 5 years, 9 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 unified diff | Download patch
« 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...) Expand 10 before | Expand all | Expand 10 after
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 evaluate scroll latency
enne (OOO) 2015/03/25 20:52:04 At this point, I think this comment doesn't add an
wjmaclean 2015/03/25 21:00:42 Removed. I thought the notion of measuring latenc
1333 // via traces.
1334 if (y_offset_did_change && layer_tree_impl()->IsActiveTree() &&
1335 this == layer_tree_impl()->InnerViewportScrollLayer()) {
1336 TRACE_COUNTER_ID1("cc", "scroll_offset_y", this->id(),
1337 current_offset.y());
1338 }
1331 } 1339 }
1332 if (scrollbar_needs_animation) { 1340 if (scrollbar_needs_animation) {
1333 layer_tree_impl()->set_needs_update_draw_properties(); 1341 layer_tree_impl()->set_needs_update_draw_properties();
1334 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars 1342 // TODO(wjmaclean) The scrollbar animator for the pinch-zoom scrollbars
1335 // should activate for every scroll on the main frame, not just the 1343 // should activate for every scroll on the main frame, not just the
1336 // scrolls that move the pinch virtual viewport (i.e. trigger from 1344 // scrolls that move the pinch virtual viewport (i.e. trigger from
1337 // either inner or outer viewport). 1345 // either inner or outer viewport).
1338 if (scrollbar_animation_controller_) { 1346 if (scrollbar_animation_controller_) {
1339 // Non-overlay scrollbars shouldn't trigger animations. 1347 // Non-overlay scrollbars shouldn't trigger animations.
1340 if (scrollbar_layer->is_overlay_scrollbar()) 1348 if (scrollbar_layer->is_overlay_scrollbar())
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 gfx::Transform scaled_draw_transform = 1626 gfx::Transform scaled_draw_transform =
1619 draw_properties_.target_space_transform; 1627 draw_properties_.target_space_transform;
1620 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); 1628 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale);
1621 gfx::Size scaled_content_bounds = 1629 gfx::Size scaled_content_bounds =
1622 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); 1630 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale));
1623 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, 1631 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform,
1624 gfx::Rect(scaled_content_bounds)); 1632 gfx::Rect(scaled_content_bounds));
1625 } 1633 }
1626 1634
1627 } // namespace cc 1635 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698