Bug 641117 - Autocomplete suggestions could be show on the wrong element [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Fri, 25 Mar 2011 10:34:41 +0100
changeset 67540 54f24b529eefa5f475ab0de97fb0a634d34095ba
parent 67539 5ea6b5645d91fe81f35a1f71c2345f0b5a5a8b66
child 67541 663cfb4654d088e6907d8f012bf3999bdded2150
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs641117
Bug 641117 - Autocomplete suggestions could be show on the wrong element [r=mfinkle]
mobile/chrome/content/common-ui.js
mobile/themes/core/forms.css
--- a/mobile/chrome/content/common-ui.js
+++ b/mobile/chrome/content/common-ui.js
@@ -883,16 +883,20 @@ var FormHelperUI = {
     suggestionsContainer.left = 0;
 
     // the scrollX/scrollY position can change because of the animated zoom so
     // delay the suggestions positioning
     if (AnimatedZoom.isZooming()) {
       let self = this;
       window.addEventListener("AnimatedZoomEnd", function() {
         window.removeEventListener("AnimatedZoomEnd", arguments.callee, true);
+          // Ensure the current element has not changed during this interval
+          if (self._currentElement != aElement)
+            return;
+
           self._updateSuggestionsFor(aElement);
       }, true);
       return;
     }
 
     let container = suggestionsContainer.firstChild;
     while (container.hasChildNodes())
       container.removeChild(container.lastChild);
@@ -1077,19 +1081,24 @@ var FormHelperUI = {
 
   _ensureCaretVisible: function _ensureCaretVisible(aCaretRect) {
     if (!aCaretRect || !Services.prefs.getBoolPref("formhelper.autozoom.caret"))
       return;
 
     // the scrollX/scrollY position can change because of the animated zoom so
     // delay the caret adjustment
     if (AnimatedZoom.isZooming()) {
+      let currentElement = this._currentElement;
       let self = this;
       window.addEventListener("AnimatedZoomEnd", function() {
         window.removeEventListener("AnimatedZoomEnd", arguments.callee, true);
+          // Ensure the current element has not changed during this interval
+          if (self._currentElement != currentElement)
+            return;
+
           self._ensureCaretVisible(aCaretRect);
       }, true);
       return;
     }
 
     let browser = getBrowser();
     let zoomRect = Rect.fromRect(browser.getBoundingClientRect());
 
--- a/mobile/themes/core/forms.css
+++ b/mobile/themes/core/forms.css
@@ -138,16 +138,17 @@
   padding: 0; /* half core spacing & none (autorepeat arrows compensate) */
   background-color: rgb(235,235,235);
   background-image: url("chrome://browser/skin/images/button-bg.png");
 }
 
 #form-helper-suggestions {
   margin: 0;
   color: black;
+  max-width: 0;
 }
 
 #form-helper-suggestions > .autorepeatbutton-down,
 #form-helper-suggestions > .autorepeatbutton-up {
   border: none;
 }
 
 #form-helper-suggestions > .autorepeatbutton-down {