зеркало из https://github.com/mozilla/gecko-dev.git
Bug 137450 - Fixed bug with end context not being included in HTML Format. r=bz
This commit is contained in:
Родитель
e68013f13f
Коммит
9c54dc49da
|
@ -190,9 +190,9 @@ protected:
|
|||
nsAutoTArray<nsIContent*, 8> mEndNodes;
|
||||
nsAutoTArray<PRInt32, 8> mEndOffsets;
|
||||
bool mHaltRangeHint;
|
||||
// HTML context has already been serialized for
|
||||
// Used when context has already been serialized for
|
||||
// table cell selections (where parent is <tr>)
|
||||
bool mContextAlreadySerialized;
|
||||
bool mDisableContextSerialize;
|
||||
bool mIsCopying; // Set to true only while copying
|
||||
bool mNodeIsContainer;
|
||||
nsStringBuffer* mCachedBuffer;
|
||||
|
@ -240,7 +240,7 @@ void nsDocumentEncoder::Initialize(bool aClearCachedSerializer)
|
|||
mStartRootIndex = 0;
|
||||
mEndRootIndex = 0;
|
||||
mHaltRangeHint = false;
|
||||
mContextAlreadySerialized = false;
|
||||
mDisableContextSerialize = false;
|
||||
mNodeIsContainer = false;
|
||||
if (aClearCachedSerializer) {
|
||||
mSerializer = nsnull;
|
||||
|
@ -922,7 +922,7 @@ nsresult
|
|||
nsDocumentEncoder::SerializeRangeContextStart(const nsTArray<nsINode*>& aAncestorArray,
|
||||
nsAString& aString)
|
||||
{
|
||||
if (mContextAlreadySerialized) {
|
||||
if (mDisableContextSerialize) {
|
||||
return NS_OK;
|
||||
}
|
||||
PRInt32 i = aAncestorArray.Length(), j;
|
||||
|
@ -953,7 +953,7 @@ nsresult
|
|||
nsDocumentEncoder::SerializeRangeContextEnd(const nsTArray<nsINode*>& aAncestorArray,
|
||||
nsAString& aString)
|
||||
{
|
||||
if (mContextAlreadySerialized) {
|
||||
if (mDisableContextSerialize) {
|
||||
return NS_OK;
|
||||
}
|
||||
PRInt32 i = 0, j;
|
||||
|
@ -1129,7 +1129,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
|
|||
rv = SerializeRangeContextStart(mCommonAncestors, output);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Don't let SerializeRangeToString serialize the context again
|
||||
mContextAlreadySerialized = true;
|
||||
mDisableContextSerialize = true;
|
||||
}
|
||||
|
||||
rv = SerializeNodeStart(n, 0, -1, output);
|
||||
|
@ -1139,10 +1139,9 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
|
|||
// Went from a <tr> to a non-<tr>
|
||||
mCommonAncestors.Clear();
|
||||
nsContentUtils::GetAncestors(p->GetNodeParent(), mCommonAncestors);
|
||||
mDisableContextSerialize = false;
|
||||
rv = SerializeRangeContextEnd(mCommonAncestors, output);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Allow output of context again
|
||||
mContextAlreadySerialized = false;
|
||||
prevNode = nsnull;
|
||||
}
|
||||
}
|
||||
|
@ -1158,13 +1157,13 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mCommonAncestors.Clear();
|
||||
nsContentUtils::GetAncestors(p->GetNodeParent(), mCommonAncestors);
|
||||
mDisableContextSerialize = false;
|
||||
rv = SerializeRangeContextEnd(mCommonAncestors, output);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// could have been placed into the above if-loop
|
||||
// but put outside to be safe
|
||||
mContextAlreadySerialized = false;
|
||||
// Just to be safe
|
||||
mDisableContextSerialize = false;
|
||||
|
||||
mSelection = nsnull;
|
||||
} else if (mRange) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче