Bug 1356663 - Calculate the status panel's mouse target rectangle lazily in getMouseTargetRect. r?florian draft
authorDão Gottwald <dao@mozilla.com>
Sun, 16 Apr 2017 16:43:53 +0200
changeset 563364 47adb98a6d41f06882dd578a2f7ab08198fef051
parent 563120 9379831bb9c3d9abfea7dbf8dd06dbdab1d81dc4
child 624442 3ae17fb022dbfeba5bde92b6c563b7725664b984
push id54265
push userdgottwald@mozilla.com
push dateSun, 16 Apr 2017 14:48:04 +0000
reviewersflorian
bugs1356663
milestone55.0a1
Bug 1356663 - Calculate the status panel's mouse target rectangle lazily in getMouseTargetRect. r?florian MozReview-Commit-ID: 1g07rylDWkx
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -7704,32 +7704,35 @@
 
           this.style.minWidth = this.getAttribute("type") == "status" &&
                                 this.getAttribute("previoustype") == "status"
                                   ? getComputedStyle(this).width : "";
 
           if (val) {
             this.setAttribute("label", val);
             this.removeAttribute("inactive");
-            this._calcMouseTargetRect();
+            this._mouseTargetRect = null;
             MousePosTracker.addListener(this);
           } else {
             this.setAttribute("inactive", "true");
             MousePosTracker.removeListener(this);
           }
 
           return val;
         ]]></setter>
         <getter>
           return this.hasAttribute("inactive") ? "" : this.getAttribute("label");
         </getter>
       </property>
 
       <method name="getMouseTargetRect">
         <body><![CDATA[
+          if (!this._mouseTargetRect) {
+            this._calcMouseTargetRect();
+          }
           return this._mouseTargetRect;
         ]]></body>
       </method>
 
       <method name="onMouseEnter">
         <body>
           this._mirror();
         </body>
@@ -7744,17 +7747,17 @@
       <method name="handleEvent">
         <parameter name="event"/>
         <body><![CDATA[
           if (!this.label)
             return;
 
           switch (event.type) {
             case "resize":
-              this._calcMouseTargetRect();
+              this._mouseTargetRect = null;
               break;
           }
         ]]></body>
       </method>
 
       <method name="_calcMouseTargetRect">
         <body><![CDATA[
           let container = this.parentNode;
@@ -7775,17 +7778,17 @@
         <body>
           if (this.hasAttribute("mirror"))
             this.removeAttribute("mirror");
           else
             this.setAttribute("mirror", "true");
 
           if (!this.hasAttribute("sizelimit")) {
             this.setAttribute("sizelimit", "true");
-            this._calcMouseTargetRect();
+            this._mouseTargetRect = null;
           }
         </body>
       </method>
     </implementation>
   </binding>
 
   <binding id="tabbrowser-tabpanels"
            extends="chrome://global/content/bindings/tabbox.xml#tabpanels">