| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 561 |
| 562 void View::SetLayoutManager(LayoutManager* layout_manager) { | 562 void View::SetLayoutManager(LayoutManager* layout_manager) { |
| 563 if (layout_manager == layout_manager_.get()) | 563 if (layout_manager == layout_manager_.get()) |
| 564 return; | 564 return; |
| 565 | 565 |
| 566 layout_manager_.reset(layout_manager); | 566 layout_manager_.reset(layout_manager); |
| 567 if (layout_manager_) | 567 if (layout_manager_) |
| 568 layout_manager_->Installed(this); | 568 layout_manager_->Installed(this); |
| 569 } | 569 } |
| 570 | 570 |
| 571 static LayoutDelegate default_layout_delegate_; |
| 572 |
| 573 LayoutDelegate* View::GetLayoutDelegate() const { |
| 574 if (layout_delegate_) |
| 575 return layout_delegate_; |
| 576 if (!parent_) |
| 577 return &default_layout_delegate_; |
| 578 return parent_->GetLayoutDelegate(); |
| 579 } |
| 580 |
| 581 void View::SetLayoutDelegate(LayoutDelegate* delegate) { |
| 582 layout_delegate_ = delegate; |
| 583 } |
| 584 |
| 571 void View::SnapLayerToPixelBoundary() { | 585 void View::SnapLayerToPixelBoundary() { |
| 572 if (!layer()) | 586 if (!layer()) |
| 573 return; | 587 return; |
| 574 | 588 |
| 575 if (snap_layer_to_pixel_boundary_ && layer()->parent() && | 589 if (snap_layer_to_pixel_boundary_ && layer()->parent() && |
| 576 layer()->GetCompositor()) { | 590 layer()->GetCompositor()) { |
| 577 ui::SnapLayerToPhysicalPixelBoundary(layer()->parent(), layer()); | 591 ui::SnapLayerToPhysicalPixelBoundary(layer()->parent(), layer()); |
| 578 } else { | 592 } else { |
| 579 // Reset the offset. | 593 // Reset the offset. |
| 580 layer()->SetSubpixelPositionOffset(gfx::Vector2dF()); | 594 layer()->SetSubpixelPositionOffset(gfx::Vector2dF()); |
| (...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2422 // Message the RootView to do the drag and drop. That way if we're removed | 2436 // Message the RootView to do the drag and drop. That way if we're removed |
| 2423 // the RootView can detect it and avoid calling us back. | 2437 // the RootView can detect it and avoid calling us back. |
| 2424 gfx::Point widget_location(event.location()); | 2438 gfx::Point widget_location(event.location()); |
| 2425 ConvertPointToWidget(this, &widget_location); | 2439 ConvertPointToWidget(this, &widget_location); |
| 2426 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2440 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2427 // WARNING: we may have been deleted. | 2441 // WARNING: we may have been deleted. |
| 2428 return true; | 2442 return true; |
| 2429 } | 2443 } |
| 2430 | 2444 |
| 2431 } // namespace views | 2445 } // namespace views |
| OLD | NEW |