Bug 1151873 - Stop forcing text/plain-only content being copied to the clipboard when an ancestor of the selected node has significant whitespace; r=roc

When fixing bug 116083, I didn't understand the purpose of the original
code correctly.  Setting mIsTextWidget to true will force a text/plain
MIME type, and therefore disabling the copying of any HTML content.  I
don't know why this path in the code used to exist, but it is basically
the cause of this bug, so we should remove it.
This commit is contained in:
Ehsan Akhgari 2015-04-08 21:24:56 -04:00
parent 49407bfd85
commit a39425eab1

View File

@ -1380,19 +1380,6 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
mIsTextWidget = true;
break;
}
else if (selContent->IsElement()) {
nsRefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(selContent->AsElement(),
nullptr, nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
if (textStyle->WhiteSpaceOrNewlineIsSignificant()) {
// Copy as plaintext for all preformatted elements
mIsTextWidget = true;
}
break;
}
}
}
// normalize selection if we are not in a widget