Bug 1317882 - Make sure contextual warning text wraps before we probe for it's height, r=MattN draft
authorTimothy Guan-tin Chien <timdream@gmail.com>
Wed, 30 Nov 2016 12:09:14 +0800
changeset 445718 70aaea6a4a8160f413245e8a14c1738420d9d120
parent 445717 a69583d2dbc6fdc18f63761a89cf539c356668be
child 538596 133bddd9e8d87fd3b378b5d6e22c98c5595b66f1
push id37591
push userbmo:timdream@gmail.com
push dateWed, 30 Nov 2016 04:12:27 +0000
reviewersMattN
bugs1317882
milestone53.0a1
Bug 1317882 - Make sure contextual warning text wraps before we probe for it's height, r=MattN MozReview-Commit-ID: 9g1FYyH1tsh
toolkit/content/widgets/autocomplete.xml
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -1505,16 +1505,25 @@ extends="chrome://global/content/binding
                 xbl:inherits="selected,actiontype">
         <xul:description class="ac-text-overflow-container">
           <xul:description anonid="action-text"
                            class="ac-action-text"
                            xbl:inherits="selected"/>
         </xul:description>
       </xul:hbox>
     </content>
+    <implementation>
+      <constructor>
+        <![CDATA[
+          // Unlike other autocomplete items, the height of the insecure warning expands when overflow.
+          // We would need to calculate the overflow at the of the construction here.
+          this._handleOverflow();
+        ]]>
+      </constructor>
+    </implementation>
   </binding>
 
   <binding id="autocomplete-richlistitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
 
     <content align="center"
              onoverflow="this._onOverflow();"
              onunderflow="this._onUnderflow();">
       <xul:image anonid="type-icon"
@@ -2250,17 +2259,18 @@ extends="chrome://global/content/binding
           }
           let typeIconStart = Number(px.substr(0, px.length - 2));
           this._typeIcon.style.marginInlineStart = (typeIconStart + delta) + "px";
           return delta > 0;
           ]]>
         </body>
       </method>
 
-      <!-- This method truncates the displayed strings as necessary. -->
+      <!-- This method calculates the max-width of the text fields,
+      cause the the displayed strings to truncate or wrap as necessary. -->
       <method name="_handleOverflow">
         <body><![CDATA[
           let itemRect = this.parentNode.getBoundingClientRect();
           let titleRect = this._titleText.getBoundingClientRect();
           let tagsRect = this._tagsText.getBoundingClientRect();
           let separatorRect = this._separator.getBoundingClientRect();
           let urlRect = this._urlText.getBoundingClientRect();
           let actionRect = this._actionText.getBoundingClientRect();