зеркало из https://github.com/mozilla/gecko-dev.git
Bug 600257. Only flush in content lists if we're in an XML document. r=peterv
This commit is contained in:
Родитель
4193bc442a
Коммит
76dee467eb
|
@ -415,6 +415,14 @@ nsContentList::nsContentList(nsINode* aRootNode,
|
|||
mMatchAll = PR_FALSE;
|
||||
}
|
||||
mRootNode->AddMutationObserver(this);
|
||||
|
||||
// We only need to flush if we're in an non-HTML document, since the
|
||||
// HTML5 parser doesn't need flushing. Further, if we're not in a
|
||||
// document at all right now (in the GetCurrentDoc() sense), we're
|
||||
// not parser-created and don't need to be flushing stuff under us
|
||||
// to get our kids right.
|
||||
nsIDocument* doc = mRootNode->GetCurrentDoc();
|
||||
mFlushesNeeded = doc && !doc->IsHTML();
|
||||
}
|
||||
|
||||
nsContentList::nsContentList(nsINode* aRootNode,
|
||||
|
@ -485,7 +493,7 @@ nsContentList::Length(PRBool aDoFlush)
|
|||
nsIContent *
|
||||
nsContentList::Item(PRUint32 aIndex, PRBool aDoFlush)
|
||||
{
|
||||
if (mRootNode && aDoFlush) {
|
||||
if (mRootNode && aDoFlush && mFlushesNeeded) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
nsIDocument* doc = mRootNode->GetCurrentDoc();
|
||||
if (doc) {
|
||||
|
@ -932,7 +940,7 @@ nsContentList::RemoveFromHashtable()
|
|||
void
|
||||
nsContentList::BringSelfUpToDate(PRBool aDoFlush)
|
||||
{
|
||||
if (mRootNode && aDoFlush) {
|
||||
if (mRootNode && aDoFlush && mFlushesNeeded) {
|
||||
// XXX sXBL/XBL2 issue
|
||||
nsIDocument* doc = mRootNode->GetCurrentDoc();
|
||||
if (doc) {
|
||||
|
|
|
@ -395,25 +395,35 @@ protected:
|
|||
* Closure data to pass to mFunc when we call it
|
||||
*/
|
||||
void* mData;
|
||||
/**
|
||||
* True if we are looking for elements named "*"
|
||||
*/
|
||||
PRPackedBool mMatchAll;
|
||||
/**
|
||||
* The current state of the list (possible values are:
|
||||
* LIST_UP_TO_DATE, LIST_LAZY, LIST_DIRTY
|
||||
*/
|
||||
PRUint8 mState;
|
||||
|
||||
// The booleans have to use PRUint8 to pack with mState, because MSVC won't
|
||||
// pack different typedefs together. Once we no longer have to worry about
|
||||
// flushes in XML documents, we can go back to using PRPackedBool for the
|
||||
// booleans.
|
||||
|
||||
/**
|
||||
* True if we are looking for elements named "*"
|
||||
*/
|
||||
PRUint8 mMatchAll : 1;
|
||||
/**
|
||||
* Whether to actually descend the tree. If this is false, we won't
|
||||
* consider grandkids of mRootNode.
|
||||
*/
|
||||
PRPackedBool mDeep;
|
||||
PRUint8 mDeep : 1;
|
||||
/**
|
||||
* Whether the return value of mFunc could depend on the values of
|
||||
* attributes.
|
||||
*/
|
||||
PRPackedBool mFuncMayDependOnAttr;
|
||||
PRUint8 mFuncMayDependOnAttr : 1;
|
||||
/**
|
||||
* Whether we actually need to flush to get our state correct.
|
||||
*/
|
||||
PRUint8 mFlushesNeeded : 1;
|
||||
|
||||
#ifdef DEBUG_CONTENT_LIST
|
||||
void AssertInSync();
|
||||
|
|
|
@ -6421,7 +6421,8 @@ nsDocument::CreateEventGroup(nsIDOMEventGroup **aInstancePtrResult)
|
|||
void
|
||||
nsDocument::FlushPendingNotifications(mozFlushType aType)
|
||||
{
|
||||
if (mParser || mWeakSink) {
|
||||
if ((!IsHTML() || aType > Flush_ContentAndNotify) &&
|
||||
(mParser || mWeakSink)) {
|
||||
nsCOMPtr<nsIContentSink> sink;
|
||||
if (mParser) {
|
||||
sink = mParser->GetContentSink();
|
||||
|
|
Загрузка…
Ссылка в новой задаче