mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
In Sky we can style share if our TreeScopes have the same styles, our :host styles are the same, and we'd inherit the same styles. This allows a lot of simplification to the style sharing logic since we don't need to deal with descendant selectors or tree boundary crossing rules: - We can remove the logic that was checking that we were distributed to the same insertion points since there's no ::content selectors. - We can check the actual inherited values instead of looking at the parentOrSHadowHostNode(). We used to look at the node in Blink because we were checking that you'd get the same descendant selectors applied. In Sky we instead want to make sure you'd inherit the same values. This also means we don't need the element().parentOrShadowHostElement() != parent case in the SharedStyleFinder which was trying to deal with descendant selectors again. I also removed the checks that were redundant with the checks inside supportsStyleSharing() which we always check before adding sharing candidates. Finally by refactoring the code to make the TreeScope style check work it exposed that the Document::styleSheets() and TreeScope::styleSheets() APIs are now dead. A future patch will delete the now dead StyleSheetList class as well. This change makes the city-list application share between all the items in the list, and all of the headers of the same type now share as well. R=ojan@chromium.org Review URL: https://codereview.chromium.org/796713002