WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
237604
Use PropertyRegistry consistently in svgAttributeChanged
https://bugs.webkit.org/show_bug.cgi?id=237604
Summary
Use PropertyRegistry consistently in svgAttributeChanged
Rob Buis
Reported
2022-03-08 06:59:18 PST
Use PropertyRegistry consistently in svgAttributeChanged.
Attachments
Patch
(22.45 KB, patch)
2022-03-08 07:01 PST
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(20.26 KB, patch)
2022-03-09 08:51 PST
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(21.12 KB, patch)
2022-03-10 01:59 PST
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(24.15 KB, patch)
2022-03-10 04:19 PST
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Rob Buis
Comment 1
2022-03-08 07:01:41 PST
Created
attachment 454118
[details]
Patch
Nikolas Zimmermann
Comment 2
2022-03-09 02:25:47 PST
Comment on
attachment 454118
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=454118&action=review
Unofficial review: Looks good, just a few comments.
> Source/WebCore/ChangeLog:8 > + Use PropertyRegistry consistently in svgAttributeChanged.
This is a bit too thin, I'd state that most svgAttributeChanged() methods start with if (PropReg::isKnownAttr(...)) and some are missing, and that you're unifying this for consistency reasons.
> Source/WebCore/svg/SVGFEBlendElement.cpp:86 > + if (PropertyRegistry::isKnownAttribute(attrName)) {
out of curiosity, did you check that each of the isKnownAttribute() functions has exactly the same attributes registered as we atually handle in svgAttributeChanged(). Could be that we missed something in the past, that's now fixed, by this usage pattern (no explicit check for all the attribute names, but instead use isKnownAttribute()).
> Source/WebCore/svg/SVGFEComponentTransferElement.cpp:65 > +void SVGFEComponentTransferElement::svgAttributeChanged(const QualifiedName& attrName)
This needs a test :/
> Source/WebCore/svg/SVGImageElement.cpp:107 > + else {
else if (auto* ..
Rob Buis
Comment 3
2022-03-09 08:51:38 PST
Created
attachment 454244
[details]
Patch
Rob Buis
Comment 4
2022-03-09 08:54:20 PST
Comment on
attachment 454118
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=454118&action=review
>> Source/WebCore/ChangeLog:8 >> + Use PropertyRegistry consistently in svgAttributeChanged. > > This is a bit too thin, I'd state that most svgAttributeChanged() methods start with if (PropReg::isKnownAttr(...)) and some are missing, and that you're unifying this for consistency reasons.
Done.
>> Source/WebCore/svg/SVGFEBlendElement.cpp:86 >> + if (PropertyRegistry::isKnownAttribute(attrName)) { > > out of curiosity, did you check that each of the isKnownAttribute() functions has exactly the same attributes registered as we atually handle in svgAttributeChanged(). > Could be that we missed something in the past, that's now fixed, by this usage pattern (no explicit check for all the attribute names, but instead use isKnownAttribute()).
I did by cross checking all changed files. One thing I missed though is that SVGFEDiffuseLightingElement::svgAttributeChanged incorrectly checked for SVGNames::lighting_colorAttr!
>> Source/WebCore/svg/SVGFEComponentTransferElement.cpp:65 >> +void SVGFEComponentTransferElement::svgAttributeChanged(const QualifiedName& attrName) > > This needs a test :/
Ok I removed this part since it is not high priority at all.
>> Source/WebCore/svg/SVGImageElement.cpp:107 >> + else { > > else if (auto* ..
Done.
Nikolas Zimmermann
Comment 5
2022-03-10 01:38:32 PST
(In reply to Rob Buis from
comment #4
)
> > This needs a test :/ > > Ok I removed this part since it is not high priority at all.
Can you still create a ticket, add a FIXME that the svgAttributeChanged() implementation is missing with a ref to the new ticket? Other than that, the last iteration looks great, unofficial r=me :-)
Rob Buis
Comment 6
2022-03-10 01:59:49 PST
Created
attachment 454327
[details]
Patch
Martin Robinson
Comment 7
2022-03-10 03:27:44 PST
Comment on
attachment 454327
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=454327&action=review
Looks good to me, assuming that PropertyRegistry::isKnownAttribute works knowing the calling class. I would also add ASSERTs in the places where the code is making assumptions about what the remaining attributes to handle are.
> Source/WebCore/svg/SVGFEBlendElement.cpp:94 > + if (PropertyRegistry::isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this); > - primitiveAttributeChanged(attrName); > - return; > - } > - > - if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { > - InstanceInvalidationGuard guard(*this); > - invalidate(); > + if (attrName == SVGNames::modeAttr) > + primitiveAttributeChanged(attrName); > + else > + invalidate(); > return; > } >
I believe in all the cases where the code assumes that a particular attribute is being handled in an else or a default code path, an assertion will make things a lot more understandable for the reader. Before it was easier to see what behavior corresponded to what attribute and the assertion will help to maintain the same readability. So here you could ASSERT(attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) in the else path.
> Source/WebCore/svg/SVGPathElement.cpp:69 > - if (attrName == SVGNames::dAttr) { > + if (PropertyRegistry::isKnownAttribute(attrName)) { > InstanceInvalidationGuard guard(*this);
I think in these cases as well, an assertion could make the code a bit more understandable.
Rob Buis
Comment 8
2022-03-10 04:19:09 PST
Created
attachment 454332
[details]
Patch
EWS
Comment 9
2022-03-10 07:53:41 PST
Committed
r291108
(
248270@main
): <
https://commits.webkit.org/248270@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 454332
[details]
.
Radar WebKit Bug Importer
Comment 10
2022-03-10 07:54:22 PST
<
rdar://problem/90098010
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug