OLD | NEW |
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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 OnEnabledChanged(); | 487 OnEnabledChanged(); |
488 } | 488 } |
489 } | 489 } |
490 | 490 |
491 void View::OnEnabledChanged() { | 491 void View::OnEnabledChanged() { |
492 SchedulePaint(); | 492 SchedulePaint(); |
493 } | 493 } |
494 | 494 |
495 // Transformations ------------------------------------------------------------- | 495 // Transformations ------------------------------------------------------------- |
496 | 496 |
497 const gfx::Transform& View::GetTransform() const { | 497 gfx::Transform View::GetTransform() const { |
498 static const gfx::Transform* no_op = new gfx::Transform; | 498 return layer() ? layer()->transform() : gfx::Transform(); |
499 return layer() ? layer()->transform() : *no_op; | |
500 } | 499 } |
501 | 500 |
502 void View::SetTransform(const gfx::Transform& transform) { | 501 void View::SetTransform(const gfx::Transform& transform) { |
503 if (transform.IsIdentity()) { | 502 if (transform.IsIdentity()) { |
504 if (layer()) { | 503 if (layer()) { |
505 layer()->SetTransform(transform); | 504 layer()->SetTransform(transform); |
506 if (!paint_to_layer_) | 505 if (!paint_to_layer_) |
507 DestroyLayer(); | 506 DestroyLayer(); |
508 } else { | 507 } else { |
509 // Nothing. | 508 // Nothing. |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 ConvertPointToWidget(this, &widget_location); | 2229 ConvertPointToWidget(this, &widget_location); |
2231 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, | 2230 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, |
2232 source); | 2231 source); |
2233 return true; | 2232 return true; |
2234 #else | 2233 #else |
2235 return false; | 2234 return false; |
2236 #endif // !defined(OS_MACOSX) | 2235 #endif // !defined(OS_MACOSX) |
2237 } | 2236 } |
2238 | 2237 |
2239 } // namespace views | 2238 } // namespace views |
OLD | NEW |