From 17aef36fd60f6e41fb1ce95a407eb058a690d514 Mon Sep 17 00:00:00 2001 From: "Matt Woodrow ext:(%2C%20Miko%20Mynttinen%20%3Cmikokm%40gmail.com%3E%2C%20Timothy%20Nikkel%20%3Ctnikkel%40gmail.com%3E)" Date: Wed, 27 Sep 2017 17:03:38 +1300 Subject: [PATCH] Bug 1404181 - Part 7: Add a way to check if existing painted items might need to be redrawn for a sync decode. r=mstange MozReview-Commit-ID: 98qxakaKolI --HG-- extra : rebase_source : 079fe441ed82ef59b4300fc9d1a8ce5f0cf51b7b --- layout/generic/nsBulletFrame.cpp | 5 +++ layout/generic/nsPluginFrame.cpp | 5 +++ layout/generic/nsPluginFrame.h | 20 ++++++++++++ layout/painting/nsDisplayListInvalidation.h | 35 +++++++++++++++++++++ 4 files changed, 65 insertions(+) diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index c1663957d37d..06b91013d1f2 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -188,6 +188,11 @@ public: mOrdinal = f->GetOrdinal(); } + virtual bool InvalidateForSyncDecodeImages() const override + { + return ShouldInvalidateToSyncDecodeImages(); + } + int32_t mOrdinal; }; diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index c708d15e4b27..baf64cce1c0e 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -915,6 +915,11 @@ public: { return LAYER_ACTIVE; } + + virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override + { + return new nsDisplayPluginGeometry(this, aBuilder); + } }; static nsRect diff --git a/layout/generic/nsPluginFrame.h b/layout/generic/nsPluginFrame.h index 5fe3828dcf51..e27b06587470 100644 --- a/layout/generic/nsPluginFrame.h +++ b/layout/generic/nsPluginFrame.h @@ -348,6 +348,21 @@ private: mozilla::UniquePtr mDidCompositeObserver; }; +class nsDisplayPluginGeometry : public nsDisplayItemGenericGeometry +{ +public: + nsDisplayPluginGeometry(nsDisplayItem *aItem, nsDisplayListBuilder* aBuilder) + : nsDisplayItemGenericGeometry(aItem, aBuilder) + {} + + // Plugins MozPaintWait event depends on sync decode, so we always want + // to rebuild the display list when sync decoding. + virtual bool InvalidateForSyncDecodeImages() const override + { + return true; + } +}; + class nsDisplayPlugin : public nsDisplayItem { public: nsDisplayPlugin(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) @@ -391,6 +406,11 @@ public: aManager); } + virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override + { + return new nsDisplayPluginGeometry(this, aBuilder); + } + virtual bool CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder, mozilla::wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc, diff --git a/layout/painting/nsDisplayListInvalidation.h b/layout/painting/nsDisplayListInvalidation.h index 250ca94ce6ac..1b3e53c8a2c6 100644 --- a/layout/painting/nsDisplayListInvalidation.h +++ b/layout/painting/nsDisplayListInvalidation.h @@ -61,6 +61,11 @@ public: mBounds.MoveBy(aOffset); } + virtual bool InvalidateForSyncDecodeImages() const + { + return false; + } + /** * Bounds of the display item */ @@ -170,6 +175,11 @@ public: : nsDisplayItemGenericGeometry(aItem, aBuilder) , nsImageGeometryMixin(aItem, aBuilder) { } + + virtual bool InvalidateForSyncDecodeImages() const override + { + return ShouldInvalidateToSyncDecodeImages(); + } }; class nsDisplayItemBoundsGeometry : public nsDisplayItemGeometry @@ -189,6 +199,11 @@ public: virtual void MoveBy(const nsPoint& aOffset) override; + virtual bool InvalidateForSyncDecodeImages() const override + { + return ShouldInvalidateToSyncDecodeImages(); + } + nsRect mContentRect; }; @@ -201,6 +216,11 @@ public: virtual void MoveBy(const nsPoint& aOffset) override; + virtual bool InvalidateForSyncDecodeImages() const override + { + return ShouldInvalidateToSyncDecodeImages(); + } + nsRect mPositioningArea; nsRect mDestRect; }; @@ -286,6 +306,11 @@ class nsDisplayMaskGeometry : public nsDisplaySVGEffectGeometry public: nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder); + virtual bool InvalidateForSyncDecodeImages() const override + { + return ShouldInvalidateToSyncDecodeImages(); + } + nsTArray mDestRects; }; @@ -295,6 +320,11 @@ class nsDisplayFilterGeometry : public nsDisplaySVGEffectGeometry public: nsDisplayFilterGeometry(nsDisplayFilter* aItem, nsDisplayListBuilder* aBuilder); + + virtual bool InvalidateForSyncDecodeImages() const override + { + return ShouldInvalidateToSyncDecodeImages(); + } }; class nsCharClipGeometry : public nsDisplayItemGenericGeometry @@ -316,6 +346,11 @@ public: nsDisplayListBuilder* aBuilder, const nsPoint& aFrameOffsetToViewport); + virtual bool InvalidateForSyncDecodeImages() const override + { + return ShouldInvalidateToSyncDecodeImages(); + } + nsPoint mFrameOffsetToViewport; };