Commit 766cbabc authored by erikchen's avatar erikchen Committed by Commit Bot

[MacViewsBrowser] Long bookmark names should show an ellipsis

Bug: 712278
Change-Id: I20d490373e46fc09a3763b23bfcb86358e0d8c92
Reviewed-on: https://chromium-review.googlesource.com/988592Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547459}
parent 73a0e7fa
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/drag_utils.h" #include "ui/views/drag_utils.h"
#include "ui/views/metrics.h" #include "ui/views/metrics.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/view_constants.h" #include "ui/views/view_constants.h"
#include "ui/views/widget/tooltip_manager.h" #include "ui/views/widget/tooltip_manager.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -153,10 +154,15 @@ static const int kInstructionsPadding = 6; ...@@ -153,10 +154,15 @@ static const int kInstructionsPadding = 6;
// Tag for the 'Apps Shortcut' button. // Tag for the 'Apps Shortcut' button.
static const int kAppsShortcutButtonTag = 2; static const int kAppsShortcutButtonTag = 2;
static const gfx::ElideBehavior kElideBehavior = gfx::FADE_TAIL;
namespace { namespace {
// How to elide bookmark and bookmark folders.
gfx::ElideBehavior GetElideBehavior() {
return views::PlatformStyle::kShouldElideBookmarksInBookmarksBar
? gfx::ELIDE_TAIL
: gfx::FADE_TAIL;
}
// To enable/disable BookmarkBar animations during testing. In production // To enable/disable BookmarkBar animations during testing. In production
// animations are enabled by default. // animations are enabled by default.
bool animations_enabled = true; bool animations_enabled = true;
...@@ -231,7 +237,7 @@ class BookmarkButtonBase : public views::LabelButton { ...@@ -231,7 +237,7 @@ class BookmarkButtonBase : public views::LabelButton {
: LabelButton(listener, title) { : LabelButton(listener, title) {
SetImageLabelSpacing(ChromeLayoutProvider::Get()->GetDistanceMetric( SetImageLabelSpacing(ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_RELATED_LABEL_HORIZONTAL_LIST)); DISTANCE_RELATED_LABEL_HORIZONTAL_LIST));
SetElideBehavior(kElideBehavior); SetElideBehavior(GetElideBehavior());
SetInkDropMode(InkDropMode::ON); SetInkDropMode(InkDropMode::ON);
set_has_ink_drop_action_on_click(true); set_has_ink_drop_action_on_click(true);
if (ui::MaterialDesignController::IsTouchOptimizedUiEnabled()) if (ui::MaterialDesignController::IsTouchOptimizedUiEnabled())
...@@ -409,7 +415,7 @@ class BookmarkFolderButton : public BookmarkMenuButtonBase { ...@@ -409,7 +415,7 @@ class BookmarkFolderButton : public BookmarkMenuButtonBase {
views::MenuButtonListener* menu_button_listener, views::MenuButtonListener* menu_button_listener,
bool show_menu_marker) bool show_menu_marker)
: BookmarkMenuButtonBase(title, menu_button_listener, show_menu_marker) { : BookmarkMenuButtonBase(title, menu_button_listener, show_menu_marker) {
SetElideBehavior(kElideBehavior); SetElideBehavior(GetElideBehavior());
show_animation_.reset(new gfx::SlideAnimation(this)); show_animation_.reset(new gfx::SlideAnimation(this));
if (!animations_enabled) { if (!animations_enabled) {
// For some reason during testing the events generated by animating // For some reason during testing the events generated by animating
......
...@@ -55,6 +55,7 @@ const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = false; ...@@ -55,6 +55,7 @@ const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = false;
const bool PlatformStyle::kUseRipples = true; const bool PlatformStyle::kUseRipples = true;
const bool PlatformStyle::kTextfieldScrollsToStartOnFocusChange = false; const bool PlatformStyle::kTextfieldScrollsToStartOnFocusChange = false;
const bool PlatformStyle::kTextfieldUsesDragCursorWhenDraggable = true; const bool PlatformStyle::kTextfieldUsesDragCursorWhenDraggable = true;
const bool PlatformStyle::kShouldElideBookmarksInBookmarksBar = false;
// static // static
std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) { std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
......
...@@ -66,6 +66,10 @@ class VIEWS_EXPORT PlatformStyle { ...@@ -66,6 +66,10 @@ class VIEWS_EXPORT PlatformStyle {
// dragging but available to do so. // dragging but available to do so.
static const bool kTextfieldUsesDragCursorWhenDraggable; static const bool kTextfieldUsesDragCursorWhenDraggable;
// Whether bookmarks in the bookmarks bar are elided [and show elipses at the
// tail] or fade out.
static const bool kShouldElideBookmarksInBookmarksBar;
// Creates the default scrollbar for the given orientation. // Creates the default scrollbar for the given orientation.
static std::unique_ptr<ScrollBar> CreateScrollBar(bool is_horizontal); static std::unique_ptr<ScrollBar> CreateScrollBar(bool is_horizontal);
......
...@@ -22,6 +22,7 @@ const bool PlatformStyle::kSelectAllOnRightClickWhenUnfocused = true; ...@@ -22,6 +22,7 @@ const bool PlatformStyle::kSelectAllOnRightClickWhenUnfocused = true;
const bool PlatformStyle::kTextfieldScrollsToStartOnFocusChange = true; const bool PlatformStyle::kTextfieldScrollsToStartOnFocusChange = true;
const bool PlatformStyle::kTextfieldUsesDragCursorWhenDraggable = false; const bool PlatformStyle::kTextfieldUsesDragCursorWhenDraggable = false;
const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = true; const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = true;
const bool PlatformStyle::kShouldElideBookmarksInBookmarksBar = true;
const bool PlatformStyle::kUseRipples = false; const bool PlatformStyle::kUseRipples = false;
const Button::NotifyAction PlatformStyle::kMenuNotifyActivationAction = const Button::NotifyAction PlatformStyle::kMenuNotifyActivationAction =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment