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 #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 <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 std::string DoPrintViewGraph(bool first, View* view_with_children); | 1241 std::string DoPrintViewGraph(bool first, View* view_with_children); |
1242 #endif | 1242 #endif |
1243 | 1243 |
1244 private: | 1244 private: |
1245 friend class internal::PreEventDispatchHandler; | 1245 friend class internal::PreEventDispatchHandler; |
1246 friend class internal::PostEventDispatchHandler; | 1246 friend class internal::PostEventDispatchHandler; |
1247 friend class internal::RootView; | 1247 friend class internal::RootView; |
1248 friend class FocusManager; | 1248 friend class FocusManager; |
1249 friend class Widget; | 1249 friend class Widget; |
1250 | 1250 |
1251 typedef gfx::RTree<intptr_t> BoundsTree; | |
1252 | |
1253 // Painting ----------------------------------------------------------------- | 1251 // Painting ----------------------------------------------------------------- |
1254 | 1252 |
1255 enum SchedulePaintType { | 1253 enum SchedulePaintType { |
1256 // Indicates the size is the same (only the origin changed). | 1254 // Indicates the size is the same (only the origin changed). |
1257 SCHEDULE_PAINT_SIZE_SAME, | 1255 SCHEDULE_PAINT_SIZE_SAME, |
1258 | 1256 |
1259 // Indicates the size changed (and possibly the origin). | 1257 // Indicates the size changed (and possibly the origin). |
1260 SCHEDULE_PAINT_SIZE_CHANGED | 1258 SCHEDULE_PAINT_SIZE_CHANGED |
1261 }; | 1259 }; |
1262 | 1260 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 // Sets the layer's bounds given in DIP coordinates. | 1333 // Sets the layer's bounds given in DIP coordinates. |
1336 void SetLayerBounds(const gfx::Rect& bounds_in_dip); | 1334 void SetLayerBounds(const gfx::Rect& bounds_in_dip); |
1337 | 1335 |
1338 // Sets the bit indicating that the cached bounds for this object within the | 1336 // Sets the bit indicating that the cached bounds for this object within the |
1339 // root view bounds tree are no longer valid. If |origin_changed| is true sets | 1337 // root view bounds tree are no longer valid. If |origin_changed| is true sets |
1340 // the same bit for all of our children as well. | 1338 // the same bit for all of our children as well. |
1341 void SetRootBoundsDirty(bool origin_changed); | 1339 void SetRootBoundsDirty(bool origin_changed); |
1342 | 1340 |
1343 // If needed, updates the bounds rectangle in paint root coordinate space | 1341 // If needed, updates the bounds rectangle in paint root coordinate space |
1344 // in the supplied RTree. Recurses to children for recomputation as well. | 1342 // in the supplied RTree. Recurses to children for recomputation as well. |
1345 void UpdateRootBounds(BoundsTree* bounds_tree, const gfx::Vector2d& offset); | 1343 void UpdateRootBounds(gfx::RTree* bounds_tree, const gfx::Vector2d& offset); |
1346 | 1344 |
1347 // Remove self and all children from the supplied bounds tree. This is used, | 1345 // Remove self and all children from the supplied bounds tree. This is used, |
1348 // for example, when a view gets a layer and therefore becomes paint root. It | 1346 // for example, when a view gets a layer and therefore becomes paint root. It |
1349 // needs to remove all references to itself and its children from any previous | 1347 // needs to remove all references to itself and its children from any previous |
1350 // paint root that may have been tracking it. | 1348 // paint root that may have been tracking it. |
1351 void RemoveRootBounds(BoundsTree* bounds_tree); | 1349 void RemoveRootBounds(gfx::RTree* bounds_tree); |
1352 | 1350 |
1353 // Traverse up the View hierarchy to the first ancestor that is a paint root | 1351 // Traverse up the View hierarchy to the first ancestor that is a paint root |
1354 // and return a pointer to its |bounds_tree_| or NULL if no tree is found. | 1352 // and return a pointer to its |bounds_tree_| or NULL if no tree is found. |
1355 BoundsTree* GetBoundsTreeFromPaintRoot(); | 1353 gfx::RTree* GetBoundsTreeFromPaintRoot(); |
1356 | 1354 |
1357 // Transformations ----------------------------------------------------------- | 1355 // Transformations ----------------------------------------------------------- |
1358 | 1356 |
1359 // Returns in |transform| the transform to get from coordinates of |ancestor| | 1357 // Returns in |transform| the transform to get from coordinates of |ancestor| |
1360 // to this. Returns true if |ancestor| is found. If |ancestor| is not found, | 1358 // to this. Returns true if |ancestor| is found. If |ancestor| is not found, |
1361 // or NULL, |transform| is set to convert from root view coordinates to this. | 1359 // or NULL, |transform| is set to convert from root view coordinates to this. |
1362 bool GetTransformRelativeTo(const View* ancestor, | 1360 bool GetTransformRelativeTo(const View* ancestor, |
1363 gfx::Transform* transform) const; | 1361 gfx::Transform* transform) const; |
1364 | 1362 |
1365 // Coordinate conversion ----------------------------------------------------- | 1363 // Coordinate conversion ----------------------------------------------------- |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 // List of descendants wanting notification when their visible bounds change. | 1524 // List of descendants wanting notification when their visible bounds change. |
1527 scoped_ptr<Views> descendants_to_notify_; | 1525 scoped_ptr<Views> descendants_to_notify_; |
1528 | 1526 |
1529 // True if the bounds on this object have changed since the last time the | 1527 // True if the bounds on this object have changed since the last time the |
1530 // paint root view constructed the spatial database. | 1528 // paint root view constructed the spatial database. |
1531 bool root_bounds_dirty_; | 1529 bool root_bounds_dirty_; |
1532 | 1530 |
1533 // If this View IsPaintRoot() then this will be a pointer to a spatial data | 1531 // If this View IsPaintRoot() then this will be a pointer to a spatial data |
1534 // structure where we will keep the bounding boxes of all our children, for | 1532 // structure where we will keep the bounding boxes of all our children, for |
1535 // efficient paint damage rectangle intersection. | 1533 // efficient paint damage rectangle intersection. |
1536 scoped_ptr<BoundsTree> bounds_tree_; | 1534 scoped_ptr<gfx::RTree> bounds_tree_; |
1537 | 1535 |
1538 // Transformations ----------------------------------------------------------- | 1536 // Transformations ----------------------------------------------------------- |
1539 | 1537 |
1540 // Clipping parameters. skia transformation matrix does not give us clipping. | 1538 // Clipping parameters. skia transformation matrix does not give us clipping. |
1541 // So we do it ourselves. | 1539 // So we do it ourselves. |
1542 gfx::Insets clip_insets_; | 1540 gfx::Insets clip_insets_; |
1543 | 1541 |
1544 // Layout -------------------------------------------------------------------- | 1542 // Layout -------------------------------------------------------------------- |
1545 | 1543 |
1546 // Whether the view needs to be laid out. | 1544 // Whether the view needs to be laid out. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 // Belongs to this view, but it's reference-counted on some platforms | 1611 // Belongs to this view, but it's reference-counted on some platforms |
1614 // so we can't use a scoped_ptr. It's dereferenced in the destructor. | 1612 // so we can't use a scoped_ptr. It's dereferenced in the destructor. |
1615 NativeViewAccessibility* native_view_accessibility_; | 1613 NativeViewAccessibility* native_view_accessibility_; |
1616 | 1614 |
1617 DISALLOW_COPY_AND_ASSIGN(View); | 1615 DISALLOW_COPY_AND_ASSIGN(View); |
1618 }; | 1616 }; |
1619 | 1617 |
1620 } // namespace views | 1618 } // namespace views |
1621 | 1619 |
1622 #endif // UI_VIEWS_VIEW_H_ | 1620 #endif // UI_VIEWS_VIEW_H_ |
OLD | NEW |