Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fb0de39d9421fe9f3ec4b38744d98c0dea0da74c
      
https://github.com/WebKit/WebKit/commit/fb0de39d9421fe9f3ec4b38744d98c0dea0da74c
  Author: Nipun Shukla <[email protected]>
  Date:   2026-04-14 (Tue, 14 Apr 2026)

  Changed paths:
    A PerformanceTests/CSS/WhereIsRuleIndexing.html
    M Source/WebCore/style/RuleSet.cpp

  Log Message:
  -----------
  Safari loads huggingface.co slowly
https://bugs.webkit.org/show_bug.cgi?id=309574
rdar://114904007

Reviewed by Antti Koivisto.

CSS rules like ".prose :where(h1):not(...)" land in the universal
rule bucket because :where() and :is() are not examined for
indexable selectors. This causes every element to be
checked against these rules during style recalculation, which causes
performance loss on huggingface.co.

This change extracts indexable tags from single argument :where/:is
and uses them for rule bucket indexing, allowing the style engine to
skip these rules for elements which can't match, avoiding unnecessary
work.

Without the fix a full relayout on
https://huggingface.co/docs/transformers/model_doc/auto takes ~1500 ms
while with the fix this takes ~500 ms. The included performance test
progresses from ~15 runs/s to ~21 runs/s.

There should be no functionality change associated with this change.
Correctness will be verified via existing tests.

* PerformanceTests/CSS/WhereIsRuleIndexing.html: Added.
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRule):

Canonical link: https://commits.webkit.org/311212@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to