Backout
bug 1214377 (rev a0390f2afafd) for build failures, a=rkent
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -45,17 +45,16 @@
#include "nsTArray.h"
#include "nsIFrame.h"
#include "nsStringBuffer.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/EncodingUtils.h"
#include "nsContainerFrame.h"
#include "nsBlockFrame.h"
-#include "nsComputedDOMStyle.h"
using namespace mozilla;
using namespace mozilla::dom;
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
enum nsRangeIterationDirection {
kDirectionOut = -1,
@@ -1426,51 +1425,42 @@ nsHTMLCopyEncoder::SetSelection(nsISelec
// here that multi-range selections are table cell selections, in which case
// the common parent is somewhere in the table and we don't really care where.
nsresult rv = aSelection->GetRangeAt(0, getter_AddRefs(range));
NS_ENSURE_SUCCESS(rv, rv);
if (!range)
return NS_ERROR_NULL_POINTER;
range->GetCommonAncestorContainer(getter_AddRefs(commonParent));
+ // Thunderbird's msg compose code abuses the HTML copy encoder and gets
+ // confused if mIsTextWidget ends up becoming true, so for now we skip
+ // this logic in Thunderbird.
+#ifndef MOZ_THUNDERBIRD
for (nsCOMPtr<nsIContent> selContent(do_QueryInterface(commonParent));
selContent;
selContent = selContent->GetParent())
{
// checking for selection inside a plaintext form widget
nsIAtom *atom = selContent->Tag();
if (atom == nsGkAtoms::input ||
atom == nsGkAtoms::textarea)
{
mIsTextWidget = true;
break;
}
-#ifdef MOZ_THUNDERBIRD
- else if (selContent->IsElement()) {
- RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(
- selContent->AsElement(), nullptr, nullptr);
- if (styleContext) {
- const nsStyleText* textStyle = styleContext->StyleText();
- if (textStyle->mWhiteSpace == NS_STYLE_WHITESPACE_PRE_WRAP) {
- mIsTextWidget = true;
- }
- }
- }
- break;
-#endif
}
// normalize selection if we are not in a widget
if (mIsTextWidget)
{
mSelection = aSelection;
mMimeType.AssignLiteral("text/plain");
return NS_OK;
}
+#endif
// also consider ourselves in a text widget if we can't find an html document
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
if (!(htmlDoc && mDocument->IsHTML())) {
mIsTextWidget = true;
mSelection = aSelection;
// mMimeType is set to text/plain when encoding starts.
return NS_OK;