Commit 370b6a32 authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Use Element::LocalNameForSelectorMatching in InvalidationSet

To match ElementRuleCollector et al. We will lower-case tag names on
(selector) parsing in HTML documents, and thus need to give the same
treatment to the local name extracted from the element.

Bug: 856368
Change-Id: I07e726864de048f5948cb27fa7e5dd6eaad9b0ef
Reviewed-on: https://chromium-review.googlesource.com/1202206
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588427}
parent 9eb3d29a
<!DOCTYPE html>
<title>Invalidation of selector containing mixed-case tag name</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<style>
filter feFlood {
flood-opacity: 0;
}
svg.filter feFlood {
flood-opacity: 1;
}
</style>
<svg>
<filter id="f" x="0" y="0" width="1" height="1">
<feFlood id="flood" flood-color="green"/>
</filter>
<rect width="100" height="100" fill="red" filter="url(#f)"/>
</svg>
<script>
test(() => {
assert_equals(getComputedStyle(flood).floodOpacity, "0",
"flood-opacity is initially 0");
document.querySelector('svg').classList.toggle("filter");
assert_equals(getComputedStyle(flood).floodOpacity, "1",
"flood-opacity is 1 after adding class");
});
</script>
......@@ -69,10 +69,11 @@ bool InvalidationSet::InvalidatesElement(Element& element) const {
if (invalidation_flags_.WholeSubtreeInvalid())
return true;
if (tag_names_ && tag_names_->Contains(element.TagQName().LocalName())) {
if (tag_names_ &&
tag_names_->Contains(element.LocalNameForSelectorMatching())) {
TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART_IF_ENABLED(
element, kInvalidationSetMatchedTagName, *this,
element.TagQName().LocalName());
element.LocalNameForSelectorMatching());
return true;
}
......@@ -115,10 +116,11 @@ bool InvalidationSet::InvalidatesElement(Element& element) const {
}
bool InvalidationSet::InvalidatesTagName(Element& element) const {
if (tag_names_ && tag_names_->Contains(element.TagQName().LocalName())) {
if (tag_names_ &&
tag_names_->Contains(element.LocalNameForSelectorMatching())) {
TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART_IF_ENABLED(
element, kInvalidationSetMatchedTagName, *this,
element.TagQName().LocalName());
element.LocalNameForSelectorMatching());
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment