Closed Bug 1644461 Opened 4 years ago Closed 4 years ago

Prepare sidebar CSS and rendering for the new macOS vibrancy implementation

Categories

(Firefox :: Theme, task)

task

Tracking

()

RESOLVED FIXED
Firefox 79
Tracking Status
firefox79 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(3 files)

Bug 1592739 will change vibrancy so that it only works if nothing is rendered behind the vibrant element. To make this work properly with the browser sidebars, both in lwtheme mode and without, we need some changes.

Depends on: 1493789

This is needed because under the new vibrancy model, vibrant -moz-appearance
values only work on elements that have nothing rendered behind them. The elements
with the vibrant appearance become truly transparent.

When a tree row in the sidebar is selected, the background of that selected row
is styled with -moz-appearance: -moz-mac-(active-)source-list-selection.
We have two ways of rendering such selections:

  1. With vibrancy, on 10.10+ if the sidebar itself uses vibrancy, and
  2. With a solid fill, on 10.9 or if the sidebar itself does not use vibrancy.

In the Firefox main browser window, sidebar styling crosses document boundaries.

<hbox id="browser">
  <vbox id="sidebar-box">  <-- this one has -moz-appearance: -moz-mac-source-list (or not)
    <browser> (bookmarksSidebar.xhtml or historySidebar.xhtml)
      <window>
        <tree> <-- this contains the tree body frame which renders the tree contents,
                   including the selection backgrounds

We detect whether "the sidebar itself uses vibrancy" by walking up the frame tree
and looking for a frame with -moz-appearance: -moz-mac-source-list.
In the past, this lookup was inconsistent between nsTreeBodyFrame.cpp and theme rendering,
and it stopped at document boundaries. This patch makes the implementations more
consistent and allows it to cross document boundaries.

The old code only worked with the given DOM structure because -moz-appearance: -moz-mac-source-list
was repeated on the <tree> element. I'd like to remove that duplication.
The new code works correctly if -moz-appearance: -moz-mac-source-list is only set
on <vbox id="sidebar-box"> and not repeated on the tree.

Depends on D51465

This -moz-appearance is already set on #sidebar-box, in the main browser document.
Furthermore, we don't want to set the -moz-appearance when lwthemes are used, and
(as far as I can tell) we cannot detect lwtheme usage with :-moz-lwtheme in the
nested documents (bookmarksSidebar.xhtml, historySidebar.xhtml, syncedtabs/sidebar.xhtml).

Depends on D78924

Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/81cffaeae7f6 Make the sidebar non-vibrant when any lwtheme is in use. r=ntim https://hg.mozilla.org/integration/autoland/rev/fad8f87c1f8f When determining whether sidebar selections should use vibrancy, check all ancestor frames. r=miko https://hg.mozilla.org/integration/autoland/rev/6f6757bfd329 Drop -moz-appearance: -moz-mac-source-list; declarations from the nested sidebar documents. r=dao
Regressions: 1594132
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 79
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: