Bug 1270310 - Part 4: Bypass line break conversion if element is single line. r=peterv
☠☠ backed out by df9fd4cff088 ☠ ☠
authorEric Rahm <erahm@mozilla.com>
Thu, 05 May 2016 15:52:28 -0700
changeset 340137 ff9ace379d788d46677e933021ebd041bff8607d
parent 340136 605790e5e6118254accae9c34c5f1a98948972da
child 340138 a789163346d95fc9bef0a113b314ef1a5fce2cb5
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1270310
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1270310 - Part 4: Bypass line break conversion if element is single line. r=peterv For single line text controls we shouldn't need to convert line breaks.
dom/html/HTMLInputElement.cpp
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -5775,24 +5775,26 @@ HTMLInputElement::SaveState()
 
       inputState = new HTMLInputElementState();
       nsAutoString value;
       nsresult rv = GetValue(value);
       if (NS_FAILED(rv)) {
         return rv;
       }
 
-      rv = nsLinebreakConverter::ConvertStringLineBreaks(
-             value,
-             nsLinebreakConverter::eLinebreakPlatform,
-             nsLinebreakConverter::eLinebreakContent);
-
-      if (NS_FAILED(rv)) {
-        NS_ERROR("Converting linebreaks failed!");
-        return rv;
+      if (!IsSingleLineTextControl(false)) {
+        rv = nsLinebreakConverter::ConvertStringLineBreaks(
+               value,
+               nsLinebreakConverter::eLinebreakPlatform,
+               nsLinebreakConverter::eLinebreakContent);
+
+        if (NS_FAILED(rv)) {
+          NS_ERROR("Converting linebreaks failed!");
+          return rv;
+        }
       }
 
       break;
   }
 
   if (inputState) {
     nsPresState* state = GetPrimaryPresState();
     if (state) {