[webkit-reviews] review granted: [Bug 229917] Correctly support fragment-only URLs in CSS images : [Attachment 444457] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 16 18:20:22 PST 2021

Darin Adler <darin at apple.com> has granted Matt Woodrow <m_woodrow at apple.com>'s
request for review:
Bug 229917: Correctly support fragment-only URLs in CSS images

Attachment 444457: Patch


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

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

> Source/WebCore/css/CSSImageValue.cpp:87
> +    if (CSSValue::isCSSLocalURL(m_location.resolvedURL.string()))

This can just be:

   if (isCSSLocalURL(...

Since CSSImageValue derives from CSSValue.

> Source/WebCore/css/CSSImageValue.cpp:88
> +	   return URL(URL(), m_location.resolvedURL.string());

This can just be:

    return m_location.resolvedURL;

No need to re-create the URL from a string.

> Source/WebCore/css/CSSValue.h:157
> +    // Empty URLs and fragment-only URLs should not be resolved relative to
the base
> +    // URL.

Let’s not break the word URL onto a separate line.

> Source/WebCore/css/CSSValue.h:158
> +    static bool isCSSLocalURL(const String& url)

I might name this argument "relativeURL". I suggest this take a StringView, not
a const String&.

If it was me, I would also move this function body out of the class definition.

More information about the webkit-reviews mailing list