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

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

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor 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>
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/i18n/rtl.h" 18 #include "base/i18n/rtl.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "ui/accessibility/ax_enums.h" 22 #include "ui/accessibility/ax_enums.h"
23 #include "ui/base/accelerators/accelerator.h" 23 #include "ui/base/accelerators/accelerator.h"
24 #include "ui/base/dragdrop/drag_drop_types.h" 24 #include "ui/base/dragdrop/drag_drop_types.h"
25 #include "ui/base/dragdrop/drop_target_event.h" 25 #include "ui/base/dragdrop/drop_target_event.h"
26 #include "ui/base/dragdrop/os_exchange_data.h" 26 #include "ui/base/dragdrop/os_exchange_data.h"
27 #include "ui/base/ui_base_types.h" 27 #include "ui/base/ui_base_types.h"
28 #include "ui/compositor/layer_delegate.h" 28 #include "ui/compositor/layer_delegate.h"
29 #include "ui/compositor/layer_owner.h" 29 #include "ui/compositor/layer_owner.h"
30 #include "ui/compositor/layer_type.h"
30 #include "ui/compositor/paint_cache.h" 31 #include "ui/compositor/paint_cache.h"
31 #include "ui/events/event.h" 32 #include "ui/events/event.h"
32 #include "ui/events/event_target.h" 33 #include "ui/events/event_target.h"
33 #include "ui/gfx/geometry/insets.h" 34 #include "ui/gfx/geometry/insets.h"
34 #include "ui/gfx/geometry/point.h" 35 #include "ui/gfx/geometry/point.h"
35 #include "ui/gfx/geometry/rect.h" 36 #include "ui/gfx/geometry/rect.h"
36 #include "ui/gfx/geometry/vector2d.h" 37 #include "ui/gfx/geometry/vector2d.h"
37 #include "ui/gfx/native_widget_types.h" 38 #include "ui/gfx/native_widget_types.h"
38 #include "ui/gfx/path.h" 39 #include "ui/gfx/path.h"
39 #include "ui/views/view_targeter.h" 40 #include "ui/views/view_targeter.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 328
328 // Clipping is done relative to the view's local bounds. 329 // Clipping is done relative to the view's local bounds.
329 void set_clip_path(const gfx::Path& path) { clip_path_ = path; } 330 void set_clip_path(const gfx::Path& path) { clip_path_ = path; }
330 331
331 // Sets the transform to the supplied transform. 332 // Sets the transform to the supplied transform.
332 void SetTransform(const gfx::Transform& transform); 333 void SetTransform(const gfx::Transform& transform);
333 334
334 // Sets whether this view paints to a layer. A view paints to a layer if 335 // Sets whether this view paints to a layer. A view paints to a layer if
335 // either of the following are true: 336 // either of the following are true:
336 // . the view has a non-identity transform. 337 // . the view has a non-identity transform.
337 // . SetPaintToLayer(true) has been invoked. 338 // . SetPaintToLayer(ui::LayerType) has been invoked.
338 // View creates the Layer only when it exists in a Widget with a non-NULL 339 // View creates the Layer only when it exists in a Widget with a non-NULL
339 // Compositor. 340 // Compositor.
340 void SetPaintToLayer(bool paint_to_layer); 341 // Removes this view's layer if |layer_type| sets to |LAYER_NOT_DRAWN|.
342 void SetPaintToLayer(ui::LayerType layer_type);
sky 2017/01/20 20:32:07 WDYT of a default of TEXTURED as that is typically
341 343
342 // Overridden from ui::LayerOwner: 344 // Overridden from ui::LayerOwner:
343 std::unique_ptr<ui::Layer> RecreateLayer() override; 345 std::unique_ptr<ui::Layer> RecreateLayer() override;
344 346
345 // RTL positioning ----------------------------------------------------------- 347 // RTL positioning -----------------------------------------------------------
346 348
347 // Methods for accessing the bounds and position of the view, relative to its 349 // 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 350 // parent. The position returned is mirrored if the parent view is using a RTL
349 // layout. 351 // layout.
350 // 352 //
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 1364
1363 // Convert a rect in the ancestor's coordinate system to the view's 1365 // Convert a rect in the ancestor's coordinate system to the view's
1364 // coordinate system using necessary transformations. Returns whether the 1366 // coordinate system using necessary transformations. Returns whether the
1365 // rect was successfully converted from the ancestor's coordinate system 1367 // rect was successfully converted from the ancestor's coordinate system
1366 // to the view's coordinate system. 1368 // to the view's coordinate system.
1367 bool ConvertRectFromAncestor(const View* ancestor, gfx::RectF* rect) const; 1369 bool ConvertRectFromAncestor(const View* ancestor, gfx::RectF* rect) const;
1368 1370
1369 // Accelerated painting ------------------------------------------------------ 1371 // Accelerated painting ------------------------------------------------------
1370 1372
1371 // Creates the layer and related fields for this view. 1373 // Creates the layer and related fields for this view.
1372 void CreateLayer(); 1374 void CreateLayer(ui::LayerType layer_type);
1373 1375
1374 // Recursively calls UpdateParentLayers() on all descendants, stopping at any 1376 // Recursively calls UpdateParentLayers() on all descendants, stopping at any
1375 // Views that have layers. Calls UpdateParentLayer() for any Views that have 1377 // 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 1378 // a layer with no parent. If at least one descendant had an unparented layer
1377 // true is returned. 1379 // true is returned.
1378 bool UpdateParentLayers(); 1380 bool UpdateParentLayers();
1379 1381
1380 // Parents this view's layer to |parent_layer|, and sets its bounds and other 1382 // 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 1383 // properties in accordance to |offset|, the view's offset from the
1382 // |parent_layer|. 1384 // |parent_layer|.
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 // Observers ------------------------------------------------------------- 1615 // Observers -------------------------------------------------------------
1614 1616
1615 base::ObserverList<ViewObserver> observers_; 1617 base::ObserverList<ViewObserver> observers_;
1616 1618
1617 DISALLOW_COPY_AND_ASSIGN(View); 1619 DISALLOW_COPY_AND_ASSIGN(View);
1618 }; 1620 };
1619 1621
1620 } // namespace views 1622 } // namespace views
1621 1623
1622 #endif // UI_VIEWS_VIEW_H_ 1624 #endif // UI_VIEWS_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698