Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 652c5fd0762ece7b5f77ec1d7b99dba35199f8fd
      
https://github.com/WebKit/WebKit/commit/652c5fd0762ece7b5f77ec1d7b99dba35199f8fd
  Author: Yoav Weiss <[email protected]>
  Date:   2025-12-15 (Mon, 15 Dec 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/document-rules.https_include=selectorMatchesDisplayLocked-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/document-rules.https_include=selectorMatchesDisplayNone-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/document-rules.https_include=unslottedLink-expected.txt
    M Source/WebCore/dom/SpeculationRulesMatcher.cpp
    M Source/WebCore/html/HTMLAnchorElement.cpp
    M Source/WebCore/html/HTMLAnchorElement.h

  Log Message:
  -----------
  SpeculationRules - do not prefetch hidden links
https://bugs.webkit.org/show_bug.cgi?id=303981

Reviewed by Alex Christensen.

The speculation rules spec states that hidden links should not be prefetched.
This PR aligns the implementation to the spec on that front.

No new tests, but progression on existing tests.

* 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/document-rules.https_include=selectorMatchesDisplayLocked-expected.txt:
 Progression.
* 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/document-rules.https_include=selectorMatchesDisplayNone-expected.txt:
 Progression.
* 
LayoutTests/imported/w3c/web-platform-tests/speculation-rules/prefetch/document-rules.https_include=unslottedLink-expected.txt:
 Progression.
* Source/WebCore/dom/SpeculationRulesMatcher.cpp:
(WebCore::isUnslottedElement): Return true if the element is part of a shadow 
DOM and has no slot.
(WebCore::SpeculationRulesMatcher::hasMatchingRule): Check the element 
visibility and if it's unslotted before prefetching its url.
* Source/WebCore/html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::insertedIntoAncestor): Schedule post-insertaion 
callback.
(WebCore::HTMLAnchorElement::didFinishInsertingNode): Check speculation rules 
post-insertion.
* Source/WebCore/html/HTMLAnchorElement.h:

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



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

Reply via email to