Bug 998188 part.6 MetroFirefox should use XP line break at calling sendQueryContentEvent() in its chrome r=jimm
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 26 Apr 2014 08:52:14 +0900
changeset 180706 93b58802f74386df550295870f5be2bfc5ea51ac
parent 180705 8305804b3099e068fa7f9dcf66c2836f8183c736
child 180707 cf785bf038ed6551bee31d9aeae6fb952ec5b864
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersjimm
bugs998188
milestone31.0a1
Bug 998188 part.6 MetroFirefox should use XP line break at calling sendQueryContentEvent() in its chrome r=jimm
browser/metro/base/content/contenthandlers/FormHelper.js
browser/metro/base/content/contenthandlers/SelectionHandler.js
--- a/browser/metro/base/content/contenthandlers/FormHelper.js
+++ b/browser/metro/base/content/contenthandlers/FormHelper.js
@@ -445,17 +445,18 @@ FormAssistant.prototype = {
 
   /** Caret is used to input text for this element. */
   _getCaretRect: function _formHelperGetCaretRect() {
     let element = this.currentElement;
     let focusedElement = gFocusManager.getFocusedElementForWindow(content, true, {});
     if (element && (element.mozIsTextField && element.mozIsTextField(false) ||
         element instanceof HTMLTextAreaElement) && focusedElement == element && this._isVisibleElement(element)) {
       let utils = Util.getWindowUtils(element.ownerDocument.defaultView);
-      let rect = utils.sendQueryContentEvent(utils.QUERY_CARET_RECT, element.selectionEnd, 0, 0, 0);
+      let rect = utils.sendQueryContentEvent(utils.QUERY_CARET_RECT, element.selectionEnd, 0, 0, 0,
+                                             utils.QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK);
       if (rect) {
         let scroll = ContentScroll.getScrollOffset(element.ownerDocument.defaultView);
         return new Rect(scroll.x + rect.left, scroll.y + rect.top, rect.width, rect.height);
       }
     }
 
     return new Rect(0, 0, 0, 0);
   },
--- a/browser/metro/base/content/contenthandlers/SelectionHandler.js
+++ b/browser/metro/base/content/contenthandlers/SelectionHandler.js
@@ -442,19 +442,21 @@ var SelectionHandler = {
     let position = Util.centerElementInView(aNewViewHeight, this._cache.element);
     if (position !== undefined) {
       return position;
     }
 
     // Special case: we are dealing with an input that is taller than the
     // desired height of content. We need to center on the caret location.
     let rect =
-      this._domWinUtils.sendQueryContentEvent(this._domWinUtils.QUERY_CARET_RECT,
-                                              this._targetElement.selectionEnd,
-                                              0, 0, 0);
+      this._domWinUtils.sendQueryContentEvent(
+        this._domWinUtils.QUERY_CARET_RECT,
+        this._targetElement.selectionEnd,
+        0, 0, 0,
+        this._domWinUtils.QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK);
     if (!rect || !rect.succeeded) {
       Util.dumpLn("no caret was present, unexpected.");
       return 0;
     }
 
     // Note sendQueryContentEvent with QUERY_CARET_RECT is really buggy. If it
     // can't find the exact location of the caret position it will "guess".
     // Sometimes this can put the result in unexpected locations.