Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5cf7b15948ed07e78ad873f8c51418831a949d2b
      
https://github.com/WebKit/WebKit/commit/5cf7b15948ed07e78ad873f8c51418831a949d2b
  Author: Basuke Suzuki <[email protected]>
  Date:   2026-04-08 (Wed, 08 Apr 2026)

  Changed paths:
    A 
LayoutTests/http/wpt/prefetch/speculation-rules-conservative-lazy-match.https-expected.txt
    A 
LayoutTests/http/wpt/prefetch/speculation-rules-conservative-lazy-match.https.html
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/html/HTMLAnchorElement.cpp
    M Source/WebCore/html/HTMLAnchorElement.h
    M Source/WebCore/loader/SpeculationRules.cpp
    M Source/WebCore/loader/SpeculationRules.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl

  Log Message:
  -----------
  Skip full-page anchor scan for conservative-only speculation rules
https://bugs.webkit.org/show_bug.cgi?id=311672
rdar://173520903

Reviewed by Chris Dumez.

processSpeculationRules() scans all links on every style recalculation,
performing pattern/selector evaluations per anchor. For conservative rules,
the result is only consumed at user interaction time. This is wasted work
on pages with many links.

Defer matching for conservative-only rules to interaction time in
HTMLAnchorElement::defaultEventHandler(), skipping the full-page anchor
scan when all rules are conservative.

Test: http/wpt/prefetch/speculation-rules-conservative-lazy-match.https.html
* 
LayoutTests/http/wpt/prefetch/speculation-rules-conservative-lazy-match.https-expected.txt:
 Added.
* 
LayoutTests/http/wpt/prefetch/speculation-rules-conservative-lazy-match.https.html:
 Added.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::processSpeculationRules):
* Source/WebCore/html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::defaultEventHandler):
(WebCore::HTMLAnchorElement::prefetchEagernessForTesting const):
(WebCore::HTMLAnchorElement::checkForSpeculationRules):
* Source/WebCore/html/HTMLAnchorElement.h:
* Source/WebCore/loader/SpeculationRules.cpp:
(WebCore::SpeculationRules::hasNonConservativePrefetchRules const):
* Source/WebCore/loader/SpeculationRules.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::anchorPrefetchEagerness):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:

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



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

Reply via email to