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

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

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

Powered by Google App Engine
This is Rietveld 408576698