[webkit-reviews] review granted: [Bug 214690] Add support for SVGAElement's rel / relList attributes : [Attachment 405052] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 23 10:29:42 PDT 2020


Darin Adler <darin at apple.com> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 214690: Add support for SVGAElement's rel / relList attributes
https://bugs.webkit.org/show_bug.cgi?id=214690

Attachment 405052: Patch

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




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

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

> Source/WebCore/svg/SVGAElement.cpp:86
> +	   return;

Wish I understood whether we should call to base or return in cases like this.
I suppose return is a slight optimization, whereas calling through to base is a
little more consistent and allows for each level to implement part of attribute
handling, which could be handy in some cases.

> Source/WebCore/svg/SVGAElement.cpp:231
> +	   m_relList =
makeUnique<DOMTokenList>(const_cast<SVGAElement&>(*this), SVGNames::relAttr,
[](Document&, StringView token) {

This const_cast makes me wonder about ever using const for functions in these
element classes. Is there anything meaningful to the use of const in the class
definition? I understand that conceptually it does not change the state of the
element. But also, making a DOMTokenList doesn’t seem to change the element
either, so why does it take a non-const reference. Except for the fact that
everything takes non-const references to classes like Node and Element.

> Source/WebCore/svg/SVGAElement.cpp:236
> +#if USE(SYSTEM_PREVIEW)
> +	       return equalIgnoringASCIICase(token, "noreferrer") ||
equalIgnoringASCIICase(token, "noopener") || equalIgnoringASCIICase(token,
"ar");
> +#else
> +	       return equalIgnoringASCIICase(token, "noreferrer") ||
equalIgnoringASCIICase(token, "noopener");
> +#endif

Is there a less repetitive way to write this? Maybe:

#if USE(SYSTEM_PREVIEW)
    if (equalIgnoringASCIICase(token, "ar"))
	return true;
#endif

Then the rest doesn’t have to be inside #if.

> Source/WebCore/svg/SVGAElement.idl:30
> +    [SameObject, PutForwards=value] readonly attribute DOMTokenList relList;

Not sure I understand the meaning of PutForwards=value, but whatever it is,
glad the generator handles it.


More information about the webkit-reviews mailing list