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

Side by Side Diff: ui/views/view.cc

Issue 2188133002: Scroll with Layers in views::ScrollView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollTrack
Patch Set: bugref, scale_delta DCHECK + comment Created 4 years, 4 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 | « ui/views/controls/scroll_view_unittest.cc ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 } 441 }
442 442
443 void View::OnEnabledChanged() { 443 void View::OnEnabledChanged() {
444 SchedulePaint(); 444 SchedulePaint();
445 } 445 }
446 446
447 // Transformations ------------------------------------------------------------- 447 // Transformations -------------------------------------------------------------
448 448
449 gfx::Transform View::GetTransform() const { 449 gfx::Transform View::GetTransform() const {
450 return layer() ? layer()->transform() : gfx::Transform(); 450 if (!layer())
451 return gfx::Transform();
452
453 gfx::Transform transform = layer()->transform();
454 gfx::ScrollOffset scroll_offset = layer()->CurrentScrollOffset();
455 transform.Translate(-scroll_offset.x(), -scroll_offset.y());
456 return transform;
451 } 457 }
452 458
453 void View::SetTransform(const gfx::Transform& transform) { 459 void View::SetTransform(const gfx::Transform& transform) {
454 if (transform.IsIdentity()) { 460 if (transform.IsIdentity()) {
455 if (layer()) { 461 if (layer()) {
456 layer()->SetTransform(transform); 462 layer()->SetTransform(transform);
457 if (!paint_to_layer_) 463 if (!paint_to_layer_)
458 DestroyLayer(); 464 DestroyLayer();
459 } else { 465 } else {
460 // Nothing. 466 // Nothing.
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 // Message the RootView to do the drag and drop. That way if we're removed 2426 // Message the RootView to do the drag and drop. That way if we're removed
2421 // the RootView can detect it and avoid calling us back. 2427 // the RootView can detect it and avoid calling us back.
2422 gfx::Point widget_location(event.location()); 2428 gfx::Point widget_location(event.location());
2423 ConvertPointToWidget(this, &widget_location); 2429 ConvertPointToWidget(this, &widget_location);
2424 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2430 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2425 // WARNING: we may have been deleted. 2431 // WARNING: we may have been deleted.
2426 return true; 2432 return true;
2427 } 2433 }
2428 2434
2429 } // namespace views 2435 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scroll_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698