Closed Bug 1055585 Opened 10 years ago Closed 10 years ago

Add support for clearing window contents behind themed frames with certain -moz-appearance values

Categories

(Core :: Graphics: Layers, defect)

All
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(5 files)

This is for the Mac OS 10.10 behind-window vibrancy style (bug 1051522), which looks similar to the Windows glass effect. It's primarily used for sidebars. Vibrancy works by declaring vibrant regions to the window server, and during painting, clearing the background of these areas and painting any contents into full transparency. I'd like a way for nsITheme to tell layers "Please clear the window background behind this widget". Then we can put vibrant widgets onto any opaque widget in the window, and our stylesheets don't have to make sure that the stuff that's behind the widget is also transparent. It also means that the window itself won't have to be transparent, so things that are outside the vibrant parts still know that they paint onto something opaque. (I'm not really sure how this part works with glass.) My suggested approach is to add an nsITheme API, nsITheme::NeedToClearBackgroundBehindWidget, and a new display item nsDisplayClearBackground, which translates into a transparent ColorLayer that has a blend mode of OP_SOURCE. Then we declare that background clearing is only supported if the stacking context around the widget is the window itself and forget about the hard cases. Does that sound like a sensible approach?
This adds nsDisplayClearBackground. nsDisplayClearBackground is opaque in the sense that it doesn't matter what's painted behind it. I think the parent layer scale comment in the patch probably isn't worth worrying about, because if there's a parent layer then it won't work anyway because it's not directly drawing into the window.
Attachment #8475218 - Flags: feedback?(roc)
Attachment #8475220 - Flags: review?(matt.woodrow)
It seems this got broken at some point. At the moment, the only caller of this is only calling it if there already is an nsDisplayList that NeedsTransparentSurface(). I also don't know if this is a good place to add the call. Thoughts?
Attachment #8475224 - Flags: review?(roc)
The purpose of part 3 and 4 is to flag the root ContainerLayer as not supporting component alpha children, because 2-pass component alpha layer rendering simply doesn't work on top of transparent window backgrounds.
Attachment #8475218 - Attachment description: add-displayclearbackground → part 1: Add nsDisplayClearBackground
This is very similar to Windows' nsWindow::UpdateThemeGeometries, which calls LayerManager::SetRegionToClear, which should work on GL too. Can you use that approach instead?
I think that will clear a region in the final composited result, whereas I'd like to clear between painting the window background and the sidebar foreground.
Flags: needinfo?(mstange)
Comment on attachment 8475224 [details] [diff] [review] part 4: Call nsDisplayList::SetNeedsTransparentSurface Review of attachment 8475224 [details] [diff] [review]: ----------------------------------------------------------------- This probably got lost during a rebase or something.
Attachment #8475224 - Flags: review?(roc) → review+
Attachment #8475227 - Flags: review?(roc)
Comment on attachment 8475220 [details] [diff] [review] part 2: Support operator source in CompositorOGL Review of attachment 8475220 [details] [diff] [review]: ----------------------------------------------------------------- r=me with the default dstBlendAlpha value fixed. ::: gfx/layers/opengl/CompositorOGL.cpp @@ +976,5 @@ > } > > GLenum srcBlend; > GLenum dstBlend; > + GLenum dstBlendAlpha = LOCAL_GL_ONE_MINUS_SRC_ALPHA; Shouldn't this just be LOCAL_GL_ONE?
Attachment #8475220 - Flags: review?(matt.woodrow) → review+
Comment on attachment 8475220 [details] [diff] [review] part 2: Support operator source in CompositorOGL oops yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: