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

Side by Side Diff: ui/views/bubble/bubble_dialog_delegate.cc

Issue 1866403005: Fix rtl shelf overflow bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/bubble/bubble_dialog_delegate.h" 5 #include "ui/views/bubble/bubble_dialog_delegate.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/color_utils.h" 10 #include "ui/gfx/color_utils.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView( 100 NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView(
101 Widget* widget) { 101 Widget* widget) {
102 BubbleFrameView* frame = new BubbleFrameView( 102 BubbleFrameView* frame = new BubbleFrameView(
103 gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin), 103 gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin),
104 margins()); 104 margins());
105 // Note: In CreateBubble, the call to SizeToContents() will cause 105 // Note: In CreateBubble, the call to SizeToContents() will cause
106 // the relayout that this call requires. 106 // the relayout that this call requires.
107 frame->SetTitleFontList(GetTitleFontList()); 107 frame->SetTitleFontList(GetTitleFontList());
108 frame->SetFootnoteView(CreateFootnoteView()); 108 frame->SetFootnoteView(CreateFootnoteView());
109 frame->set_mirror_arrow_in_rtl(mirror_arrow_in_rtl_);
109 110
110 BubbleBorder::Arrow adjusted_arrow = arrow(); 111 BubbleBorder::Arrow adjusted_arrow = arrow();
111 if (base::i18n::IsRTL()) 112 if (base::i18n::IsRTL() && mirror_arrow_in_rtl_)
112 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); 113 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow);
113 frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>( 114 frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>(
114 new BubbleBorder(adjusted_arrow, shadow(), color()))); 115 new BubbleBorder(adjusted_arrow, shadow(), color())));
115 return frame; 116 return frame;
116 } 117 }
117 118
118 void BubbleDialogDelegateView::GetAccessibleState(ui::AXViewState* state) { 119 void BubbleDialogDelegateView::GetAccessibleState(ui::AXViewState* state) {
119 state->role = ui::AX_ROLE_DIALOG; 120 state->role = ui::AX_ROLE_DIALOG;
120 } 121 }
121 122
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 199
199 BubbleDialogDelegateView::BubbleDialogDelegateView() 200 BubbleDialogDelegateView::BubbleDialogDelegateView()
200 : BubbleDialogDelegateView(nullptr, BubbleBorder::TOP_LEFT) {} 201 : BubbleDialogDelegateView(nullptr, BubbleBorder::TOP_LEFT) {}
201 202
202 BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view, 203 BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view,
203 BubbleBorder::Arrow arrow) 204 BubbleBorder::Arrow arrow)
204 : close_on_deactivate_(true), 205 : close_on_deactivate_(true),
205 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), 206 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()),
206 anchor_widget_(NULL), 207 anchor_widget_(NULL),
207 arrow_(arrow), 208 arrow_(arrow),
209 mirror_arrow_in_rtl_(true),
208 shadow_(BubbleBorder::SMALL_SHADOW), 210 shadow_(BubbleBorder::SMALL_SHADOW),
209 color_explicitly_set_(false), 211 color_explicitly_set_(false),
210 margins_(kPanelVertMargin, 212 margins_(kPanelVertMargin,
211 kPanelHorizMargin, 213 kPanelHorizMargin,
212 kPanelVertMargin, 214 kPanelVertMargin,
213 kPanelHorizMargin), 215 kPanelHorizMargin),
214 accept_events_(true), 216 accept_events_(true),
215 border_accepts_events_(true), 217 border_accepts_events_(true),
216 adjust_if_offscreen_(true), 218 adjust_if_offscreen_(true),
217 parent_window_(NULL) { 219 parent_window_(NULL) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // http://crbug.com/474622 for details. 312 // http://crbug.com/474622 for details.
311 if (widget == GetWidget() && visible) { 313 if (widget == GetWidget() && visible) {
312 ui::AXViewState state; 314 ui::AXViewState state;
313 GetAccessibleState(&state); 315 GetAccessibleState(&state);
314 if (state.role == ui::AX_ROLE_ALERT_DIALOG) 316 if (state.role == ui::AX_ROLE_ALERT_DIALOG)
315 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 317 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
316 } 318 }
317 } 319 }
318 320
319 } // namespace views 321 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698