Skip to content

Commit

Permalink
Referenced SVG elements in an external resource document match :target
Browse files Browse the repository at this point in the history
Track which elements are referenced (by <use>) in an external resource
document by funneling the lookup through a special function on
SVGResourceDocumentContent that creates SVGResourceTarget objects for
each (valid) reference and lets the targeted element weakly reference
the object. While matching :target, the selector checker will check if
the element has a reference to an SVGResourceTarget object and let
:target match if it does.

Bug: 342705674
Change-Id: I9b88e4338dccc0e01c45afb0df3e1c412b2466a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5574989
Reviewed-by: Rune Lillesveen <[email protected]>
Commit-Queue: Fredrik Söderquist <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1307926}
  • Loading branch information
Fredrik Söderquist authored and chromium-wpt-export-bot committed May 30, 2024
1 parent 5317dc8 commit c8838c8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions svg/struct/reftests/support/sprites-stacked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions svg/struct/reftests/support/sprites-target.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>&lt;use> referencing an external document resource with :target pseudo class</title>
<link rel="help" href="https://svgwg.org/svg2-draft/linking.html#processingURL">
<link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseStyleInheritance">
<link rel="help" href="https://drafts.csswg.org/selectors/#the-target-pseudo">
<link rel="match" href="reference/green-100x100.html">
<svg width="100" height="100">
<use href="support/sprites-stacked.svg#green-rect"/>
</svg>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<title>&lt;use> referencing an external document resource with :target pseudo class</title>
<link rel="help" href="https://svgwg.org/svg2-draft/linking.html#processingURL">
<link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseStyleInheritance">
<link rel="help" href="https://drafts.csswg.org/selectors/#the-target-pseudo">
<link rel="match" href="reference/green-100x100.html">
<svg width="100" height="100">
<use href="support/sprites-target.svg#rect"/>
</svg>

0 comments on commit c8838c8

Please sign in to comment.