A smarter default for views::DialogDelegate::ShouldSnapFrameWidth() -> bool (and addressing dialogs with buttons that return `NONE` from DialogDelegate::GetDialogButtons()) |
||
Issue descriptionChrome Version : 60.0.3080.5 OS Version: OS X 10.12.4 Overriding ShouldSnapFrameWidth() gives a concrete DialogDelegate control over whether it should be subject to Harmony consistent dialog-width snapping. Some dialogs are "tooltip-like", such as the PageInfo bubble for chrome:// pages. They shouldn't have extra padding on the right. See Issue 718696 . Other examples: views::TooltipIcon - http://crbug.com/635173#c14 HomePageUndoBubble - http://crbug.com/635173#c21 A common feature of these is that they don't have dialog buttons. So, DialogDelegate::ShouldSnapFrameWidth() could `return DialogDelegate::GetDialogButtons() != ui::DIALOG_BUTTON_NONE;`. But there are dialogs that roll their own buttons which should snap dialog widths. (Note that dialogs with buttons that return ui::DIALOG_BUTTON_NONE from GetDialogButtons may be considered a bug.). Examples (from https://codereview.chromium.org/2863923002/#msg11) - AddBookmark bubble - has 3 buttons, but `Cancel` is in the `ExtraView` spot rather than in the middle. - The new signin flow dialogs - they have a few "sheets" that slide in with different buttons. - WebUI dialogs, with WebUI buttons - chromecast, print preview. - The TranslateBubble - has "TODO: This should be using GetDialogButtons." Currently (in https://codereview.chromium.org/2863923002/), ShouldSnapFrameWidth() returns true by default.
,
May 8 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0657b42372a48280879bb16061dcbd258a360814 commit 0657b42372a48280879bb16061dcbd258a360814 Author: tapted <tapted@chromium.org> Date: Mon May 08 07:39:08 2017 Harmony: Don't snap the width of the chrome:// page info bubbles. Adds views::DialogDelegate::ShouldSnapFrameWidth() -> bool to do this. BUG= 718696 , 719274 Review-Url: https://codereview.chromium.org/2863923002 Cr-Commit-Position: refs/heads/master@{#469914} [modify] https://crrev.com/0657b42372a48280879bb16061dcbd258a360814/chrome/browser/ui/views/page_info/page_info_bubble_view.cc [modify] https://crrev.com/0657b42372a48280879bb16061dcbd258a360814/ui/views/bubble/bubble_frame_view.cc [modify] https://crrev.com/0657b42372a48280879bb16061dcbd258a360814/ui/views/bubble/bubble_frame_view_unittest.cc [modify] https://crrev.com/0657b42372a48280879bb16061dcbd258a360814/ui/views/window/dialog_delegate.cc [modify] https://crrev.com/0657b42372a48280879bb16061dcbd258a360814/ui/views/window/dialog_delegate.h
,
May 10 2017
How's this for a heuristic: if the BubbleDialogDelegateView has exactly one child view, don't snap? That covers both cases mentioned in the initial bug that shouldn't be snapped (both have one child view, a Label) and does snap all the other mentioned dialogs in the initial bug. I'll put up a CL implementing this shortly and we can play with it a bit.
,
May 10 2017
Nope, that doesn't work. In all cases it has one child view, which is the content view, and then the content view has one or more child views of its own, but for the tooltip case, the content view is a StyledLabel which has children of its own. Back to the drawing board!
,
May 10 2017
I was going to say the "one child" thing felt too much like "magic heuristic that happens to coincide in practice with what we want", whereas the idea of "check whether there are buttons" matches better with the actual determination we were using to decide about snapping. Most of the exceptions are due to people rolling their own buttons, some of which we can fix and some of which it seems OK to special-case around.
,
May 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3dbe6a55d833fb5bc63fb36a4e055988fb1d1482 commit 3dbe6a55d833fb5bc63fb36a4e055988fb1d1482 Author: ellyjones <ellyjones@chromium.org> Date: Fri May 12 22:46:25 2017 views: don't snap dialogs with no buttons These are mostly bubbles/infobars/etc that do not need to be snapped. BUG= 719274 Review-Url: https://codereview.chromium.org/2880433002 Cr-Commit-Position: refs/heads/master@{#471471} [modify] https://crrev.com/3dbe6a55d833fb5bc63fb36a4e055988fb1d1482/chrome/browser/ui/views/page_info/page_info_bubble_view.cc [modify] https://crrev.com/3dbe6a55d833fb5bc63fb36a4e055988fb1d1482/ui/views/bubble/bubble_frame_view_unittest.cc [modify] https://crrev.com/3dbe6a55d833fb5bc63fb36a4e055988fb1d1482/ui/views/window/dialog_delegate.cc [modify] https://crrev.com/3dbe6a55d833fb5bc63fb36a4e055988fb1d1482/ui/views/window/dialog_delegate_unittest.cc
,
May 15 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by pkasting@chromium.org
, May 8 2017Owner: ellyjo...@chromium.org
Status: Assigned (was: Available)