| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 return; | 461 return; |
| 462 | 462 |
| 463 paint_to_layer_ = paint_to_layer; | 463 paint_to_layer_ = paint_to_layer; |
| 464 if (paint_to_layer_ && !layer()) { | 464 if (paint_to_layer_ && !layer()) { |
| 465 CreateLayer(); | 465 CreateLayer(); |
| 466 } else if (!paint_to_layer_ && layer()) { | 466 } else if (!paint_to_layer_ && layer()) { |
| 467 DestroyLayer(); | 467 DestroyLayer(); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 | 470 |
| 471 scoped_ptr<ui::Layer> View::RecreateLayer() { |
| 472 scoped_ptr<ui::Layer> old_layer = LayerOwner::RecreateLayer(); |
| 473 Widget* widget = GetWidget(); |
| 474 if (widget) |
| 475 widget->UpdateRootLayers(); |
| 476 return old_layer.Pass(); |
| 477 } |
| 478 |
| 471 // RTL positioning ------------------------------------------------------------- | 479 // RTL positioning ------------------------------------------------------------- |
| 472 | 480 |
| 473 gfx::Rect View::GetMirroredBounds() const { | 481 gfx::Rect View::GetMirroredBounds() const { |
| 474 gfx::Rect bounds(bounds_); | 482 gfx::Rect bounds(bounds_); |
| 475 bounds.set_x(GetMirroredX()); | 483 bounds.set_x(GetMirroredX()); |
| 476 return bounds; | 484 return bounds; |
| 477 } | 485 } |
| 478 | 486 |
| 479 gfx::Point View::GetMirroredPosition() const { | 487 gfx::Point View::GetMirroredPosition() const { |
| 480 return gfx::Point(GetMirroredX(), y()); | 488 return gfx::Point(GetMirroredX(), y()); |
| (...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 // Message the RootView to do the drag and drop. That way if we're removed | 2379 // Message the RootView to do the drag and drop. That way if we're removed |
| 2372 // the RootView can detect it and avoid calling us back. | 2380 // the RootView can detect it and avoid calling us back. |
| 2373 gfx::Point widget_location(event.location()); | 2381 gfx::Point widget_location(event.location()); |
| 2374 ConvertPointToWidget(this, &widget_location); | 2382 ConvertPointToWidget(this, &widget_location); |
| 2375 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2383 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2376 // WARNING: we may have been deleted. | 2384 // WARNING: we may have been deleted. |
| 2377 return true; | 2385 return true; |
| 2378 } | 2386 } |
| 2379 | 2387 |
| 2380 } // namespace views | 2388 } // namespace views |
| OLD | NEW |