зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1643333: part 6) Move `SerializeToStringIterative` to `NodeSerializer`. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D78313
This commit is contained in:
Родитель
f5980a564e
Коммит
7e55972c83
|
@ -239,7 +239,6 @@ class nsDocumentEncoder : public nsIDocumentEncoder {
|
||||||
nsresult SerializeToStringRecursive(nsINode* aNode, bool aDontSerializeRoot,
|
nsresult SerializeToStringRecursive(nsINode* aNode, bool aDontSerializeRoot,
|
||||||
uint32_t aMaxLength = 0);
|
uint32_t aMaxLength = 0);
|
||||||
// This serializes the content of aNode.
|
// This serializes the content of aNode.
|
||||||
nsresult SerializeToStringIterative(nsINode* aNode);
|
|
||||||
nsresult SerializeRangeToString(const nsRange* aRange);
|
nsresult SerializeRangeToString(const nsRange* aRange);
|
||||||
nsresult SerializeRangeNodes(const nsRange* aRange, nsINode* aNode,
|
nsresult SerializeRangeNodes(const nsRange* aRange, nsINode* aNode,
|
||||||
int32_t aDepth);
|
int32_t aDepth);
|
||||||
|
@ -375,6 +374,8 @@ class nsDocumentEncoder : public nsIDocumentEncoder {
|
||||||
nsresult SerializeNodeEnd(nsINode& aOriginalNode,
|
nsresult SerializeNodeEnd(nsINode& aOriginalNode,
|
||||||
nsINode* aFixupNode = nullptr) const;
|
nsINode* aFixupNode = nullptr) const;
|
||||||
|
|
||||||
|
nsresult SerializeToStringIterative(nsINode* aNode) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const bool& mNeedsPreformatScanning;
|
const bool& mNeedsPreformatScanning;
|
||||||
const nsCOMPtr<nsIContentSerializer>& mSerializer;
|
const nsCOMPtr<nsIContentSerializer>& mSerializer;
|
||||||
|
@ -550,7 +551,7 @@ nsresult nsDocumentEncoder::SerializeNode() {
|
||||||
const bool nodeIsContainer = mEncodingScope.mNodeIsContainer;
|
const bool nodeIsContainer = mEncodingScope.mNodeIsContainer;
|
||||||
if (!mNodeFixup && !(mFlags & SkipInvisibleContent) && !mTextStreamer &&
|
if (!mNodeFixup && !(mFlags & SkipInvisibleContent) && !mTextStreamer &&
|
||||||
nodeIsContainer) {
|
nodeIsContainer) {
|
||||||
rv = SerializeToStringIterative(node);
|
rv = mNodeSerializer.SerializeToStringIterative(node);
|
||||||
} else {
|
} else {
|
||||||
rv = SerializeToStringRecursive(node, nodeIsContainer);
|
rv = SerializeToStringRecursive(node, nodeIsContainer);
|
||||||
}
|
}
|
||||||
|
@ -846,17 +847,18 @@ nsresult nsDocumentEncoder::SerializeToStringRecursive(nsINode* aNode,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsDocumentEncoder::SerializeToStringIterative(nsINode* aNode) {
|
nsresult nsDocumentEncoder::NodeSerializer::SerializeToStringIterative(
|
||||||
|
nsINode* aNode) const {
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsINode* node = aNode->GetFirstChildOfTemplateOrNode();
|
nsINode* node = aNode->GetFirstChildOfTemplateOrNode();
|
||||||
while (node) {
|
while (node) {
|
||||||
nsINode* current = node;
|
nsINode* current = node;
|
||||||
rv = mNodeSerializer.SerializeNodeStart(*current, 0, -1, current);
|
rv = SerializeNodeStart(*current, 0, -1, current);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
node = current->GetFirstChildOfTemplateOrNode();
|
node = current->GetFirstChildOfTemplateOrNode();
|
||||||
while (!node && current && current != aNode) {
|
while (!node && current && current != aNode) {
|
||||||
rv = mNodeSerializer.SerializeNodeEnd(*current);
|
rv = SerializeNodeEnd(*current);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
// Check if we have siblings.
|
// Check if we have siblings.
|
||||||
node = current->GetNextSibling();
|
node = current->GetNextSibling();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче