Closed Bug 1382985 Opened 7 years ago Closed 7 years ago

Image animation doesn't work in layers-free mode

Categories

(Core :: Graphics: WebRender, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: ethlin, Assigned: ethlin)

References

Details

Attachments

(1 file)

Originally nsImageFrame uses InvalidateLayer() to update the image. For layers-free, we need an alternative way to do this.

[1] https://dxr.mozilla.org/mozilla-central/source/layout/generic/nsImageFrame.cpp?q=nsImageFrame.cpp&redirect_type=direct#644
Comment on attachment 8889292 [details]
Bug 1382985 - Support image animation for layers-free mode.

https://reviewboard.mozilla.org/r/160342/#review166236

::: layout/generic/nsImageFrame.cpp:645
(Diff revision 2)
>  
>  void
>  nsImageFrame::InvalidateSelf(const nsIntRect* aLayerInvalidRect,
>                               const nsRect* aFrameInvalidRect)
>  {
> +  if (gfxPrefs::WebRenderLayersFree() && HasProperty(nsIFrame::WebRenderUserDataProperty())) {

I would get rid of the gfxPrefs check here. The HasProperty check should be sufficient - that will only exist if we're in layers free mode. I don't like having the check because if we change the conditions for layers-free then we'd have to update it in multiple places.

::: layout/generic/nsImageFrame.cpp:653
(Diff revision 2)
> +    RefPtr<WebRenderUserData> data;
> +    userDataTable->Get(nsDisplayItem::TYPE_IMAGE, getter_AddRefs(data));
> +    if (data && data->AsFallbackData()) {
> +      data->AsFallbackData()->SetInvalid(true);
> +    }
> +    SchedulePaint(PAINT_DEFAULT);

Don't need to specify PAINT_DEFAULT here since it's the default value of this arg anyway.
Attachment #8889292 - Flags: review?(bugmail) → review+
Pushed by ethlin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d2513137446a
Support image animation for layers-free mode. r=kats
https://hg.mozilla.org/mozilla-central/rev/d2513137446a
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.