mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
style: Make svg:use use an actual shadow tree.
This fixes a couple fuzz bugs and prevents special-casing <svg:use> even more in bug 1431255. Unfortunately not as many hacks went away as I'd have hoped, since we still need to match document rules, see the linked SVGWG issues. But blocks_ancestor_combinators goes away, which is nice since it's on a very hot path. Bug: 1450250 Reviewed-by: heycam Differential Revision: https://phabricator.services.mozilla.com/D2154 MozReview-Commit-ID: C4mthjoSNFh
This commit is contained in:
parent
1a91beaf57
commit
02d27ad3dd
5 changed files with 25 additions and 29 deletions
|
@ -1261,8 +1261,9 @@ impl Stylist {
|
|||
|
||||
if let Some(containing_shadow) = rule_hash_target.containing_shadow() {
|
||||
let cascade_data = containing_shadow.style_data();
|
||||
let host = containing_shadow.host();
|
||||
if let Some(map) = cascade_data.normal_rules(pseudo_element) {
|
||||
context.with_shadow_host(Some(containing_shadow.host()), |context| {
|
||||
context.with_shadow_host(Some(host), |context| {
|
||||
map.get_all_matching_rules(
|
||||
element,
|
||||
rule_hash_target,
|
||||
|
@ -1276,7 +1277,26 @@ impl Stylist {
|
|||
shadow_cascade_order += 1;
|
||||
}
|
||||
|
||||
match_document_author_rules = false;
|
||||
// NOTE(emilio): Hack so <svg:use> matches document rules as
|
||||
// expected.
|
||||
//
|
||||
// This is not a problem for invalidation and that kind of stuff
|
||||
// because they still don't match rules based on elements
|
||||
// outside of the shadow tree, and because the <svg:use> subtree
|
||||
// is immutable and recreated each time the source tree changes.
|
||||
//
|
||||
// See: https://github.com/w3c/svgwg/issues/504
|
||||
//
|
||||
// Note that we always resolve URLs against the document, so we
|
||||
// can't get into a nested shadow situation here.
|
||||
//
|
||||
// See: https://github.com/w3c/svgwg/issues/505
|
||||
//
|
||||
let host_is_svg_use =
|
||||
host.is_svg_element() &&
|
||||
host.local_name() == &*local_name!("use");
|
||||
|
||||
match_document_author_rules = host_is_svg_use;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue