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

Unified Diff: ui/views/animation/flood_fill_ink_drop_ripple.h

Issue 2533053002: Handle view resize for ripple (Closed)
Patch Set: const -> constexpr Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/animation/flood_fill_ink_drop_ripple.h
diff --git a/ui/views/animation/flood_fill_ink_drop_ripple.h b/ui/views/animation/flood_fill_ink_drop_ripple.h
index 2088677d6f4833da07d3cefb1525392ec9d8787d..643ff41f51edc9755d3c32c232e9ec0c0a8af267 100644
--- a/ui/views/animation/flood_fill_ink_drop_ripple.h
+++ b/ui/views/animation/flood_fill_ink_drop_ripple.h
@@ -14,6 +14,7 @@
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/gfx/animation/tween.h"
+#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/transform.h"
@@ -33,8 +34,13 @@ namespace test {
class FloodFillInkDropRippleTestApi;
} // namespace test
-// An ink drop ripple that starts as a small circle and flood fills a
-// rectangle of the given size. The circle is clipped to the rectangles bounds.
+// An ink drop ripple that starts as a small circle and flood fills a rectangle
+// of the size determined by |host_size| and |clip_insets| (if provided). The
+// circle is clipped to this rectangle's bounds.
+// Constructors take |host_size| and |clip_insets| and calculate the effective
+// bounds of the flood fill based on them. This way, the ripple's bounds are
+// defined relative to the host size and can be recalculated whenever the host
+// size is changed.
//
// The valid InkDropState transitions are defined below:
//
@@ -48,13 +54,19 @@ class FloodFillInkDropRippleTestApi;
//
class VIEWS_EXPORT FloodFillInkDropRipple : public InkDropRipple {
public:
- FloodFillInkDropRipple(const gfx::Rect& clip_bounds,
+ FloodFillInkDropRipple(const gfx::Size& host_size,
+ const gfx::Insets& clip_insets,
+ const gfx::Point& center_point,
+ SkColor color,
+ float visible_opacity);
+ FloodFillInkDropRipple(const gfx::Size& host_size,
const gfx::Point& center_point,
SkColor color,
float visible_opacity);
~FloodFillInkDropRipple() override;
// InkDropRipple:
+ void HostSizeChanged(const gfx::Size& new_size) override;
void SnapToActivated() override;
ui::Layer* GetRootLayer() override;
@@ -105,6 +117,9 @@ class VIEWS_EXPORT FloodFillInkDropRipple : public InkDropRipple {
// |root_layer_| bounds.
float MaxDistanceToCorners(const gfx::Point& point) const;
+ // Insets of the clip area relative to the host bounds.
+ gfx::Insets clip_insets_;
+
// The point where the Center of the ink drop's circle should be drawn.
gfx::Point center_point_;
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view.cc ('k') | ui/views/animation/flood_fill_ink_drop_ripple.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698