New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 711012 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 1
Type: Bug



Sign in to add a comment

Regression: Bubble title/content misalignment pre-Harmony

Project Member Reported by pkasting@chromium.org, Apr 12 2017

Issue description

Various bubbles have title/content misaligned, or did until people started landing bandaids to fix them; see e.g.  bug 704575 .

The root cause of this looks to be https://codereview.chromium.org/2571613002 , which changed BubbleDialogDelegateView::CreateNonClientFrameView() to call views_delegate->GetDialogFrameViewInsets().  In the current code, this lives in the constructor of BubbleDialogDelegateView, and is the line:

  title_margins_ = views_delegate->GetInsetsMetric(InsetsMetric::DIALOG_TITLE);

This resulted in a behavior change pre-Harmony, because the dialog title's horizontal insets differ from the previous ones used there.  In the nomenclature of the old views constants, we went from using kPanelHorizMargin to kButtonHEdgeMarginNew.  The bubble contents remained using the panel margin, and the panel margin seems more semantically correct to me.

So I think step 1 on this bug is ensuring that the bubble title margins are set to the old values pre-Harmony.  In Harmony, these values (which map to PANEL_CONTENT_MARGIN and DIALOG_BUTTON_MARGIN) are both kHarmonyLayoutUnit, so we'll see no visible effect.

Step 2 is unwinding the various bandaids people have landed when they didn't trace back to fix the real root cause here.  For example:

* https://codereview.chromium.org/2773733002 for  bug 704575  can probably just be reverted
* https://codereview.chromium.org/2800723003 was landed in response to the above but I think does not need to be reverted, it looks like the previous code was newly written after the original problem above and thus was just wrong
* https://codereview.chromium.org/2640593002 was landed in response to the original change; I'm wondering if maybe if this is all fixed, we can unwind this a bit and go back to the idea of not having separate title/contents margins for bubbles
* Maybe other CLs did similar things?  I didn't look; possibly searching for people who call set_title_margins() will turn something up
 
Cc: bettes@chromium.org jasonkliu@chromium.org pkasting@chromium.org mrefaat@chromium.org
 Issue 710212  has been merged into this issue.
Step 1 seems to be done already merely due to the churn around the LayoutProvider and similar other changes.


I don't think so -- bubbles are using INSETS_DIALOG_TITLE for the title area, which uses kButtonHEdgeMarginNew for horizontal insets.  We need to use kPanelHorizMargin for that value for bubbles.

The two ways to do this are either to add INSETS_BUBBLE_TITLE, or to compute the correct insets from INSETS_BUBBLE_CONTENTS directly in BubbleDialogDelegateView.  The latter route would suggest doing something similar for dialogs -- removing INSETS_DIALOG_TITLE and instead just having INSETS_PANEL (maybe renamed INSETS_DIALOG) and computing the title insets from that in DialogDelegate.

Then post-Harmony maybe we nuke INSETS_BUBBLE entirely, since in Harmony bubbles/dialogs are all the same insets.
Oh... Right. I got it backwards.
Project Member

Comment 6 by bugdroid1@chromium.org, Apr 19 2017

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

commit 5d0f09e42f23950e3937e36e5bdc3a384f732330
Author: kylixrd <kylixrd@chromium.org>
Date: Wed Apr 19 16:45:10 2017

Restored Pre-Harmony Bubble title margin metrics

Added INSETS_BUBBLE_TITLE metric to distinguish from INSETS_DIALOG_TITLE

BUG= 711012 
BUG= 705907 

Review-Url: https://codereview.chromium.org/2819633002
Cr-Commit-Position: refs/heads/master@{#465635}

[modify] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/chrome/browser/ui/views/harmony/harmony_layout_provider.cc
[modify] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
[add] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
[modify] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/chrome/browser/ui/views/passwords/password_dialog_view_browsertest.cc
[modify] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/chrome/browser/ui/views/session_crashed_bubble_view.h
[add] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/chrome/browser/ui/views/session_crashed_bubble_view_browsertest.cc
[modify] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/chrome/test/BUILD.gn
[modify] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/ui/views/bubble/bubble_dialog_delegate.cc
[modify] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/ui/views/layout/layout_provider.cc
[modify] https://crrev.com/5d0f09e42f23950e3937e36e5bdc3a384f732330/ui/views/layout/layout_provider.h

Status: Fixed (was: Assigned)

Sign in to add a comment