mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
7b1b52b19b
This code was assuming that the only non-opaque parts of compositor rendering would be the parts of the window that had vibrancy. But now that the default window background is transparent, we can have non-vibrant parts where we render into transparency. Dialog windows such as sheet windows are an example of this. So instead of using the non-vibrant region of the window as its opaque region, we now use the region that is covered by opaque Gecko layers. This region is a lot more conservative: For example, the main browser chrome is now entirely transparent, because the chrome's opaque parts share a layer with its transparent parts. As a result, this change slightly affects the CALayer partitioning in the main browser window: The entire browser chrome is now transparent, not just the tab bar. The web content area is still opaque. I think this will be fine. The thing I'm most concerned about is that scrolling inside web content might cause invalidations of pixels from the chrome, because then we'd recomposite the CALayers that cover the vibrant tab bar. This doesn't seem to happen most of the time though, from what I can tell. Differential Revision: https://phabricator.services.mozilla.com/D51466
108 lines
3.3 KiB
C++
108 lines
3.3 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "InProcessCompositorWidget.h"
|
|
|
|
#include "mozilla/VsyncDispatcher.h"
|
|
#include "nsBaseWidget.h"
|
|
|
|
#if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING)
|
|
# include "mozilla/widget/AndroidCompositorWidget.h"
|
|
#endif
|
|
|
|
namespace mozilla {
|
|
namespace widget {
|
|
|
|
// Platforms with no OOP compositor process support use
|
|
// InProcessCompositorWidget by default.
|
|
#if !defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING)
|
|
/* static */
|
|
RefPtr<CompositorWidget> CompositorWidget::CreateLocal(
|
|
const CompositorWidgetInitData& aInitData,
|
|
const layers::CompositorOptions& aOptions, nsIWidget* aWidget) {
|
|
MOZ_ASSERT(aWidget);
|
|
# ifdef MOZ_WIDGET_ANDROID
|
|
return new AndroidCompositorWidget(aOptions,
|
|
static_cast<nsBaseWidget*>(aWidget));
|
|
# else
|
|
return new InProcessCompositorWidget(aOptions,
|
|
static_cast<nsBaseWidget*>(aWidget));
|
|
# endif
|
|
}
|
|
#endif
|
|
|
|
InProcessCompositorWidget::InProcessCompositorWidget(
|
|
const layers::CompositorOptions& aOptions, nsBaseWidget* aWidget)
|
|
: CompositorWidget(aOptions), mWidget(aWidget) {}
|
|
|
|
bool InProcessCompositorWidget::PreRender(WidgetRenderingContext* aContext) {
|
|
return mWidget->PreRender(aContext);
|
|
}
|
|
|
|
void InProcessCompositorWidget::PostRender(WidgetRenderingContext* aContext) {
|
|
mWidget->PostRender(aContext);
|
|
}
|
|
|
|
RefPtr<layers::NativeLayerRoot>
|
|
InProcessCompositorWidget::GetNativeLayerRoot() {
|
|
return mWidget->GetNativeLayerRoot();
|
|
}
|
|
|
|
already_AddRefed<gfx::DrawTarget>
|
|
InProcessCompositorWidget::StartRemoteDrawing() {
|
|
return mWidget->StartRemoteDrawing();
|
|
}
|
|
|
|
already_AddRefed<gfx::DrawTarget>
|
|
InProcessCompositorWidget::StartRemoteDrawingInRegion(
|
|
LayoutDeviceIntRegion& aInvalidRegion, layers::BufferMode* aBufferMode) {
|
|
return mWidget->StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
|
|
}
|
|
|
|
void InProcessCompositorWidget::EndRemoteDrawing() {
|
|
mWidget->EndRemoteDrawing();
|
|
}
|
|
|
|
void InProcessCompositorWidget::EndRemoteDrawingInRegion(
|
|
gfx::DrawTarget* aDrawTarget, const LayoutDeviceIntRegion& aInvalidRegion) {
|
|
mWidget->EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion);
|
|
}
|
|
|
|
void InProcessCompositorWidget::CleanupRemoteDrawing() {
|
|
mWidget->CleanupRemoteDrawing();
|
|
}
|
|
|
|
void InProcessCompositorWidget::CleanupWindowEffects() {
|
|
mWidget->CleanupWindowEffects();
|
|
}
|
|
|
|
bool InProcessCompositorWidget::InitCompositor(
|
|
layers::Compositor* aCompositor) {
|
|
return mWidget->InitCompositor(aCompositor);
|
|
}
|
|
|
|
LayoutDeviceIntSize InProcessCompositorWidget::GetClientSize() {
|
|
return mWidget->GetClientSize();
|
|
}
|
|
|
|
uint32_t InProcessCompositorWidget::GetGLFrameBufferFormat() {
|
|
return mWidget->GetGLFrameBufferFormat();
|
|
}
|
|
|
|
uintptr_t InProcessCompositorWidget::GetWidgetKey() {
|
|
return reinterpret_cast<uintptr_t>(mWidget);
|
|
}
|
|
|
|
nsIWidget* InProcessCompositorWidget::RealWidget() { return mWidget; }
|
|
|
|
void InProcessCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
|
|
if (RefPtr<CompositorVsyncDispatcher> cvd =
|
|
mWidget->GetCompositorVsyncDispatcher()) {
|
|
cvd->SetCompositorVsyncObserver(aObserver);
|
|
}
|
|
}
|
|
|
|
} // namespace widget
|
|
} // namespace mozilla
|