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

Side by Side Diff: ui/wm/core/shadow.h

Issue 2562143002: Update WM shadow transitions. (Closed)
Patch Set: review feedback Created 4 years 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 | « no previous file | ui/wm/core/shadow.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_WM_CORE_SHADOW_H_ 5 #ifndef UI_WM_CORE_SHADOW_H_
6 #define UI_WM_CORE_SHADOW_H_ 6 #define UI_WM_CORE_SHADOW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Moves and resizes the shadow layer to frame |content_bounds|. 55 // Moves and resizes the shadow layer to frame |content_bounds|.
56 void SetContentBounds(const gfx::Rect& content_bounds); 56 void SetContentBounds(const gfx::Rect& content_bounds);
57 57
58 // Sets the shadow's style, animating opacity as necessary. 58 // Sets the shadow's style, animating opacity as necessary.
59 void SetStyle(Style style); 59 void SetStyle(Style style);
60 60
61 // ui::ImplicitAnimationObserver overrides: 61 // ui::ImplicitAnimationObserver overrides:
62 void OnImplicitAnimationsCompleted() override; 62 void OnImplicitAnimationsCompleted() override;
63 63
64 private: 64 private:
65 // Updates the shadow images to the current |style_|. 65 // Updates the shadow layer and its image to the current |style_|.
66 void UpdateImagesForStyle(); 66 void RecreateShadowLayer();
67 67
68 // Updates the shadow layer bounds based on the inteior inset and the current 68 // Updates the shadow layer bounds based on the inteior inset and the current
69 // |content_bounds_|. 69 // |content_bounds_|.
70 void UpdateLayerBounds(); 70 void UpdateLayerBounds();
71 71
72 // Returns the "elevation" for |style_|, which dictates the shadow's display 72 // Returns the "elevation" for |style_|, which dictates the shadow's display
73 // characteristics. The elevation is proportional to the size of the blur and 73 // characteristics. The elevation is proportional to the size of the blur and
74 // its offset. 74 // its offset.
75 int ElevationForStyle(); 75 int ElevationForStyle();
76 76
77 // The current style, set when the transition animation starts. 77 // The current style, set when the transition animation starts.
78 Style style_ = STYLE_ACTIVE; 78 Style style_ = STYLE_ACTIVE;
79 79
80 // The parent layer of the shadow layer. It serves as a container accessible 80 // The parent layer of the shadow layer. It serves as a container accessible
81 // from the outside to control the visibility of the shadow. 81 // from the outside to control the visibility of the shadow.
82 std::unique_ptr<ui::Layer> layer_; 82 std::unique_ptr<ui::Layer> layer_;
83 83
84 // The actual shadow layer corresponding to a cc::NinePatchLayer. 84 // The actual shadow layer corresponding to a cc::NinePatchLayer.
85 std::unique_ptr<ui::Layer> shadow_layer_; 85 std::unique_ptr<ui::Layer> shadow_layer_;
86 86
87 // When the style changes, the old shadow cross-fades with the new one.
88 // When non-null, this is an old |shadow_layer_| that's being animated out.
89 std::unique_ptr<ui::Layer> fading_layer_;
90
87 // Bounds of the content that the shadow encloses. 91 // Bounds of the content that the shadow encloses.
88 gfx::Rect content_bounds_; 92 gfx::Rect content_bounds_;
89 93
90 DISALLOW_COPY_AND_ASSIGN(Shadow); 94 DISALLOW_COPY_AND_ASSIGN(Shadow);
91 }; 95 };
92 96
93 } // namespace wm 97 } // namespace wm
94 98
95 #endif // UI_WM_CORE_SHADOW_H_ 99 #endif // UI_WM_CORE_SHADOW_H_
OLDNEW
« no previous file with comments | « no previous file | ui/wm/core/shadow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698