summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-14 23:06:36 +0000
committersaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-14 23:06:36 +0000
commite92b243cd51f8e834602d3f114b946a435f8a5fd (patch)
tree1b11f5dd24a75ebe04d63a23f03a08f25a54fbf8 /ui
parent8af81c0e35caff07d2e9710de572d52a2e7100fa (diff)
downloadchromium_src-e92b243cd51f8e834602d3f114b946a435f8a5fd.zip
chromium_src-e92b243cd51f8e834602d3f114b946a435f8a5fd.tar.gz
chromium_src-e92b243cd51f8e834602d3f114b946a435f8a5fd.tar.bz2
Update drop down menu look & feel
BUG=122908 TBR=oshima@chromium.org Review URL: https://chromiumcodereview.appspot.com/10829176 Patch from Harry McCleave <harrym@chromium.org>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151596 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/resources/default_100_percent/ash/small_shadow_bottom.pngbin171 -> 136 bytes
-rw-r--r--ui/resources/default_100_percent/ash/small_shadow_bottom_left.pngbin1202 -> 179 bytes
-rw-r--r--ui/resources/default_100_percent/ash/small_shadow_bottom_right.pngbin1226 -> 185 bytes
-rw-r--r--ui/resources/default_100_percent/ash/small_shadow_left.pngbin153 -> 77 bytes
-rw-r--r--ui/resources/default_100_percent/ash/small_shadow_right.pngbin1010 -> 78 bytes
-rw-r--r--ui/resources/default_100_percent/ash/small_shadow_top.pngbin1002 -> 76 bytes
-rw-r--r--ui/resources/default_100_percent/ash/small_shadow_top_left.pngbin337 -> 150 bytes
-rw-r--r--ui/resources/default_100_percent/ash/small_shadow_top_right.pngbin1224 -> 148 bytes
-rw-r--r--ui/resources/default_100_percent/discloure_arrow.pngbin153 -> 0 bytes
-rw-r--r--ui/resources/default_200_percent/ash/small_shadow_bottom.pngbin0 -> 158 bytes
-rw-r--r--ui/resources/default_200_percent/ash/small_shadow_bottom_left.pngbin0 -> 333 bytes
-rw-r--r--ui/resources/default_200_percent/ash/small_shadow_bottom_right.pngbin0 -> 328 bytes
-rw-r--r--ui/resources/default_200_percent/ash/small_shadow_left.pngbin0 -> 136 bytes
-rw-r--r--ui/resources/default_200_percent/ash/small_shadow_right.pngbin0 -> 142 bytes
-rw-r--r--ui/resources/default_200_percent/ash/small_shadow_top.pngbin0 -> 131 bytes
-rw-r--r--ui/resources/default_200_percent/ash/small_shadow_top_left.pngbin0 -> 236 bytes
-rw-r--r--ui/resources/default_200_percent/ash/small_shadow_top_right.pngbin0 -> 245 bytes
-rw-r--r--ui/resources/ui_resources.grd3
-rw-r--r--ui/views/controls/combobox/native_combobox_views.cc23
-rw-r--r--ui/views/controls/menu/menu_config_views.cc2
-rw-r--r--ui/views/controls/menu/menu_controller.cc45
-rw-r--r--ui/views/controls/menu/menu_controller.h4
-rw-r--r--ui/views/controls/menu/menu_item_view.h14
23 files changed, 21 insertions, 70 deletions
diff --git a/ui/resources/default_100_percent/ash/small_shadow_bottom.png b/ui/resources/default_100_percent/ash/small_shadow_bottom.png
index 87ccf0b..96558f7 100644
--- a/ui/resources/default_100_percent/ash/small_shadow_bottom.png
+++ b/ui/resources/default_100_percent/ash/small_shadow_bottom.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/small_shadow_bottom_left.png b/ui/resources/default_100_percent/ash/small_shadow_bottom_left.png
index e0bf537..1badab6 100644
--- a/ui/resources/default_100_percent/ash/small_shadow_bottom_left.png
+++ b/ui/resources/default_100_percent/ash/small_shadow_bottom_left.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/small_shadow_bottom_right.png b/ui/resources/default_100_percent/ash/small_shadow_bottom_right.png
index 39f0965..fe92d77 100644
--- a/ui/resources/default_100_percent/ash/small_shadow_bottom_right.png
+++ b/ui/resources/default_100_percent/ash/small_shadow_bottom_right.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/small_shadow_left.png b/ui/resources/default_100_percent/ash/small_shadow_left.png
index 06920a7..1615283 100644
--- a/ui/resources/default_100_percent/ash/small_shadow_left.png
+++ b/ui/resources/default_100_percent/ash/small_shadow_left.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/small_shadow_right.png b/ui/resources/default_100_percent/ash/small_shadow_right.png
index 2221877..b445a78 100644
--- a/ui/resources/default_100_percent/ash/small_shadow_right.png
+++ b/ui/resources/default_100_percent/ash/small_shadow_right.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/small_shadow_top.png b/ui/resources/default_100_percent/ash/small_shadow_top.png
index 552c6a7..ffd617a 100644
--- a/ui/resources/default_100_percent/ash/small_shadow_top.png
+++ b/ui/resources/default_100_percent/ash/small_shadow_top.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/small_shadow_top_left.png b/ui/resources/default_100_percent/ash/small_shadow_top_left.png
index 91c39eb..8f14327 100644
--- a/ui/resources/default_100_percent/ash/small_shadow_top_left.png
+++ b/ui/resources/default_100_percent/ash/small_shadow_top_left.png
Binary files differ
diff --git a/ui/resources/default_100_percent/ash/small_shadow_top_right.png b/ui/resources/default_100_percent/ash/small_shadow_top_right.png
index de1eee8..61b2d68 100644
--- a/ui/resources/default_100_percent/ash/small_shadow_top_right.png
+++ b/ui/resources/default_100_percent/ash/small_shadow_top_right.png
Binary files differ
diff --git a/ui/resources/default_100_percent/discloure_arrow.png b/ui/resources/default_100_percent/discloure_arrow.png
deleted file mode 100644
index a958850..0000000
--- a/ui/resources/default_100_percent/discloure_arrow.png
+++ /dev/null
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/small_shadow_bottom.png b/ui/resources/default_200_percent/ash/small_shadow_bottom.png
new file mode 100644
index 0000000..94534bf
--- /dev/null
+++ b/ui/resources/default_200_percent/ash/small_shadow_bottom.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/small_shadow_bottom_left.png b/ui/resources/default_200_percent/ash/small_shadow_bottom_left.png
new file mode 100644
index 0000000..e8dfb63
--- /dev/null
+++ b/ui/resources/default_200_percent/ash/small_shadow_bottom_left.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/small_shadow_bottom_right.png b/ui/resources/default_200_percent/ash/small_shadow_bottom_right.png
new file mode 100644
index 0000000..fb52827
--- /dev/null
+++ b/ui/resources/default_200_percent/ash/small_shadow_bottom_right.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/small_shadow_left.png b/ui/resources/default_200_percent/ash/small_shadow_left.png
new file mode 100644
index 0000000..f89aa1a
--- /dev/null
+++ b/ui/resources/default_200_percent/ash/small_shadow_left.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/small_shadow_right.png b/ui/resources/default_200_percent/ash/small_shadow_right.png
new file mode 100644
index 0000000..bc1a5d1
--- /dev/null
+++ b/ui/resources/default_200_percent/ash/small_shadow_right.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/small_shadow_top.png b/ui/resources/default_200_percent/ash/small_shadow_top.png
new file mode 100644
index 0000000..9aa60c2
--- /dev/null
+++ b/ui/resources/default_200_percent/ash/small_shadow_top.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/small_shadow_top_left.png b/ui/resources/default_200_percent/ash/small_shadow_top_left.png
new file mode 100644
index 0000000..a43689b
--- /dev/null
+++ b/ui/resources/default_200_percent/ash/small_shadow_top_left.png
Binary files differ
diff --git a/ui/resources/default_200_percent/ash/small_shadow_top_right.png b/ui/resources/default_200_percent/ash/small_shadow_top_right.png
new file mode 100644
index 0000000..923b715
--- /dev/null
+++ b/ui/resources/default_200_percent/ash/small_shadow_top_right.png
Binary files differ
diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd
index d29d904..54521a5 100644
--- a/ui/resources/ui_resources.grd
+++ b/ui/resources/ui_resources.grd
@@ -305,9 +305,6 @@
<structure type="chrome_scaled_image" name="IDR_CONTENT_RIGHT_SIDE" file="content_right_side.png" />
<structure type="chrome_scaled_image" name="IDR_DEFAULT_FAVICON" file="default_favicon.png" />
<structure type="chrome_scaled_image" name="IDR_DEFAULT_LARGE_FAVICON" file="default_large_favicon.png" />
- <if expr="pp_ifdef('toolkit_views')">
- <structure type="chrome_scaled_image" name="IDR_DISCLOSURE_ARROW" file="discloure_arrow.png" />
- </if>
<structure type="chrome_scaled_image" name="IDR_FOLDER_CLOSED" file="common/folder_closed.png" />
<structure type="chrome_scaled_image" name="IDR_FOLDER_CLOSED_RTL" file="common/folder_closed_rtl.png" />
<structure type="chrome_scaled_image" name="IDR_FOLDER_OPEN" file="common/folder_open.png" />
diff --git a/ui/views/controls/combobox/native_combobox_views.cc b/ui/views/controls/combobox/native_combobox_views.cc
index f791d4f..40e9821 100644
--- a/ui/views/controls/combobox/native_combobox_views.cc
+++ b/ui/views/controls/combobox/native_combobox_views.cc
@@ -32,6 +32,12 @@ const int kLeftInsetSize = 4;
const int kBottomInsetSize = 4;
const int kRightInsetSize = 4;
+// Menu border widths
+const int kMenuBorderWidthLeft = 1;
+const int kMenuBorderWidthTop = 1;
+const int kMenuBorderWidthRight = 1;
+const int kMenuBorderWidthBottom = 2;
+
// Limit how small a combobox can be.
const int kMinComboboxWidth = 148;
@@ -58,7 +64,7 @@ NativeComboboxViews::NativeComboboxViews(Combobox* combobox)
: combobox_(combobox),
text_border_(new FocusableBorder()),
disclosure_arrow_(ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_DISCLOSURE_ARROW).ToImageSkia()),
+ IDR_MENU_DROPARROW).ToImageSkia()),
dropdown_open_(false),
selected_index_(-1),
content_width_(0),
@@ -325,15 +331,18 @@ void NativeComboboxViews::ShowDropDownMenu() {
// Extend the menu to the width of the combobox.
MenuItemView* menu = dropdown_list_menu_runner_->GetMenu();
SubmenuView* submenu = menu->CreateSubmenu();
- submenu->set_minimum_preferred_width(size().width());
-
-#if defined(USE_AURA)
- // Aura style is to have the menu over the bounds. Below bounds is default.
- menu->set_menu_position(views::MenuItemView::POSITION_OVER_BOUNDS);
-#endif
+ submenu->set_minimum_preferred_width(size().width() -
+ (kMenuBorderWidthLeft + kMenuBorderWidthRight));
gfx::Rect lb = GetLocalBounds();
gfx::Point menu_position(lb.origin());
+
+ // Inset the menu's requested position so the border of the menu lines up
+ // with the border of the combobox.
+ menu_position.set_x(menu_position.x() + kMenuBorderWidthLeft);
+ menu_position.set_y(menu_position.y() + kMenuBorderWidthTop);
+ lb.set_width(lb.width() - (kMenuBorderWidthLeft + kMenuBorderWidthRight));
+
View::ConvertPointToScreen(this, &menu_position);
if (menu_position.x() < 0)
menu_position.set_x(0);
diff --git a/ui/views/controls/menu/menu_config_views.cc b/ui/views/controls/menu/menu_config_views.cc
index 92df3fa..babbd2a 100644
--- a/ui/views/controls/menu/menu_config_views.cc
+++ b/ui/views/controls/menu/menu_config_views.cc
@@ -19,7 +19,7 @@ MenuConfig* MenuConfig::Create() {
config->text_color = ui::NativeTheme::instance()->GetSystemColor(
ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor);
config->submenu_horizontal_margin_size = 0;
- config->submenu_vertical_margin_size = 2;
+ config->submenu_vertical_margin_size = 0;
config->submenu_horizontal_inset = 1;
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
config->arrow_to_edge_padding = 20;
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index c57bcbe..ba8bf0f 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -277,11 +277,6 @@ MenuItemView* MenuController::Run(Widget* parent,
possible_drag_ = false;
drag_in_progress_ = false;
- // We need to drop the first mouse release event when the menu has been
- // layed out over the bounds.
- drop_first_release_event_ =
- root->GetRequestedMenuPosition() == MenuItemView::POSITION_OVER_BOUNDS;
-
bool nested_menu = showing_;
if (showing_) {
// Only support nesting of blocking_run menus, nesting of
@@ -473,18 +468,6 @@ void MenuController::OnMouseReleased(SubmenuView* source,
if (!blocking_run_)
return;
- // We must ignore the first release event when it occured within the original
- // bounds.
- if (drop_first_release_event_ && (event.flags() & ui::EF_LEFT_MOUSE_BUTTON)) {
- drop_first_release_event_ = false;
- gfx::Point loc(event.location());
- View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc);
- DCHECK(!state_.initial_bounds.IsEmpty());
- if (state_.initial_bounds.Contains(loc))
- return;
- }
- drop_first_release_event_ = false;
-
DCHECK(state_.item);
possible_drag_ = false;
DCHECK(blocking_run_);
@@ -792,7 +775,6 @@ void MenuController::SetSelectionOnPointerDown(SubmenuView* source,
const ui::LocatedEvent& event) {
if (!blocking_run_)
return;
- drop_first_release_event_ = false;
DCHECK(!active_mouse_view_);
@@ -1049,7 +1031,6 @@ MenuController::MenuController(bool blocking,
internal::MenuControllerDelegate* delegate)
: blocking_run_(blocking),
showing_(false),
- drop_first_release_event_(false),
exit_type_(EXIT_NONE),
did_capture_(false),
result_(NULL),
@@ -1555,8 +1536,7 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item,
gfx::Size pref = submenu->GetScrollViewContainer()->GetPreferredSize();
// Don't let the menu go too wide.
- if (item->actual_menu_position() != MenuItemView::POSITION_OVER_BOUNDS)
- pref.set_width(std::min(pref.width(),
+ pref.set_width(std::min(pref.width(),
item->GetDelegate()->GetMaxWidthForMenu(item)));
if (!state_.monitor_bounds.IsEmpty())
pref.set_width(std::min(pref.width(), state_.monitor_bounds.width()));
@@ -1569,22 +1549,12 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item,
if (!item->GetParentMenuItem()) {
// First item, position relative to initial location.
x = state_.initial_bounds.x();
- if (item->actual_menu_position() == MenuItemView::POSITION_OVER_BOUNDS)
- y = state_.initial_bounds.y();
- else
- y = state_.initial_bounds.bottom();
+ y = state_.initial_bounds.bottom();
if (state_.anchor == MenuItemView::TOPRIGHT)
x = x + state_.initial_bounds.width() - pref.width();
if (!state_.monitor_bounds.IsEmpty() &&
- pref.height() > state_.monitor_bounds.height() &&
- item->actual_menu_position() == MenuItemView::POSITION_OVER_BOUNDS) {
- // Handle very tall menus.
- pref.set_height(state_.monitor_bounds.height());
- y = state_.monitor_bounds.y();
- } else if (!state_.monitor_bounds.IsEmpty() &&
- y + pref.height() > state_.monitor_bounds.bottom() &&
- item->actual_menu_position() != MenuItemView::POSITION_OVER_BOUNDS) {
+ y + pref.height() > state_.monitor_bounds.bottom()) {
// The menu doesn't fit fully below the button on the screen. The menu
// position with respect to the bounds will be preserved if it has
// already been drawn. When the requested positioning is below the bounds
@@ -1649,15 +1619,6 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item,
pref.set_height(std::min(pref.height(),
state_.initial_bounds.y() - state_.monitor_bounds.y()));
y = state_.initial_bounds.y() - pref.height();
- } else if (item->actual_menu_position() ==
- MenuItemView::POSITION_OVER_BOUNDS) {
- // Center vertically assuming all items have the same height.
- int middle = state_.initial_bounds.y() - pref.height() / 2;
- if (submenu->GetMenuItemCount() > 0)
- middle += submenu->GetMenuItemAt(0)->GetPreferredSize().height() / 2;
- y = std::max(state_.monitor_bounds.y(), middle);
- if (y + pref.height() > state_.monitor_bounds.bottom())
- y = state_.monitor_bounds.bottom() - pref.height();
} else {
item->set_actual_menu_position(MenuItemView::POSITION_BELOW_BOUNDS);
}
diff --git a/ui/views/controls/menu/menu_controller.h b/ui/views/controls/menu/menu_controller.h
index 483e024ab..b67af9b 100644
--- a/ui/views/controls/menu/menu_controller.h
+++ b/ui/views/controls/menu/menu_controller.h
@@ -468,10 +468,6 @@ class VIEWS_EXPORT MenuController
// If true, we're showing.
bool showing_;
- // Is true for some menu types and only until the first mouse press or mouse
- // release event occurs.
- bool drop_first_release_event_;
-
// Indicates what to exit.
ExitType exit_type_;
diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h
index 03ef36e..c80a1d3 100644
--- a/ui/views/controls/menu/menu_item_view.h
+++ b/ui/views/controls/menu/menu_item_view.h
@@ -100,8 +100,7 @@ class VIEWS_EXPORT MenuItemView : public View {
enum MenuPosition {
POSITION_BEST_FIT,
POSITION_ABOVE_BOUNDS,
- POSITION_BELOW_BOUNDS,
- POSITION_OVER_BOUNDS
+ POSITION_BELOW_BOUNDS
};
// Constructor for use with the top level menu item. This menu is never
@@ -217,11 +216,6 @@ class VIEWS_EXPORT MenuItemView : public View {
// Returns the type of this menu.
const Type& GetType() const { return type_; }
- // Returns the requested menu position.
- const MenuPosition& GetRequestedMenuPosition() {
- return requested_menu_position_;
- }
-
// Sets whether this item is selected. This is invoked as the user moves
// the mouse around the menu while open.
void SetSelected(bool selected);
@@ -300,12 +294,6 @@ class VIEWS_EXPORT MenuItemView : public View {
// negative margin is specified then MenuConfig values are used.
void SetMargins(int top_margin, int bottom_margin);
- // Set the position of the menu with respect to the bounds (top
- // level only).
- void set_menu_position(MenuPosition menu_position) {
- requested_menu_position_ = menu_position;
- }
-
// Suppress the right margin if this is set to false.
void set_use_right_margin(bool use_right_margin) {
use_right_margin_ = use_right_margin;