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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 OnEnabledChanged(); | 431 OnEnabledChanged(); |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 void View::OnEnabledChanged() { | 435 void View::OnEnabledChanged() { |
436 SchedulePaint(); | 436 SchedulePaint(); |
437 } | 437 } |
438 | 438 |
439 // Transformations ------------------------------------------------------------- | 439 // Transformations ------------------------------------------------------------- |
440 | 440 |
441 const gfx::Transform& View::GetTransform() const { | 441 gfx::Transform View::GetTransform() const { |
442 static const gfx::Transform* no_op = new gfx::Transform; | 442 return layer() ? layer()->transform() : gfx::Transform(); |
443 return layer() ? layer()->transform() : *no_op; | |
444 } | 443 } |
445 | 444 |
446 void View::SetTransform(const gfx::Transform& transform) { | 445 void View::SetTransform(const gfx::Transform& transform) { |
447 if (transform.IsIdentity()) { | 446 if (transform.IsIdentity()) { |
448 if (layer()) { | 447 if (layer()) { |
449 layer()->SetTransform(transform); | 448 layer()->SetTransform(transform); |
450 if (!paint_to_layer_) | 449 if (!paint_to_layer_) |
451 DestroyLayer(); | 450 DestroyLayer(); |
452 } else { | 451 } else { |
453 // Nothing. | 452 // Nothing. |
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 ConvertPointToWidget(this, &widget_location); | 2161 ConvertPointToWidget(this, &widget_location); |
2163 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, | 2162 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, |
2164 source); | 2163 source); |
2165 return true; | 2164 return true; |
2166 #else | 2165 #else |
2167 return false; | 2166 return false; |
2168 #endif // !defined(OS_MACOSX) | 2167 #endif // !defined(OS_MACOSX) |
2169 } | 2168 } |
2170 | 2169 |
2171 } // namespace views | 2170 } // namespace views |
OLD | NEW |