Commit d603432d authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Remove mirror_{arrows,client}_in_rtl

AFAICT, post-Mac views this is always true.

This is cleanup for removing the MacRTL flag.

Change-Id: I35de9ddf6dd8f89ec90d427915917945a2164347
Reviewed-on: https://chromium-review.googlesource.com/c/1344191Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611285}
parent 94853e6e
......@@ -61,10 +61,6 @@ class ChromeViewsDelegate : public views::ViewsDelegate {
ui::ContextFactoryPrivate* GetContextFactoryPrivate() override;
std::string GetApplicationName() override;
#if defined(OS_MACOSX)
bool ShouldMirrorArrowsInRTL() const override;
#endif
private:
#if defined(OS_WIN)
typedef std::map<HMONITOR, int> AppbarAutohideEdgeMap;
......
......@@ -13,7 +13,3 @@ views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget(
// By returning null Widget creates the default NativeWidget implementation.
return nullptr;
}
bool ChromeViewsDelegate::ShouldMirrorArrowsInRTL() const {
return base::FeatureList::IsEnabled(features::kMacRTL);
}
......@@ -121,14 +121,6 @@ PermissionsBubbleDialogDelegateView::PermissionsBubbleDialogDelegateView(
set_close_on_deactivate(false);
#if defined(OS_MACOSX)
// On Mac, the browser UI flips depending on a runtime feature. TODO(tapted):
// Change the default in views::PlatformStyle when features::kMacRTL launches,
// and remove the following.
if (base::FeatureList::IsEnabled(features::kMacRTL))
set_mirror_arrow_in_rtl(true);
#endif
ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kVertical, gfx::Insets(),
......
......@@ -16,7 +16,6 @@
#include "ui/views/layout/layout_manager.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/view_properties.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
#include "ui/views/window/dialog_client_view.h"
......@@ -134,7 +133,6 @@ bool BubbleDialogDelegateView::ShouldShowCloseButton() const {
ClientView* BubbleDialogDelegateView::CreateClientView(Widget* widget) {
DialogClientView* client = new DialogClientView(widget, GetContentsView());
widget->non_client_view()->set_mirror_client_in_rtl(mirror_arrow_in_rtl_);
return client;
}
......@@ -148,7 +146,7 @@ NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView(
frame->SetFootnoteView(CreateFootnoteView());
BubbleBorder::Arrow adjusted_arrow = arrow();
if (base::i18n::IsRTL() && mirror_arrow_in_rtl_)
if (base::i18n::IsRTL())
adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow);
std::unique_ptr<BubbleBorder> border =
std::make_unique<BubbleBorder>(adjusted_arrow, GetShadow(), color());
......@@ -275,8 +273,6 @@ BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view,
anchor_view_tracker_(std::make_unique<ViewTracker>()),
anchor_widget_(nullptr),
arrow_(arrow),
mirror_arrow_in_rtl_(
ViewsDelegate::GetInstance()->ShouldMirrorArrowsInRTL()),
shadow_(shadow),
color_explicitly_set_(false),
accept_events_(true),
......
......@@ -77,8 +77,6 @@ class VIEWS_EXPORT BubbleDialogDelegateView : public DialogDelegateView,
BubbleBorder::Arrow arrow() const { return arrow_; }
void SetArrow(BubbleBorder::Arrow arrow);
void set_mirror_arrow_in_rtl(bool mirror) { mirror_arrow_in_rtl_ = mirror; }
BubbleBorder::Shadow GetShadow() const;
void set_shadow(BubbleBorder::Shadow shadow) { shadow_ = shadow; }
......@@ -205,9 +203,6 @@ class VIEWS_EXPORT BubbleDialogDelegateView : public DialogDelegateView,
// The arrow's location on the bubble.
BubbleBorder::Arrow arrow_;
// Automatically mirror the arrow in RTL layout.
bool mirror_arrow_in_rtl_;
// Bubble border shadow to use.
BubbleBorder::Shadow shadow_;
......
......@@ -132,25 +132,6 @@ TEST_F(BubbleDialogDelegateViewTest, CreateDelegate) {
EXPECT_TRUE(bubble_observer.widget_closed());
}
TEST_F(BubbleDialogDelegateViewTest, MirrorArrowInRtl) {
std::string default_locale = base::i18n::GetConfiguredLocale();
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
for (bool rtl : {false, true}) {
base::i18n::SetICUDefaultLocale(rtl ? "he" : "en");
EXPECT_EQ(rtl, base::i18n::IsRTL());
for (bool mirror : {false, true}) {
TestBubbleDialogDelegateView* bubble =
new TestBubbleDialogDelegateView(anchor_widget->GetContentsView());
bubble->set_mirror_arrow_in_rtl(mirror);
BubbleDialogDelegateView::CreateBubble(bubble);
EXPECT_EQ(rtl && mirror ? BubbleBorder::horizontal_mirror(bubble->arrow())
: bubble->arrow(),
bubble->GetBubbleFrameView()->bubble_border()->arrow());
}
}
base::i18n::SetICUDefaultLocale(default_locale);
}
TEST_F(BubbleDialogDelegateViewTest, CloseAnchorWidget) {
std::unique_ptr<Widget> anchor_widget(CreateTestWidget());
BubbleDialogDelegateView* bubble_delegate =
......
......@@ -131,10 +131,6 @@ int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor,
}
#endif
bool ViewsDelegate::ShouldMirrorArrowsInRTL() const {
return true;
}
#if defined(USE_AURA)
void ViewsDelegate::SetTouchSelectionMenuRunner(
std::unique_ptr<TouchSelectionMenuRunnerViews> menu_runner) {
......
......@@ -196,10 +196,6 @@ class VIEWS_EXPORT ViewsDelegate {
const base::Closure& callback);
#endif
// Whether to mirror the arrow of bubble dialogs in RTL, such that the bubble
// opens in the opposite direction.
virtual bool ShouldMirrorArrowsInRTL() const;
protected:
ViewsDelegate();
......
......@@ -43,7 +43,6 @@ bool NonClientFrameView::GetClientMask(const gfx::Size& size,
NonClientView::NonClientView()
: client_view_(nullptr),
mirror_client_in_rtl_(true),
overlay_view_(nullptr) {
SetEventTargeter(
std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
......@@ -166,10 +165,6 @@ void NonClientView::Layout() {
// Then layout the ClientView, using those bounds.
gfx::Rect client_bounds = frame_view_->GetBoundsForClientView();
// RTL code will mirror the ClientView in the frame by default. If this isn't
// desired, do a second mirror here to get the standard LTR position.
if (base::i18n::IsRTL() && !mirror_client_in_rtl_)
client_bounds.set_x(GetMirroredXForRect(client_bounds));
if (client_bounds != client_view_->bounds()) {
client_view_->SetBoundsRect(client_bounds);
......
......@@ -217,8 +217,6 @@ class VIEWS_EXPORT NonClientView : public View, public ViewTargeterDelegate {
client_view_ = client_view;
}
void set_mirror_client_in_rtl(bool mirror) { mirror_client_in_rtl_ = mirror; }
// Layout just the frame view. This is necessary on Windows when non-client
// metrics such as the position of the window controls changes independently
// of a window resize message.
......@@ -251,9 +249,6 @@ class VIEWS_EXPORT NonClientView : public View, public ViewTargeterDelegate {
// implementation.
ClientView* client_view_;
// Set to false if client_view_ position shouldn't be mirrored in RTL.
bool mirror_client_in_rtl_;
// The NonClientFrameView that renders the non-client portions of the window.
// This object is not owned by the view hierarchy because it can be replaced
// dynamically as the system settings change.
......
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