[Webkit-unassigned] [Bug 237236] New: Fix typo in StyleSharingResolver

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Feb 26 08:10:44 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=237236

            Bug ID: 237236
           Summary: Fix typo in StyleSharingResolver
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ntim at apple.com

https://webkit-search.igalia.com/webkit/rev/d9fb961816b603d071c05f5fbc2754c061adabaa/Source/WebCore/style/StyleSharingResolver.cpp#300-301

```
    if (element.matchesInvalidPseudoClass() != element.matchesValidPseudoClass())
        return false;
```

This essentially is `if (true) return false` in most cases.

This typo was introduced in bug 153768, before that it was:

```
    if (element->matchesInvalidPseudoClass() != state.element()->matchesValidPseudoClass())
        return false;
```

That version was introduced in bug 138769, which I also doubt is correct, since it says if both elements are invalid, then do not share.

I think the version that we want is:

```
    if (candidateElement.matchesInvalidPseudoClass() != element.matchesInvalidPseudoClass())
        return false;
```

which is sort of redundant with `if (candidateElement.matchesValidPseudoClass() != element.matchesValidPseudoClass())` above, so maybe this should just be an ASSERT checking that valid is the exact opposite of invalid.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220226/89f1f456/attachment-0001.htm>


More information about the webkit-unassigned mailing list