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

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

Issue 533403002: Fix touch selection for Athena home card (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed NeedsNotificationWhenVisibleBoundsChange() Created 6 years, 3 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') | ui/views/view_unittest.cc » ('j') | 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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 1311
1312 void View::OnBoundsChanged(const gfx::Rect& previous_bounds) { 1312 void View::OnBoundsChanged(const gfx::Rect& previous_bounds) {
1313 } 1313 }
1314 1314
1315 void View::PreferredSizeChanged() { 1315 void View::PreferredSizeChanged() {
1316 InvalidateLayout(); 1316 InvalidateLayout();
1317 if (parent_) 1317 if (parent_)
1318 parent_->ChildPreferredSizeChanged(this); 1318 parent_->ChildPreferredSizeChanged(this);
1319 } 1319 }
1320 1320
1321 bool View::NeedsNotificationWhenVisibleBoundsChange() const { 1321 bool View::GetNeedsNotificationWhenVisibleBoundsChange() const {
1322 return false; 1322 return false;
1323 } 1323 }
1324 1324
1325 void View::OnVisibleBoundsChanged() { 1325 void View::OnVisibleBoundsChanged() {
1326 } 1326 }
1327 1327
1328 // Tree operations ------------------------------------------------------------- 1328 // Tree operations -------------------------------------------------------------
1329 1329
1330 void View::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) { 1330 void View::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) {
1331 } 1331 }
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL)); 1920 UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL));
1921 } 1921 }
1922 1922
1923 OnBoundsChanged(previous_bounds); 1923 OnBoundsChanged(previous_bounds);
1924 1924
1925 if (previous_bounds.size() != size()) { 1925 if (previous_bounds.size() != size()) {
1926 needs_layout_ = false; 1926 needs_layout_ = false;
1927 Layout(); 1927 Layout();
1928 } 1928 }
1929 1929
1930 if (NeedsNotificationWhenVisibleBoundsChange()) 1930 if (GetNeedsNotificationWhenVisibleBoundsChange())
1931 OnVisibleBoundsChanged(); 1931 OnVisibleBoundsChanged();
1932 1932
1933 // Notify interested Views that visible bounds within the root view may have 1933 // Notify interested Views that visible bounds within the root view may have
1934 // changed. 1934 // changed.
1935 if (descendants_to_notify_.get()) { 1935 if (descendants_to_notify_.get()) {
1936 for (Views::iterator i(descendants_to_notify_->begin()); 1936 for (Views::iterator i(descendants_to_notify_->begin());
1937 i != descendants_to_notify_->end(); ++i) { 1937 i != descendants_to_notify_->end(); ++i) {
1938 (*i)->OnVisibleBoundsChanged(); 1938 (*i)->OnVisibleBoundsChanged();
1939 } 1939 }
1940 } 1940 }
1941 } 1941 }
1942 1942
1943 // static 1943 // static
1944 void View::RegisterChildrenForVisibleBoundsNotification(View* view) { 1944 void View::RegisterChildrenForVisibleBoundsNotification(View* view) {
1945 if (view->NeedsNotificationWhenVisibleBoundsChange()) 1945 if (view->GetNeedsNotificationWhenVisibleBoundsChange())
1946 view->RegisterForVisibleBoundsNotification(); 1946 view->RegisterForVisibleBoundsNotification();
1947 for (int i = 0; i < view->child_count(); ++i) 1947 for (int i = 0; i < view->child_count(); ++i)
1948 RegisterChildrenForVisibleBoundsNotification(view->child_at(i)); 1948 RegisterChildrenForVisibleBoundsNotification(view->child_at(i));
1949 } 1949 }
1950 1950
1951 // static 1951 // static
1952 void View::UnregisterChildrenForVisibleBoundsNotification(View* view) { 1952 void View::UnregisterChildrenForVisibleBoundsNotification(View* view) {
1953 if (view->NeedsNotificationWhenVisibleBoundsChange()) 1953 if (view->GetNeedsNotificationWhenVisibleBoundsChange())
1954 view->UnregisterForVisibleBoundsNotification(); 1954 view->UnregisterForVisibleBoundsNotification();
1955 for (int i = 0; i < view->child_count(); ++i) 1955 for (int i = 0; i < view->child_count(); ++i)
1956 UnregisterChildrenForVisibleBoundsNotification(view->child_at(i)); 1956 UnregisterChildrenForVisibleBoundsNotification(view->child_at(i));
1957 } 1957 }
1958 1958
1959 void View::RegisterForVisibleBoundsNotification() { 1959 void View::RegisterForVisibleBoundsNotification() {
1960 if (registered_for_visible_bounds_notification_) 1960 if (registered_for_visible_bounds_notification_)
1961 return; 1961 return;
1962 1962
1963 registered_for_visible_bounds_notification_ = true; 1963 registered_for_visible_bounds_notification_ = true;
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 // Message the RootView to do the drag and drop. That way if we're removed 2442 // Message the RootView to do the drag and drop. That way if we're removed
2443 // the RootView can detect it and avoid calling us back. 2443 // the RootView can detect it and avoid calling us back.
2444 gfx::Point widget_location(event.location()); 2444 gfx::Point widget_location(event.location());
2445 ConvertPointToWidget(this, &widget_location); 2445 ConvertPointToWidget(this, &widget_location);
2446 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2446 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2447 // WARNING: we may have been deleted. 2447 // WARNING: we may have been deleted.
2448 return true; 2448 return true;
2449 } 2449 }
2450 2450
2451 } // namespace views 2451 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698