Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: ui/views/view.cc

Issue 2230913003: Experimental alignment layout manager using a property on the views Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed AlignAttribute and associated types to FillAttribute Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // Creation and lifetime ------------------------------------------------------- 99 // Creation and lifetime -------------------------------------------------------
100 100
101 View::View() 101 View::View()
102 : owned_by_client_(false), 102 : owned_by_client_(false),
103 id_(0), 103 id_(0),
104 group_(-1), 104 group_(-1),
105 parent_(NULL), 105 parent_(NULL),
106 visible_(true), 106 visible_(true),
107 enabled_(true), 107 enabled_(true),
108 attributes_(this),
108 notify_enter_exit_on_child_(false), 109 notify_enter_exit_on_child_(false),
109 registered_for_visible_bounds_notification_(false), 110 registered_for_visible_bounds_notification_(false),
110 needs_layout_(true), 111 needs_layout_(true),
111 snap_layer_to_pixel_boundary_(false), 112 snap_layer_to_pixel_boundary_(false),
112 flip_canvas_on_paint_for_rtl_ui_(false), 113 flip_canvas_on_paint_for_rtl_ui_(false),
113 paint_to_layer_(false), 114 paint_to_layer_(false),
114 accelerator_focus_manager_(NULL), 115 accelerator_focus_manager_(NULL),
115 registered_accelerator_count_(0), 116 registered_accelerator_count_(0),
116 next_focusable_view_(NULL), 117 next_focusable_view_(NULL),
117 previous_focusable_view_(NULL), 118 previous_focusable_view_(NULL),
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 ViewHierarchyChangedDetails details(false, old_parent, this, new_parent); 1852 ViewHierarchyChangedDetails details(false, old_parent, this, new_parent);
1852 for (View* v = this; v; v = v->parent_) 1853 for (View* v = this; v; v = v->parent_)
1853 v->ViewHierarchyChangedImpl(true, details); 1854 v->ViewHierarchyChangedImpl(true, details);
1854 } 1855 }
1855 1856
1856 void View::PropagateAddNotifications( 1857 void View::PropagateAddNotifications(
1857 const ViewHierarchyChangedDetails& details) { 1858 const ViewHierarchyChangedDetails& details) {
1858 for (int i = 0, count = child_count(); i < count; ++i) 1859 for (int i = 0, count = child_count(); i < count; ++i)
1859 child_at(i)->PropagateAddNotifications(details); 1860 child_at(i)->PropagateAddNotifications(details);
1860 ViewHierarchyChangedImpl(true, details); 1861 ViewHierarchyChangedImpl(true, details);
1862 attributes_.ViewNotification(this);
1861 } 1863 }
1862 1864
1863 void View::PropagateNativeViewHierarchyChanged() { 1865 void View::PropagateNativeViewHierarchyChanged() {
1864 for (int i = 0, count = child_count(); i < count; ++i) 1866 for (int i = 0, count = child_count(); i < count; ++i)
1865 child_at(i)->PropagateNativeViewHierarchyChanged(); 1867 child_at(i)->PropagateNativeViewHierarchyChanged();
1866 NativeViewHierarchyChanged(); 1868 NativeViewHierarchyChanged();
1867 } 1869 }
1868 1870
1869 void View::ViewHierarchyChangedImpl( 1871 void View::ViewHierarchyChangedImpl(
1870 bool register_accelerators, 1872 bool register_accelerators,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 OnVisibleBoundsChanged(); 1949 OnVisibleBoundsChanged();
1948 1950
1949 // Notify interested Views that visible bounds within the root view may have 1951 // Notify interested Views that visible bounds within the root view may have
1950 // changed. 1952 // changed.
1951 if (descendants_to_notify_.get()) { 1953 if (descendants_to_notify_.get()) {
1952 for (Views::iterator i(descendants_to_notify_->begin()); 1954 for (Views::iterator i(descendants_to_notify_->begin());
1953 i != descendants_to_notify_->end(); ++i) { 1955 i != descendants_to_notify_->end(); ++i) {
1954 (*i)->OnVisibleBoundsChanged(); 1956 (*i)->OnVisibleBoundsChanged();
1955 } 1957 }
1956 } 1958 }
1959 attributes_.ViewNotification(this);
1957 } 1960 }
1958 1961
1959 // static 1962 // static
1960 void View::RegisterChildrenForVisibleBoundsNotification(View* view) { 1963 void View::RegisterChildrenForVisibleBoundsNotification(View* view) {
1961 if (view->GetNeedsNotificationWhenVisibleBoundsChange()) 1964 if (view->GetNeedsNotificationWhenVisibleBoundsChange())
1962 view->RegisterForVisibleBoundsNotification(); 1965 view->RegisterForVisibleBoundsNotification();
1963 for (int i = 0; i < view->child_count(); ++i) 1966 for (int i = 0; i < view->child_count(); ++i)
1964 RegisterChildrenForVisibleBoundsNotification(view->child_at(i)); 1967 RegisterChildrenForVisibleBoundsNotification(view->child_at(i));
1965 } 1968 }
1966 1969
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
2418 // Message the RootView to do the drag and drop. That way if we're removed 2421 // Message the RootView to do the drag and drop. That way if we're removed
2419 // the RootView can detect it and avoid calling us back. 2422 // the RootView can detect it and avoid calling us back.
2420 gfx::Point widget_location(event.location()); 2423 gfx::Point widget_location(event.location());
2421 ConvertPointToWidget(this, &widget_location); 2424 ConvertPointToWidget(this, &widget_location);
2422 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2425 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2423 // WARNING: we may have been deleted. 2426 // WARNING: we may have been deleted.
2424 return true; 2427 return true;
2425 } 2428 }
2426 2429
2427 } // namespace views 2430 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698