[snap] with CSD and Yaru, background color of the header bar is incorrect

Bug #1800260 reported by Jeff Vehrs
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
chromium-browser (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Description: Ubuntu 18.04.1 LTS
Release: 18.04

Channel: Stable
Version: 70.0.3538.67
Updated: 10/19/2018
License: Free
Developer: Canonical
Source: Snap Store
Installed Size: 148.2 MB

Settings -> Appearance: "Use system title bar and borders" was turned off. Close, minimize, maximize buttons became oval (more of stretched down) instead of circle. Turned back it on, buttons went back to normal shape (circle). It's a repeatable action.

Tags: snap
Paul White (paulw2u)
summary: - close, minimize, maximize buttons look funny
+ [snap] close, minimize, maximize buttons look funny
Revision history for this message
Olivier Tilloy (osomon) wrote : Re: [snap] close, minimize, maximize buttons look funny

Thanks for the report Jeff. I can reliably observe the problem in a bionic VM.
I also tested the snap in the candidate channel (based on core18), and there are also issues with the custom rendering of the window title bar and borders, although they are different (only the close button is visible, minimize and maximize can be hovered and clicked but they are not rendered properly).

Changed in chromium-browser (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
tags: added: snap
Revision history for this message
Olivier Tilloy (osomon) wrote : Re: [snap] with CSD, minimize and maximize buttons are invisible until hovered

Updated the bug title because all chromium snaps are based off core18, and the symptoms are slightly different to what was initially reported.

summary: - [snap] close, minimize, maximize buttons look funny
+ [snap] with CSD, minimize and maximize buttons are invisible until
+ hovered
Revision history for this message
Olivier Tilloy (osomon) wrote :

Preliminary investigation: the code in chromium responsible for looking up the theme color for the header bar is there: https://cs.chromium.org/chromium/src/chrome/browser/ui/libgtkui/gtk_ui.cc?type=cs&l=864.

Outside of the snap confinement, the query for "#headerbar.header-bar.titlebar" returns the expected RGB value (for Yaru) of (43,43,41). But within the snap confinement the computed value is (242,242,242).

I suspect the version of Yaru that's in gtk-common-themes has something to do with this, but I need to write a minimal reproducer to verify that.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I updated the title to reflect the fact that only Yaru (or communitheme on older releases) seems to be affected. All the other themes that I tested behave correctly.

summary: - [snap] with CSD, minimize and maximize buttons are invisible until
- hovered
+ [snap] with CSD and Yaru, background color of the header bar is
+ incorrect
Revision history for this message
Olivier Tilloy (osomon) wrote :

This is not a confinement problem, as the same happens when the snap is installed in devmode.

Something must be missing, either in the gtk-common-themes snap or in the snapcraft-desktop-helpers desktop-launch script, but I don't know what yet.

I straced the execution of the snap, and it locates and opens the expected css file (~/snap/chromium/current/.local/share/themes/Yaru/gtk-3.20/gtk.css), so it's puzzling that it doesn't extract the right background color value for the headerbar.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I modified Yaru in the gtk-common-themes snap with different, garish colors for the focused and unfocused headerbar. In other snaps such as gnome-calculator these new colors were picked up as expected. In chromium, only the unfocused color was applied, the focused one remained (242,242,242).

Revision history for this message
Olivier Tilloy (osomon) wrote :

I tested a few more things, unsuccessfully:

 - I modified the Yaru theme css in gtk-common-themes to remove the ".titlebar:not(headerbar)," selector, keeping only the "headerbar" selector for header bars, but no difference

 - I modified the custom selector in gtk_ui.cc to be just "#headerbar" instead of "#headerbar.header-bar.titlebar", but no difference

 - I instrumented AppendCssNodeToStyleContext() in gtk_util.cc to print out the actual selectors being queried at the end of the function, just before the return statement, and they looked correct ("window⤶headerbar" and "window⤶headerbar:backdrop")

Revision history for this message
Olivier Tilloy (osomon) wrote :

I tested in an XFCE/XUbuntu session, and the focused headerbar color was correct, so there's something specific to the Ubuntu/GNOME session.

Revision history for this message
Olivier Tilloy (osomon) wrote :

This doesn't appear to be chromium-specific, nor Yaru-specific. I initially thought that only Yaru was exhibiting an incorrect background color for the focused headerbar, but I am now seeing an incorrect color with the gnome-calculator snap when using Adwaita.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I'm attaching a screenshot demonstrating my claim above, showing gnome-calculator as a snap on the left, and from the deb on the right. This is in a clean and up-to-date disco VM, with Adwaita as the default theme. Colours clearly aren't right with the snap.

Revision history for this message
Olivier Tilloy (osomon) wrote :
Revision history for this message
Olivier Tilloy (osomon) wrote :

(and both are focused, of course)

Revision history for this message
Olivier Tilloy (osomon) wrote :

As pointed out by Nicolás in https://forum.snapcraft.io/t/call-for-testing-chromium-browser-deb-to-snap-transition/11772/14, the gtk-common-themes snap in the candidate channel appears to fix the problem.

I am now trying to bisect what change fixed the problem, and I will talk to the maintainers to have it promoted to stable.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I am not sure exactly which commit fixed the problem, but I suspect it's an update in Yaru itself.
Possibly one of those:

  https://github.com/ubuntu/yaru/commit/4a6484deaa19c284344923efb1ccdc1998325aef
  https://github.com/ubuntu/yaru/commit/a0ff34f379d2b2d4673f4910970fdb02756b03b3

Revision history for this message
Olivier Tilloy (osomon) wrote :

The gtk-common-theme snap in the candidate channel has now been promoted to stable, so I'm closing this bug.

Changed in chromium-browser (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.