Fix bug 345609. r+sr+a=roc

This commit is contained in:
bzbarsky@mit.edu 2007-10-12 11:37:51 -07:00
parent ea85dbdbbb
commit d6ddf5aec3
6 changed files with 39 additions and 23 deletions

View File

@ -1098,6 +1098,13 @@ public:
nsIURI *aLinkURI, const nsString& aTargetSpec,
PRBool aClick, PRBool aIsUserTriggered);
/**
* Return true if aContent or one of its ancestors in the
* bindingParent chain is native anonymous.
*/
static PRBool IsNativeAnonymous(nsIContent* aContent);
private:
static PRBool InitializeEventTable();

View File

@ -3685,3 +3685,23 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
handler->OnLinkClick(aContent, aLinkURI, aTargetSpec.get());
}
}
PRBool
nsContentUtils::IsNativeAnonymous(nsIContent* aContent)
{
while (aContent) {
nsIContent* bindingParent = aContent->GetBindingParent();
if (bindingParent == aContent) {
NS_ASSERTION(bindingParent->IsNativeAnonymous() ||
bindingParent->IsNodeOfType(nsINode::eXUL),
"Bogus binding parent?");
return PR_TRUE;
}
NS_ASSERTION(!aContent->IsNativeAnonymous(),
"Native anonymous node with wrong binding parent");
aContent = bindingParent;
}
return PR_FALSE;
}

View File

@ -55,6 +55,7 @@
#include "nsCSSRuleProcessor.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsContentUtils.h"
nsIURI *nsStyleSet::gQuirkURI = 0;
@ -508,7 +509,7 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
nsRuleNode* lastPresHintRN = mRuleWalker->GetCurrentNode();
mRuleWalker->SetLevel(eUserSheet, PR_FALSE);
PRBool skipUserStyles = IsNativeAnonymous(aData->mContent);
PRBool skipUserStyles = nsContentUtils::IsNativeAnonymous(aData->mContent);
if (!skipUserStyles && mRuleProcessors[eUserSheet]) // NOTE: different
(*aCollectorFunc)(mRuleProcessors[eUserSheet], aData);
nsRuleNode* lastUserRN = mRuleWalker->GetCurrentNode();
@ -572,7 +573,7 @@ nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
if (mRuleProcessors[ePresHintSheet])
(*aFunc)(mRuleProcessors[ePresHintSheet], aData);
PRBool skipUserStyles = IsNativeAnonymous(aData->mContent);
PRBool skipUserStyles = nsContentUtils::IsNativeAnonymous(aData->mContent);
if (!skipUserStyles && mRuleProcessors[eUserSheet]) // NOTE: different
(*aFunc)(mRuleProcessors[eUserSheet], aData);
@ -1004,20 +1005,3 @@ nsStyleSet::HasAttributeDependentStyle(nsPresContext* aPresContext,
return result;
}
PRBool
nsStyleSet::IsNativeAnonymous(nsIContent* aContent)
{
while (aContent) {
nsIContent* bindingParent = aContent->GetBindingParent();
if (bindingParent == aContent) {
NS_ASSERTION(bindingParent->IsNativeAnonymous() ||
bindingParent->IsNodeOfType(nsINode::eXUL),
"Bogus binding parent?");
return PR_TRUE;
}
aContent = bindingParent;
}
return PR_FALSE;
}

View File

@ -245,10 +245,6 @@ class nsStyleSet
nsPresContext* PresContext() { return mRuleTree->GetPresContext(); }
// Return true if aContent or one of its ancestors in the
// bindingParent chain is native anonymous.
static PRBool IsNativeAnonymous(nsIContent* aContent);
static nsIURI *gQuirkURI;
// The sheets in each array in mSheets are stored with the most significant

View File

@ -607,6 +607,13 @@ nsBoxFrame::DidReflow(nsPresContext* aPresContext,
return rv;
}
PRBool
nsBoxFrame::HonorPrintBackgroundSettings()
{
return (!mContent || !nsContentUtils::IsNativeAnonymous(mContent)) &&
nsContainerFrame::HonorPrintBackgroundSettings();
}
#ifdef DO_NOISY_REFLOW
static int myCounter = 0;
static void printSize(char * aDesc, nscoord aSize)

View File

@ -159,6 +159,8 @@ public:
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
virtual PRBool HonorPrintBackgroundSettings();
virtual ~nsBoxFrame();
nsBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot = nsnull, nsIBoxLayout* aLayoutManager = nsnull);