[webkit-reviews] review granted: [Bug 207902] Lazy load images using base URL at parse time : [Attachment 391184] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 19 21:31:53 PST 2020


Darin Adler <darin at apple.com> has granted Rob Buis <rbuis at igalia.com>'s request
for review:
Bug 207902: Lazy load images using base URL at parse time
https://bugs.webkit.org/show_bug.cgi?id=207902

Attachment 391184: Patch

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




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

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

> Source/WebCore/loader/ImageLoader.cpp:189
> +	   auto uri = document.completeURL(sourceURI(attr));
> +	   if (m_lazyImageLoadState == LazyImageLoadState::LoadImmediately)
> +	       uri = m_image->url();

Seems a little strange to call this URI.

Seems wasteful to compute the URL, then check m_lazyImageLoadState, then
overwrite it. I’d write this:

    URL imageURL = m_lazyImageLoadState == LazyImageLoadState::LoadImmediately
	? m_image->url() : document.completeURL(sourceURI(attr));

But also, i think this needs  "why" comment. The concept here of
"LoadImmediately" and special URL rules seems subtle and a bit tricky.


More information about the webkit-reviews mailing list