Bug 220711

Summary: Optimize :hover/:active style invalidation for deep trees and descendant selectors
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: 04-punch-pinyons, cdumez, changseok, cmarcelo, esprehn+autocc, ews-watchlist, graouts, gyuyoung.kim, kangil.han, mifenton, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch
none
patch none

Antti Koivisto
Reported 2021-01-18 08:57:39 PST
Hover and active states are flipped for the entire ancestor chain. We compute invalidation for each element separately. If the selectors are of form ':active .descendant' then each of these invalidations need to traverse the whole subtree leading to O(n^2) behavior. We really only need to traverse the descendants once, starting from the element closest to the root that changes state.
Attachments
patch (14.46 KB, patch)
2021-01-18 09:05 PST, Antti Koivisto
no flags
patch (17.23 KB, patch)
2021-01-18 09:51 PST, Antti Koivisto
no flags
patch (17.17 KB, patch)
2021-01-18 10:02 PST, Antti Koivisto
no flags
Antti Koivisto
Comment 1 2021-01-18 09:05:56 PST
Antti Koivisto
Comment 2 2021-01-18 09:51:27 PST
Antti Koivisto
Comment 3 2021-01-18 10:02:14 PST
Antti Koivisto
Comment 4 2021-01-18 12:12:25 PST
EWS
Comment 5 2021-01-18 12:26:29 PST
Committed r271584: <https://trac.webkit.org/changeset/271584> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417840 [details].
Radar WebKit Bug Importer
Comment 6 2021-01-18 12:27:13 PST
Antoine Quint
Comment 7 2021-01-22 08:52:51 PST
I suspect this caused bug 220862.
Note You need to log in before you can comment on or make changes to this bug.