Bug 1455392 - Remove checkState from nsIDOMXULCheckboxElement and nsIDOMXULButtonElement;r=surkov,r=bz draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Fri, 20 Apr 2018 09:37:03 -0700
changeset 785754 b77fc5fecccf2c336a18c84364f70ccc33ea1fb6
parent 785753 765bc7f830886ed2a5a52ca433a6e1d86511cc46
push id107305
push userbgrinstead@mozilla.com
push dateFri, 20 Apr 2018 16:37:20 +0000
reviewerssurkov, bz
bugs1455392
milestone61.0a1
Bug 1455392 - Remove checkState from nsIDOMXULCheckboxElement and nsIDOMXULButtonElement;r=surkov,r=bz There aren't any consumers for the third state, so `checked` is enough. MozReview-Commit-ID: BpcQX2acA6C
accessible/xul/XULFormControlAccessible.cpp
dom/interfaces/xul/nsIDOMXULButtonElement.idl
dom/interfaces/xul/nsIDOMXULCheckboxElement.idl
toolkit/content/widgets/button.xml
--- a/accessible/xul/XULFormControlAccessible.cpp
+++ b/accessible/xul/XULFormControlAccessible.cpp
@@ -99,24 +99,19 @@ XULButtonAccessible::NativeState()
   // Buttons can be checked -- they simply appear pressed in rather than checked
   nsCOMPtr<nsIDOMXULButtonElement> xulButtonElement(do_QueryInterface(mContent));
   if (xulButtonElement) {
     nsAutoString type;
     xulButtonElement->GetType(type);
     if (type.EqualsLiteral("checkbox") || type.EqualsLiteral("radio")) {
       state |= states::CHECKABLE;
       bool checked = false;
-      int32_t checkState = 0;
       xulButtonElement->GetChecked(&checked);
       if (checked) {
         state |= states::PRESSED;
-        xulButtonElement->GetCheckState(&checkState);
-        if (checkState == nsIDOMXULButtonElement::CHECKSTATE_MIXED) {
-          state |= states::MIXED;
-        }
       }
     }
   }
 
   if (ContainsMenu())
     state |= states::HASPOPUP;
 
   if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_default))
@@ -336,20 +331,16 @@ XULCheckboxAccessible::NativeState()
   // Determine Checked state
   nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement =
     do_QueryInterface(mContent);
   if (xulCheckboxElement) {
     bool checked = false;
     xulCheckboxElement->GetChecked(&checked);
     if (checked) {
       state |= states::CHECKED;
-      int32_t checkState = 0;
-      xulCheckboxElement->GetCheckState(&checkState);
-      if (checkState == nsIDOMXULCheckboxElement::CHECKSTATE_MIXED)
-        state |= states::MIXED;
     }
   }
 
   return state;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULGroupboxAccessible
--- a/dom/interfaces/xul/nsIDOMXULButtonElement.idl
+++ b/dom/interfaces/xul/nsIDOMXULButtonElement.idl
@@ -1,28 +1,23 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 #include "nsIDOMXULLabeledControlEl.idl"
 
-[scriptable, uuid(d56f1f8f-fc4e-4650-9a85-25108bbd1980)]
+[scriptable, uuid(6ed53cfb-9e59-424c-af8d-e74582381951)]
 interface nsIDOMXULButtonElement : nsIDOMXULLabeledControlElement {
-  const short CHECKSTATE_UNCHECKED = 0;
-  const short CHECKSTATE_CHECKED = 1;
-  const short CHECKSTATE_MIXED = 2;
-
   attribute DOMString type;
   attribute DOMString dlgType;
 
   // For buttons of type="menu" only.
   attribute boolean open;
   
   // For buttons of type="checkbox" only.
   attribute boolean checked;
-  attribute long checkState;
   attribute boolean autoCheck;
 
   // For buttons of type="radio" only.
   attribute DOMString group;
 };
 
--- a/dom/interfaces/xul/nsIDOMXULCheckboxElement.idl
+++ b/dom/interfaces/xul/nsIDOMXULCheckboxElement.idl
@@ -1,18 +1,13 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 #include "nsIDOMElement.idl"
 #include "nsIDOMXULLabeledControlEl.idl"
 
-[scriptable, uuid(745518ad-3163-41f0-b358-c81fb5a587bc)]
+[scriptable, uuid(674965d9-aff4-411d-a382-7cb32c0f25a1)]
 interface nsIDOMXULCheckboxElement : nsIDOMXULLabeledControlElement {
-  const short CHECKSTATE_UNCHECKED = 0;
-  const short CHECKSTATE_CHECKED = 1;
-  const short CHECKSTATE_MIXED = 2;
-
   attribute boolean checked;
-  attribute long checkState;
   attribute boolean autoCheck;
 };
--- a/toolkit/content/widgets/button.xml
+++ b/toolkit/content/widgets/button.xml
@@ -34,50 +34,31 @@
             this.removeAttribute("open");
           }
           return val;
         ]]></setter>
       </property>
 
       <property name="checked" onget="return this.hasAttribute('checked');">
         <setter><![CDATA[
-          if (this.type == "checkbox") {
-            this.checkState = val ? 1 : 0;
-          } else if (this.type == "radio" && val) {
+          if (this.type == "radio" && val) {
             var sibs = this.parentNode.getElementsByAttribute("group", this.group);
             for (var i = 0; i < sibs.length; ++i)
               sibs[i].removeAttribute("checked");
           }
 
           if (val)
             this.setAttribute("checked", "true");
           else
             this.removeAttribute("checked");
 
           return val;
         ]]></setter>
       </property>
 
-      <property name="checkState">
-        <getter><![CDATA[
-          var state = this.getAttribute("checkState");
-          if (state == "")
-            return this.checked ? 1 : 0;
-          if (state == "0")
-            return 0;
-          if (state == "2")
-            return 2;
-          return 1;
-        ]]></getter>
-        <setter><![CDATA[
-          this.setAttribute("checkState", val);
-          return val;
-        ]]></setter>
-      </property>
-
       <property name="autoCheck"
                 onget="return this.getAttribute('autoCheck') == 'true';"
                 onset="this.setAttribute('autoCheck', val); return val;"/>
 
       <method name ="filterButtons">
         <parameter name="node"/>
         <body>
         <![CDATA[