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

Unified Diff: chrome/browser/ui/views/dropdown_bar_view.cc

Issue 1478303003: Converted all Views to use an InkDropDelegate instead of a InkDropAnimationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing include. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/dropdown_bar_view.cc
diff --git a/chrome/browser/ui/views/dropdown_bar_view.cc b/chrome/browser/ui/views/dropdown_bar_view.cc
index 369f0e55154b4e2bc4c98be3f9a1d57e59fbddf3..45883bfd0ed49717a7c1fd157233652a6513eb87 100644
--- a/chrome/browser/ui/views/dropdown_bar_view.cc
+++ b/chrome/browser/ui/views/dropdown_bar_view.cc
@@ -20,6 +20,11 @@
namespace {
+// When we are animating, we draw only the top part of the left and right
+// edges to give the illusion that the find dialog is attached to the
+// window during this animation; this is the height of the items we draw.
+const int kAnimatingEdgeHeight = 5;
+
// Background to paint toolbar background with rounded corners.
class DropdownBackground : public views::Background {
public:
@@ -82,12 +87,41 @@ void DropdownBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
} // namespace
-DropdownBarView::DropdownBarView(DropdownBarHost* host) : host_(host) {}
+DropdownBarView::DropdownBarView(DropdownBarHost* host)
+ : host_(host),
+ animation_offset_(0) {
+}
DropdownBarView::~DropdownBarView() {
}
////////////////////////////////////////////////////////////////////////////////
+// DropDownBarView, public:
+
+void DropdownBarView::SetAnimationOffset(int offset) {
+ animation_offset_ = offset;
+ set_clip_insets(gfx::Insets(animation_offset_, 0, 0, 0));
+}
+
+// DropDownBarView, views::View overrides:
+void DropdownBarView::OnPaint(gfx::Canvas* canvas) {
+ OnPaintBackground(canvas);
+ OnPaintBorder(canvas);
+
+ if (animation_offset() > 0) {
+ gfx::Canvas animating_edges(
+ gfx::Size(bounds().width(), kAnimatingEdgeHeight),
+ canvas->image_scale(),
+ false);
+ canvas->Translate(bounds().OffsetFromOrigin());
+ OnPaintBackground(&animating_edges);
+ OnPaintBorder(&animating_edges);
+ canvas->DrawImageInt(gfx::ImageSkia(animating_edges.ExtractImageRep()),
+ bounds().x(), animation_offset());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
// DropDownBarView, protected:
void DropdownBarView::SetBackground(const gfx::ImageSkia* left_alpha_mask,

Powered by Google App Engine
This is Rietveld 408576698