Bug 672483 - Find in Page toolbar scrolls down with the page when URL bar is displayed r=mfinkle
authorLucas Rocha <lucasr@mozilla.com>
Tue, 09 Aug 2011 12:30:04 -0700
changeset 74146 10aece9bb796496183fdfe3e695a177f9bb9b6cf
parent 74145 1679a3cf1e2b14baf79b4ea52d49b139f29c0a5d
child 74147 838b538e5b4a5ee97912957d2f1100dc785620b2
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersmfinkle
bugs672483
milestone8.0a1
Bug 672483 - Find in Page toolbar scrolls down with the page when URL bar is displayed r=mfinkle
mobile/chrome/content/bindings.xml
--- a/mobile/chrome/content/bindings.xml
+++ b/mobile/chrome/content/bindings.xml
@@ -1584,22 +1584,25 @@
       </field>
 
       <method name="contentHasChanged">
         <body><![CDATA[
           if (!this.isActive)
             return;
 
           // There is a race condition with getBoundingClientRect and when the
-          // box is displayed, the padding is ignored in the size calculation
+          // box is displayed, the padding is ignored in the size calculation.
+          // A nested timeouts below are used to workaround this problem.
           this.getBoundingClientRect();
 
           setTimeout(function(self) {
-            let height = Math.floor(self.getBoundingClientRect().height);
-            self.top = window.innerHeight - height;
+            setTimeout(function(self) {
+              let height = Math.floor(self.getBoundingClientRect().height);
+              self.top = window.innerHeight - height;
+            }, 0, self);
           }, 0, this);
         ]]></body>
       </method>
 
       <property name="isActive" onget="return !!this.model;"/>
 
       <field name="model">null</field>
       <method name="show">