| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 for (View* v = this; v; v = v->parent_) | 230 for (View* v = this; v; v = v->parent_) |
| 231 v->ViewHierarchyChangedImpl(false, details); | 231 v->ViewHierarchyChangedImpl(false, details); |
| 232 | 232 |
| 233 view->PropagateAddNotifications(details); | 233 view->PropagateAddNotifications(details); |
| 234 UpdateTooltip(); | 234 UpdateTooltip(); |
| 235 views::Widget* widget = GetWidget(); | 235 views::Widget* widget = GetWidget(); |
| 236 if (widget) { | 236 if (widget) { |
| 237 RegisterChildrenForVisibleBoundsNotification(view); | 237 RegisterChildrenForVisibleBoundsNotification(view); |
| 238 const ui::NativeTheme* new_theme = widget->GetNativeTheme(); | 238 const ui::NativeTheme* new_theme = widget->GetNativeTheme(); |
| 239 if (new_theme != old_theme) | 239 if (new_theme != old_theme) |
| 240 PropagateNativeThemeChanged(new_theme); | 240 view->PropagateNativeThemeChanged(new_theme); |
| 241 if (view->visible()) | 241 if (view->visible()) |
| 242 view->SchedulePaint(); | 242 view->SchedulePaint(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 if (layout_manager_.get()) | 245 if (layout_manager_.get()) |
| 246 layout_manager_->ViewAdded(this, view); | 246 layout_manager_->ViewAdded(this, view); |
| 247 | 247 |
| 248 ReorderLayers(); | 248 ReorderLayers(); |
| 249 | 249 |
| 250 // Make sure the visibility of the child layers are correct. | 250 // Make sure the visibility of the child layers are correct. |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 void View::WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) { | 1609 void View::WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) { |
| 1610 DCHECK(drag_controller_); | 1610 DCHECK(drag_controller_); |
| 1611 drag_controller_->WriteDragDataForView(this, press_pt, data); | 1611 drag_controller_->WriteDragDataForView(this, press_pt, data); |
| 1612 } | 1612 } |
| 1613 | 1613 |
| 1614 bool View::InDrag() { | 1614 bool View::InDrag() { |
| 1615 Widget* widget = GetWidget(); | 1615 Widget* widget = GetWidget(); |
| 1616 return widget ? widget->dragged_view() == this : false; | 1616 return widget ? widget->dragged_view() == this : false; |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 // NativeTheme ----------------------------------------------------------------- |
| 1620 |
| 1621 void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) { |
| 1622 for (int i = 0, count = child_count(); i < count; ++i) |
| 1623 child_at(i)->PropagateNativeThemeChanged(theme); |
| 1624 OnNativeThemeChanged(theme); |
| 1625 } |
| 1626 |
| 1619 // Debugging ------------------------------------------------------------------- | 1627 // Debugging ------------------------------------------------------------------- |
| 1620 | 1628 |
| 1621 #if !defined(NDEBUG) | 1629 #if !defined(NDEBUG) |
| 1622 | 1630 |
| 1623 std::string View::PrintViewGraph(bool first) { | 1631 std::string View::PrintViewGraph(bool first) { |
| 1624 return DoPrintViewGraph(first, this); | 1632 return DoPrintViewGraph(first, this); |
| 1625 } | 1633 } |
| 1626 | 1634 |
| 1627 std::string View::DoPrintViewGraph(bool first, View* view_with_children) { | 1635 std::string View::DoPrintViewGraph(bool first, View* view_with_children) { |
| 1628 // 64-bit pointer = 16 bytes of hex + "0x" + '\0' = 19. | 1636 // 64-bit pointer = 16 bytes of hex + "0x" + '\0' = 19. |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1873 OrphanLayers(); | 1881 OrphanLayers(); |
| 1874 Widget* widget = GetWidget(); | 1882 Widget* widget = GetWidget(); |
| 1875 if (widget) | 1883 if (widget) |
| 1876 widget->UpdateRootLayers(); | 1884 widget->UpdateRootLayers(); |
| 1877 } | 1885 } |
| 1878 | 1886 |
| 1879 ViewHierarchyChanged(details); | 1887 ViewHierarchyChanged(details); |
| 1880 details.parent->needs_layout_ = true; | 1888 details.parent->needs_layout_ = true; |
| 1881 } | 1889 } |
| 1882 | 1890 |
| 1883 void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) { | |
| 1884 for (int i = 0, count = child_count(); i < count; ++i) | |
| 1885 child_at(i)->PropagateNativeThemeChanged(theme); | |
| 1886 OnNativeThemeChanged(theme); | |
| 1887 } | |
| 1888 | |
| 1889 // Size and disposition -------------------------------------------------------- | 1891 // Size and disposition -------------------------------------------------------- |
| 1890 | 1892 |
| 1891 void View::PropagateVisibilityNotifications(View* start, bool is_visible) { | 1893 void View::PropagateVisibilityNotifications(View* start, bool is_visible) { |
| 1892 for (int i = 0, count = child_count(); i < count; ++i) | 1894 for (int i = 0, count = child_count(); i < count; ++i) |
| 1893 child_at(i)->PropagateVisibilityNotifications(start, is_visible); | 1895 child_at(i)->PropagateVisibilityNotifications(start, is_visible); |
| 1894 VisibilityChangedImpl(start, is_visible); | 1896 VisibilityChangedImpl(start, is_visible); |
| 1895 } | 1897 } |
| 1896 | 1898 |
| 1897 void View::VisibilityChangedImpl(View* starting_from, bool is_visible) { | 1899 void View::VisibilityChangedImpl(View* starting_from, bool is_visible) { |
| 1898 VisibilityChanged(starting_from, is_visible); | 1900 VisibilityChanged(starting_from, is_visible); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 // Message the RootView to do the drag and drop. That way if we're removed | 2367 // Message the RootView to do the drag and drop. That way if we're removed |
| 2366 // the RootView can detect it and avoid calling us back. | 2368 // the RootView can detect it and avoid calling us back. |
| 2367 gfx::Point widget_location(event.location()); | 2369 gfx::Point widget_location(event.location()); |
| 2368 ConvertPointToWidget(this, &widget_location); | 2370 ConvertPointToWidget(this, &widget_location); |
| 2369 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2371 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2370 // WARNING: we may have been deleted. | 2372 // WARNING: we may have been deleted. |
| 2371 return true; | 2373 return true; |
| 2372 } | 2374 } |
| 2373 | 2375 |
| 2374 } // namespace views | 2376 } // namespace views |
| OLD | NEW |