Bug 1494529 - kill #text-label binding, r=smaug
authorAlexander Surkov <surkov.alexander@gmail.com>
Tue, 02 Oct 2018 10:15:51 +0800
changeset 494865 181d337b15bd2354fa1b910e735c1521ee8d7807
parent 494864 2b4331c9d829043af5513f3f1b97f53026928d8c
child 494866 aa6baa1cd577a16cf471e36c1eee51d19b74d201
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1494529
milestone64.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 1494529 - kill #text-label binding, r=smaug
dom/chrome-webidl/XULTextElement.webidl
dom/xul/XULTextElement.h
toolkit/content/widgets/text.xml
toolkit/content/xul.css
--- a/dom/chrome-webidl/XULTextElement.webidl
+++ b/dom/chrome-webidl/XULTextElement.webidl
@@ -4,9 +4,10 @@
  * 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/.
  */
 
 [HTMLConstructor, Func="IsChromeOrXBL"]
 interface XULTextElement : XULElement {
   attribute boolean disabled;
   attribute DOMString value;
+  attribute DOMString accessKey;
 };
--- a/dom/xul/XULTextElement.h
+++ b/dom/xul/XULTextElement.h
@@ -32,16 +32,24 @@ public:
   void GetValue(DOMString& aValue) const
   {
     GetXULAttr(nsGkAtoms::value, aValue);
   }
   MOZ_CAN_RUN_SCRIPT void SetValue(const nsAString& aValue)
   {
     SetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue, true);
   }
+  void GetAccessKey(DOMString& aValue) const
+  {
+    GetXULAttr(nsGkAtoms::accesskey, aValue);
+  }
+  MOZ_CAN_RUN_SCRIPT void SetAccessKey(const nsAString& aValue)
+  {
+    SetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, aValue, true);
+  }
 
 protected:
   virtual ~XULTextElement() {}
   JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) final;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/toolkit/content/widgets/text.xml
+++ b/toolkit/content/widgets/text.xml
@@ -4,46 +4,17 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 
 <bindings id="textBindings"
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:html="http://www.w3.org/1999/xhtml">
 
-  <binding id="text-label">
-    <implementation>
-      <property name="accessKey">
-        <getter>
-          <![CDATA[
-            var accessKey = this.getAttribute("accesskey");
-            return accessKey ? accessKey[0] : null;
-          ]]>
-        </getter>
-        <setter>
-          <![CDATA[
-            this.setAttribute("accesskey", val);
-            return val;
-          ]]>
-        </setter>
-      </property>
-
-      <property name="control" onget="return getAttribute('control');">
-        <setter>
-          <![CDATA[
-            // After this gets set, the label will use the binding #label-control
-            this.setAttribute("control", val);
-            return val;
-          ]]>
-        </setter>
-      </property>
-    </implementation>
-  </binding>
-
-  <binding id="label-control" extends="chrome://global/content/bindings/text.xml#text-label">
+  <binding id="label-control">
     <content>
       <children/><html:span anonid="accessKeyParens"></html:span>
     </content>
     <implementation>
       <constructor>
         <![CDATA[
           this.formatAccessKey(true);
         ]]>
@@ -281,17 +252,17 @@
           controlElement.checked = !controlElement.checked;
         } else if (controlElement.localName == "radio") {
           controlElement.control.selectedItem = controlElement;
         }
       ]]></handler>
     </handlers>
   </binding>
 
-  <binding id="text-link" extends="chrome://global/content/bindings/text.xml#text-label">
+  <binding id="text-link">
     <implementation>
       <property name="href" onget="return this.getAttribute('href');"
                             onset="this.setAttribute('href', val); return val;" />
       <method name="open">
         <parameter name="aEvent"/>
         <body>
         <![CDATA[
           var href = this.href;
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -95,20 +95,16 @@ page {
 /******** box *******/
 
 vbox {
   -moz-box-orient: vertical;
 }
 
 /********** label **********/
 
-label {
-  -moz-binding: url("chrome://global/content/bindings/text.xml#text-label");
-}
-
 label.text-link, label[onclick] {
   -moz-binding: url("chrome://global/content/bindings/text.xml#text-link");
   -moz-user-focus: normal;
 }
 
 label[control], label.radio-label, label.checkbox-label, label.toolbarbutton-multiline-text {
   -moz-binding: url("chrome://global/content/bindings/text.xml#label-control");
 }