mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1214377 - Hack to solve Thunderbird's need to detect style pre-wrap. r=roc
This commit is contained in:
parent
9bb72b9ef2
commit
81295a7fcb
@ -51,6 +51,7 @@
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsComputedDOMStyle.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -1428,10 +1429,6 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
||||
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())
|
||||
@ -1442,6 +1439,20 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
||||
mIsTextWidget = true;
|
||||
break;
|
||||
}
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
else if (selContent->IsElement()) {
|
||||
nsRefPtr<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
|
||||
@ -1451,7 +1462,6 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user