New issue
Advanced search Search tips

Issue 760663 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome
Pri: 2
Type: Bug-Regression



Sign in to add a comment

The autosign-in toast has a big vertical padding

Project Member Reported by vasi...@chromium.org, Aug 30 2017

Issue description

Chrome Version: 61.0.3163.59 (Official Build) beta (64-bit)
OS: Win, Linux, CrOS

What steps will reproduce the problem?
(1) Visit https://w3c.github.io/webappsec/demos/credential-management/
(2) Click "Sign In"
(3) Create a credential and save it in Chrome
(4) refresh the page and click "Sign in"
  (4+) you may see an account chooser. In that case click on the credential. The next dialog will ask if you agree with auto sign-in. Click "OK" and repeat the step 4.

What is the expected result?
The autosign-in toast appears.

What happens instead?
The toast has a big vertical margin.

The culprit is r493962. Bisected manually.
 
Screenshot from 2017-08-25 17:08:06.png
8.3 KB View Download

Comment 1 by tapted@chromium.org, Aug 30 2017

Cc: bsep@chromium.org
Status: Started (was: Assigned)
Gosh. So.

 - These dialogs use StyledLabel for their Window Title
 - StyledLabel::GetPreferredSize() can't be trusted until the width is known (since it may word-wrap)
 - BubbleFrameView traditionally used title()->GetPreferredSize().height > 0 as an indicator whether room should be made for the title
 - That doesn't work for StyledLabel so r493962 took the stance that if a dialog was to set GetBubbleFrameView()->SetTitleView(..) then it means room should be made for the title
 - So this means the updated logic in BubbleFrameView::HasTitle() now thinks these dialogs want a title


That is, even though ManagePasswordsBubbleView calls SetTitleView() it doesn't actually want a title for this flavour of itself.

To fix, I think I need to change

bool BubbleFrameView::HasTitle() const {
  return custom_title_ != nullptr ||
         default_title_->GetPreferredSize().height() > 0 ||
         title_icon_->GetPreferredSize().height() > 0;
}

into something more complex, like

bool BubbleFrameView::HasTitle() const {
  return (custom_title_ != nullptr &&
          GetWidget()->widget_delegate()->ShouldShowWindowTitle()) ||
         (default_title_ != nullptr &&
          default_title_->GetPreferredSize().height() > 0) ||
         title_icon_->GetPreferredSize().height() > 0;
}


then also override WidgetDelegate::ShouldShowWindowTitle() in ManagePasswordsBubbleView so that BubbleFrameView doesn't have to rely on custom_view_->GetPreferredSize() to show/hide the title (since that is guaranteed to break if the StyledLabel title string ever changes).

-> https://chromium-review.googlesource.com/644389

Comment 2 by bsep@chromium.org, Aug 30 2017

That seems reasonable to me. Thanks for tackling this Trent!
Project Member

Comment 3 by bugdroid1@chromium.org, Aug 31 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c47591e9c88c52f8e6012a85a5c60000e22471c8

commit c47591e9c88c52f8e6012a85a5c60000e22471c8
Author: Trent Apted <tapted@chromium.org>
Date: Thu Aug 31 17:46:37 2017

When a dialog uses SetTitleView() also use ShouldShowWindowTitle().

For regular title views, BubbleFrameView decides whether to add
title margins based on the preferred height of the title view.

This doesn't work for StyledLabel titles. Generally, the preferred
height of label (styled or otherwise) is not meaningful until the
width is known (due to word wrapping). And knowing the width requires
knowing whether title margins are added. So for fancy titles,
BubbleFrameView would use whether a non-null fancy title was added
at all via SetTitleView(). But that doesn't cater to use-cases that
always set a title view, but sometimes don't want to show it.

To cater for this, use WidgetDelegate::ShouldShowWindowTitle() to
determine whether a title should be hidden, even if a dialog has
called SetTitleView().

Bug:  760663 
Change-Id: Ib0feaa6a7408dfdb3ca71f62e6f425abf64ed212
Reviewed-on: https://chromium-review.googlesource.com/644389
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#498915}
[modify] https://crrev.com/c47591e9c88c52f8e6012a85a5c60000e22471c8/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
[modify] https://crrev.com/c47591e9c88c52f8e6012a85a5c60000e22471c8/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
[modify] https://crrev.com/c47591e9c88c52f8e6012a85a5c60000e22471c8/ui/views/bubble/bubble_dialog_delegate_unittest.cc
[modify] https://crrev.com/c47591e9c88c52f8e6012a85a5c60000e22471c8/ui/views/bubble/bubble_frame_view.cc

Comment 4 by tapted@chromium.org, Aug 31 2017

Status: Fixed (was: Started)
Should this be merged?
I don't think this meets the requirements of go/chrome-merges
(assuming you meant an m61 merge. I'm pretty sure this made the m62 cut)

Sign in to add a comment