Bug 1575495: part 1) Simplify assignments to `mAtFirstColumn`. r=hsivonen
authorMirko Brodesser <mbrodesser@mozilla.com>
Fri, 23 Aug 2019 13:16:30 +0000
changeset 553583 0fd980b158e3a9566edcac0d7614e5ff4c32ee25
parent 553582 25e387fe2c17749fa16dacffa11121cd1feebaaa
child 553584 149e16997325445797f0bbc47bb5b4bdef458eb4
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs1575495
milestone70.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 1575495: part 1) Simplify assignments to `mAtFirstColumn`. r=hsivonen Differential Revision: https://phabricator.services.mozilla.com/D42837
dom/base/nsPlainTextSerializer.cpp
--- a/dom/base/nsPlainTextSerializer.cpp
+++ b/dom/base/nsPlainTextSerializer.cpp
@@ -1089,17 +1089,17 @@ void nsPlainTextSerializer::EnsureVertic
 void nsPlainTextSerializer::FlushLine() {
   if (!mCurrentLineContent.mValue.IsEmpty()) {
     if (mAtFirstColumn) {
       OutputQuotesAndIndent();  // XXX: Should we always do this? Bug?
     }
 
     MaybeReplaceNbspsForOutput(mCurrentLineContent.mValue);
     Output(mCurrentLineContent.mValue);
-    mAtFirstColumn = mAtFirstColumn && mCurrentLineContent.mValue.IsEmpty();
+    mAtFirstColumn = false;
     mCurrentLineContent.mValue.Truncate();
     mCurrentLineContent.mWidth = 0;
   }
 }
 
 void nsPlainTextSerializer::MaybeReplaceNbspsForOutput(
     nsString& aString) const {
   if (!(mSettings.mFlags & nsIDocumentEncoder::OutputPersistNBSP)) {
@@ -1391,47 +1391,45 @@ void nsPlainTextSerializer::OutputQuotes
       /* Better don't output a space here, if the line is empty,
          in case a receiving f=f-aware UA thinks, this were a flowed line,
          which it isn't - it's just empty.
          (Flowed lines may be joined with the following one,
          so the empty line may be lost completely.) */
       quotes.Append(char16_t(' '));
     }
     stringToOutput = quotes;
-    mAtFirstColumn = false;
   }
 
   // Indent if necessary
   int32_t indentwidth = mIndent - mInIndentString.Length();
   if (indentwidth > 0 &&
       (!mCurrentLineContent.mValue.IsEmpty() || !mInIndentString.IsEmpty())
       // Don't make empty lines look flowed
   ) {
     nsAutoString spaces;
     for (int i = 0; i < indentwidth; ++i) spaces.Append(char16_t(' '));
     stringToOutput += spaces;
-    mAtFirstColumn = false;
   }
 
   if (!mInIndentString.IsEmpty()) {
     stringToOutput += mInIndentString;
-    mAtFirstColumn = false;
     mInIndentString.Truncate();
   }
 
   if (stripTrailingSpaces) {
     int32_t lineLength = stringToOutput.Length();
     while (lineLength > 0 && ' ' == stringToOutput[lineLength - 1]) {
       --lineLength;
     }
     stringToOutput.SetLength(lineLength);
   }
 
   if (!stringToOutput.IsEmpty()) {
     Output(stringToOutput);
+    mAtFirstColumn = false;
   }
 }
 
 /**
  * Write a string. This is the highlevel function to use to get text output.
  * By using AddToLine, Output, EndLine and other functions it handles quotation,
  * line wrapping, indentation, whitespace compression and other things.
  */