summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 07:38:16 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 07:38:16 -0400
commitf605c68f1369935026e38ad2f535608f06d50d73 (patch)
treecb1495a7bcf55c3d5e2d2bbee7503d4a0cc167e5
parent53df3a74f46fa6b5d3778f9635a1afb7522c345f (diff)
downloadUXP-f605c68f1369935026e38ad2f535608f06d50d73.tar
UXP-f605c68f1369935026e38ad2f535608f06d50d73.tar.gz
UXP-f605c68f1369935026e38ad2f535608f06d50d73.tar.lz
UXP-f605c68f1369935026e38ad2f535608f06d50d73.tar.xz
UXP-f605c68f1369935026e38ad2f535608f06d50d73.zip
Bug 1417829 - Remove unresolved pseudoclass
Tag #1375
-rw-r--r--dom/base/CustomElementRegistry.cpp3
-rw-r--r--dom/events/EventStates.h6
-rw-r--r--dom/tests/mochitest/webcomponents/mochitest.ini1
-rw-r--r--dom/tests/mochitest/webcomponents/test_unresolved_pseudo_class.html101
-rw-r--r--layout/style/nsCSSPseudoClassList.h3
5 files changed, 2 insertions, 112 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp
index df2201407..d9acd4d6d 100644
--- a/dom/base/CustomElementRegistry.cpp
+++ b/dom/base/CustomElementRegistry.cpp
@@ -291,7 +291,6 @@ CustomElementRegistry::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTy
nsTArray<nsWeakPtr>* unresolved = mCandidatesMap.LookupOrAdd(typeName);
nsWeakPtr* elem = unresolved->AppendElement();
*elem = do_GetWeakReference(aElement);
- aElement->AddStates(NS_EVENT_STATE_UNRESOLVED);
return;
}
@@ -865,8 +864,6 @@ CustomElementRegistry::Upgrade(Element* aElement,
CustomElementDefinition* aDefinition,
ErrorResult& aRv)
{
- aElement->RemoveStates(NS_EVENT_STATE_UNRESOLVED);
-
RefPtr<CustomElementData> data = aElement->GetCustomElementData();
MOZ_ASSERT(data, "CustomElementData should exist");
diff --git a/dom/events/EventStates.h b/dom/events/EventStates.h
index bda36c040..3397110ba 100644
--- a/dom/events/EventStates.h
+++ b/dom/events/EventStates.h
@@ -313,8 +313,7 @@ private:
// attribute or any HTML element which has a "dir" attribute whose value is
// "auto".
#define NS_EVENT_STATE_DIR_ATTR_LIKE_AUTO NS_DEFINE_EVENT_STATE_MACRO(49)
-// Element is an unresolved custom element candidate
-#define NS_EVENT_STATE_UNRESOLVED NS_DEFINE_EVENT_STATE_MACRO(50)
+// Free bit NS_DEFINE_EVENT_STATE_MACRO(50)
// Element is transitioning for rules changed by style editor
#define NS_EVENT_STATE_STYLEEDITOR_TRANSITIONING NS_DEFINE_EVENT_STATE_MACRO(51)
// Content shows its placeholder
@@ -339,8 +338,7 @@ private:
#define ESM_MANAGED_STATES (DIR_ATTR_STATES | NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS | \
NS_EVENT_STATE_HOVER | NS_EVENT_STATE_DRAGOVER | \
NS_EVENT_STATE_URLTARGET | NS_EVENT_STATE_FOCUSRING | \
- NS_EVENT_STATE_FULL_SCREEN | NS_EVENT_STATE_UNRESOLVED | \
- NS_EVENT_STATE_FOCUS_WITHIN)
+ NS_EVENT_STATE_FULL_SCREEN | NS_EVENT_STATE_FOCUS_WITHIN)
#define INTRINSIC_STATES (~ESM_MANAGED_STATES)
diff --git a/dom/tests/mochitest/webcomponents/mochitest.ini b/dom/tests/mochitest/webcomponents/mochitest.ini
index d56196272..84322d21d 100644
--- a/dom/tests/mochitest/webcomponents/mochitest.ini
+++ b/dom/tests/mochitest/webcomponents/mochitest.ini
@@ -44,5 +44,4 @@ skip-if = true # disabled - See bug 1390396
[test_shadowroot_style.html]
[test_shadowroot_style_order.html]
[test_style_fallback_content.html]
-[test_unresolved_pseudo_class.html]
[test_link_prefetch.html]
diff --git a/dom/tests/mochitest/webcomponents/test_unresolved_pseudo_class.html b/dom/tests/mochitest/webcomponents/test_unresolved_pseudo_class.html
deleted file mode 100644
index a1ff3b3c6..000000000
--- a/dom/tests/mochitest/webcomponents/test_unresolved_pseudo_class.html
+++ /dev/null
@@ -1,101 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1111633
--->
-<head>
- <title>Test template element in stale document.</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
- <style>
- :unresolved {
- color: rgb(0, 0, 255);
- background-color: rgb(0, 0, 255);
- }
-
- x-foo { color: rgb(255, 0, 0); }
-
- [is="x-del"]:not(:unresolved) { color: rgb(255, 0, 0); }
-
- [is="x-bar"]:not(:unresolved) { color: rgb(255, 0, 0); }
-
- [is="x-bar"]:unresolved { background-color: rgb(255, 0, 0); }
-
- x-baz:not(:unresolved) {
- color: rgb(255, 0, 0);
- background-color: rgb(255, 0, 0);
- }
-
- span { color: rgb(0,255,0); }
-
- x-foo:unresolved + span { color: rgb(255,0,0); }
-
- </style>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1111633">Bug 1111633</a>
-<div id="container"></div>
-<x-foo id="foo"></x-foo>
-<span id="span1">This text should be green</span>
-<span id="bar" is="x-bar"></span>
-<x-baz id="baz"></x-baz>
-<span id="del" is="x-del"></span>
-<script>
-
-// Before define
-var foo = document.querySelector('#foo');
-is(getComputedStyle(foo).color, "rgb(0, 0, 255)", "foo - color");
-is(getComputedStyle(foo).backgroundColor, "rgb(0, 0, 255)", "foo - backgroundColor");
-
-var bar = document.querySelector('#bar');
-is(getComputedStyle(bar).color, "rgb(0, 0, 255)", "bar - color");
-is(getComputedStyle(bar).backgroundColor, "rgb(255, 0, 0)", "bar - backgroundColor");
-
-var baz = document.querySelector('#baz');
-is(getComputedStyle(baz).color, "rgb(0, 0, 255)", "baz - color");
-is(getComputedStyle(baz).backgroundColor, "rgb(0, 0, 255)", "baz - backgroundColor");
-
-var span1 = document.querySelector('#span1');
-is(getComputedStyle(span1).color, "rgb(255, 0, 0)", "span1 - color");
-
-customElements.define('x-foo', class extends HTMLElement {});
-
-customElements.define('x-bar', class extends HTMLSpanElement {}, { extends: 'span' });
-
-customElements.define('x-baz', class extends HTMLElement {});
-
-// After define
-is(getComputedStyle(foo).color, "rgb(255, 0, 0)",
- "foo - color (after define)");
-
-is(getComputedStyle(bar).color,
- "rgb(255, 0, 0)", "bar - color (after define)");
-
-is(getComputedStyle(baz).color,
- "rgb(255, 0, 0)", "baz - color (after define)");
-is(getComputedStyle(baz).backgroundColor,
- "rgb(255, 0, 0)", "baz - backgroundColor (after define)");
-
-is(getComputedStyle(span1).color, "rgb(0, 255, 0)", "span1 - color (after define)");
-
-// After tree removal
-var del = document.querySelector('#del');
-is(getComputedStyle(del).color, "rgb(0, 0, 255)", "del - color");
-var par = del.parentNode;
-par.removeChild(del);
-// Changing is attribute after creation should not change the type
-// of a custom element, even if the element was removed and re-append to the tree.
-del.setAttribute("is", "foobar");
-par.appendChild(del);
-is(getComputedStyle(del).color, "rgb(0, 0, 255)", "del - color (after reappend)");
-
-class Del extends HTMLSpanElement {};
-customElements.define('x-del', Del, { extends: 'span' });
-// [is="x-del"] will not match any longer so the rule of span will apply
-is(getComputedStyle(del).color, "rgb(0, 255, 0)", "del - color (after define)");
-// but the element should have been upgraded:
-ok(del instanceof Del, "element was upgraded correctly after changing |is|");
-
-</script>
-</body>
-</html>
diff --git a/layout/style/nsCSSPseudoClassList.h b/layout/style/nsCSSPseudoClassList.h
index 6d5b6eca1..12f43af5b 100644
--- a/layout/style/nsCSSPseudoClassList.h
+++ b/layout/style/nsCSSPseudoClassList.h
@@ -90,9 +90,6 @@ CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type", 0, "")
// Match nodes that are HTML but not XHTML
CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html", 0, "")
-// Match all custom elements whose created callback has not yet been invoked
- CSS_STATE_PSEUDO_CLASS(unresolved, ":unresolved", 0, "", NS_EVENT_STATE_UNRESOLVED)
-
// Matches nodes that are in a native-anonymous subtree (i.e., nodes in
// a subtree of C++ anonymous content constructed by Gecko for its own
// purposes).