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

Unified Diff: ui/views/controls/menu/menu_scroll_view_container.cc

Issue 1812303002: Added Layer based clipping to MenuScrollViewContainer::MenuScrollView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO with reference to bug. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/menu/menu_scroll_view_container.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_scroll_view_container.cc
diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc
index 381bef70f6f8147990c13a0c7d0235500fb10d34..22e3c1edec6e2624ab2477f7d5d22b14c6a87c66 100644
--- a/ui/views/controls/menu/menu_scroll_view_container.cc
+++ b/ui/views/controls/menu/menu_scroll_view_container.cc
@@ -8,6 +8,7 @@
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/accessibility/ax_view_state.h"
+#include "ui/compositor/layer.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/views/border.h"
@@ -34,6 +35,8 @@ static const int kBorderPaddingDueToRoundedCorners = 1;
class MenuScrollButton : public View {
public:
+ static const char kViewClassName[];
+
MenuScrollButton(SubmenuView* host, bool is_up)
: host_(host),
is_up_(is_up),
@@ -41,6 +44,8 @@ class MenuScrollButton : public View {
pref_height_(MenuItemView::pref_menu_height()) {
}
+ const char* GetClassName() const override { return kViewClassName; }
+
gfx::Size GetPreferredSize() const override {
return gfx::Size(MenuConfig::instance().scroll_arrow_height * 2 - 1,
pref_height_);
@@ -120,6 +125,9 @@ class MenuScrollButton : public View {
DISALLOW_COPY_AND_ASSIGN(MenuScrollButton);
};
+// static
+const char MenuScrollButton::kViewClassName[] = "MenuScrollButton";
+
} // namespace
// MenuScrollView --------------------------------------------------------------
@@ -134,10 +142,18 @@ class MenuScrollButton : public View {
class MenuScrollViewContainer::MenuScrollView : public View {
public:
+ static const char kViewClassName[];
+
explicit MenuScrollView(View* child) {
+ SetPaintToLayer(true);
+ layer()->SetMasksToBounds(true);
+ // TODO(bruthig): Paint bounds opaquely. See http://crbug.com/601135.
+ layer()->SetFillsBoundsOpaquely(false);
AddChildView(child);
}
+ const char* GetClassName() const override { return kViewClassName; }
+
void ScrollRectToVisible(const gfx::Rect& rect) override {
// NOTE: this assumes we only want to scroll in the y direction.
@@ -169,8 +185,16 @@ class MenuScrollViewContainer::MenuScrollView : public View {
DISALLOW_COPY_AND_ASSIGN(MenuScrollView);
};
+// static
+const char MenuScrollViewContainer::MenuScrollView::kViewClassName[] =
+ "MenuScrollViewContainer::MenuScrollView";
+
// MenuScrollViewContainer ----------------------------------------------------
+// static
+const char MenuScrollViewContainer::kViewClassName[] =
+ "MenuScrollViewContainer";
+
MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view)
: content_view_(content_view),
arrow_(BubbleBorder::NONE),
@@ -201,6 +225,10 @@ void MenuScrollViewContainer::SetBubbleArrowOffset(int offset) {
bubble_border_->set_arrow_offset(offset);
}
+const char* MenuScrollViewContainer::GetClassName() const {
+ return kViewClassName;
+}
+
gfx::Size MenuScrollViewContainer::GetPreferredSize() const {
gfx::Size prefsize = scroll_view_->GetContents()->GetPreferredSize();
gfx::Insets insets = GetInsets();
« no previous file with comments | « ui/views/controls/menu/menu_scroll_view_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698