Bug 312971 - Unprefix -moz-read-write / -moz-read-only. r=edgar
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 14 May 2020 16:46:08 +0000
changeset 597269 c2658687ac2373252a5dc4b7fa9a7ef12772d6bf
parent 597268 3f463aabe0de79354acec0c38f348633bbcdeff0
child 597270 566430349999f5c1eb844ea6e01f9ef349258986
push id2357
push userffxbld-merge
push dateMon, 22 Jun 2020 15:16:15 +0000
treeherdermozilla-release@12dd23e8e944 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedgar
bugs312971
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 312971 - Unprefix -moz-read-write / -moz-read-only. r=edgar And remove some duplicated tests from WPT. Differential Revision: https://phabricator.services.mozilla.com/D75231
accessible/generic/HyperTextAccessible.cpp
dom/base/Element.cpp
dom/base/Element.h
dom/base/FragmentOrElement.cpp
dom/base/Selection.cpp
dom/events/EventStates.h
dom/events/IMEStateManager.cpp
dom/html/nsGenericHTMLElement.cpp
dom/html/test/test_bug1264157.html
editor/libeditor/HTMLEditor.cpp
editor/reftests/672709-ref.html
editor/reftests/694880-1.html
editor/reftests/694880-2.html
editor/reftests/694880-3.html
editor/reftests/readonly-editable.html
editor/reftests/readonly-non-editable.html
editor/reftests/readwrite-editable.html
editor/reftests/readwrite-non-editable.html
layout/forms/test/test_readonly.html
layout/generic/crashtests/767765.html
layout/reftests/forms/input/number/pseudo-classes.html
layout/reftests/forms/input/reftest.list
layout/reftests/forms/input/selector-read-write-type-change-001-ref.html
layout/reftests/forms/input/selector-read-write-type-change-001.html
layout/reftests/forms/input/selector-read-write-type-change-002-ref.html
layout/reftests/forms/input/selector-read-write-type-change-002.html
layout/style/contenteditable.css
layout/style/res/forms.css
security/manager/pki/resources/content/certViewer.xhtml
servo/components/style/element_state.rs
servo/components/style/gecko/non_ts_pseudo_class_list.rs
servo/components/style/gecko/selector_parser.rs
servo/components/style/gecko/wrapper.rs
testing/web-platform/meta/css/selectors/selector-read-write-type-change-002.html.ini
testing/web-platform/meta/html/semantics/selectors/pseudo-classes/readwrite-readonly.html.ini
toolkit/content/widgets/marquee.css
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -67,17 +67,17 @@ role HyperTextAccessible::NativeRole() c
   if (frame && frame->IsInlineFrame()) return roles::TEXT;
 
   return roles::TEXT_CONTAINER;
 }
 
 uint64_t HyperTextAccessible::NativeState() const {
   uint64_t states = AccessibleWrap::NativeState();
 
-  if (mContent->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
+  if (mContent->AsElement()->State().HasState(NS_EVENT_STATE_READWRITE)) {
     states |= states::EDITABLE;
 
   } else if (mContent->IsHTMLElement(nsGkAtoms::article)) {
     // We want <article> to behave like a document in terms of readonly state.
     states |= states::READONLY;
   }
 
   if (HasChildren()) states |= states::SELECTABLE_TEXT;
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -255,18 +255,17 @@ Element::QueryInterface(REFNSIID aIID, v
   if (NS_SUCCEEDED(rv)) {
     return NS_OK;
   }
 
   return NS_NOINTERFACE;
 }
 
 EventStates Element::IntrinsicState() const {
-  return IsEditable() ? NS_EVENT_STATE_MOZ_READWRITE
-                      : NS_EVENT_STATE_MOZ_READONLY;
+  return IsEditable() ? NS_EVENT_STATE_READWRITE : NS_EVENT_STATE_READONLY;
 }
 
 void Element::NotifyStateChange(EventStates aStates) {
   Document* doc = GetComposedDoc();
   if (doc) {
     nsAutoScriptBlocker scriptBlocker;
     doc->ContentStateChanged(this, aStates);
   }
@@ -329,21 +328,21 @@ void Element::UpdateEditableState(bool a
   if (aNotify) {
     UpdateState(aNotify);
   } else {
     // Avoid calling UpdateState in this very common case, because
     // this gets called for pretty much every single element on
     // insertion into the document and UpdateState can be slow for
     // some kinds of elements even when not notifying.
     if (IsEditable()) {
-      RemoveStatesSilently(NS_EVENT_STATE_MOZ_READONLY);
-      AddStatesSilently(NS_EVENT_STATE_MOZ_READWRITE);
+      RemoveStatesSilently(NS_EVENT_STATE_READONLY);
+      AddStatesSilently(NS_EVENT_STATE_READWRITE);
     } else {
-      RemoveStatesSilently(NS_EVENT_STATE_MOZ_READWRITE);
-      AddStatesSilently(NS_EVENT_STATE_MOZ_READONLY);
+      RemoveStatesSilently(NS_EVENT_STATE_READWRITE);
+      AddStatesSilently(NS_EVENT_STATE_READONLY);
     }
   }
 }
 
 Maybe<int32_t> Element::GetTabIndexAttrValue() {
   const nsAttrValue* attrVal = GetParsedAttr(nsGkAtoms::tabindex);
   if (attrVal && attrVal->Type() == nsAttrValue::eInteger) {
     return Some(attrVal->GetIntegerValue());
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -167,17 +167,17 @@ class Grid;
     SetAttr(nsGkAtoms::attr, aValue, aRv);                      \
   }
 
 class Element : public FragmentOrElement {
  public:
 #ifdef MOZILLA_INTERNAL_API
   explicit Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
       : FragmentOrElement(std::move(aNodeInfo)),
-        mState(NS_EVENT_STATE_MOZ_READONLY | NS_EVENT_STATE_DEFINED) {
+        mState(NS_EVENT_STATE_READONLY | NS_EVENT_STATE_DEFINED) {
     MOZ_ASSERT(mNodeInfo->NodeType() == ELEMENT_NODE,
                "Bad NodeType in aNodeInfo");
     SetIsElement();
   }
 
   ~Element() {
     NS_ASSERTION(!HasServoData(), "expected ServoData to be cleared earlier");
   }
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -192,17 +192,17 @@ HTMLSlotElement* nsIContent::GetAssigned
   return slot;
 }
 
 nsIContent::IMEState nsIContent::GetDesiredIMEState() {
   if (!IsEditable()) {
     // Check for the special case where we're dealing with elements which don't
     // have the editable flag set, but are readwrite (such as text controls).
     if (!IsElement() ||
-        !AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
+        !AsElement()->State().HasState(NS_EVENT_STATE_READWRITE)) {
       return IMEState(IMEState::DISABLED);
     }
   }
   // NOTE: The content for independent editors (e.g., input[type=text],
   // textarea) must override this method, so, we don't need to worry about
   // that here.
   nsIContent* editableAncestor = GetEditingHost();
 
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -356,17 +356,17 @@ static bool IsEditorNode(const nsINode* 
     return false;
   }
 
   if (aNode->IsEditable()) {
     return true;
   }
 
   auto* element = Element::FromNode(aNode);
-  return element && element->State().HasState(NS_EVENT_STATE_MOZ_READWRITE);
+  return element && element->State().HasState(NS_EVENT_STATE_READWRITE);
 }
 
 bool Selection::IsEditorSelection() const {
   return IsEditorNode(GetFocusNode());
 }
 
 Nullable<int16_t> Selection::GetCaretBidiLevel(
     mozilla::ErrorResult& aRv) const {
--- a/dom/events/EventStates.h
+++ b/dom/events/EventStates.h
@@ -223,21 +223,22 @@ class EventStates {
 // Link hasn't been visited.
 #define NS_EVENT_STATE_UNVISITED NS_DEFINE_EVENT_STATE_MACRO(25)
 // Drag is hovering over content.
 #define NS_EVENT_STATE_DRAGOVER NS_DEFINE_EVENT_STATE_MACRO(26)
 // Content value is in-range (and can be out-of-range).
 #define NS_EVENT_STATE_INRANGE NS_DEFINE_EVENT_STATE_MACRO(27)
 // Content value is out-of-range.
 #define NS_EVENT_STATE_OUTOFRANGE NS_DEFINE_EVENT_STATE_MACRO(28)
-// These two are temporary (see bug 302188)
 // Content is read-only.
-#define NS_EVENT_STATE_MOZ_READONLY NS_DEFINE_EVENT_STATE_MACRO(29)
+// TODO(emilio): This is always the inverse of READWRITE. With some style system
+// work we could remove one of the two bits.
+#define NS_EVENT_STATE_READONLY NS_DEFINE_EVENT_STATE_MACRO(29)
 // Content is editable.
-#define NS_EVENT_STATE_MOZ_READWRITE NS_DEFINE_EVENT_STATE_MACRO(30)
+#define NS_EVENT_STATE_READWRITE NS_DEFINE_EVENT_STATE_MACRO(30)
 // Content is the default one (meaning depends of the context).
 #define NS_EVENT_STATE_DEFAULT NS_DEFINE_EVENT_STATE_MACRO(31)
 // Content is a submit control and the form isn't valid.
 #define NS_EVENT_STATE_MOZ_SUBMITINVALID NS_DEFINE_EVENT_STATE_MACRO(32)
 // Content is in the optimum region.
 #define NS_EVENT_STATE_OPTIMUM NS_DEFINE_EVENT_STATE_MACRO(33)
 // Content is in the suboptimal region.
 #define NS_EVENT_STATE_SUB_OPTIMUM NS_DEFINE_EVENT_STATE_MACRO(34)
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -1737,17 +1737,17 @@ nsresult IMEStateManager::NotifyIME(IMEM
 
 // static
 bool IMEStateManager::IsEditable(nsINode* node) {
   if (node->IsEditable()) {
     return true;
   }
   // |node| might be readwrite (for example, a text control)
   if (node->IsElement() &&
-      node->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
+      node->AsElement()->State().HasState(NS_EVENT_STATE_READWRITE)) {
     return true;
   }
   return false;
 }
 
 // static
 nsINode* IMEStateManager::GetRootEditableNode(nsPresContext* aPresContext,
                                               nsIContent* aContent) {
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1972,20 +1972,20 @@ EventStates nsGenericHTMLFormElement::In
   if (mForm && mForm->IsDefaultSubmitElement(this)) {
     NS_ASSERTION(IsSubmitControl(),
                  "Default submit element that isn't a submit control.");
     // We are the default submit element (:default)
     state |= NS_EVENT_STATE_DEFAULT;
   }
 
   // Make the text controls read-write
-  if (!state.HasState(NS_EVENT_STATE_MOZ_READWRITE) && DoesReadOnlyApply()) {
+  if (!state.HasState(NS_EVENT_STATE_READWRITE) && DoesReadOnlyApply()) {
     if (!GetBoolAttr(nsGkAtoms::readonly) && !IsDisabled()) {
-      state |= NS_EVENT_STATE_MOZ_READWRITE;
-      state &= ~NS_EVENT_STATE_MOZ_READONLY;
+      state |= NS_EVENT_STATE_READWRITE;
+      state &= ~NS_EVENT_STATE_READONLY;
     }
   }
 
   return state;
 }
 
 nsGenericHTMLFormElement::FocusTristate nsGenericHTMLFormElement::FocusState() {
   // We can't be focused if we aren't in a (composed) document
--- a/dom/html/test/test_bug1264157.html
+++ b/dom/html/test/test_bug1264157.html
@@ -40,19 +40,19 @@ https://bugzilla.mozilla.org/show_bug.cg
   <input type="number" value=11 min=0 max=10 readonly> Read-only out-of-range
 </div>
 <pre id="test">
 <script type="text/javascript">
 
 /** Test for Bug 1264157 **/
 SimpleTest.waitForFocus(function() {
   // Check the initial values.
-  let active = [].slice.call(document.querySelectorAll("input:not(:disabled):not(:-moz-read-only)"));
+  let active = [].slice.call(document.querySelectorAll("input:not(:disabled):not(:read-only)"));
   let disabled = [].slice.call(document.querySelectorAll("input:disabled"));
-  let readonly = [].slice.call(document.querySelectorAll("input:-moz-read-only:not(:disabled)"));
+  let readonly = [].slice.call(document.querySelectorAll("input:read-only:not(:disabled)"));
   ok(active.length == 2, "Test is messed up: missing non-disabled/non-readonly inputs");
   ok(disabled.length == 2, "Test is messed up: missing disabled inputs");
   ok(readonly.length == 2, "Test is messed up: missing readonly inputs");
 
   is(document.querySelectorAll("input:in-range").length, 1,
      "Wrong number of in-range elements selected.");
   is(document.querySelectorAll("input:out-of-range").length, 1,
      "Wrong number of out-of-range elements selected.");
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -390,17 +390,17 @@ Element* HTMLEditor::FindSelectionRoot(n
     return GetRoot();
   }
 
   nsIContent* content = aNode->AsContent();
   if (!content->HasFlag(NODE_IS_EDITABLE)) {
     // If the content is in read-write state but is not editable itself,
     // return it as the selection root.
     if (content->IsElement() &&
-        content->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
+        content->AsElement()->State().HasState(NS_EVENT_STATE_READWRITE)) {
       return content->AsElement();
     }
     return nullptr;
   }
 
   // For non-readonly editors we want to find the root of the editable subtree
   // containing aContent.
   return content->GetEditingHost();
--- a/editor/reftests/672709-ref.html
+++ b/editor/reftests/672709-ref.html
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <html class="reftest-wait">
   <body>
     <style>
-      :-moz-read-only { color: red; }
-      :-moz-read-write { color: green; }
+      :read-only { color: red; }
+      :read-write { color: green; }
     </style>
     <script>
       onload = function() {
         document.designMode = "on";
         var p = document.createElement("p");
         p.textContent = "test";
         document.getElementById("x").appendChild(p);
         getSelection().removeAllRanges(); // don't need a caret
--- a/editor/reftests/694880-1.html
+++ b/editor/reftests/694880-1.html
@@ -1,10 +1,10 @@
 <!DOCTYPE html>
 <html>
   <style>
-    :-moz-read-only { color: green; }
-    :-moz-read-write { color: red; }
+    :read-only { color: green; }
+    :read-write { color: red; }
   </style>
   <body onload="document.designMode='on';document.designMode='off'">
     <div>test</div>
   </body>
 </html>
--- a/editor/reftests/694880-2.html
+++ b/editor/reftests/694880-2.html
@@ -1,11 +1,11 @@
 <!DOCTYPE html>
 <html>
   <style>
-    :-moz-read-only { color: green; }
-    :-moz-read-write { color: red; }
+    :read-only { color: green; }
+    :read-write { color: red; }
   </style>
   <body onload="document.designMode='on';document.designMode='off'">
     <div>test</div>
     <div contenteditable></div>
   </body>
 </html>
--- a/editor/reftests/694880-3.html
+++ b/editor/reftests/694880-3.html
@@ -1,10 +1,10 @@
 <!DOCTYPE html>
 <html>
   <style>
-    :-moz-read-only { color: red; }
-    :-moz-read-write { color: green; }
+    :read-only { color: red; }
+    :read-write { color: green; }
   </style>
   <body onload="document.designMode='on';document.designMode='off'">
     <div contenteditable>test</div>
   </body>
 </html>
--- a/editor/reftests/readonly-editable.html
+++ b/editor/reftests/readonly-editable.html
@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <html>
   <head>
     <style>
-      :-moz-read-write + span {
+      :read-write + span {
         display: none;
       }
       span {
         color: transparent; /* workaround for bug 617524 */
         outline: 1px solid green;
       }
     </style>
   </head>
--- a/editor/reftests/readonly-non-editable.html
+++ b/editor/reftests/readonly-non-editable.html
@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <html>
   <head>
     <style>
-      :-moz-read-only + span {
+      :read-only + span {
         display: none;
       }
       span {
         color: transparent; /* workaround for bug 617524 */
         outline: 1px solid green;
       }
     </style>
   </head>
--- a/editor/reftests/readwrite-editable.html
+++ b/editor/reftests/readwrite-editable.html
@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <html>
   <head>
     <style>
-      :-moz-read-write + span {
+      :read-write + span {
         display: none;
       }
       span {
         color: transparent; /* workaround for bug 617524 */
         outline: 1px solid green;
       }
     </style>
   </head>
--- a/editor/reftests/readwrite-non-editable.html
+++ b/editor/reftests/readwrite-non-editable.html
@@ -1,13 +1,13 @@
 <!DOCTYPE html>
 <html>
   <head>
     <style>
-      :-moz-read-write + span {
+      :read-write + span {
         display: none;
       }
       span {
         color: transparent; /* workaround for bug 617524 */
         outline: 1px solid green;
       }
     </style>
   </head>
--- a/layout/forms/test/test_readonly.html
+++ b/layout/forms/test/test_readonly.html
@@ -30,29 +30,29 @@
   <input type="color">
 </div>
 <script>
 for (const element of Array.from(document.querySelectorAll('#should-apply *'))) {
   let elementDesc = element.tagName.toLowerCase();
   if (elementDesc === "input")
     elementDesc += ` type="${element.type}"`;
   test(function() {
-    assert_false(element.matches(':-moz-read-only'), "Shouldn't be initially read-only");
-    assert_true(element.matches(':-moz-read-write'), "Thus should be read-write");
+    assert_false(element.matches(':read-only'), "Shouldn't be initially read-only");
+    assert_true(element.matches(':read-write'), "Thus should be read-write");
     element.setAttribute("readonly", "readonly");
-    assert_true(element.matches(':-moz-read-only'), "Should become read-only");
-    assert_false(element.matches(':-moz-read-write'), "Thus should stop being read-write");
+    assert_true(element.matches(':read-only'), "Should become read-only");
+    assert_false(element.matches(':read-write'), "Thus should stop being read-write");
   }, elementDesc);
 }
 
 for (const element of Array.from(document.querySelectorAll('#should-not-apply *'))) {
   let elementDesc = element.tagName.toLowerCase();
   if (elementDesc === "input")
     elementDesc += ` type="${element.type}"`;
   test(function() {
-    assert_true(element.matches(':-moz-read-only'), "Should match read-only");
-    assert_false(element.matches(':-moz-read-write'), "Should not be read-write");
+    assert_true(element.matches(':read-only'), "Should match read-only");
+    assert_false(element.matches(':read-write'), "Should not be read-write");
     element.setAttribute("readonly", "readonly");
-    assert_true(element.matches(':-moz-read-only'), "Should keep matching read-only");
-    assert_false(element.matches(':-moz-read-write'), "Should still not be read-write");
+    assert_true(element.matches(':read-only'), "Should keep matching read-only");
+    assert_false(element.matches(':read-write'), "Should still not be read-write");
   }, elementDesc);
 }
 </script>
--- a/layout/generic/crashtests/767765.html
+++ b/layout/generic/crashtests/767765.html
@@ -1,11 +1,11 @@
 <html class="reftest-wait"><style>
-.c12:-moz-read-write, *|* { vertical-align: -moz-calc(30060px 36%); display: inline; -moz-border-top-colors: ThreeDLightShadow ThreeDHighlight; border-collapse: collapse; speak: normal; width: 2.88999223464x+18mozmm; -moz-outline-radius: -219px/6827px;  }
-.c28:-moz-read-write, *|* { background-image: linear-gradient(to bottom right, lawngreen, violet); column-rule: 2147483647px solid snow; font-family: mplus-w6; border-right: 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999px solid hsla(56224, 127%, 11074%, 3.1529590536x+18); font: Arial, sans-serif; -moz-transform: matrix(9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, 54, 70.084369622, 2600244143.97, 225, 200); animation: step-right 7.82973832672x+18s forwards;.c29 { background: radial-gradient(circle closest-corner at 223px 33127px, mediumspringgreen, steelblue); -moz-appearance: statusbar; font-family: foo, sans-serif; : blue; column-rule-width: 21px; column-rule-style: solid;  }
+.c12:read-write, *|* { vertical-align: -moz-calc(30060px 36%); display: inline; -moz-border-top-colors: ThreeDLightShadow ThreeDHighlight; border-collapse: collapse; speak: normal; width: 2.88999223464x+18mozmm; -moz-outline-radius: -219px/6827px;  }
+.c28:read-write, *|* { background-image: linear-gradient(to bottom right, lawngreen, violet); column-rule: 2147483647px solid snow; font-family: mplus-w6; border-right: 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999px solid hsla(56224, 127%, 11074%, 3.1529590536x+18); font: Arial, sans-serif; -moz-transform: matrix(9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, 54, 70.084369622, 2600244143.97, 225, 200); animation: step-right 7.82973832672x+18s forwards;.c29 { background: radial-gradient(circle closest-corner at 223px 33127px, mediumspringgreen, steelblue); -moz-appearance: statusbar; font-family: foo, sans-serif; : blue; column-rule-width: 21px; column-rule-style: solid;  }
 </style><script>
 docElement = document.documentElement;
 docElement.contentEditable = "true";
 function initCF() {
 document.removeEventListener("DOMContentLoaded", initCF);
 try { tCF0 = document.createElementNS("http://example.org/ExampleBusinessData", "region"); } catch(e) {}
 try { docElement.appendChild(tCF0); } catch(e) {}
 setTimeout(function(){
--- a/layout/reftests/forms/input/number/pseudo-classes.html
+++ b/layout/reftests/forms/input/number/pseudo-classes.html
@@ -7,21 +7,21 @@
   <meta charset="utf-8">
   <title>Test pseudo-classes on number controls</title>
   <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1250315">
   <link rel="help" href="https://drafts.csswg.org/selectors-4/#rw-pseudos">
   <link rel="match" href="about:blank">
   <style type="text/css">
 body,html { color:black; background:white; font-size:16px; padding:0; margin:0; }
 
-#t1:-moz-read-only { display:none; }
-#t1:-moz-read-write { display:block; }
+#t1:read-only { display:none; }
+#t1:read-write { display:block; }
 
-#t2:-moz-read-write { display:none; }
-#t2:-moz-read-only { display:block; }
+#t2:read-write { display:none; }
+#t2:read-only { display:block; }
 
 #t3:disabled { display:none; }
 #t3:enabled { display:block; }
 
 #t4:enabled { display:none; }
 #t4:disabled { display:block; }
 
   </style>
--- a/layout/reftests/forms/input/reftest.list
+++ b/layout/reftests/forms/input/reftest.list
@@ -7,11 +7,8 @@ include number/reftest.list
 include file/reftest.list
 include radio/reftest.list
 include range/reftest.list
 include text/reftest.list
 include percentage/reftest.list
 include hidden/reftest.list
 include color/reftest.list
 include datetime/reftest.list
-
-fuzzy-if(geckoview,0-1,0-2) == selector-read-write-type-change-001.html selector-read-write-type-change-001-ref.html
-== selector-read-write-type-change-002.html selector-read-write-type-change-002-ref.html
deleted file mode 100644
--- a/layout/reftests/forms/input/selector-read-write-type-change-001-ref.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <style>
-      span { color: green; }
-    </style>
-  </head>
-  <body>
-    <input type="button"><span>This should be green</span>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/forms/input/selector-read-write-type-change-001.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Check for correctly updating :read-write matching on type change</title>
-    <link rel="match" href="selector-read-write-type-change-001-ref.html">
-    <style>
-      span { color: green; }
-      :-moz-read-write + span { color: red }
-    </style>
-    <script>
-      onload = function() {
-        document.querySelector("input").type = "button";
-      }
-    </script>
-  </head>
-  <body>
-    <input required><span>This should be green</span>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/forms/input/selector-read-write-type-change-002-ref.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <style>
-      span { color: green; }
-    </style>
-  </head>
-  <body>
-    <input required><span>This should be green</span>
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/forms/input/selector-read-write-type-change-002.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html class="reftest-wait">
-  <head>
-    <title>Check for correctly updating :read-write matching on type change</title>
-    <link rel="match" href="selector-read-write-type-change-002-ref.html">
-    <style>
-      span { color: red; }
-      :-moz-read-write + span { color: green }
-    </style>
-    <script>
-      onload = function() {
-        // setTimeout because in some browsers apparently a toplevel restyle
-        // happens right after the load event fires?
-        setTimeout(function() {
-          document.querySelector("input").type = "";
-          document.documentElement.className = "";
-        }, 10);
-      }
-    </script>
-  </head>
-  <body>
-    <input type="hidden" required><span>This should be green</span>
-  </body>
-</html>
--- a/layout/style/contenteditable.css
+++ b/layout/style/contenteditable.css
@@ -3,92 +3,92 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 @namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
 
 /* Scroll-anchoring shouldn't work in any editable and scrollable elements when
    user inserts something.
 */
-*|*:-moz-read-write:focus,
-*|*:root:-moz-read-write {
+*|*:read-write:focus,
+*|*:root:read-write {
   overflow-anchor: none;
 }
 
 *|*::-moz-canvas {
   cursor: text;
 }
 
 /* Use default arrow over objects with size that
    are selected when clicked on.
    Override the browser's pointer cursor over links
 */
 
-img:-moz-read-write, img:-moz-read-write[usemap], area:-moz-read-write,
-object:-moz-read-write, object:-moz-read-write[usemap],
-applet:-moz-read-write, hr:-moz-read-write, button:-moz-read-write,
-select:-moz-read-write,
-a:-moz-read-write:link img, a:-moz-read-write:visited img,
-a:-moz-read-write:active img, a:-moz-read-write:-moz-only-whitespace[name] {
+img:read-write, img:read-write[usemap], area:read-write,
+object:read-write, object:read-write[usemap],
+applet:read-write, hr:read-write, button:read-write,
+select:read-write,
+a:read-write:link img, a:read-write:visited img,
+a:read-write:active img, a:read-write:-moz-only-whitespace[name] {
   cursor: default;
 }
 
-*|*:any-link:-moz-read-write {
+*|*:any-link:read-write {
   cursor: text;
 }
 
 /* Prevent clicking on links from going to link */
-a:link:-moz-read-write img, a:visited:-moz-read-write img,
-a:active:-moz-read-write img {
+a:link:read-write img, a:visited:read-write img,
+a:active:read-write img {
   -moz-user-input: none;
 }
 
 /* We suppress user/author's prefs for link underline,
    so we must set explicitly. This isn't good!
 */
-a:link:-moz-read-write {
+a:link:read-write {
   color: -moz-hyperlinktext;
 }
 
 /* Allow double-clicks on these widgets to open properties dialogs
    XXX except when the widget has disabled attribute */
-*|*:-moz-read-write > input:-moz-read-only,
-*|*:-moz-read-write > button:-moz-read-only,
-*|*:-moz-read-write > textarea:-moz-read-only {
+*|*:read-write > input:read-only,
+*|*:read-write > button:read-only,
+*|*:read-write > textarea:read-only {
   user-select: all;
   -moz-user-input: auto !important;
   -moz-user-focus: none !important;
 }
 
 /* XXX Still need a better way of blocking other events to these widgets */
-select:-moz-read-write,
-*|*:-moz-read-write > input:disabled,
-*|*:-moz-read-write > input[type="checkbox"],
-*|*:-moz-read-write > input[type="radio"],
-*|*:-moz-read-write > input[type="file"],
+select:read-write,
+*|*:read-write > input:disabled,
+*|*:read-write > input[type="checkbox"],
+*|*:read-write > input[type="radio"],
+*|*:read-write > input[type="file"],
 input[contenteditable="true"]:disabled,
 input[contenteditable="true"][type="checkbox"],
 input[contenteditable="true"][type="radio"],
 input[contenteditable="true"][type="file"] {
   user-select: all;
   -moz-user-input: none !important;
   -moz-user-focus: none !important;
 }
 
-*|*:-moz-read-write > input[type="hidden"],
+*|*:read-write > input[type="hidden"],
 input[contenteditable="true"][type="hidden"] {
   border: 1px solid black !important;
   visibility: visible !important;
 }
 
 *|*::-moz-display-comboboxcontrol-frame {
   user-select: text;
 }
 
-option:-moz-read-write {
+option:read-write {
   user-select: text;
 }
 
 /* the following rules are for Image Resizing */
 
 span[\_moz_anonclass="mozResizer"] {
   width: 5px;
   height: 5px;
--- a/layout/style/res/forms.css
+++ b/layout/style/res/forms.css
@@ -209,18 +209,18 @@ textarea::placeholder {
   opacity: 0.54;
 }
 
 textarea::placeholder,
 textarea::-moz-text-control-preview {
   white-space: pre-wrap !important;
 }
 
-input:-moz-read-write,
-textarea:-moz-read-write {
+input:read-write,
+textarea:read-write {
   -moz-user-modify: read-write !important;
 }
 
 select {
   margin: 0;
   border-color: ThreeDLightShadow;
   background-color: -moz-Combobox;
   color: -moz-ComboboxText;
@@ -1056,18 +1056,18 @@ input[type="date"],
 input[type="time"] {
   overflow: hidden !important;
   font-family: -moz-fixed;
   cursor: default;
 }
 
 input[type="date"]:disabled,
 input[type="time"]:disabled,
-input[type="date"]:-moz-read-only,
-input[type="time"]:-moz-read-only {
+input[type="date"]:read-only,
+input[type="time"]:read-only {
   color: GrayText;
 }
 
 :-moz-autofill, :-moz-autofill-preview {
   filter: grayscale(21%) brightness(88%) contrast(161%) invert(10%) sepia(40%) saturate(206%);
 }
 :-moz-autofill-preview {
   color: GrayText;
--- a/security/manager/pki/resources/content/certViewer.xhtml
+++ b/security/manager/pki/resources/content/certViewer.xhtml
@@ -37,18 +37,18 @@
   }
   th {
     vertical-align: middle;
     text-align: start;
   }
   th[scope="row"] {
     font-weight: normal;
   }
-  input:-moz-read-only,
-  textarea:-moz-read-only {
+  input:read-only,
+  textarea:read-only {
     background: none;
     border: none;
     width: 100%;
     padding-block: 0;
     margin-inline: 0;
   }
 </html:style>
 
--- a/servo/components/style/element_state.rs
+++ b/servo/components/style/element_state.rs
@@ -82,19 +82,19 @@ bitflags! {
                                               ElementState::IN_UNVISITED_STATE.bits;
         /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-drag-over
         const IN_DRAGOVER_STATE = 1 << 26;
         /// <https://html.spec.whatwg.org/multipage/#selector-in-range>
         const IN_INRANGE_STATE = 1 << 27;
         /// <https://html.spec.whatwg.org/multipage/#selector-out-of-range>
         const IN_OUTOFRANGE_STATE = 1 << 28;
         /// <https://html.spec.whatwg.org/multipage/#selector-read-only>
-        const IN_MOZ_READONLY_STATE = 1 << 29;
+        const IN_READONLY_STATE = 1 << 29;
         /// <https://html.spec.whatwg.org/multipage/#selector-read-write>
-        const IN_MOZ_READWRITE_STATE = 1 << 30;
+        const IN_READWRITE_STATE = 1 << 30;
         /// <https://html.spec.whatwg.org/multipage/#selector-default>
         const IN_DEFAULT_STATE = 1 << 31;
         /// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-submit-invalid
         const IN_MOZ_SUBMITINVALID_STATE = 1 << 32;
         /// Non-standard & undocumented.
         const IN_OPTIMUM_STATE = 1 << 33;
         /// Non-standard & undocumented.
         const IN_SUB_OPTIMUM_STATE = 1 << 34;
--- a/servo/components/style/gecko/non_ts_pseudo_class_list.rs
+++ b/servo/components/style/gecko/non_ts_pseudo_class_list.rs
@@ -74,18 +74,18 @@ macro_rules! apply_non_ts_list {
                 ("required", Required, IN_REQUIRED_STATE, _),
                 ("optional", Optional, IN_OPTIONAL_STATE, _),
                 ("valid", Valid, IN_VALID_STATE, _),
                 ("invalid", Invalid, IN_INVALID_STATE, _),
                 ("in-range", InRange, IN_INRANGE_STATE, _),
                 ("out-of-range", OutOfRange, IN_OUTOFRANGE_STATE, _),
                 ("default", Default, IN_DEFAULT_STATE, _),
                 ("placeholder-shown", PlaceholderShown, IN_PLACEHOLDER_SHOWN_STATE, _),
-                ("-moz-read-only", MozReadOnly, IN_MOZ_READONLY_STATE, _),
-                ("-moz-read-write", MozReadWrite, IN_MOZ_READWRITE_STATE, _),
+                ("read-only", ReadOnly, IN_READONLY_STATE, _),
+                ("read-write", ReadWrite, IN_READWRITE_STATE, _),
                 ("-moz-submit-invalid", MozSubmitInvalid, IN_MOZ_SUBMITINVALID_STATE, _),
                 ("-moz-ui-valid", MozUIValid, IN_MOZ_UI_VALID_STATE, _),
                 ("-moz-ui-invalid", MozUIInvalid, IN_MOZ_UI_INVALID_STATE, _),
                 ("-moz-meter-optimum", MozMeterOptimum, IN_OPTIMUM_STATE, _),
                 ("-moz-meter-sub-optimum", MozMeterSubOptimum, IN_SUB_OPTIMUM_STATE, _),
                 ("-moz-meter-sub-sub-optimum", MozMeterSubSubOptimum, IN_SUB_SUB_OPTIMUM_STATE, _),
 
                 ("-moz-user-disabled", MozUserDisabled, IN_USER_DISABLED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
--- a/servo/components/style/gecko/selector_parser.rs
+++ b/servo/components/style/gecko/selector_parser.rs
@@ -114,16 +114,18 @@ impl NonTSPseudoClass {
     /// None otherwise. It doesn't check whether the pseudo-class is enabled
     /// in a particular state.
     pub fn parse_non_functional(name: &str) -> Option<Self> {
         macro_rules! pseudo_class_parse {
             ([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
                 match_ignore_ascii_case! { &name,
                     $($css => Some(NonTSPseudoClass::$name),)*
                     "-moz-full-screen" => Some(NonTSPseudoClass::Fullscreen),
+                    "-moz-read-only" => Some(NonTSPseudoClass::ReadOnly),
+                    "-moz-read-write" => Some(NonTSPseudoClass::ReadWrite),
                     _ => None,
                 }
             }
         }
         apply_non_ts_list!(pseudo_class_parse)
     }
 
     /// Returns true if this pseudo-class has any of the given flags set.
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -2032,18 +2032,18 @@ impl<'le> ::selectors::Element for Gecko
             NonTSPseudoClass::MozUserDisabled |
             NonTSPseudoClass::MozSuppressed |
             NonTSPseudoClass::MozLoading |
             NonTSPseudoClass::MozHandlerBlocked |
             NonTSPseudoClass::MozHandlerDisabled |
             NonTSPseudoClass::MozHandlerCrashed |
             NonTSPseudoClass::Required |
             NonTSPseudoClass::Optional |
-            NonTSPseudoClass::MozReadOnly |
-            NonTSPseudoClass::MozReadWrite |
+            NonTSPseudoClass::ReadOnly |
+            NonTSPseudoClass::ReadWrite |
             NonTSPseudoClass::FocusWithin |
             NonTSPseudoClass::FocusVisible |
             NonTSPseudoClass::MozDragOver |
             NonTSPseudoClass::MozDevtoolsHighlighted |
             NonTSPseudoClass::MozStyleeditorTransitioning |
             NonTSPseudoClass::MozFocusRing |
             NonTSPseudoClass::MozHandlerClickToPlay |
             NonTSPseudoClass::MozHandlerVulnerableUpdatable |
deleted file mode 100644
--- a/testing/web-platform/meta/css/selectors/selector-read-write-type-change-002.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[selector-read-write-type-change-002.html]
-  expected: FAIL
-  bug: 312971
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/selectors/pseudo-classes/readwrite-readonly.html.ini
+++ /dev/null
@@ -1,67 +0,0 @@
-[readwrite-readonly.html]
-  [The :read-write pseudo-class must match input elements to which the readonly attribute applies, and that are mutable]
-    expected: FAIL
-
-  [The :read-only pseudo-class must not match input elements to which the readonly attribute applies, and that are mutable]
-    expected: FAIL
-
-  [The :read-write pseudo-class must not match input elements after the readonly attribute has been added]
-    expected: FAIL
-
-  [The :read-only pseudo-class must match input elements after the readonly attribute has been added]
-    expected: FAIL
-
-  [The :read-write pseudo-class must not match input elements after the readonly attribute has been removed]
-    expected: FAIL
-
-  [The :read-only pseudo-class must match input elements after the readonly attribute has been removed]
-    expected: FAIL
-
-  [The :read-write pseudo-class must match textarea elements that do not have a readonly attribute, and that are not disabled]
-    expected: FAIL
-
-  [The :read-only pseudo-class must match textarea elements that have a readonly attribute, or that are disabled]
-    expected: FAIL
-
-  [The :read-write pseudo-class must match textarea elements after the readonly attribute has been added]
-    expected: FAIL
-
-  [The :read-only pseudo-class must match textarea elements after the readonly attribute has been added]
-    expected: FAIL
-
-  [The :read-write pseudo-class must not match textarea elements that are disabled]
-    expected: FAIL
-
-  [The :read-only pseudo-class must match textarea elements that are disabled]
-    expected: FAIL
-
-  [The :read-write pseudo-class must match elements that are editable]
-    expected: FAIL
-
-  [The :read-only pseudo-class must not match elements that are editable]
-    expected: FAIL
-
-  [The :read-write pseudo-class must match elements that are editing hosts]
-    expected: FAIL
-
-  [The :read-only pseudo-class must not match elements that are editing hosts]
-    expected: FAIL
-
-  [The :read-write pseudo-class must not match input elements to which the readonly attribute does not apply]
-    expected: FAIL
-
-  [The :read-only pseudo-class must match input elements to which the readonly attribute does not apply]
-    expected: FAIL
-
-  [The :read-only pseudo-class must match input elements after the disabled attribute has been added]
-    expected: FAIL
-
-  [The :read-only pseudo-class must not match input elements after the disabled attribute has been removed]
-    expected: FAIL
-
-  [The :read-write pseudo-class must not match input elements after the disabled attribute has been added]
-    expected: FAIL
-
-  [The :read-write pseudo-class must match input elements after the disabled attribute has been removed]
-    expected: FAIL
-
--- a/toolkit/content/widgets/marquee.css
+++ b/toolkit/content/widgets/marquee.css
@@ -17,18 +17,18 @@
 }
 
 .verticalContainer {
   overflow: hidden;
   width: -moz-available;
 }
 
 /* disable scrolling in contenteditable */
-:host(:-moz-read-write) .horizontalOuterDiv,
-:host(:-moz-read-write) .verticalInnerDiv {
+:host(:read-write) .horizontalOuterDiv,
+:host(:read-write) .verticalInnerDiv {
   margin: 0 !important;
   padding: 0 !important;
 }
 
 /* PRINT ONLY rules */
 @media print {
   .horizontalOuterDiv,
   .verticalInnerDiv {