Bug 785520 - Scroll contenteditable elements into view when focused. r=Cwiiis
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 27 Aug 2012 20:36:39 -0400
changeset 105658 1bbd007974326b6bd373b4f87afb5b22d73a8870
parent 105657 c7e7eb166dd9ac82b7ecf7b6892eac4fcac43d5c
child 105659 c1a0b963ffb1b583c87abb6b9c2fa0f0bb793269
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersCwiiis
bugs785520
milestone18.0a1
Bug 785520 - Scroll contenteditable elements into view when focused. r=Cwiiis
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -961,17 +961,19 @@ var BrowserApp = {
   },
 
   scrollToFocusedInput: function(aBrowser) {
     let doc = aBrowser.contentDocument;
     if (!doc)
       return;
 
     let focused = doc.activeElement;
-    if ((focused instanceof HTMLInputElement && focused.mozIsTextField(false)) || (focused instanceof HTMLTextAreaElement)) {
+    if ((focused instanceof HTMLInputElement && focused.mozIsTextField(false))
+        || (focused instanceof HTMLTextAreaElement)
+        || (focused.isContentEditable)) {
       let tab = BrowserApp.getTabForBrowser(aBrowser);
       let win = aBrowser.contentWindow;
 
       // tell gecko to scroll the field into view. this will scroll any nested scrollable elements
       // as well as the browser's content window, and modify the scrollX and scrollY on the content window.
       focused.scrollIntoView(false);
 
       // As Gecko isn't aware of the zoom level we're drawing with, the element may not entirely be in view