[webkit-reviews] review granted: [Bug 227682] Object-fit:cover and img source with srcset cause rendering issue : [Attachment 441825] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 20 19:11:36 PDT 2021


Darin Adler <darin at apple.com> has granted cathiechen <cathiechen at igalia.com>'s
request for review:
Bug 227682: Object-fit:cover and img source with srcset cause rendering issue
https://bugs.webkit.org/show_bug.cgi?id=227682

Attachment 441825: Patch

https://bugs.webkit.org/attachment.cgi?id=441825&action=review




--- Comment #19 from Darin Adler <darin at apple.com> ---
Comment on attachment 441825
  --> https://bugs.webkit.org/attachment.cgi?id=441825
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=441825&action=review

> Source/WebCore/html/HTMLImageElement.cpp:685
> +    if (pictureElement())
> +	   pictureElement()->sourcesChanged();

Modern way to write this is to make sure to ref the thing before calling a
function on it:

    if (RefPtr element = pictureElement())
	element->sourcesChanged();

This seems kind of messy since it will almost always call sourcesChanged twice,
once when the picture element moves and again when the image element moves.
Might be nice if it was lazy enough not to do it all twice.


More information about the webkit-reviews mailing list