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