зеркало из https://github.com/mozilla/gecko-dev.git
Bug 959150 part 3 - Move the parts of nsHtml5TreeOpExecutor that the static methods in nsHtml5TreeOperation need to access into a new superclass. r=smaug.
This commit is contained in:
Родитель
dfb2504638
Коммит
128e0f3424
|
@ -21,6 +21,7 @@ EXPORTS += [
|
|||
'nsHtml5AtomTable.h',
|
||||
'nsHtml5ByteReadable.h',
|
||||
'nsHtml5DependentUTF16Buffer.h',
|
||||
'nsHtml5DocumentBuilder.h',
|
||||
'nsHtml5DocumentMode.h',
|
||||
'nsHtml5HtmlAttributes.h',
|
||||
'nsHtml5Macros.h',
|
||||
|
@ -54,6 +55,7 @@ UNIFIED_SOURCES += [
|
|||
'nsHtml5AtomTable.cpp',
|
||||
'nsHtml5AttributeName.cpp',
|
||||
'nsHtml5DependentUTF16Buffer.cpp',
|
||||
'nsHtml5DocumentBuilder.cpp',
|
||||
'nsHtml5ElementName.cpp',
|
||||
'nsHtml5Highlighter.cpp',
|
||||
'nsHtml5HtmlAttributes.cpp',
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 sw=2 et tw=78: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsHtml5DocumentBuilder.h"
|
||||
|
||||
#include "nsScriptLoader.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsHtml5DocumentBuilder, nsContentSink,
|
||||
mOwnedElements)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsHtml5DocumentBuilder)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsContentSink)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHtml5DocumentBuilder, nsContentSink)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHtml5DocumentBuilder, nsContentSink)
|
||||
|
||||
void
|
||||
nsHtml5DocumentBuilder::DropHeldElements()
|
||||
{
|
||||
mScriptLoader = nullptr;
|
||||
mDocument = nullptr;
|
||||
mNodeInfoManager = nullptr;
|
||||
mCSSLoader = nullptr;
|
||||
mDocumentURI = nullptr;
|
||||
mDocShell = nullptr;
|
||||
mOwnedElements.Clear();
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 sw=2 et tw=78: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsHtml5DocumentBuilder_h
|
||||
#define nsHtml5DocumentBuilder_h
|
||||
|
||||
#include "nsHtml5PendingNotification.h"
|
||||
|
||||
typedef nsIContent* nsIContentPtr;
|
||||
|
||||
enum eHtml5FlushState {
|
||||
eNotFlushing = 0, // not flushing
|
||||
eInFlush = 1, // the Flush() method is on the call stack
|
||||
eInDocUpdate = 2, // inside an update batch on the document
|
||||
eNotifying = 3 // flushing pending append notifications
|
||||
};
|
||||
|
||||
class nsHtml5DocumentBuilder : public nsContentSink
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHtml5DocumentBuilder,
|
||||
nsContentSink)
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
inline void HoldElement(nsIContent* aContent) {
|
||||
mOwnedElements.AppendElement(aContent);
|
||||
}
|
||||
|
||||
inline bool HaveNotified(nsIContent* aNode) {
|
||||
NS_PRECONDITION(aNode, "HaveNotified called with null argument.");
|
||||
const nsHtml5PendingNotification* start = mPendingNotifications.Elements();
|
||||
const nsHtml5PendingNotification* end = start + mPendingNotifications.Length();
|
||||
for (;;) {
|
||||
nsIContent* parent = aNode->GetParent();
|
||||
if (!parent) {
|
||||
return true;
|
||||
}
|
||||
for (nsHtml5PendingNotification* iter = (nsHtml5PendingNotification*)start; iter < end; ++iter) {
|
||||
if (iter->Contains(parent)) {
|
||||
return iter->HaveNotifiedIndex(parent->IndexOf(aNode));
|
||||
}
|
||||
}
|
||||
aNode = parent;
|
||||
}
|
||||
}
|
||||
|
||||
void PostPendingAppendNotification(nsIContent* aParent, nsIContent* aChild) {
|
||||
bool newParent = true;
|
||||
const nsIContentPtr* first = mElementsSeenInThisAppendBatch.Elements();
|
||||
const nsIContentPtr* last = first + mElementsSeenInThisAppendBatch.Length() - 1;
|
||||
for (const nsIContentPtr* iter = last; iter >= first; --iter) {
|
||||
#ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
|
||||
sAppendBatchSlotsExamined++;
|
||||
#endif
|
||||
if (*iter == aParent) {
|
||||
newParent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aChild->IsElement()) {
|
||||
mElementsSeenInThisAppendBatch.AppendElement(aChild);
|
||||
}
|
||||
mElementsSeenInThisAppendBatch.AppendElement(aParent);
|
||||
if (newParent) {
|
||||
mPendingNotifications.AppendElement(aParent);
|
||||
}
|
||||
#ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
|
||||
sAppendBatchExaminations++;
|
||||
#endif
|
||||
}
|
||||
|
||||
void FlushPendingAppendNotifications() {
|
||||
NS_PRECONDITION(mFlushState == eInDocUpdate, "Notifications flushed outside update");
|
||||
mFlushState = eNotifying;
|
||||
const nsHtml5PendingNotification* start = mPendingNotifications.Elements();
|
||||
const nsHtml5PendingNotification* end = start + mPendingNotifications.Length();
|
||||
for (nsHtml5PendingNotification* iter = (nsHtml5PendingNotification*)start; iter < end; ++iter) {
|
||||
iter->Fire();
|
||||
}
|
||||
mPendingNotifications.Clear();
|
||||
#ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
|
||||
if (mElementsSeenInThisAppendBatch.Length() > sAppendBatchMaxSize) {
|
||||
sAppendBatchMaxSize = mElementsSeenInThisAppendBatch.Length();
|
||||
}
|
||||
#endif
|
||||
mElementsSeenInThisAppendBatch.Clear();
|
||||
NS_ASSERTION(mFlushState == eNotifying, "mFlushState out of sync");
|
||||
mFlushState = eInDocUpdate;
|
||||
}
|
||||
|
||||
void DropHeldElements();
|
||||
|
||||
// Getters and setters for fields from nsContentSink
|
||||
nsIDocument* GetDocument() {
|
||||
return mDocument;
|
||||
}
|
||||
nsNodeInfoManager* GetNodeInfoManager() {
|
||||
return mNodeInfoManager;
|
||||
}
|
||||
|
||||
virtual bool BelongsToStringParser() = 0;
|
||||
|
||||
protected:
|
||||
inline void SetAppendBatchCapacity(uint32_t aCapacity)
|
||||
{
|
||||
mElementsSeenInThisAppendBatch.SetCapacity(aCapacity);
|
||||
}
|
||||
|
||||
private:
|
||||
nsTArray<nsHtml5PendingNotification> mPendingNotifications;
|
||||
nsTArray<nsCOMPtr<nsIContent> > mOwnedElements;
|
||||
nsTArray<nsIContentPtr> mElementsSeenInThisAppendBatch;
|
||||
protected:
|
||||
eHtml5FlushState mFlushState;
|
||||
};
|
||||
|
||||
#endif // nsHtml5DocumentBuilder_h
|
|
@ -35,13 +35,10 @@
|
|||
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsHtml5TreeOpExecutor, nsContentSink,
|
||||
mOwnedElements)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHtml5TreeOpExecutor)
|
||||
NS_INTERFACE_TABLE_INHERITED1(nsHtml5TreeOpExecutor,
|
||||
nsIContentSink)
|
||||
NS_INTERFACE_TABLE_TAIL_INHERITING(nsContentSink)
|
||||
NS_INTERFACE_TABLE_TAIL_INHERITING(nsHtml5DocumentBuilder)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHtml5TreeOpExecutor, nsContentSink)
|
||||
|
||||
|
@ -509,7 +506,7 @@ nsHtml5TreeOpExecutor::RunFlushLoop()
|
|||
|
||||
uint32_t numberOfOpsToFlush = mOpQueue.Length();
|
||||
|
||||
mElementsSeenInThisAppendBatch.SetCapacity(numberOfOpsToFlush * 2);
|
||||
SetAppendBatchCapacity(numberOfOpsToFlush * 2);
|
||||
|
||||
const nsHtml5TreeOperation* first = mOpQueue.Elements();
|
||||
const nsHtml5TreeOperation* last = first + numberOfOpsToFlush - 1;
|
||||
|
@ -613,7 +610,7 @@ nsHtml5TreeOpExecutor::FlushDocumentWrite()
|
|||
|
||||
uint32_t numberOfOpsToFlush = mOpQueue.Length();
|
||||
|
||||
mElementsSeenInThisAppendBatch.SetCapacity(numberOfOpsToFlush * 2);
|
||||
SetAppendBatchCapacity(numberOfOpsToFlush * 2);
|
||||
|
||||
const nsHtml5TreeOperation* start = mOpQueue.Elements();
|
||||
const nsHtml5TreeOperation* end = start + numberOfOpsToFlush;
|
||||
|
@ -898,18 +895,6 @@ nsHtml5TreeOpExecutor::Reset()
|
|||
MOZ_ASSERT(NS_SUCCEEDED(mBroken));
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeOpExecutor::DropHeldElements()
|
||||
{
|
||||
mScriptLoader = nullptr;
|
||||
mDocument = nullptr;
|
||||
mNodeInfoManager = nullptr;
|
||||
mCSSLoader = nullptr;
|
||||
mDocumentURI = nullptr;
|
||||
mDocShell = nullptr;
|
||||
mOwnedElements.Clear();
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeOpExecutor::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue)
|
||||
{
|
||||
|
|
|
@ -6,13 +6,11 @@
|
|||
#define nsHtml5TreeOpExecutor_h
|
||||
|
||||
#include "nsIAtom.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "nsHtml5TreeOperation.h"
|
||||
#include "nsHtml5SpeculativeLoad.h"
|
||||
#include "nsHtml5PendingNotification.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsContentSink.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
|
@ -25,22 +23,14 @@
|
|||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "nsHtml5DocumentBuilder.h"
|
||||
|
||||
class nsHtml5Parser;
|
||||
class nsHtml5TreeBuilder;
|
||||
class nsHtml5Tokenizer;
|
||||
class nsHtml5StreamParser;
|
||||
|
||||
typedef nsIContent* nsIContentPtr;
|
||||
|
||||
enum eHtml5FlushState {
|
||||
eNotFlushing = 0, // not flushing
|
||||
eInFlush = 1, // the Flush() method is on the call stack
|
||||
eInDocUpdate = 2, // inside an update batch on the document
|
||||
eNotifying = 3 // flushing pending append notifications
|
||||
};
|
||||
|
||||
class nsHtml5TreeOpExecutor : public nsContentSink,
|
||||
class nsHtml5TreeOpExecutor : public nsHtml5DocumentBuilder,
|
||||
public nsIContentSink,
|
||||
public nsAHtml5TreeOpSink,
|
||||
public mozilla::LinkedListElement<nsHtml5TreeOpExecutor>
|
||||
|
@ -50,7 +40,6 @@ class nsHtml5TreeOpExecutor : public nsContentSink,
|
|||
public:
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHtml5TreeOpExecutor, nsContentSink)
|
||||
|
||||
private:
|
||||
static bool sExternalViewSource;
|
||||
|
@ -69,10 +58,7 @@ class nsHtml5TreeOpExecutor : public nsContentSink,
|
|||
|
||||
bool mReadingFromStage;
|
||||
nsTArray<nsHtml5TreeOperation> mOpQueue;
|
||||
nsTArray<nsIContentPtr> mElementsSeenInThisAppendBatch;
|
||||
nsTArray<nsHtml5PendingNotification> mPendingNotifications;
|
||||
nsHtml5StreamParser* mStreamParser;
|
||||
nsTArray<nsCOMPtr<nsIContent> > mOwnedElements;
|
||||
|
||||
/**
|
||||
* URLs already preloaded/preloading.
|
||||
|
@ -90,8 +76,6 @@ class nsHtml5TreeOpExecutor : public nsContentSink,
|
|||
|
||||
nsHtml5TreeOpStage mStage;
|
||||
|
||||
eHtml5FlushState mFlushState;
|
||||
|
||||
bool mRunFlushLoopOnStack;
|
||||
|
||||
bool mCallContinueInterruptedParsingIfEnabled;
|
||||
|
@ -180,13 +164,7 @@ class nsHtml5TreeOpExecutor : public nsContentSink,
|
|||
*/
|
||||
void UpdateStyleSheet(nsIContent* aElement);
|
||||
|
||||
// Getters and setters for fields from nsContentSink
|
||||
nsIDocument* GetDocument() {
|
||||
return mDocument;
|
||||
}
|
||||
nsNodeInfoManager* GetNodeInfoManager() {
|
||||
return mNodeInfoManager;
|
||||
}
|
||||
// XXX Does anyone need this?
|
||||
nsIDocShell* GetDocShell() {
|
||||
return mDocShell;
|
||||
}
|
||||
|
@ -247,68 +225,7 @@ class nsHtml5TreeOpExecutor : public nsContentSink,
|
|||
}
|
||||
}
|
||||
|
||||
void PostPendingAppendNotification(nsIContent* aParent, nsIContent* aChild) {
|
||||
bool newParent = true;
|
||||
const nsIContentPtr* first = mElementsSeenInThisAppendBatch.Elements();
|
||||
const nsIContentPtr* last = first + mElementsSeenInThisAppendBatch.Length() - 1;
|
||||
for (const nsIContentPtr* iter = last; iter >= first; --iter) {
|
||||
#ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
|
||||
sAppendBatchSlotsExamined++;
|
||||
#endif
|
||||
if (*iter == aParent) {
|
||||
newParent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aChild->IsElement()) {
|
||||
mElementsSeenInThisAppendBatch.AppendElement(aChild);
|
||||
}
|
||||
mElementsSeenInThisAppendBatch.AppendElement(aParent);
|
||||
if (newParent) {
|
||||
mPendingNotifications.AppendElement(aParent);
|
||||
}
|
||||
#ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
|
||||
sAppendBatchExaminations++;
|
||||
#endif
|
||||
}
|
||||
|
||||
void FlushPendingAppendNotifications() {
|
||||
NS_PRECONDITION(mFlushState == eInDocUpdate, "Notifications flushed outside update");
|
||||
mFlushState = eNotifying;
|
||||
const nsHtml5PendingNotification* start = mPendingNotifications.Elements();
|
||||
const nsHtml5PendingNotification* end = start + mPendingNotifications.Length();
|
||||
for (nsHtml5PendingNotification* iter = (nsHtml5PendingNotification*)start; iter < end; ++iter) {
|
||||
iter->Fire();
|
||||
}
|
||||
mPendingNotifications.Clear();
|
||||
#ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
|
||||
if (mElementsSeenInThisAppendBatch.Length() > sAppendBatchMaxSize) {
|
||||
sAppendBatchMaxSize = mElementsSeenInThisAppendBatch.Length();
|
||||
}
|
||||
#endif
|
||||
mElementsSeenInThisAppendBatch.Clear();
|
||||
NS_ASSERTION(mFlushState == eNotifying, "mFlushState out of sync");
|
||||
mFlushState = eInDocUpdate;
|
||||
}
|
||||
|
||||
inline bool HaveNotified(nsIContent* aNode) {
|
||||
NS_PRECONDITION(aNode, "HaveNotified called with null argument.");
|
||||
const nsHtml5PendingNotification* start = mPendingNotifications.Elements();
|
||||
const nsHtml5PendingNotification* end = start + mPendingNotifications.Length();
|
||||
for (;;) {
|
||||
nsIContent* parent = aNode->GetParent();
|
||||
if (!parent) {
|
||||
return true;
|
||||
}
|
||||
for (nsHtml5PendingNotification* iter = (nsHtml5PendingNotification*)start; iter < end; ++iter) {
|
||||
if (iter->Contains(parent)) {
|
||||
return iter->HaveNotifiedIndex(parent->IndexOf(aNode));
|
||||
}
|
||||
}
|
||||
aNode = parent;
|
||||
}
|
||||
}
|
||||
|
||||
void StartLayout();
|
||||
|
||||
void SetDocumentMode(nsHtml5DocumentMode m);
|
||||
|
@ -358,12 +275,6 @@ class nsHtml5TreeOpExecutor : public nsContentSink,
|
|||
|
||||
void Reset();
|
||||
|
||||
inline void HoldElement(nsIContent* aContent) {
|
||||
mOwnedElements.AppendElement(aContent);
|
||||
}
|
||||
|
||||
void DropHeldElements();
|
||||
|
||||
/**
|
||||
* Flush the operations from the tree operations from the argument
|
||||
* queue unconditionally. (This is for the main thread case.)
|
||||
|
|
|
@ -120,7 +120,7 @@ nsresult
|
|||
nsHtml5TreeOperation::AppendTextToTextNode(const char16_t* aBuffer,
|
||||
uint32_t aLength,
|
||||
nsIContent* aTextNode,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
NS_PRECONDITION(aTextNode, "Got null text node.");
|
||||
|
||||
|
@ -152,7 +152,7 @@ nsresult
|
|||
nsHtml5TreeOperation::AppendText(const char16_t* aBuffer,
|
||||
uint32_t aLength,
|
||||
nsIContent* aParent,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIContent* lastChild = aParent->GetLastChild();
|
||||
|
@ -176,7 +176,7 @@ nsHtml5TreeOperation::AppendText(const char16_t* aBuffer,
|
|||
nsresult
|
||||
nsHtml5TreeOperation::Append(nsIContent* aNode,
|
||||
nsIContent* aParent,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIDocument* executorDoc = aBuilder->GetDocument();
|
||||
|
@ -207,7 +207,7 @@ nsHtml5TreeOperation::Append(nsIContent* aNode,
|
|||
|
||||
nsresult
|
||||
nsHtml5TreeOperation::AppendToDocument(nsIContent* aNode,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
aBuilder->FlushPendingAppendNotifications();
|
||||
|
@ -245,7 +245,7 @@ IsElementOrTemplateContent(nsINode* aNode) {
|
|||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeOperation::Detach(nsIContent* aNode, nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5TreeOperation::Detach(nsIContent* aNode, nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
aBuilder->FlushPendingAppendNotifications();
|
||||
nsCOMPtr<nsINode> parent = aNode->GetParentNode();
|
||||
|
@ -261,7 +261,7 @@ nsHtml5TreeOperation::Detach(nsIContent* aNode, nsHtml5TreeOpExecutor* aBuilder)
|
|||
nsresult
|
||||
nsHtml5TreeOperation::AppendChildrenToNewParent(nsIContent* aNode,
|
||||
nsIContent* aParent,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
aBuilder->FlushPendingAppendNotifications();
|
||||
|
||||
|
@ -288,7 +288,7 @@ nsresult
|
|||
nsHtml5TreeOperation::FosterParent(nsIContent* aNode,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aTable,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
nsIContent* foster = aTable->GetParent();
|
||||
|
||||
|
@ -311,7 +311,7 @@ nsHtml5TreeOperation::FosterParent(nsIContent* aNode,
|
|||
nsresult
|
||||
nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
|
||||
nsHtml5HtmlAttributes* aAttributes,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
dom::Element* node = aNode->AsElement();
|
||||
nsHtml5OtherDocUpdate update(node->OwnerDoc(),
|
||||
|
@ -345,7 +345,7 @@ nsHtml5TreeOperation::CreateElement(int32_t aNs,
|
|||
nsIAtom* aName,
|
||||
nsHtml5HtmlAttributes* aAttributes,
|
||||
bool aFromNetwork,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
bool isKeygen = (aName == nsHtml5Atoms::keygen && aNs == kNameSpaceID_XHTML);
|
||||
if (MOZ_UNLIKELY(isKeygen)) {
|
||||
|
@ -490,7 +490,7 @@ nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHtml5TreeOperation::AppendIsindexPrompt(nsIContent* parent, nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5TreeOperation::AppendIsindexPrompt(nsIContent* parent, nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
nsXPIDLString prompt;
|
||||
nsresult rv =
|
||||
|
@ -512,7 +512,7 @@ nsHtml5TreeOperation::FosterParentText(nsIContent* aStackParent,
|
|||
char16_t* aBuffer,
|
||||
uint32_t aLength,
|
||||
nsIContent* aTable,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIContent* foster = aTable->GetParent();
|
||||
|
@ -552,7 +552,7 @@ nsresult
|
|||
nsHtml5TreeOperation::AppendComment(nsIContent* aParent,
|
||||
char16_t* aBuffer,
|
||||
int32_t aLength,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
nsRefPtr<dom::Comment> comment =
|
||||
new dom::Comment(aBuilder->GetNodeInfoManager());
|
||||
|
@ -566,7 +566,7 @@ nsHtml5TreeOperation::AppendComment(nsIContent* aParent,
|
|||
nsresult
|
||||
nsHtml5TreeOperation::AppendCommentToDocument(char16_t* aBuffer,
|
||||
int32_t aLength,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
nsRefPtr<dom::Comment> comment =
|
||||
new dom::Comment(aBuilder->GetNodeInfoManager());
|
||||
|
@ -581,7 +581,7 @@ nsresult
|
|||
nsHtml5TreeOperation::AppendDoctypeToDocument(nsIAtom* aName,
|
||||
const nsAString& aPublicId,
|
||||
const nsAString& aSystemId,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
// Adapted from nsXMLContentSink
|
||||
// Create a new doctype node
|
||||
|
@ -618,7 +618,7 @@ nsHtml5TreeOperation::PreventScriptExecution(nsIContent* aNode)
|
|||
|
||||
void
|
||||
nsHtml5TreeOperation::DoneAddingChildren(nsIContent* aNode,
|
||||
nsHtml5TreeOpExecutor* aBuilder)
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
aNode->DoneAddingChildren(aBuilder->HaveNotified(aNode));
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
class nsIContent;
|
||||
class nsHtml5TreeOpExecutor;
|
||||
class nsHtml5StateSnapshot;
|
||||
class nsHtml5DocumentBuilder;
|
||||
|
||||
enum eHtml5TreeOperation {
|
||||
#ifdef DEBUG
|
||||
|
@ -113,72 +114,72 @@ class nsHtml5TreeOperation {
|
|||
static nsresult AppendTextToTextNode(const char16_t* aBuffer,
|
||||
uint32_t aLength,
|
||||
nsIContent* aTextNode,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult AppendText(const char16_t* aBuffer,
|
||||
uint32_t aLength,
|
||||
nsIContent* aParent,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult Append(nsIContent* aNode,
|
||||
nsIContent* aParent,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult AppendToDocument(nsIContent* aNode,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static void Detach(nsIContent* aNode, nsHtml5TreeOpExecutor* aBuilder);
|
||||
static void Detach(nsIContent* aNode, nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult AppendChildrenToNewParent(nsIContent* aNode,
|
||||
nsIContent* aParent,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult FosterParent(nsIContent* aNode,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aTable,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult AddAttributes(nsIContent* aNode,
|
||||
nsHtml5HtmlAttributes* aAttributes,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsIContent* CreateElement(int32_t aNs,
|
||||
nsIAtom* aName,
|
||||
nsHtml5HtmlAttributes* aAttributes,
|
||||
bool aFromNetwork,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static void SetFormElement(nsIContent* aNode, nsIContent* aParent);
|
||||
|
||||
static nsresult AppendIsindexPrompt(nsIContent* parent,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult FosterParentText(nsIContent* aStackParent,
|
||||
char16_t* aBuffer,
|
||||
uint32_t aLength,
|
||||
nsIContent* aTable,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult AppendComment(nsIContent* aParent,
|
||||
char16_t* aBuffer,
|
||||
int32_t aLength,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult AppendCommentToDocument(char16_t* aBuffer,
|
||||
int32_t aLength,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsresult AppendDoctypeToDocument(nsIAtom* aName,
|
||||
const nsAString& aPublicId,
|
||||
const nsAString& aSystemId,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static nsIContent* GetDocumentFragmentForTemplate(nsIContent* aNode);
|
||||
|
||||
static void PreventScriptExecution(nsIContent* aNode);
|
||||
|
||||
static void DoneAddingChildren(nsIContent* aNode,
|
||||
nsHtml5TreeOpExecutor* aBuilder);
|
||||
nsHtml5DocumentBuilder* aBuilder);
|
||||
|
||||
static void DoneCreatingElement(nsIContent* aNode);
|
||||
|
||||
|
@ -441,7 +442,8 @@ class nsHtml5TreeOperation {
|
|||
mFour.integer = aLine;
|
||||
}
|
||||
|
||||
nsresult Perform(nsHtml5TreeOpExecutor* aBuilder, nsIContent** aScriptElement);
|
||||
nsresult Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
nsIContent** aScriptElement);
|
||||
|
||||
private:
|
||||
// possible optimization:
|
||||
|
|
Загрузка…
Ссылка в новой задаче