Bug 1574592 - Add CompositorWidget::GetOpaqueWidgetRegion. r=mattwoodrow

This lets LayerManagerComposite and RendererOGL set the correct opaque region
on the native layer.

Differential Revision: https://phabricator.services.mozilla.com/D42401

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-08-25 21:41:58 +00:00
Родитель 222be5a822
Коммит c3d94ae29a
6 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -252,6 +252,24 @@ class CompositorWidget {
*/
virtual already_AddRefed<gfx::SourceSurface> EndBackBufferDrawing();
#ifdef XP_MACOSX
/**
* Return the opaque region of the widget. This is racy and can only be used
* on macOS, where the widget works around the raciness.
* Bug 1576491 tracks fixing this properly.
* The problem with this method is that it can return values "from the future"
* - the compositor might be working on frame N but the widget will return its
* opaque region from frame N + 1.
* It is believed that this won't lead to visible glitches on macOS due to the
* SuspendAsyncCATransactions call when the vibrant region changes or when the
* window resizes. Whenever the compositor uses an opaque region that's a
* frame ahead, the result it renders won't be shown on the screen; instead,
* the next composite will happen with the correct display list, and that's
* what's shown on the screen once the FlushRendering call completes.
*/
virtual LayoutDeviceIntRegion GetOpaqueWidgetRegion() { return {}; }
#endif
/**
* Observe or unobserve vsync.
*/

Просмотреть файл

@ -110,6 +110,12 @@ uintptr_t InProcessCompositorWidget::GetWidgetKey() {
nsIWidget* InProcessCompositorWidget::RealWidget() { return mWidget; }
#ifdef XP_MACOSX
LayoutDeviceIntRegion InProcessCompositorWidget::GetOpaqueWidgetRegion() {
return mWidget->GetOpaqueWidgetRegion();
}
#endif
void InProcessCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
if (RefPtr<CompositorVsyncDispatcher> cvd =
mWidget->GetCompositorVsyncDispatcher()) {

Просмотреть файл

@ -38,6 +38,9 @@ class InProcessCompositorWidget : public CompositorWidget {
virtual bool InitCompositor(layers::Compositor* aCompositor) override;
virtual LayoutDeviceIntSize GetClientSize() override;
virtual uint32_t GetGLFrameBufferFormat() override;
#ifdef XP_MACOSX
virtual LayoutDeviceIntRegion GetOpaqueWidgetRegion() override;
#endif
virtual void ObserveVsync(VsyncObserver* aObserver) override;
virtual uintptr_t GetWidgetKey() override;

Просмотреть файл

@ -568,6 +568,8 @@ class nsChildView final : public nsBaseWidget {
virtual LayoutDeviceIntPoint GetClientOffset() override;
virtual LayoutDeviceIntRegion GetOpaqueWidgetRegion() override;
void DispatchAPZWheelInputEvent(mozilla::InputData& aEvent, bool aCanTriggerSwipe);
nsEventStatus DispatchAPZInputEvent(mozilla::InputData& aEvent);

Просмотреть файл

@ -1590,6 +1590,11 @@ LayoutDeviceIntPoint nsChildView::WidgetToScreenOffset() {
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
}
LayoutDeviceIntRegion nsChildView::GetOpaqueWidgetRegion() {
auto opaqueRegion = mOpaqueRegion.Lock();
return *opaqueRegion;
}
nsresult nsChildView::SetTitle(const nsAString& title) {
// child views don't have titles
return NS_OK;

Просмотреть файл

@ -476,6 +476,9 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
}
virtual uint32_t GetGLFrameBufferFormat();
virtual bool CompositorInitiallyPaused() { return false; }
#ifdef XP_MACOSX
virtual LayoutDeviceIntRegion GetOpaqueWidgetRegion() { return {}; }
#endif
protected:
void ResolveIconName(const nsAString& aIconName, const nsAString& aIconSuffix,