New issue
Advanced search Search tips

Issue 725956 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Reduce overdraw on bookmark bar

Project Member Reported by yiyix@chromium.org, May 24 2017

Issue description

The bookmark bar always contains 2 layers of overdraw. We created a layer at bookmark bar initialization time to animate the showing/hiding motion of bookmark bar. 

This layer should be added before animation and destroyed afterwards.

By using @reveman's tool, I get the screenshot in the attachment.
 
Screenshot from 2017-05-03 22:19:12.png
13.4 KB View Download

Comment 1 by danakj@chromium.org, May 24 2017

Agree that we should remove the layer. But also jw is the layer marked as opaque? (ui::Layer::SetFillsBoundsOpaquely)

Comment 2 by danakj@chromium.org, May 24 2017

> Agree that we should remove the layer

After the animation like you said, ofc.

Comment 3 by est...@chromium.org, May 24 2017

> But also jw is the layer marked as opaque?

Is "jw" short for "just why"? Isn't it faster if the layer is opaque? Since there's text on the bar we have to paint in the background or we get subpixel rendering issues. As long as the bg is being painted we might as well use the opaque layer optimization.

Comment 4 by danakj@chromium.org, May 24 2017

"just wondering"

If it's not opaque then it won't occlude so you'd def get overdraw. I am wondering if the layer was forgotten to be marked opaque even tho it is.

Comment 5 by est...@chromium.org, May 24 2017

oh yea, you're right, it's explicitly marked as not opaque.[1] There goes my subpixel aa theory.  I can't remember offhand if the background[2] is always opaque. Should look into that.

[1] https://cs.chromium.org/chromium/src/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc?rcl=fe9fc5308c333d5dd084872675cff77ff87c894c&l=608
[2] https://cs.chromium.org/chromium/src/chrome/browser/ui/views/frame/browser_view.cc?rcl=7de5d92d63eab0410c6e679510ca65941d59587b&l=377

Comment 6 by yiyix@chromium.org, May 25 2017

Cc: sky@chromium.org
I prefer the approach of using the opaque layer: 
- there will be no overdraw 
- the animation looks more smooth than creating the layer at the start of animation.

Regarding the Evan's comments
I tried to print the opacity in the 2nd reference, it's always equal to 1.

I tried to change the line in 1st reference to layer()->SetFillsBoundsOpaquely(true); It works fine regarding the overdraw problem. However, if the bookmark bar is hidden and a new window is opened, I saw a blue line on top of the bookmark bar as show in the attachment. I will investigate on what caused this.
Screenshot from 2017-05-25 00_55_10.png
27.9 KB View Download

Comment 7 by est...@chromium.org, May 25 2017

> I tried to print the opacity in the 2nd reference, it's always equal to 1.

Even for themed windows? It seems likely this could be different for certain themes.

Comment 8 by danakj@chromium.org, May 25 2017

> I tried to print the opacity in the 2nd reference, it's always equal to 1.

SetFillsBoundsOpaquely refers to the pixel content in the window, not the opacity. The alpha of every pixel should be 0.

Comment 9 by danakj@chromium.org, May 25 2017

> I saw a blue line on top of the bookmark bar as show in the attachment. I will investigate on what caused this.

In a debug build, that cyan is an area of the layer for which no paint command was given: https://cs.chromium.org/chromium/src/cc/debug/debug_colors.cc?rcl=d4d25fc7cc5cebdee0a46b5f679c7a0fe9732c96&l=268

Comment 10 Deleted

Comment 11 by yiyix@chromium.org, May 30 2017

I have been working on a cl for this issue: https://codereview.chromium.org/2899133004/ I get the attached screenshot for after updating the bookmark layer to opaque. 

As I have replied in the cl, bookmark bar is always opaque:
For attached case, we first paint background color of the toolbar which is always opaque (ref: https://cs.chromium.org/chromium/src/chrome/browser/themes/browser_theme_pack.cc?type=cs&q=BrowserThemePack::GetColor&l=739), then we paint the image from the theme on the bookmark bar. (the order of painting can be found in https://cs.chromium.org/chromium/src/chrome/browser/ui/views/frame/browser_view.cc?sq=package:chromium&dr=CSs&l=240). I also searched on if we plan to support transparent theme, i found this bug, https://bugs.chromium.org/p/chromium/issues/detail?id=244892, and is marked as "won't fix".

For detached case, I found this comment in browser_view, https://cs.chromium.org/chromium/src/chrome/browser/ui/views/frame/browser_view.cc?sq=package:chromium&dr=CSs&l=208, which explains the color for view must be painted opaquely and the layer can be semi-transparent.


Therefore, i believe it is safe to mark the bookmark bar layer opaque.
(thanks @danakj and @bsep)


Screenshot from 2017-05-30 15:11:12.png
42.9 KB View Download
Project Member

Comment 12 by bugdroid1@chromium.org, Jun 2 2017

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

commit 7073ae5bc6af913c649500e015210992f9c7111a
Author: yiyix <yiyix@chromium.org>
Date: Fri Jun 02 04:46:13 2017

Reduce overdraw on bookmark bar

The bookmark bar always experience 2 layers of overdraw because the layers
are marked as non-opaque. After research, I noticed that it is always opaque
for both attached and detached bookmark bar with or without theme, so the
top layer is now marked as opaque.

The bookmark bar and the toolbar is overlapped for the toolbar to control the
show/hide animation of the separator between them. This cl also updates the
location and the height of bookmark bar to avoid the overlapping.

BUG= 725956 

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

[modify] https://crrev.com/7073ae5bc6af913c649500e015210992f9c7111a/chrome/browser/ui/bookmarks/bookmark_bar_constants.h
[modify] https://crrev.com/7073ae5bc6af913c649500e015210992f9c7111a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
[modify] https://crrev.com/7073ae5bc6af913c649500e015210992f9c7111a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
[modify] https://crrev.com/7073ae5bc6af913c649500e015210992f9c7111a/chrome/browser/ui/views/frame/browser_view.cc
[modify] https://crrev.com/7073ae5bc6af913c649500e015210992f9c7111a/chrome/browser/ui/views/frame/browser_view_layout.cc
[modify] https://crrev.com/7073ae5bc6af913c649500e015210992f9c7111a/chrome/browser/ui/views/frame/browser_view_unittest.cc

Status: Fixed (was: Assigned)

Comment 14 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment