| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 // Clipping is done relative to the view's local bounds. | 328 // Clipping is done relative to the view's local bounds. |
| 329 void set_clip_path(const gfx::Path& path) { clip_path_ = path; } | 329 void set_clip_path(const gfx::Path& path) { clip_path_ = path; } |
| 330 | 330 |
| 331 // Sets the transform to the supplied transform. | 331 // Sets the transform to the supplied transform. |
| 332 void SetTransform(const gfx::Transform& transform); | 332 void SetTransform(const gfx::Transform& transform); |
| 333 | 333 |
| 334 // Sets whether this view paints to a layer. A view paints to a layer if | 334 // Sets whether this view paints to a layer. A view paints to a layer if |
| 335 // either of the following are true: | 335 // either of the following are true: |
| 336 // . the view has a non-identity transform. | 336 // . the view has a non-identity transform. |
| 337 // . SetPaintToLayer(true) has been invoked. | 337 // . SetPaintToLayer(ui::LayerType) has been invoked. |
| 338 // View creates the Layer only when it exists in a Widget with a non-NULL | 338 // View creates the Layer only when it exists in a Widget with a non-NULL |
| 339 // Compositor. | 339 // Compositor. |
| 340 void SetPaintToLayer(bool paint_to_layer); | 340 void SetPaintToLayer(ui::LayerType layer_type = ui::LAYER_TEXTURED); |
| 341 |
| 342 // Removes |view|'s layer if it has its own. |
| 343 void DetachLayer(); |
| 341 | 344 |
| 342 // Overridden from ui::LayerOwner: | 345 // Overridden from ui::LayerOwner: |
| 343 std::unique_ptr<ui::Layer> RecreateLayer() override; | 346 std::unique_ptr<ui::Layer> RecreateLayer() override; |
| 344 | 347 |
| 345 // RTL positioning ----------------------------------------------------------- | 348 // RTL positioning ----------------------------------------------------------- |
| 346 | 349 |
| 347 // Methods for accessing the bounds and position of the view, relative to its | 350 // Methods for accessing the bounds and position of the view, relative to its |
| 348 // parent. The position returned is mirrored if the parent view is using a RTL | 351 // parent. The position returned is mirrored if the parent view is using a RTL |
| 349 // layout. | 352 // layout. |
| 350 // | 353 // |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 | 1365 |
| 1363 // Convert a rect in the ancestor's coordinate system to the view's | 1366 // Convert a rect in the ancestor's coordinate system to the view's |
| 1364 // coordinate system using necessary transformations. Returns whether the | 1367 // coordinate system using necessary transformations. Returns whether the |
| 1365 // rect was successfully converted from the ancestor's coordinate system | 1368 // rect was successfully converted from the ancestor's coordinate system |
| 1366 // to the view's coordinate system. | 1369 // to the view's coordinate system. |
| 1367 bool ConvertRectFromAncestor(const View* ancestor, gfx::RectF* rect) const; | 1370 bool ConvertRectFromAncestor(const View* ancestor, gfx::RectF* rect) const; |
| 1368 | 1371 |
| 1369 // Accelerated painting ------------------------------------------------------ | 1372 // Accelerated painting ------------------------------------------------------ |
| 1370 | 1373 |
| 1371 // Creates the layer and related fields for this view. | 1374 // Creates the layer and related fields for this view. |
| 1372 void CreateLayer(); | 1375 void CreateLayer(ui::LayerType layer_type); |
| 1373 | 1376 |
| 1374 // Recursively calls UpdateParentLayers() on all descendants, stopping at any | 1377 // Recursively calls UpdateParentLayers() on all descendants, stopping at any |
| 1375 // Views that have layers. Calls UpdateParentLayer() for any Views that have | 1378 // Views that have layers. Calls UpdateParentLayer() for any Views that have |
| 1376 // a layer with no parent. If at least one descendant had an unparented layer | 1379 // a layer with no parent. If at least one descendant had an unparented layer |
| 1377 // true is returned. | 1380 // true is returned. |
| 1378 bool UpdateParentLayers(); | 1381 bool UpdateParentLayers(); |
| 1379 | 1382 |
| 1380 // Parents this view's layer to |parent_layer|, and sets its bounds and other | 1383 // Parents this view's layer to |parent_layer|, and sets its bounds and other |
| 1381 // properties in accordance to |offset|, the view's offset from the | 1384 // properties in accordance to |offset|, the view's offset from the |
| 1382 // |parent_layer|. | 1385 // |parent_layer|. |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 // Observers ------------------------------------------------------------- | 1616 // Observers ------------------------------------------------------------- |
| 1614 | 1617 |
| 1615 base::ObserverList<ViewObserver> observers_; | 1618 base::ObserverList<ViewObserver> observers_; |
| 1616 | 1619 |
| 1617 DISALLOW_COPY_AND_ASSIGN(View); | 1620 DISALLOW_COPY_AND_ASSIGN(View); |
| 1618 }; | 1621 }; |
| 1619 | 1622 |
| 1620 } // namespace views | 1623 } // namespace views |
| 1621 | 1624 |
| 1622 #endif // UI_VIEWS_VIEW_H_ | 1625 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |