зеркало из https://github.com/mozilla/gecko-dev.git
Ignore noxxx content when copy pasting into a plain text editor. b=97687, r=peterv, sr=heikki
This commit is contained in:
Родитель
7d4604306b
Коммит
ce8790d388
|
@ -168,10 +168,9 @@ mozSanitizingHTMLSerializer::Write(const nsAString& aString)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
mozSanitizingHTMLSerializer::GetPref(PRInt32 aTag, PRBool& aPref)
|
||||
mozSanitizingHTMLSerializer::IsEnabled(PRInt32 aTag, PRBool* aReturn)
|
||||
{
|
||||
aPref = PR_FALSE;
|
||||
|
||||
*aReturn = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref);
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn);
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
NS_IMETHOD DoFragment(PRBool aFlag);
|
||||
NS_IMETHOD BeginContext(PRInt32 aPosition) { return NS_OK; }
|
||||
|
|
|
@ -586,18 +586,18 @@ nsPlainTextSerializer::CloseFrameset()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlainTextSerializer::GetPref(PRInt32 aTag, PRBool& aPref)
|
||||
nsPlainTextSerializer::IsEnabled(PRInt32 aTag, PRBool* aReturn)
|
||||
{
|
||||
nsHTMLTag theHTMLTag = nsHTMLTag(aTag);
|
||||
|
||||
if (theHTMLTag == eHTMLTag_script) {
|
||||
aPref = mFlags & nsIDocumentEncoder::OutputNoScriptContent;
|
||||
*aReturn = !(mFlags & nsIDocumentEncoder::OutputNoScriptContent);
|
||||
}
|
||||
else if (theHTMLTag == eHTMLTag_frameset) {
|
||||
aPref = !(mFlags & nsIDocumentEncoder::OutputNoFramesContent);
|
||||
*aReturn = !(mFlags & nsIDocumentEncoder::OutputNoFramesContent);
|
||||
}
|
||||
else {
|
||||
aPref = PR_FALSE;
|
||||
*aReturn = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -634,7 +634,9 @@ nsPlainTextSerializer::DoOpenContainer(const nsIParserNode* aNode, PRInt32 aTag)
|
|||
!(mFlags & nsIDocumentEncoder::OutputNoScriptContent)) ||
|
||||
((type == eHTMLTag_iframe || type == eHTMLTag_noframes) &&
|
||||
!(mFlags & nsIDocumentEncoder::OutputNoFramesContent))) {
|
||||
mIgnoreAboveIndex = mTagStackIndex;
|
||||
// Ignore everything that follows the current tag in
|
||||
// question until a matching end tag is encountered.
|
||||
mIgnoreAboveIndex = mTagStackIndex - 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -923,18 +925,21 @@ nsPlainTextSerializer::DoOpenContainer(const nsIParserNode* aNode, PRInt32 aTag)
|
|||
nsresult
|
||||
nsPlainTextSerializer::DoCloseContainer(PRInt32 aTag)
|
||||
{
|
||||
eHTMLTags type = (eHTMLTags)aTag;
|
||||
|
||||
if (mTagStackIndex > 0) {
|
||||
--mTagStackIndex;
|
||||
}
|
||||
|
||||
if (mTagStackIndex >= mIgnoreAboveIndex) {
|
||||
if (mTagStackIndex == mIgnoreAboveIndex) {
|
||||
// We're dealing with the close tag whose matching
|
||||
// open tag had set the mIgnoreAboveIndex value.
|
||||
// Reset mIgnoreAboveIndex before discarding this tag.
|
||||
mIgnoreAboveIndex = (PRUint32)kNotFound;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mIgnoreAboveIndex = (PRUint32)kNotFound;
|
||||
|
||||
eHTMLTags type = (eHTMLTags)aTag;
|
||||
// End current line if we're ending a block level tag
|
||||
if((type == eHTMLTag_body) || (type == eHTMLTag_html)) {
|
||||
// We want the output to end with a new line,
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref);
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn);
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
|
||||
NS_IMETHOD DoFragment(PRBool aFlag);
|
||||
|
|
|
@ -281,7 +281,7 @@ public:
|
|||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag, PRBool& aPref);
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn);
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack();
|
||||
|
||||
NS_IMETHOD DoFragment(PRBool aFlag);
|
||||
|
@ -3463,16 +3463,16 @@ HTMLContentSink::CloseMap()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLContentSink::GetPref(PRInt32 aTag, PRBool& aPref)
|
||||
HTMLContentSink::IsEnabled(PRInt32 aTag, PRBool* aReturn)
|
||||
{
|
||||
nsHTMLTag theHTMLTag = nsHTMLTag(aTag);
|
||||
|
||||
if (theHTMLTag == eHTMLTag_script) {
|
||||
aPref = mFlags & NS_SINK_FLAG_SCRIPT_ENABLED;
|
||||
*aReturn = mFlags & NS_SINK_FLAG_SCRIPT_ENABLED ? PR_TRUE : PR_FALSE;
|
||||
} else if (theHTMLTag == eHTMLTag_frameset) {
|
||||
aPref = mFlags & NS_SINK_FLAG_FRAMES_ENABLED;
|
||||
*aReturn = mFlags & NS_SINK_FLAG_FRAMES_ENABLED ? PR_TRUE : PR_FALSE;
|
||||
} else {
|
||||
aPref = PR_FALSE;
|
||||
*aReturn = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD OpenNoscript(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseNoscript();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
|
||||
NS_IMETHOD OpenMap(const nsIParserNode& aNode);
|
||||
|
|
|
@ -224,12 +224,10 @@ public:
|
|||
NS_IMETHOD EndContext(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Use this method to retrieve pref. for the tag.
|
||||
*
|
||||
* @update 04/11/01 harishd
|
||||
* @param aTag - Check pref. for this tag.
|
||||
* @update 01/09/2003 harishd
|
||||
* @param aTag - Check if this tag is enabled or not.
|
||||
*/
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) = 0;
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) = 0;
|
||||
|
||||
/**
|
||||
* This method is called when parser is about to begin
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
|
||||
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
|
||||
|
|
|
@ -432,12 +432,12 @@ nsresult CNavDTD::WillBuildModel(const CParserContext& aParserContext,
|
|||
|
||||
if(mSink) {
|
||||
PRBool enabled;
|
||||
mSink->GetPref(eHTMLTag_frameset,enabled);
|
||||
mSink->IsEnabled(eHTMLTag_frameset, &enabled);
|
||||
if(enabled) {
|
||||
mFlags |= NS_DTD_FLAG_FRAMES_ENABLED;
|
||||
}
|
||||
|
||||
mSink->GetPref(eHTMLTag_script,enabled);
|
||||
mSink->IsEnabled(eHTMLTag_script, &enabled);
|
||||
if(enabled) {
|
||||
mFlags |= NS_DTD_FLAG_SCRIPT_ENABLED;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
|
||||
NS_IMETHOD WillProcessTokens(void) { return NS_OK; }
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
|
||||
NS_IMETHOD DoFragment(PRBool aFlag);
|
||||
|
|
|
@ -224,12 +224,10 @@ public:
|
|||
NS_IMETHOD EndContext(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Use this method to retrieve pref. for the tag.
|
||||
*
|
||||
* @update 04/11/01 harishd
|
||||
* @param aTag - Check pref. for this tag.
|
||||
* @update 01/09/2003 harishd
|
||||
* @param aTag - Check if this tag is enabled or not.
|
||||
*/
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) = 0;
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) = 0;
|
||||
|
||||
/**
|
||||
* This method is called when parser is about to begin
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
|
||||
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
|
||||
|
|
|
@ -432,12 +432,12 @@ nsresult CNavDTD::WillBuildModel(const CParserContext& aParserContext,
|
|||
|
||||
if(mSink) {
|
||||
PRBool enabled;
|
||||
mSink->GetPref(eHTMLTag_frameset,enabled);
|
||||
mSink->IsEnabled(eHTMLTag_frameset, &enabled);
|
||||
if(enabled) {
|
||||
mFlags |= NS_DTD_FLAG_FRAMES_ENABLED;
|
||||
}
|
||||
|
||||
mSink->GetPref(eHTMLTag_script,enabled);
|
||||
mSink->IsEnabled(eHTMLTag_script, &enabled);
|
||||
if(enabled) {
|
||||
mFlags |= NS_DTD_FLAG_SCRIPT_ENABLED;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
|
||||
NS_IMETHOD WillProcessTokens(void) { return NS_OK; }
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
NS_IMETHOD CloseMap();
|
||||
NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
|
||||
NS_IMETHOD CloseFrameset();
|
||||
NS_IMETHOD GetPref(PRInt32 aTag,PRBool& aPref) { return NS_OK; }
|
||||
NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
|
||||
NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
|
||||
|
||||
NS_IMETHOD DoFragment(PRBool aFlag);
|
||||
|
|
Загрузка…
Ссылка в новой задаче