Bug 1113796 - Use the WhiteSpaceOrNewlineIsSignificant() helper method; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 20 Dec 2014 10:27:25 -0500
changeset 220730 fa443367d637e3ec05de1fca2920a7662a6520a1
parent 220729 663e8640e19681aaa1c137fdd29035abc972bf4e
child 220731 ba0dc109a8f86ca831866a5933cf863d379434cd
child 220756 41373ca728e4950cb74919ea2afc8c0d62c2a694
push id27996
push userphilringnalda@gmail.com
push dateSat, 20 Dec 2014 20:17:43 +0000
treeherdermozilla-central@ba0dc109a8f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1113796
milestone37.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 1113796 - Use the WhiteSpaceOrNewlineIsSignificant() helper method; r=roc
dom/base/nsDocumentEncoder.cpp
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -1391,27 +1391,22 @@ nsHTMLCopyEncoder::SetSelection(nsISelec
       break;
     }
     else if (selContent->IsElement()) {
       nsRefPtr<nsStyleContext> styleContext =
         nsComputedDOMStyle::GetStyleContextForElementNoFlush(selContent->AsElement(),
                                                              nullptr, nullptr);
       if (styleContext) {
         const nsStyleText* textStyle = styleContext->StyleText();
-        switch (textStyle->mWhiteSpace) {
-        case NS_STYLE_WHITESPACE_PRE:
-        case NS_STYLE_WHITESPACE_PRE_WRAP:
-        case NS_STYLE_WHITESPACE_PRE_LINE:
-        case NS_STYLE_WHITESPACE_PRE_SPACE:
+        if (textStyle->WhiteSpaceOrNewlineIsSignificant()) {
           // Copy as plaintext for all preformatted elements
           mIsTextWidget = true;
-          break;
         }
+        break;
       }
-      break;
     }
   }
   
   // normalize selection if we are not in a widget
   if (mIsTextWidget) 
   {
     mSelection = aSelection;
     mMimeType.AssignLiteral("text/plain");