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

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

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: address comments Created 3 years, 11 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Destroys the layer associated with this view, and reparents any descendants
343 // to the destroyed layer's parent.
sky 2017/01/23 21:21:05 Document this has no effect if the view does not c
yiyix 2017/01/24 03:14:53 Thanks, it is good to include in the description.
344 void DestroyLayer();
341 345
342 // Overridden from ui::LayerOwner: 346 // Overridden from ui::LayerOwner:
343 std::unique_ptr<ui::Layer> RecreateLayer() override; 347 std::unique_ptr<ui::Layer> RecreateLayer() override;
344 348
345 // RTL positioning ----------------------------------------------------------- 349 // RTL positioning -----------------------------------------------------------
346 350
347 // Methods for accessing the bounds and position of the view, relative to its 351 // 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 352 // parent. The position returned is mirrored if the parent view is using a RTL
349 // layout. 353 // layout.
350 // 354 //
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 1366
1363 // Convert a rect in the ancestor's coordinate system to the view's 1367 // Convert a rect in the ancestor's coordinate system to the view's
1364 // coordinate system using necessary transformations. Returns whether the 1368 // coordinate system using necessary transformations. Returns whether the
1365 // rect was successfully converted from the ancestor's coordinate system 1369 // rect was successfully converted from the ancestor's coordinate system
1366 // to the view's coordinate system. 1370 // to the view's coordinate system.
1367 bool ConvertRectFromAncestor(const View* ancestor, gfx::RectF* rect) const; 1371 bool ConvertRectFromAncestor(const View* ancestor, gfx::RectF* rect) const;
1368 1372
1369 // Accelerated painting ------------------------------------------------------ 1373 // Accelerated painting ------------------------------------------------------
1370 1374
1371 // Creates the layer and related fields for this view. 1375 // Creates the layer and related fields for this view.
1372 void CreateLayer(); 1376 void CreateLayer(ui::LayerType layer_type);
1373 1377
1374 // Recursively calls UpdateParentLayers() on all descendants, stopping at any 1378 // Recursively calls UpdateParentLayers() on all descendants, stopping at any
1375 // Views that have layers. Calls UpdateParentLayer() for any Views that have 1379 // 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 1380 // a layer with no parent. If at least one descendant had an unparented layer
1377 // true is returned. 1381 // true is returned.
1378 bool UpdateParentLayers(); 1382 bool UpdateParentLayers();
1379 1383
1380 // Parents this view's layer to |parent_layer|, and sets its bounds and other 1384 // 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 1385 // properties in accordance to |offset|, the view's offset from the
1382 // |parent_layer|. 1386 // |parent_layer|.
1383 void ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer); 1387 void ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer);
1384 1388
1385 // Called to update the layer visibility. The layer will be visible if the 1389 // Called to update the layer visibility. The layer will be visible if the
1386 // View itself, and all its parent Views are visible. This also updates 1390 // View itself, and all its parent Views are visible. This also updates
1387 // visibility of the child layers. 1391 // visibility of the child layers.
1388 void UpdateLayerVisibility(); 1392 void UpdateLayerVisibility();
1389 void UpdateChildLayerVisibility(bool visible); 1393 void UpdateChildLayerVisibility(bool visible);
1390 1394
1391 // Orphans the layers in this subtree that are parented to layers outside of 1395 // Orphans the layers in this subtree that are parented to layers outside of
1392 // this subtree. 1396 // this subtree.
1393 void OrphanLayers(); 1397 void OrphanLayers();
1394 1398
1395 // Destroys the layer associated with this view, and reparents any descendants
1396 // to the destroyed layer's parent.
1397 void DestroyLayer();
1398
1399 // Input --------------------------------------------------------------------- 1399 // Input ---------------------------------------------------------------------
1400 1400
1401 bool ProcessMousePressed(const ui::MouseEvent& event); 1401 bool ProcessMousePressed(const ui::MouseEvent& event);
1402 bool ProcessMouseDragged(const ui::MouseEvent& event); 1402 bool ProcessMouseDragged(const ui::MouseEvent& event);
1403 void ProcessMouseReleased(const ui::MouseEvent& event); 1403 void ProcessMouseReleased(const ui::MouseEvent& event);
1404 1404
1405 // Accelerators -------------------------------------------------------------- 1405 // Accelerators --------------------------------------------------------------
1406 1406
1407 // Registers this view's keyboard accelerators that are not registered to 1407 // Registers this view's keyboard accelerators that are not registered to
1408 // FocusManager yet, if possible. 1408 // FocusManager yet, if possible.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 // Observers ------------------------------------------------------------- 1613 // Observers -------------------------------------------------------------
1614 1614
1615 base::ObserverList<ViewObserver> observers_; 1615 base::ObserverList<ViewObserver> observers_;
1616 1616
1617 DISALLOW_COPY_AND_ASSIGN(View); 1617 DISALLOW_COPY_AND_ASSIGN(View);
1618 }; 1618 };
1619 1619
1620 } // namespace views 1620 } // namespace views
1621 1621
1622 #endif // UI_VIEWS_VIEW_H_ 1622 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/controls/slide_out_view.cc ('k') | ui/views/view.cc » ('j') | ui/views/view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698