Lines Matching refs:view
31 #include "ui/views/view.h"
49 // Convenience functions for walking a View tree.
50 const views::View* FirstView(const views::View* view) {
51 const views::View* v = view;
57 const views::View* NextView(const views::View* view) {
58 const views::View* v = view;
59 const views::View* parent = v->parent();
92 // Given the root nodes of a View tree and a Layer tree, makes sure the two
94 bool ViewAndLayerTreeAreConsistent(const views::View* view,
96 const views::View* v = FirstView(view);
99 // Find the view with a layer.
106 // Check if the View tree and the Layer tree are in sync.
111 // Check if the visibility states of the View and the Layer are in sync.
114 for (const views::View* vv = v; vv; vv = vv->parent())
122 // Check if the size of the View and the Layer are in sync.
127 if (v == view || l == layer)
128 return v == view && l == layer;
137 // Constructs a View tree with the specified depth.
138 void ConstructTree(views::View* view, int depth) {
143 views::View* v = new views::View;
144 view->AddChildView(v);
154 void ScrambleTree(views::View* view) {
155 int count = view->child_count();
159 ScrambleTree(view->child_at(i));
166 views::View* view_a = view->child_at(a);
167 views::View* view_b = view->child_at(b);
168 view->ReorderChildView(view_a, b);
169 view->ReorderChildView(view_b, a);
172 if (!view->layer() && base::RandDouble() < 0.1)
173 view->SetPaintToLayer(true);
176 view->SetVisible(!view->visible());
186 class TestView : public View {
189 : View(),
209 views::View::Focus();
213 views::View::Blur();
216 bool focusable() const { return View::focusable(); }
381 // Confirm that a view can be deleted as part of processing a mouse press.
397 View* root = widget->GetRootView();
422 View::SchedulePaintInRect(rect);
436 View* root_view = widget->GetRootView();
438 View* v1 = new View;
442 View* v11 = new View;
446 View* v111 = new View;
450 View* v112 = new View;
454 View* v113 = new View;
458 View* v1131 = new View;
462 View* v12 = new View;
467 View* v2 = new View;
471 View* v21 = new View;
475 View* v211 = new View;
482 // Try removing a leaf view.
488 // Now try removing a view with a hierarchy of depth 1.
507 // Synchronously closing the window deletes the view hierarchy, which should
537 // View::GetEventHandlerForRect(). See http://goo.gl/3Jp2BD for a description
543 View* root_view = widget->GetRootView();
547 // the root view's coordinate space):
601 // |touch_rect| does not intersect any descendant view of |root_view|.
603 View* result_view = root_view->GetEventHandlerForRect(touch_rect);
781 // so in this case the view selected is arbitrary (i.e.,
791 // the same center point, the child view should be selected.
798 // the touch is not located within either view. Since both views
799 // share the same center point, the child view should be selected.
832 // A mouse click |v5| and |v51| should target the child view.
839 // the child view.
849 // as expected when different views in the view hierarchy return false
855 View* root_view = widget->GetRootView();
859 // space of the root view):
892 View* result_view = root_view->GetEventHandlerForRect(rect_in_v_grandchild);
942 // of the root view (|v_grandchild| in this case), so use (1, 1).
1009 View* root_view = widget->GetRootView();
1145 View* root_view = widget->GetRootView();
1169 // Tests that the Textfield view respond appropiately to cut/copy/paste.
1182 View* root_view = widget->GetRootView();
1281 // Register a keyboard accelerator before the view is added to a window.
1283 TestView* view = new TestView();
1284 view->Reset();
1285 view->AddAccelerator(return_accelerator);
1286 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 0);
1288 // Create a window and add the view as its child.
1294 View* root = widget->GetRootView();
1295 root->AddChildView(view);
1304 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 1);
1309 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 1);
1310 EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 0);
1313 view->AddAccelerator(escape_accelerator);
1315 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 1);
1316 EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 1);
1319 view->RemoveAccelerator(return_accelerator);
1321 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 1);
1322 EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 1);
1325 view->AddAccelerator(return_accelerator);
1327 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 2);
1328 EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 1);
1330 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 2);
1331 EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 2);
1334 view->ResetAccelerators();
1336 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 2);
1337 EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 2);
1339 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 2);
1340 EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 2);
1347 TestView* view = new TestView();
1348 view->Reset();
1349 view->AddAccelerator(return_accelerator);
1350 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 0);
1357 View* root = widget->GetRootView();
1358 root->AddChildView(view);
1364 view->SetVisible(false);
1367 view->SetVisible(true);
1375 TestView* view = new TestView();
1376 view->Reset();
1377 view->AddAccelerator(return_accelerator);
1378 EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 0);
1385 View* root = widget->GetRootView();
1386 root->AddChildView(view);
1392 EXPECT_EQ(0, view->accelerator_count_map_[return_accelerator]);
1396 EXPECT_EQ(1, view->accelerator_count_map_[return_accelerator]);
1400 EXPECT_EQ(1, view->accelerator_count_map_[return_accelerator]);
1408 class ScrollableTestView : public View {
1421 class TestViewWithControls : public View {
1433 explicit SimpleWidgetDelegate(View* contents) : contents_(contents) { }
1437 virtual View* GetContentsView() { return contents_; }
1443 View* contents_;
1451 // - focused view is apparently reset across window activations and never
1474 // scroll-view).
1487 // Native view hierachy
1489 class ToplevelWidgetObserverView : public View {
1496 // View overrides:
1517 // Test that a view can track the current top level widget by overriding
1518 // View::ViewHierarchyChanged() and View::NativeViewHierarchyChanged().
1551 // Make |observer_view| |child|'s contents view again so that it gets deleted
1571 // Overridden from View:
1595 View* root = widget->GetRootView();
1633 View* root = widget->GetRootView();
1774 View* viewport = new View;
1776 View* contents = new View;
1781 View* child = new View;
1799 class VisibleBoundsView : public View {
1810 // Overridden from View:
1833 View* viewport = new View;
1835 View* contents = new View;
1840 // Create a view that cares about visible bounds notifications, and position
1913 TestView view;
1915 view.SetBoundsRect(gfx::Rect(0, 0, 100, 100));
1916 view.InvalidateLayout();
1917 view.scheduled_paint_rects_.clear();
1918 view.SetBoundsRect(gfx::Rect(0, 0, 100, 100));
1919 EXPECT_TRUE(view.scheduled_paint_rects_.empty());
1926 // We have to put the View hierarchy into a Widget or no paints will be
1940 View* child_view = new View;
1948 scoped_ptr<View> child_deleter(child_view);
1959 // View hierarchy used to test scale transforms.
1963 // View used to test a rotation transform.
2029 View::ConvertPointToTarget(child, &top_view, &point);
2034 View::ConvertRectToTarget(child, &top_view, &rect);
2041 View::ConvertPointToTarget(&top_view, child, &point);
2046 View::ConvertRectToTarget(&top_view, child, &rect);
2056 View::ConvertPointToTarget(child_child, &top_view, &point);
2061 View::ConvertRectToTarget(child_child, &top_view, &rect);
2068 View::ConvertPointToTarget(&top_view, child_child, &point);
2073 View::ConvertRectToTarget(&top_view, child_child, &rect);
2083 View::ConvertPointToTarget(child_child, child, &point);
2088 View::ConvertRectToTarget(child_child, child, &rect);
2095 View::ConvertPointToTarget(child, child_child, &point);
2100 View::ConvertRectToTarget(child, child_child, &rect);
2111 View::ConvertPointToTarget(&top_view, child, &point);
2117 View::ConvertRectToTarget(&top_view, child, &rect);
2127 View::ConvertRectToTarget(child_2, &top_view, &rect);
2134 View::ConvertRectToTarget(&top_view, child_2, &rect);
2150 View* child = new View;
2161 View::ConvertPointFromScreen(child, &point);
2164 View::ConvertPointToScreen(child, &point);
2175 View* root = widget->GetRootView();
2215 class ObserverView : public View {
2234 // View:
2272 // a child view is added or removed to all the views in the hierarchy (up and
2309 // Verifies that |v2| is the child view *added* and the parent view is |v1|.
2337 // Verifies that |v2| is the child view *removed* and the parent view is |v1|.
2357 // Verifies notifications when reparenting a view.
2417 View root;
2419 View* child1 = new View;
2423 root.AddChildView(new View);
2425 View* foo = new View;
2430 foo->AddChildView(new View);
2444 View v1;
2445 View* v2 = new View;
2446 View* v3 = new View;
2468 // view.
2475 View root;
2477 View* child1 = new View;
2480 View* child2 = new View;
2483 View* foo1 = new View;
2507 View root;
2509 View* child = new View();
2512 View* foo1 = new View();
2514 View* foo2 = new View();
2516 View* foo3 = new View();
2559 // Verifies that GetViewByID returns the correctly child view from the specified
2567 View v1;
2571 View v2;
2575 View v3;
2579 View v4;
2600 View::Views views;
2604 View::Views::const_iterator i(std::find(views.begin(), views.end(), &v3));
2612 View v1, v2, v3;
2670 View* view1 = new View();
2673 View* view2 = new View();
2683 // Disable the focused view and check if the next view gets focused.
2692 // Hide the focused view and check it the next view gets focused.
2701 // Set the focused view as not focusable and check if the next view gets
2780 View* content_view = new View;
2784 View* v1 = new View;
2794 View* v2 = new View;
2811 // The bounds of the layer should have changed to be relative to the root view
2832 View* content_view = new View;
2836 View* v1 = new View;
2840 View* v2 = new View;
2843 View* v3 = new View;
2855 View* content_view = new View;
2858 View* v1 = new View;
2876 View* content_view = new View;
2879 View* v1 = new View;
2883 View* v2 = new View;
2896 // Bounds of the layer should change even if the view is not invisible.
2911 View* view = new View;
2912 widget()->SetContentsView(view);
2914 int content_width = view->width();
2917 // bounds as the view.
2918 View* v1 = new View;
2926 view->AddChildView(v1);
2931 // Now attach a View to the widget first, then create a layer for it. Make
2933 View* v2 = new View;
2936 view->AddChildView(v2);
2942 view->SetPaintToLayer(true);
2952 view->SetPaintToLayer(false);
2956 // Move a view again.
2967 View* view = new View;
2970 view->SetTransform(transform);
2971 widget()->SetContentsView(view);
2972 EXPECT_EQ(2.0f, view->GetTransform().matrix().get(0, 0));
2974 view->SetVisible(false);
2975 EXPECT_EQ(2.0f, view->GetTransform().matrix().get(0, 0));
2977 view->SetVisible(true);
2978 EXPECT_EQ(2.0f, view->GetTransform().matrix().get(0, 0));
2981 // Verifies a transform persists after removing/adding a view with a transform.
2983 View* view = new View;
2986 view->SetTransform(transform);
2987 widget()->SetContentsView(view);
2988 EXPECT_EQ(2.0f, view->GetTransform().matrix().get(0, 0));
2989 ASSERT_TRUE(view->layer() != NULL);
2990 EXPECT_EQ(2.0f, view->layer()->transform().matrix().get(0, 0));
2992 View* parent = view->parent();
2993 parent->RemoveChildView(view);
2994 parent->AddChildView(view);
2996 EXPECT_EQ(2.0f, view->GetTransform().matrix().get(0, 0));
2997 ASSERT_TRUE(view->layer() != NULL);
2998 EXPECT_EQ(2.0f, view->layer()->transform().matrix().get(0, 0));
3001 // Makes sure that layer visibility is correct after toggling View visibility.
3003 View* content_view = new View;
3006 // The view isn't attached to a widget or a parent view yet. But it should
3009 View* v1 = new View;
3015 // Once the view is attached to a widget, its layer should be attached to the
3035 // Tests that the layers in the subtree are orphaned after a View is removed
3038 View* content_view = new View;
3041 View* v1 = new View;
3044 View* v2 = new View;
3065 class PaintTrackingView : public View {
3107 // Tests that the visibility of child layers are updated correctly when a View's
3110 View* v1 = new View;
3114 View* v2 = new View;
3117 View* v3 = new View;
3121 View* v4 = new View;
3153 // This test creates a random View tree, and then randomly reorders child views,
3157 View* content = new View;
3178 View* content = new View;
3180 View* c1 = new View;
3183 View* c2 = new View;
3199 // Verifies that the layer of a view can be acquired properly.
3201 View* content = new View;
3203 scoped_ptr<View> c1(new View);
3214 // Destroy view before destroying layer.
3220 scoped_ptr<View> v(new View());
3223 View* v1 = new View();
3226 View* v2 = new View();
3250 View* v = new View();
3253 View* v1 = new View();
3256 View* v2 = new View();
3279 // a View.
3281 View v;
3283 View child;
3307 class BoundsTreeTestView : public View {
3319 last_cull_set_.insert(reinterpret_cast<View*>(*it));
3322 View::PaintChildren(canvas, cull_set);
3325 std::set<View*> last_cull_set_;
3332 View* v1 = new View();
3336 View* v2 = new View();
3340 // Schedule a full-view paint to get everyone's rectangles updated.
3364 // on call to TestView::Paint(), along with the widget root view.
3382 // Add child views, which should be in RTL coordinate space of parent view.
3383 View* v1 = new View;
3387 View* v2 = new View;
3391 // Schedule a full-view paint to get everyone's rectangles updated.
3396 // Damage to the right side of the parent view should touch both child views.
3407 // Damage to the left side of the parent view should only touch the
3425 View* v1 = new View;
3429 View* v2 = new View;
3433 // Schedule a full-view paint to get everyone's rectangles updated.
3459 View* v1 = new View;
3463 View* v2 = new View;
3467 // Schedule a full-view paint to get everyone's rectangles updated.
3477 // Schedule another full-view paint.
3488 // Schedule another full-view paint.
3504 View* v1 = new View;
3508 View* v2 = new View;
3512 // Schedule a full-view
3517 // Now remove v1 from the root view.
3520 // Schedule another full-view paint.
3529 // View v1 and v2 are no longer part of view hierarchy and therefore won't be
3539 View* v1 = new View;
3543 View* v2 = new View;
3547 View* v3 = new View;
3551 // Schedule a full-view paint and ensure all views are present in the cull.
3562 // Build an unrelated view hierarchy and move v2 in to it.
3573 // Now schedule full-view paints in both widgets.
3602 View* v1 = new View;
3604 View* v11 = new View;
3618 // Creating a layer in parent should update the child view's layer offset.
3628 // Deleting parent's layer should update the child view's layer's offset.
3632 // Setting parent view should update the child view's layer's offset.
3642 // View subclasses may change insets based on whether they are focusable,
3645 // whether the View is focusable right now. For this reason it's important
3647 // whether the View is focusable right now.
3648 TestView view;
3649 view.SetFocusable(true);
3650 EXPECT_TRUE(view.focusable());
3651 view.SetEnabled(false);
3652 EXPECT_TRUE(view.focusable());
3653 view.SetFocusable(false);
3654 EXPECT_FALSE(view.focusable());
3657 // Verifies when a view is deleted it is removed from ViewStorage.
3662 View view;
3663 view_storage->StoreView(storage_id, &view);
3682 // Child view added before the widget hierarchy exists should get the
3697 // Child view added after the widget hierarchy exists should also get the