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

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

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: nit Created 3 years, 6 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
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 #ifndef UI_VIEWS_VIEW_H_ 5 #ifndef UI_VIEWS_VIEW_H_
6 #define UI_VIEWS_VIEW_H_ 6 #define UI_VIEWS_VIEW_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 static int GetHorizontalDragThreshold(); 1261 static int GetHorizontalDragThreshold();
1262 static int GetVerticalDragThreshold(); 1262 static int GetVerticalDragThreshold();
1263 1263
1264 // NativeTheme --------------------------------------------------------------- 1264 // NativeTheme ---------------------------------------------------------------
1265 1265
1266 // Invoked when the NativeTheme associated with this View changes, including 1266 // Invoked when the NativeTheme associated with this View changes, including
1267 // when one first becomes available (after the view is added to a widget 1267 // when one first becomes available (after the view is added to a widget
1268 // hierarchy). 1268 // hierarchy).
1269 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) {} 1269 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) {}
1270 1270
1271 // Pixel Canvas --------------------------------------------------------------
1272
1273 // Returns the type of scaling to be done for this View. Values should be from
1274 // ui::PaintContext::ScaleType.
1275 virtual int GetContextScaleType() const;
sky 2017/06/23 23:40:23 Why is this virtual? Why would it need to be overr
malaykeshav 2017/06/24 00:30:03 The ScaleType can vary depending on whether we are
1276
1271 // Debugging ----------------------------------------------------------------- 1277 // Debugging -----------------------------------------------------------------
1272 1278
1273 #if !defined(NDEBUG) 1279 #if !defined(NDEBUG)
1274 // Returns string containing a graph of the views hierarchy in graphViz DOT 1280 // Returns string containing a graph of the views hierarchy in graphViz DOT
1275 // language (http://graphviz.org/). Can be called within debugger and save 1281 // language (http://graphviz.org/). Can be called within debugger and save
1276 // to a file to compile/view. 1282 // to a file to compile/view.
1277 // Note: Assumes initial call made with first = true. 1283 // Note: Assumes initial call made with first = true.
1278 virtual std::string PrintViewGraph(bool first); 1284 virtual std::string PrintViewGraph(bool first);
1279 1285
1280 // Some classes may own an object which contains the children to displayed in 1286 // Some classes may own an object which contains the children to displayed in
(...skipping 28 matching lines...) Expand all
1309 1315
1310 // Schedules a paint on the parent View if it exists. 1316 // Schedules a paint on the parent View if it exists.
1311 void SchedulePaintOnParent(); 1317 void SchedulePaintOnParent();
1312 1318
1313 // Returns whether this view is eligible for painting, i.e. is visible and 1319 // Returns whether this view is eligible for painting, i.e. is visible and
1314 // nonempty. Note that this does not behave like IsDrawn(), since it doesn't 1320 // nonempty. Note that this does not behave like IsDrawn(), since it doesn't
1315 // check ancestors recursively; rather, it's used to prune subtrees of views 1321 // check ancestors recursively; rather, it's used to prune subtrees of views
1316 // during painting. 1322 // during painting.
1317 bool ShouldPaint() const; 1323 bool ShouldPaint() const;
1318 1324
1319 // Returns the offset that should be used when constructing the paint context 1325 // Returns the bounds that should be used when constructing the paint context
1320 // for this view. 1326 // for this view.
1321 gfx::Vector2d GetPaintContextOffset() const; 1327 gfx::Rect GetPaintContextBounds() const;
1322 1328
1323 // Adjusts the transform of |recorder| in advance of painting. 1329 // Adjusts the transform of |recorder| in advance of painting.
1324 void SetupTransformRecorderForPainting(ui::TransformRecorder* recorder) const; 1330 void SetupTransformRecorderForPainting(ui::TransformRecorder* recorder,
1331 const ui::PaintContext& context) const;
1325 1332
1326 // Recursively calls the painting method |func| on all non-layered children, 1333 // Recursively calls the painting method |func| on all non-layered children,
1327 // in Z order. 1334 // in Z order.
1328 void RecursivePaintHelper(void (View::*func)(const ui::PaintContext&), 1335 void RecursivePaintHelper(void (View::*func)(const ui::PaintContext&),
1329 const ui::PaintContext& context); 1336 const ui::PaintContext& context);
1330 1337
1331 // Invokes Paint() and, if necessary, PaintDebugRects(). Should be called 1338 // Invokes Paint() and, if necessary, PaintDebugRects(). Should be called
1332 // only on the root of a widget/layer. PaintDebugRects() is invoked as a 1339 // only on the root of a widget/layer. PaintDebugRects() is invoked as a
1333 // separate pass, instead of being rolled into Paint(), so that siblings will 1340 // separate pass, instead of being rolled into Paint(), so that siblings will
1334 // not obscure debug rects. 1341 // not obscure debug rects.
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 // Observers ------------------------------------------------------------- 1716 // Observers -------------------------------------------------------------
1710 1717
1711 base::ObserverList<ViewObserver> observers_; 1718 base::ObserverList<ViewObserver> observers_;
1712 1719
1713 DISALLOW_COPY_AND_ASSIGN(View); 1720 DISALLOW_COPY_AND_ASSIGN(View);
1714 }; 1721 };
1715 1722
1716 } // namespace views 1723 } // namespace views
1717 1724
1718 #endif // UI_VIEWS_VIEW_H_ 1725 #endif // UI_VIEWS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698