Fix for 104336, deCOMtaminate rulenode, rulewalker, frames, r=dbaron, sr=waterson

This commit is contained in:
hyatt%netscape.com 2001-10-24 00:01:09 +00:00
Родитель 67bc4ca68d
Коммит 0214ac3fdb
112 изменённых файлов: 6000 добавлений и 1436 удалений

Просмотреть файл

@ -51,7 +51,7 @@ class nsIContent;
class nsISupportsArray;
class nsIAtom;
class nsICSSPseudoComparator;
class nsIRuleWalker;
class nsRuleWalker;
// IID for the nsIStyleRuleProcessor interface {015575fe-7b6c-11d3-ba05-001083023c2b}
#define NS_ISTYLE_RULE_PROCESSOR_IID \
@ -73,7 +73,7 @@ public:
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker) = 0;
nsRuleWalker* aRuleWalker) = 0;
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -81,7 +81,7 @@ public:
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker) = 0;
nsRuleWalker* aRuleWalker) = 0;
// Test if style is dependent on content state
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,

Просмотреть файл

@ -44,7 +44,7 @@ class nsString;
class nsIStyleRule;
class nsIStyleContext;
class nsISupportsArray;
class nsIRuleWalker;
class nsRuleWalker;
// IID for the nsIStyledContent class
#define NS_ISTYLEDCONTENT_IID \
@ -60,8 +60,8 @@ public:
NS_IMETHOD GetClasses(nsVoidArray& aArray) const = 0;
NS_IMETHOD HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const = 0;
NS_IMETHOD WalkContentStyleRules(nsIRuleWalker* aRuleWalker) = 0;
NS_IMETHOD WalkInlineStyleRules(nsIRuleWalker* aRuleWalker) = 0;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0;
NS_IMETHOD WalkInlineStyleRules(nsRuleWalker* aRuleWalker) = 0;
/** NRA ***
* Get a hint that tells the style system what to do when

Просмотреть файл

@ -55,7 +55,6 @@
#include "nsIStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIStyleContext.h"
#include "nsIFrame.h"
#include "nsIScriptGlobalObjectOwner.h"

Просмотреть файл

@ -1954,13 +1954,13 @@ nsGenericElement::HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const
}
NS_IMETHODIMP
nsGenericElement::WalkContentStyleRules(nsIRuleWalker* aRuleWalker)
nsGenericElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
{
return NS_OK;
}
NS_IMETHODIMP
nsGenericElement::WalkInlineStyleRules(nsIRuleWalker* aRuleWalker)
nsGenericElement::WalkInlineStyleRules(nsRuleWalker* aRuleWalker)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -294,8 +294,8 @@ public:
NS_IMETHOD GetID(nsIAtom*& aResult) const;
NS_IMETHOD GetClasses(nsVoidArray& aArray) const;
NS_IMETHOD HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
NS_IMETHOD WalkContentStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkInlineStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD WalkInlineStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
PRInt32& aHint) const;

Просмотреть файл

@ -38,7 +38,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsString.h"
#include "nsUnitConversion.h"
@ -70,7 +69,7 @@ class nsStyleContext : public nsIStyleContext
{
public:
nsStyleContext(nsIStyleContext* aParent, nsIAtom* aPseudoTag,
nsIRuleNode* aRuleNode,
nsRuleNode* aRuleNode,
nsIPresContext* aPresContext);
virtual ~nsStyleContext();
@ -84,7 +83,7 @@ public:
NS_IMETHOD GetPseudoType(nsIAtom*& aPseudoTag) const;
NS_IMETHOD FindChildWithRules(const nsIAtom* aPseudoTag, nsIRuleNode* aRules,
NS_IMETHOD FindChildWithRules(const nsIAtom* aPseudoTag, nsRuleNode* aRules,
nsIStyleContext*& aResult);
virtual PRBool Equals(const nsIStyleContext* aOther) const;
@ -95,13 +94,15 @@ public:
NS_IMETHOD GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct);
NS_IMETHOD SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct);
NS_IMETHOD GetRuleNode(nsIRuleNode** aResult) { *aResult = mRuleNode; NS_IF_ADDREF(*aResult); return NS_OK; };
NS_IMETHOD GetRuleNode(nsRuleNode** aResult) { *aResult = mRuleNode; return NS_OK; };
NS_IMETHOD AddStyleBit(const PRUint32& aBit) { mBits |= aBit; return NS_OK; };
NS_IMETHOD GetStyleBits(PRUint32* aBits) { *aBits = mBits; return NS_OK; };
virtual const nsStyleStruct* GetStyleData(nsStyleStructID aSID);
virtual nsStyleStruct* GetUniqueStyleData(nsIPresContext* aPresContext, const nsStyleStructID& aSID);
virtual nsresult ClearCachedDataForRule(nsIStyleRule* aRule);
virtual nsresult ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule);
virtual void ForceUnique(void);
@ -130,7 +131,7 @@ protected:
nsIAtom* mPseudoTag;
PRUint32 mBits; // Which structs are inherited from the parent context.
nsIRuleNode* mRuleNode; // Weak. Rules can't go away without us going away.
nsRuleNode* mRuleNode;
nsCachedStyleData mCachedStyleData; // Our cached style data.
};
@ -138,7 +139,7 @@ static PRInt32 gLastDataCode;
nsStyleContext::nsStyleContext(nsIStyleContext* aParent,
nsIAtom* aPseudoTag,
nsIRuleNode* aRuleNode,
nsRuleNode* aRuleNode,
nsIPresContext* aPresContext)
: mParent((nsStyleContext*)aParent),
mChild(nsnull),
@ -219,12 +220,10 @@ nsStyleContext::GetFirstChild(nsIStyleContext** aContext)
void nsStyleContext::AppendChild(nsStyleContext* aChild)
{
PRBool isRoot = PR_FALSE;
nsCOMPtr<nsIRuleNode> ruleNode;
aChild->GetRuleNode(getter_AddRefs(ruleNode));
ruleNode->IsRoot(&isRoot);
if (isRoot) {
nsRuleNode* ruleNode;
aChild->GetRuleNode(&ruleNode);
if (ruleNode->IsRoot()) {
// We matched no rules.
if (nsnull == mEmptyChild) {
mEmptyChild = aChild;
@ -257,12 +256,10 @@ void nsStyleContext::RemoveChild(nsStyleContext* aChild)
return;
}
PRBool isRoot = PR_FALSE;
nsCOMPtr<nsIRuleNode> ruleNode;
aChild->GetRuleNode(getter_AddRefs(ruleNode));
ruleNode->IsRoot(&isRoot);
if (isRoot) { // is empty
nsRuleNode* ruleNode;
aChild->GetRuleNode(&ruleNode);
if (ruleNode->IsRoot()) { // is empty
if (aChild->mPrevSibling != aChild) { // has siblings
if (mEmptyChild == aChild) {
mEmptyChild = mEmptyChild->mNextSibling;
@ -302,7 +299,7 @@ nsStyleContext::GetPseudoType(nsIAtom*& aPseudoTag) const
NS_IMETHODIMP
nsStyleContext::FindChildWithRules(const nsIAtom* aPseudoTag,
nsIRuleNode* aRuleNode,
nsRuleNode* aRuleNode,
nsIStyleContext*& aResult)
{
PRUint32 threshold = 10; // The # of siblings we're willing to examine
@ -312,9 +309,7 @@ nsStyleContext::FindChildWithRules(const nsIAtom* aPseudoTag,
if ((nsnull != mChild) || (nsnull != mEmptyChild)) {
nsStyleContext* child;
PRBool isRoot = PR_TRUE;
aRuleNode->IsRoot(&isRoot);
if (isRoot) {
if (aRuleNode->IsRoot()) {
if (nsnull != mEmptyChild) {
child = mEmptyChild;
do {
@ -568,6 +563,17 @@ nsStyleContext::ApplyStyleFixups(nsIPresContext* aPresContext)
}
}
nsresult
nsStyleContext::ClearCachedDataForRule(nsIStyleRule* aInlineStyleRule)
{
mRuleNode->ClearCachedData(aInlineStyleRule); // XXXdwh. If we're willing to *really* special case
// inline style, we could only invalidate the struct data
// that actually changed. For example, if someone changes
// style.left, we really only need to blow away cached
// data in the position struct.
return NS_OK;
}
nsresult
nsStyleContext::ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule)
{
@ -846,19 +852,16 @@ void nsStyleContext::List(FILE* out, PRInt32 aIndent)
fputs(" ", out);
}
nsCOMPtr<nsIRuleNode> ruleNode;
GetRuleNode(getter_AddRefs(ruleNode));
if (ruleNode) {
if (mRuleNode) {
fputs("{\n", out);
nsRuleNode* ruleNode = mRuleNode;
while (ruleNode) {
nsCOMPtr<nsIStyleRule> styleRule;
ruleNode->GetRule(getter_AddRefs(styleRule));
if (styleRule) {
styleRule->List(out, aIndent + 1);
}
nsIRuleNode* parent;
ruleNode->GetParent(&parent);
ruleNode = dont_AddRef(parent);
ruleNode = ruleNode->GetParent();
}
for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fputs("}\n", out);
@ -1206,7 +1209,7 @@ NS_EXPORT nsresult
NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
nsIStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsIRuleNode* aRuleNode,
nsRuleNode* aRuleNode,
nsIPresContext* aPresContext)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
@ -1215,7 +1218,7 @@ NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
}
nsStyleContext* context = new (aPresContext) nsStyleContext(aParentContext, aPseudoTag,
aRuleNode, aPresContext);
aRuleNode, aPresContext);
if (nsnull == context) {
return NS_ERROR_OUT_OF_MEMORY;
}

Просмотреть файл

@ -42,7 +42,6 @@
#include "nsIStyleRuleProcessor.h"
#include "nsIStyleRule.h"
#include "nsICSSStyleRule.h"
#include "nsIStyleContext.h"
#include "nsISupportsArray.h"
#include "nsIFrame.h"
#include "nsIPresContext.h"
@ -56,7 +55,7 @@
#include "nsNetUtil.h"
#include "nsIStyleRuleSupplier.h"
#include "nsRuleNode.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsIBodySuper.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLBodyElement.h"
@ -134,7 +133,9 @@ public:
NS_IMETHOD Shutdown();
virtual nsresult GetRuleTree(nsIRuleNode** aResult);
virtual nsresult GetRuleTree(nsRuleNode** aResult);
virtual nsresult ClearCachedDataInRuleTree(nsIStyleRule* aRule);
virtual nsresult ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule, nsIStyleContext* aContext);
virtual nsresult RemoveBodyFixupRule(nsIDocument *aDocument);
@ -232,7 +233,7 @@ public:
#endif
virtual void ResetUniqueStyleItems(void);
void AddImportantRules(nsIRuleNode* aRuleNode);
void AddImportantRules(nsRuleNode* aRuleNode);
#ifdef MOZ_PERF_METRICS
NS_DECL_NSITIMERECORDER
@ -290,10 +291,10 @@ protected:
nsCOMPtr<nsIStyleRuleSupplier> mStyleRuleSupplier;
nsCOMPtr<nsIRuleNode> mRuleTree; // This is the root of our rule tree. It is a lexicographic tree of
// matched rules that style contexts use to look up properties.
nsCOMPtr<nsIRuleWalker> mRuleWalker; // This is an instance of a rule walker that can be used
// to navigate through our tree.
nsRuleNode* mRuleTree; // This is the root of our rule tree. It is a lexicographic tree of
// matched rules that style contexts use to look up properties.
nsRuleWalker* mRuleWalker; // This is an instance of a rule walker that can be used
// to navigate through our tree.
MOZ_TIMER_DECLARE(mStyleResolutionWatch)
@ -316,7 +317,9 @@ StyleSetImpl::StyleSetImpl()
mRecycler(nsnull),
mFrameConstructor(nsnull),
mQuirkStyleSheet(nsnull),
mStyleRuleSupplier(nsnull)
mStyleRuleSupplier(nsnull),
mRuleTree(nsnull),
mRuleWalker(nsnull)
#ifdef MOZ_PERF_METRICS
,mTimerEnabled(PR_FALSE)
#endif
@ -746,7 +749,7 @@ struct RulesMatchingData {
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
: mPresContext(aPresContext),
mMedium(aMedium),
mContent(aContent),
@ -758,7 +761,7 @@ struct RulesMatchingData {
nsIAtom* mMedium;
nsIContent* mContent;
nsIStyleContext* mParentContext;
nsCOMPtr<nsIRuleWalker> mRuleWalker;
nsRuleWalker* mRuleWalker;
};
static PRBool
@ -779,8 +782,7 @@ nsIStyleContext* StyleSetImpl::GetContext(nsIPresContext* aPresContext,
{
nsIStyleContext* result = nsnull;
nsCOMPtr<nsIRuleNode> ruleNode;
mRuleWalker->GetCurrentNode(getter_AddRefs(ruleNode));
nsRuleNode* ruleNode = mRuleWalker->GetCurrentNode();
if ((PR_FALSE == aForceUnique) && (nsnull != aParentContext)) {
aParentContext->FindChildWithRules(aPseudoTag, ruleNode, result);
@ -805,12 +807,11 @@ nsIStyleContext* StyleSetImpl::GetContext(nsIPresContext* aPresContext,
}
void
StyleSetImpl::AddImportantRules(nsIRuleNode* aCurrNode)
StyleSetImpl::AddImportantRules(nsRuleNode* aCurrNode)
{
// XXX Note: this is still incorrect from a cascade standpoint, but
// it preserves the existing incorrect cascade behavior.
nsCOMPtr<nsIRuleNode> parent;
aCurrNode->GetParent(getter_AddRefs(parent));
nsRuleNode* parent = aCurrNode->GetParent();
if (parent)
AddImportantRules(parent);
@ -839,8 +840,8 @@ void StyleSetImpl::EnsureRuleWalker(nsIPresContext* aPresContext)
if (mRuleWalker)
return;
nsRuleNode::CreateRootNode(aPresContext, getter_AddRefs(mRuleTree));
NS_NewRuleWalker(mRuleTree, getter_AddRefs(mRuleWalker));
nsRuleNode::CreateRootNode(aPresContext, &mRuleTree);
mRuleWalker = new nsRuleWalker(mRuleTree);
}
nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
@ -866,8 +867,7 @@ nsIStyleContext* StyleSetImpl::ResolveStyleFor(nsIPresContext* aPresContext,
WalkRuleProcessors(EnumRulesMatching, &data, aContent);
// Walk all of the rules and add in the !important counterparts.
nsCOMPtr<nsIRuleNode> ruleNode;
mRuleWalker->GetCurrentNode(getter_AddRefs(ruleNode));
nsRuleNode* ruleNode = mRuleWalker->GetCurrentNode();
AddImportantRules(ruleNode);
result = GetContext(aPresContext, aParentContext, nsnull, aForceUnique);
@ -888,7 +888,7 @@ struct PseudoRulesMatchingData {
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aWalker)
nsRuleWalker* aWalker)
: mPresContext(aPresContext),
mMedium(aMedium),
mParentContent(aParentContent),
@ -904,7 +904,7 @@ struct PseudoRulesMatchingData {
nsIAtom* mPseudoTag;
nsIStyleContext* mParentContext;
nsICSSPseudoComparator* mComparator;
nsCOMPtr<nsIRuleWalker> mRuleWalker;
nsRuleWalker* mRuleWalker;
};
static PRBool
@ -945,8 +945,7 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
WalkRuleProcessors(EnumPseudoRulesMatching, &data, aParentContent);
// Walk all of the rules and add in the !important counterparts.
nsCOMPtr<nsIRuleNode> ruleNode;
mRuleWalker->GetCurrentNode(getter_AddRefs(ruleNode));
nsRuleNode* ruleNode = mRuleWalker->GetCurrentNode();
AddImportantRules(ruleNode);
result = GetContext(aPresContext, aParentContext, aPseudoTag, aForceUnique);
@ -985,12 +984,9 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
WalkRuleProcessors(EnumPseudoRulesMatching, &data, aParentContent);
// Walk all of the rules and add in the !important counterparts.
nsCOMPtr<nsIRuleNode> ruleNode;
mRuleWalker->GetCurrentNode(getter_AddRefs(ruleNode));
nsRuleNode* ruleNode = mRuleWalker->GetCurrentNode();
AddImportantRules(ruleNode);
PRBool isAtRoot = PR_FALSE;
mRuleWalker->AtRoot(&isAtRoot);
if (!isAtRoot)
if (!mRuleWalker->AtRoot())
result = GetContext(aPresContext, aParentContext, aPseudoTag, aForceUnique);
// Now reset the walker back to the root of the tree.
@ -1006,16 +1002,24 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
NS_IMETHODIMP
StyleSetImpl::Shutdown()
{
mRuleWalker = nsnull; // Drop our ref. This destroys all rule nodes.
delete mRuleWalker;
mRuleTree->Destroy();
mRuleTree = nsnull;
return NS_OK;
}
nsresult
StyleSetImpl::GetRuleTree(nsIRuleNode** aResult)
StyleSetImpl::GetRuleTree(nsRuleNode** aResult)
{
*aResult = mRuleTree;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
nsresult
StyleSetImpl::ClearCachedDataInRuleTree(nsIStyleRule* aInlineStyleRule)
{
if (mRuleTree)
mRuleTree->ClearCachedDataInSubtree(aInlineStyleRule);
return NS_OK;
}
@ -1028,8 +1032,8 @@ StyleSetImpl::ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule,
// style.left, we really only need to blow away cached
// data in the position struct.
if (aContext) {
nsCOMPtr<nsIRuleNode> ruleNode;
aContext->GetRuleNode(getter_AddRefs(ruleNode));
nsRuleNode* ruleNode;
aContext->GetRuleNode(&ruleNode);
ruleNode->ClearCachedData(aRule);
// We don't need to mess with the style tree in this case, since the act of
@ -1109,8 +1113,8 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
nsIAtom* pseudoTag = nsnull;
aStyleContext->GetPseudoType(pseudoTag);
nsCOMPtr<nsIRuleNode> ruleNode;
aStyleContext->GetRuleNode(getter_AddRefs(ruleNode));
nsRuleNode* ruleNode;
aStyleContext->GetRuleNode(&ruleNode);
if (aNewParentContext) {
result = aNewParentContext->FindChildWithRules(pseudoTag, ruleNode, newChild);
}

Просмотреть файл

@ -63,7 +63,6 @@
#include "nsILinkHandler.h"
#include "nsPIDOMWindow.h"
#include "nsISizeOfHandler.h"
#include "nsIStyleContext.h"
#include "nsIStyleRule.h"
#include "nsISupportsArray.h"
#include "nsIURL.h"
@ -112,7 +111,7 @@
#include "nsIBindingManager.h"
#include "nsIXBLBinding.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsIObjectFrame.h"
#include "nsLayoutAtoms.h"
@ -2400,7 +2399,7 @@ nsGenericHTMLElement::HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const
}
nsresult
nsGenericHTMLElement::WalkContentStyleRules(nsIRuleWalker* aRuleWalker)
nsGenericHTMLElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
{
nsresult result = NS_OK;
@ -2416,7 +2415,7 @@ nsGenericHTMLElement::WalkContentStyleRules(nsIRuleWalker* aRuleWalker)
}
nsresult
nsGenericHTMLElement::WalkInlineStyleRules(nsIRuleWalker* aRuleWalker)
nsGenericHTMLElement::WalkInlineStyleRules(nsRuleWalker* aRuleWalker)
{
nsresult result = NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIStyleRule> rule;

Просмотреть файл

@ -182,8 +182,8 @@ public:
NS_IMETHOD GetID(nsIAtom*& aResult) const;
NS_IMETHOD GetClasses(nsVoidArray& aArray) const;
NS_IMETHOD HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
NS_IMETHOD WalkContentStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkInlineStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD WalkInlineStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const;
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const;

Просмотреть файл

@ -48,7 +48,6 @@
#include "nsILink.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIEventStateManager.h"

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLBRElement : public nsGenericHTMLLeafElement,
public nsIDOMHTMLBRElement

Просмотреть файл

@ -68,7 +68,7 @@
#include "nsISizeOfHandler.h"
#include "nsIView.h"
#include "nsLayoutAtoms.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsIBodySuper.h"
//----------------------------------------------------------------------
@ -233,8 +233,8 @@ public:
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD WalkContentStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkInlineStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD WalkInlineStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
PRInt32& aHint) const;
#ifdef DEBUG
@ -995,7 +995,7 @@ static nsIHTMLStyleSheet* GetAttrStyleSheet(nsIDocument* aDocument)
}
NS_IMETHODIMP
nsHTMLBodyElement::WalkContentStyleRules(nsIRuleWalker* aRuleWalker)
nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
{
nsBodySuper::WalkContentStyleRules(aRuleWalker);
@ -1032,7 +1032,7 @@ static nsIHTMLCSSStyleSheet* GetInlineStyleSheet(nsIDocument* aDocument)
}
NS_IMETHODIMP
nsHTMLBodyElement::WalkInlineStyleRules(nsIRuleWalker* aRuleWalker)
nsHTMLBodyElement::WalkInlineStyleRules(nsRuleWalker* aRuleWalker)
{
PRBool useBodyFixupRule = PR_FALSE;

Просмотреть файл

@ -50,6 +50,7 @@
#include "nsIForm.h"
#include "nsIURL.h"
#include "nsIFrame.h"
#include "nsIFormControlFrame.h"
#include "nsIEventStateManager.h"
#include "nsIDOMEvent.h"

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
// XXX nav4 has type= start= (same as OL/UL)

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
// XXX support missing nav attributes? gutter, cols, width

Просмотреть файл

@ -49,7 +49,7 @@
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsICSSDeclaration.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLFontElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLFontElement

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLHRElement : public nsGenericHTMLLeafElement,
public nsIDOMHTMLHRElement

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLHeadingElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLHeadingElement

Просмотреть файл

@ -53,7 +53,7 @@
#include "nsIHTMLAttributes.h"
#include "nsIChromeEventHandler.h"
#include "nsDOMError.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLIFrameElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLIFrameElement,

Просмотреть файл

@ -76,7 +76,7 @@
#include "nsILoadGroup.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
#include "nsIJSContextStack.h"

Просмотреть файл

@ -84,7 +84,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsMutationEvent.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
// XXX align=left, hspace, vspace, border? other nav4 attrs

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLLIElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLLIElement

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
// XXX nav4 has type= start= (same as OL/UL)

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLOListElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLOListElement

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
// XXX missing nav attributes

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
#include "nsICSSDeclaration.h"
// XXX wrap, variable, cols, tabstop

Просмотреть файл

@ -72,7 +72,7 @@
#include "nsIFormControlFrame.h"
#include "nsIFrame.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLSelectElement;

Просмотреть файл

@ -1,330 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIHTMLAttributes.h"
#include "nsSize.h"
#include "nsIDocument.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMDocument.h"
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsIURL.h"
#include "nsIServiceManager.h"
#include "nsNetUtil.h"
#include "nsIWebShell.h"
#include "nsIFrame.h"
#include "nsLayoutAtoms.h"
#include "nsIRuleNode.h"
// XXX nav attrs: suppress
class nsHTMLSpacerElement : public nsGenericHTMLLeafElement,
public nsIDOMHTMLElement
{
public:
nsHTMLSpacerElement();
virtual ~nsHTMLSpacerElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
PRInt32& aHint) const;
#ifdef DEBUG
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
#endif
};
nsresult
NS_NewHTMLSpacerElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLSpacerElement* it = new nsHTMLSpacerElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLSpacerElement::nsHTMLSpacerElement()
{
}
nsHTMLSpacerElement::~nsHTMLSpacerElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLSpacerElement, nsGenericElement);
NS_IMPL_RELEASE_INHERITED(nsHTMLSpacerElement, nsGenericElement);
// QueryInterface implementation for nsHTMLSpacerElement
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLSpacerElement,
nsGenericHTMLLeafElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLSpacerElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
nsresult
nsHTMLSpacerElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLSpacerElement* it = new nsHTMLSpacerElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLSpacerElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
if (aAttribute == nsHTMLAtoms::size) {
if (ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::align) {
if (ParseAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height)) {
if (ParseValueOrPercent(aValue, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP
nsHTMLSpacerElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const
{
if (aAttribute == nsHTMLAtoms::align) {
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
AlignValueToString(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return nsGenericHTMLLeafElement::AttributeToString(aAttribute, aValue,
aResult);
}
static void
MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (!aAttributes || !aData)
return;
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData);
if (aData->mPositionData) {
nsHTMLValue value;
const nsStyleDisplay* display = (const nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
PRBool typeIsBlock = (display->mDisplay == NS_STYLE_DISPLAY_BLOCK);
if (typeIsBlock) {
// width: value
if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
aAttributes->GetAttribute(nsHTMLAtoms::width, value);
if (value.GetUnit() == eHTMLUnit_Pixel)
aData->mPositionData->mWidth.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
else if (value.GetUnit() == eHTMLUnit_Percent)
aData->mPositionData->mWidth.SetPercentValue(value.GetPercentValue());
}
// height: value
if (aData->mPositionData->mHeight.GetUnit() == eCSSUnit_Null) {
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
if (value.GetUnit() == eHTMLUnit_Pixel)
aData->mPositionData->mHeight.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
else if (value.GetUnit() == eHTMLUnit_Percent)
aData->mPositionData->mHeight.SetPercentValue(value.GetPercentValue());
}
}
else
{
// size: value
if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
aAttributes->GetAttribute(nsHTMLAtoms::size, value);
if (value.GetUnit() == eHTMLUnit_Pixel)
aData->mPositionData->mWidth.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
}
}
}
else if (aData->mDisplayData) {
nsHTMLValue value;
aAttributes->GetAttribute(nsHTMLAtoms::align, value);
if (value.GetUnit() == eHTMLUnit_Enumerated) {
PRUint8 align = (PRUint8)(value.GetIntValue());
if (aData->mDisplayData && aData->mDisplayData->mFloat.GetUnit() == eCSSUnit_Null) {
if (align == NS_STYLE_TEXT_ALIGN_LEFT)
aData->mDisplayData->mFloat.SetIntValue(NS_STYLE_FLOAT_LEFT, eCSSUnit_Enumerated);
else if (align == NS_STYLE_TEXT_ALIGN_RIGHT)
aData->mDisplayData->mFloat.SetIntValue(NS_STYLE_FLOAT_RIGHT, eCSSUnit_Enumerated);
}
}
if (aData->mDisplayData->mDisplay == eCSSUnit_Null) {
aAttributes->GetAttribute(nsHTMLAtoms::type, value);
if (eHTMLUnit_String == value.GetUnit()) {
nsAutoString tmp;
value.GetStringValue(tmp);
if (tmp.EqualsIgnoreCase("line") ||
tmp.EqualsIgnoreCase("vert") ||
tmp.EqualsIgnoreCase("vertical") ||
tmp.EqualsIgnoreCase("block")) {
// This is not strictly 100% compatible: if the spacer is given
// a width of zero then it is basically ignored.
aData->mDisplayData->mDisplay = NS_STYLE_DISPLAY_BLOCK;
}
}
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP
nsHTMLSpacerElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
PRInt32& aHint) const
{
if ((aAttribute == nsHTMLAtoms::usemap) ||
(aAttribute == nsHTMLAtoms::ismap)) {
aHint = NS_STYLE_HINT_FRAMECHANGE;
}
else if (aAttribute == nsHTMLAtoms::align) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
}
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLSpacerElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
{
aMapRuleFunc = &MapAttributesIntoRule;
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP
nsHTMLSpacerElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}
#endif

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLTableCaptionElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLTableCaptionElement

Просмотреть файл

@ -48,7 +48,7 @@
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLTableCellElement : public nsGenericHTMLContainerElement,
public nsIHTMLTableCellElement,
@ -84,7 +84,7 @@ public:
const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD WalkContentStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
PRInt32& aHint) const;
#ifdef DEBUG
@ -248,7 +248,7 @@ nsHTMLTableCellElement::GetCellIndex(PRInt32* aCellIndex)
NS_IMETHODIMP
nsHTMLTableCellElement::WalkContentStyleRules(nsIRuleWalker* aRuleWalker)
nsHTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
{
// get table, add its rules too
// XXX can we safely presume structure or do we need to QI on the way up?

Просмотреть файл

@ -46,7 +46,7 @@
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
class nsHTMLTableColElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLTableColElement,

Просмотреть файл

@ -1,332 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLTableColElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIHTMLContent.h"
#include "nsIHTMLAttributes.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIRuleNode.h"
class nsHTMLTableColGroupElement : public nsGenericHTMLContainerElement,
public nsIDOMHTMLTableColElement
{
public:
nsHTMLTableColGroupElement();
virtual ~nsHTMLTableColGroupElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
// nsIDOMHTMLTableColElement
NS_DECL_NSIDOMHTMLTABLECOLELEMENT
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
PRInt32& aHint) const;
#ifdef DEBUG
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
#endif
};
nsresult
NS_NewHTMLTableColGroupElement(nsIHTMLContent** aInstancePtrResult,
nsINodeInfo *aNodeInfo)
{
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
nsHTMLTableColGroupElement* it = new nsHTMLTableColGroupElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = it->Init(aNodeInfo);
if (NS_FAILED(rv)) {
delete it;
return rv;
}
*aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it);
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
nsHTMLTableColGroupElement::nsHTMLTableColGroupElement()
{
}
nsHTMLTableColGroupElement::~nsHTMLTableColGroupElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLTableColGroupElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLTableColGroupElement, nsGenericElement)
// QueryInterface implementation for nsHTMLTableColGroupElement
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLTableColGroupElement,
nsGenericHTMLContainerElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLTableColElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLTableColGroupElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
nsresult
nsHTMLTableColGroupElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
nsHTMLTableColGroupElement* it = new nsHTMLTableColGroupElement();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
nsresult rv = it->Init(mNodeInfo);
if (NS_FAILED(rv))
return rv;
CopyInnerTo(this, it, aDeep);
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
NS_ADDREF(*aReturn);
return NS_OK;
}
NS_IMPL_STRING_ATTR(nsHTMLTableColGroupElement, Align, align)
NS_IMPL_STRING_ATTR(nsHTMLTableColGroupElement, Ch, _char)
NS_IMPL_STRING_ATTR(nsHTMLTableColGroupElement, ChOff, charoff)
NS_IMPL_INT_ATTR(nsHTMLTableColGroupElement, Span, span)
NS_IMPL_STRING_ATTR(nsHTMLTableColGroupElement, VAlign, valign)
NS_IMPL_STRING_ATTR(nsHTMLTableColGroupElement, Width, width)
NS_IMETHODIMP
nsHTMLTableColGroupElement::StringToAttribute(nsIAtom* aAttribute,
const nsAReadableString& aValue,
nsHTMLValue& aResult)
{
/* ignore these attributes, stored simply as strings
ch
*/
/* attributes that resolve to integers */
if (aAttribute == nsHTMLAtoms::charoff) {
if (ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::span) {
if (ParseValue(aValue, 1, aResult, eHTMLUnit_Integer)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::width) {
/* attributes that resolve to integers or percents or proportions */
if (ParseValueOrPercentOrProportional(aValue, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::align) {
/* other attributes */
if (ParseTableCellHAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::valign) {
if (ParseTableVAlignValue(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return NS_CONTENT_ATTR_NOT_THERE;
}
NS_IMETHODIMP
nsHTMLTableColGroupElement::AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue,
nsAWritableString& aResult) const
{
/* ignore these attributes, stored already as strings
ch
*/
/* ignore attributes that are of standard types
charoff, repeat
*/
if (aAttribute == nsHTMLAtoms::align) {
if (TableCellHAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::valign) {
if (TableVAlignValueToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
else if (aAttribute == nsHTMLAtoms::width) {
if (ValueOrPercentOrProportionalToString(aValue, aResult)) {
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
return nsGenericHTMLContainerElement::AttributeToString(aAttribute, aValue,
aResult);
}
static
void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aData)
{
if (!aAttributes || !aData)
return;
nsHTMLValue value;
if (aData->mPositionData && aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
// width
aAttributes->GetAttribute(nsHTMLAtoms::width, value);
if (value.GetUnit() != eHTMLUnit_Null) {
switch (value.GetUnit()) {
case eHTMLUnit_Percent: {
aData->mPositionData->mWidth.SetPercentValue(value.GetPercentValue());
break;
}
case eHTMLUnit_Pixel: {
aData->mPositionData->mWidth.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
break;
}
case eHTMLUnit_Proportional: {
aData->mPositionData->mWidth.SetFloatValue((float)value.GetIntValue(), eCSSUnit_Proportional);
break;
}
default:
break;
}
}
}
else if (aData->mTextData) {
if (aData->mSID == eStyleStruct_Text) {
if (aData->mTextData->mTextAlign.GetUnit() == eCSSUnit_Null) {
// align: enum
nsHTMLValue value;
aAttributes->GetAttribute(nsHTMLAtoms::align, value);
if (value.GetUnit() == eHTMLUnit_Enumerated)
aData->mTextData->mTextAlign.SetIntValue(value.GetIntValue(), eCSSUnit_Enumerated);
}
}
else {
if (aData->mTextData->mVerticalAlign.GetUnit() == eCSSUnit_Null) {
// valign: enum
nsHTMLValue value;
aAttributes->GetAttribute(nsHTMLAtoms::valign, value);
if (value.GetUnit() == eHTMLUnit_Enumerated)
aData->mTextData->mVerticalAlign.SetIntValue(value.GetIntValue(), eCSSUnit_Enumerated);
}
}
}
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP
nsHTMLTableColGroupElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
PRInt32& aHint) const
{
if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::align) ||
(aAttribute == nsHTMLAtoms::valign)) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableColGroupElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
{
aMapRuleFunc = &MapAttributesIntoRule;
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP
nsHTMLTableColGroupElement::SizeOf(nsISizeOfHandler* aSizer,
PRUint32* aResult) const
{
*aResult = sizeof(*this) + BaseSizeOf(aSizer);
return NS_OK;
}
#endif

Просмотреть файл

@ -51,7 +51,7 @@
#include "nsIPresContext.h"
#include "nsHTMLParts.h"
#include "nsStyleUtil.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
/* for collections */
#include "nsIDOMElement.h"

Просмотреть файл

@ -50,7 +50,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLParts.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
// temporary
#include "nsIDocument.h"

Просмотреть файл

@ -47,7 +47,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "GenericElementCollection.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
// you will see the phrases "rowgroup" and "section" used interchangably

Просмотреть файл

@ -65,7 +65,7 @@
#include "nsIFormControlFrame.h"
#include "nsIPrivateDOMEvent.h"
#include "nsGUIEvent.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);

Просмотреть файл

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIHTMLAttributes.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
extern nsGenericHTMLElement::EnumTable kListTypeTable[];
extern nsGenericHTMLElement::EnumTable kOldListTypeTable[];

Просмотреть файл

@ -7,6 +7,4 @@ nsICSSLoaderObserver.h
nsICSSParser.h
nsICSSPseudoComparator.h
nsICSSStyleSheet.h
nsIRuleWalker.h
nsIRuleNode.h
nsIMediaList.h

Просмотреть файл

@ -35,9 +35,7 @@ EXPORTS = \
nsICSSStyleSheet.h \
nsICSSLoaderObserver.h \
nsIComputedDOMStyle.h \
nsIRuleNode.h \
nsIRuleWalker.h \
nsIMediaList.h \
nsIMediaList.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))

Просмотреть файл

@ -1,28 +0,0 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..
EXPORTS=nsICSSLoader.h nsICSSParser.h nsICSSPseudoComparator.h nsICSSStyleSheet.h nsICSSLoaderObserver.h nsIComputedDOMStyle.h nsIRuleNode.h nsIRuleWalker.h nsIMediaList.h
MODULE=content
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

Просмотреть файл

@ -65,9 +65,7 @@ CPPSRCS = \
nsHTMLCSSStyleSheet.cpp \
nsComputedDOMStyle.cpp \
nsROCSSPrimitiveValue.cpp \
nsRuleNode.cpp \
nsRuleWalker.cpp \
$(NULL)
$(NULL)
EXPORTS = \
nsDOMCSSDeclaration.h \

Просмотреть файл

@ -77,9 +77,7 @@ CPPSRCS= \
nsDOMCSSDeclaration.cpp \
nsComputedDOMStyle.cpp \
nsROCSSPrimitiveValue.cpp \
nsRuleNode.cpp \
nsRuleWalker.cpp \
$(NULL)
$(NULL)
CPP_OBJS = \
.\$(OBJDIR)\nsHTMLStyleSheet.obj \
@ -97,9 +95,7 @@ CPP_OBJS = \
.\$(OBJDIR)\nsDOMCSSDeclaration.obj \
.\$(OBJDIR)\nsComputedDOMStyle.obj \
.\$(OBJDIR)\nsROCSSPrimitiveValue.obj \
.\$(OBJDIR)\nsRuleNode.obj \
.\$(OBJDIR)\nsRuleWalker.obj \
$(NULL)
$(NULL)
LINCS= -I..\..\..\base\src \
-I..\..\..\xul\content\src \

Просмотреть файл

@ -1227,6 +1227,8 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData)
nsCOMPtr<nsILoadGroup> loadGroup;
mDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
NS_ASSERTION(loadGroup, "A stylesheet was unable to locate a load group. This means the onload is going to fire too early!");
#ifdef MOZ_TIMELINE
NS_TIMELINE_MARK_URI("Loading style sheet: %s", urlClone);
NS_TIMELINE_INDENT();

Просмотреть файл

@ -69,7 +69,7 @@
#include "nsINameSpace.h"
#include "nsILookAndFeel.h"
#include "xp_core.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"

Просмотреть файл

@ -80,7 +80,7 @@
#include "nsIPresShell.h"
#include "nsICSSParser.h"
#include "nsICSSLoader.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsCSSAtoms.h"
#include "nsINameSpaceManager.h"
#include "nsINameSpace.h"
@ -717,7 +717,7 @@ public:
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -725,7 +725,7 @@ public:
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -3226,7 +3226,7 @@ MOZ_DECL_CTOR_COUNTER(SelectorMatchesData)
struct SelectorMatchesData {
SelectorMatchesData(nsIPresContext* aPresContext, nsIContent* aContent,
nsIRuleWalker* aRuleWalker, nsCompatibility* aCompat = nsnull);
nsRuleWalker* aRuleWalker, nsCompatibility* aCompat = nsnull);
virtual ~SelectorMatchesData()
{
@ -3256,7 +3256,7 @@ struct SelectorMatchesData {
nsIPresContext* mPresContext;
nsIContent* mContent;
nsIContent* mParentContent; // if content, content->GetParent()
nsCOMPtr<nsIRuleWalker> mRuleWalker; // Used to add rules to our results.
nsRuleWalker* mRuleWalker; // Used to add rules to our results.
nsCOMPtr<nsIStyleRuleSupplier> mStyleRuleSupplier; // used to query for the current scope
nsIAtom* mContentTag; // if content, then content->GetTag()
@ -3275,7 +3275,7 @@ struct SelectorMatchesData {
};
SelectorMatchesData::SelectorMatchesData(nsIPresContext* aPresContext, nsIContent* aContent,
nsIRuleWalker* aRuleWalker,
nsRuleWalker* aRuleWalker,
nsCompatibility* aCompat /*= nsnull*/)
{
MOZ_COUNT_CTOR(SelectorMatchesData);
@ -3797,7 +3797,7 @@ static PRBool SelectorMatches(SelectorMatchesData &data,
struct ContentEnumData : public SelectorMatchesData {
ContentEnumData(nsIPresContext* aPresContext, nsIContent* aContent,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
: SelectorMatchesData(aPresContext,aContent,aRuleWalker)
{}
};
@ -3947,7 +3947,7 @@ CSSRuleProcessor::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
NS_PRECONDITION(nsnull != aPresContext, "null arg");
NS_PRECONDITION(nsnull != aContent, "null arg");
@ -3994,7 +3994,7 @@ CSSRuleProcessor::RulesMatching(nsIPresContext* aPresContext,
struct PseudoEnumData : public SelectorMatchesData {
PseudoEnumData(nsIPresContext* aPresContext, nsIContent* aParentContent,
nsIAtom* aPseudoTag, nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
: SelectorMatchesData(aPresContext, aParentContent, aRuleWalker)
{
mPseudoTag = aPseudoTag;
@ -4061,7 +4061,7 @@ CSSRuleProcessor::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
NS_PRECONDITION(nsnull != aPresContext, "null arg");
NS_PRECONDITION(nsnull != aPseudoTag, "null arg");

Просмотреть файл

@ -56,7 +56,7 @@
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
MOZ_DECL_CTOR_COUNTER(HTMLAttribute)
@ -856,7 +856,7 @@ public:
NS_IMETHOD SetStyleSheet(nsIHTMLStyleSheet* aSheet);
NS_IMETHOD WalkMappedAttributeStyleRules(nsIRuleWalker* aRuleWalker) const;
NS_IMETHOD WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker) const;
#ifdef UNIQUE_ATTR_SUPPORT
NS_IMETHOD AddContentRef(void);
@ -1474,7 +1474,7 @@ HTMLAttributesImpl::SetStyleSheet(nsIHTMLStyleSheet* aSheet)
}
NS_IMETHODIMP
HTMLAttributesImpl::WalkMappedAttributeStyleRules(nsIRuleWalker* aRuleWalker) const
HTMLAttributesImpl::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker) const
{
if (aRuleWalker && mMapped)
aRuleWalker->Forward((nsIStyleRule*)mMapped);

Просмотреть файл

@ -56,7 +56,7 @@
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsISizeOfHandler.h"
@ -248,7 +248,7 @@ public:
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -256,7 +256,7 @@ public:
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -400,7 +400,7 @@ HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
NS_PRECONDITION(nsnull != aPresContext, "null arg");
NS_PRECONDITION(nsnull != aContent, "null arg");
@ -422,12 +422,10 @@ HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
if (aPseudoTag == nsHTMLAtoms::firstLinePseudo) {
PRBool atRoot = PR_FALSE;
aRuleWalker->AtRoot(&atRoot);
if (!atRoot) {
if (!aRuleWalker->AtRoot()) {
if (nsnull == mFirstLineRule) {
mFirstLineRule = new CSSFirstLineRule(this);
if (mFirstLineRule) {
@ -441,9 +439,7 @@ HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
}
}
if (aPseudoTag == nsHTMLAtoms::firstLetterPseudo) {
PRBool atRoot = PR_FALSE;
aRuleWalker->AtRoot(&atRoot);
if (!atRoot) {
if (!aRuleWalker->AtRoot()) {
if (nsnull == mFirstLetterRule) {
mFirstLetterRule = new CSSFirstLetterRule(this);
if (mFirstLetterRule) {

Просмотреть файл

@ -59,7 +59,7 @@
#include "nsContentCID.h"
#include "nsLayoutCID.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"
@ -567,7 +567,7 @@ public:
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -575,7 +575,7 @@ public:
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -808,7 +808,7 @@ HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
NS_PRECONDITION(nsnull != aPresContext, "null arg");
NS_PRECONDITION(nsnull != aContent, "null arg");
@ -922,7 +922,7 @@ HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
// no pseudo frame style
return NS_OK;

Просмотреть файл

@ -44,7 +44,7 @@
class nsIAtom;
class nsISupportsArray;
class nsIHTMLStyleSheet;
class nsIRuleWalker;
class nsRuleWalker;
// IID for the nsIHTMLAttributes interface {a18f85f0-c058-11d1-8031-006008159b5a}
#define NS_IHTML_ATTRIBUTES_IID \
@ -94,7 +94,7 @@ public:
NS_IMETHOD SetStyleSheet(nsIHTMLStyleSheet* aSheet) = 0;
NS_IMETHOD WalkMappedAttributeStyleRules(nsIRuleWalker* aRuleWalker) const = 0;
NS_IMETHOD WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker) const = 0;
#ifdef UNIQUE_ATTR_SUPPORT
NS_IMETHOD Equals(const nsIHTMLAttributes* aAttributes, PRBool& aResult) const = 0;

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -39,7 +39,6 @@
#include <math.h>
#include "nsStyleUtil.h"
#include "nsCRT.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsUnitConversion.h"
@ -59,7 +58,7 @@
// XXX This is here because nsCachedStyleData is accessed outside of
// the content module; e.g., by nsCSSFrameConstructor.
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
nsCachedStyleData::StyleStructInfo
nsCachedStyleData::gInfo[] = {

Просмотреть файл

@ -14,6 +14,8 @@ nsHTMLValue.h
nsImageMapUtils.h
nsLayoutAtomList.h
nsLayoutAtoms.h
nsRuleNode.h
nsRuleWalker.h
nsStyleCoord.h
nsStyleUtil.h
nsStyleStruct.h

Просмотреть файл

@ -42,6 +42,8 @@ nsHTMLUtils.h \
nsImageMapUtils.h \
nsLayoutAtomList.h \
nsLayoutAtoms.h \
nsRuleNode.h \
nsRuleWalker.h \
nsStyleCoord.h \
nsStyleUtil.h \
nsStyleStruct.h \

Просмотреть файл

@ -35,6 +35,8 @@ EXPORTS = \
nsImageMapUtils.h \
nsLayoutAtomList.h \
nsLayoutAtoms.h \
nsRuleNode.h \
nsRuleWalker.h \
nsStyleCoord.h \
nsStyleUtil.h \
nsStyleStruct.h \

Просмотреть файл

@ -0,0 +1,519 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsRuleNode_h___
#define nsRuleNode_h___
#include "nsCOMPtr.h"
#include "nsHashtable.h"
#include "nsIStyleRule.h"
#include "nsIFrame.h"
#include "nsFixedSizeAllocator.h"
#include "nsIPresContext.h"
#include "nsICSSDeclaration.h"
class nsIHTMLMappedAttributes;
class nsIStyleContext;
struct nsRuleList;
typedef void (*nsPostResolveFunc)(nsStyleStruct* aStyleStruct, nsRuleData* aData);
struct nsInheritedStyleData
{
nsStyleVisibility* mVisibilityData;
nsStyleFont* mFontData;
nsStyleList* mListData;
nsStyleTableBorder* mTableData;
nsStyleColor* mColorData;
nsStyleQuotes* mQuotesData;
nsStyleText* mTextData;
nsStyleUserInterface* mUIData;
void* operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
return result;
};
void ClearInheritedData(PRUint32 aBits) {
if (mVisibilityData && (aBits & NS_STYLE_INHERIT_VISIBILITY))
mVisibilityData = nsnull;
if (mFontData && (aBits & NS_STYLE_INHERIT_FONT))
mFontData = nsnull;
if (mListData && (aBits & NS_STYLE_INHERIT_LIST))
mListData = nsnull;
if (mTableData && (aBits & NS_STYLE_INHERIT_TABLE_BORDER))
mTableData = nsnull;
if (mColorData && (aBits & NS_STYLE_INHERIT_COLOR))
mColorData = nsnull;
if (mQuotesData && (aBits & NS_STYLE_INHERIT_QUOTES))
mQuotesData = nsnull;
if (mTextData && (aBits & NS_STYLE_INHERIT_TEXT))
mTextData = nsnull;
if (mUIData && (aBits & NS_STYLE_INHERIT_UI))
mUIData = nsnull;
};
void Destroy(PRUint32 aBits, nsIPresContext* aContext) {
if (mVisibilityData && !(aBits & NS_STYLE_INHERIT_VISIBILITY))
mVisibilityData->Destroy(aContext);
if (mFontData && !(aBits & NS_STYLE_INHERIT_FONT))
mFontData->Destroy(aContext);
if (mListData && !(aBits & NS_STYLE_INHERIT_LIST))
mListData->Destroy(aContext);
if (mTableData && !(aBits & NS_STYLE_INHERIT_TABLE_BORDER))
mTableData->Destroy(aContext);
if (mColorData && !(aBits & NS_STYLE_INHERIT_COLOR))
mColorData->Destroy(aContext);
if (mQuotesData && !(aBits & NS_STYLE_INHERIT_QUOTES))
mQuotesData->Destroy(aContext);
if (mTextData && !(aBits & NS_STYLE_INHERIT_TEXT))
mTextData->Destroy(aContext);
if (mUIData && !(aBits & NS_STYLE_INHERIT_UI))
mUIData->Destroy(aContext);
aContext->FreeToShell(sizeof(nsInheritedStyleData), this);
};
nsInheritedStyleData()
:mVisibilityData(nsnull), mFontData(nsnull), mListData(nsnull),
mTableData(nsnull), mColorData(nsnull), mQuotesData(nsnull), mTextData(nsnull), mUIData(nsnull)
{};
};
struct nsResetStyleData
{
nsResetStyleData()
:mDisplayData(nsnull), mMarginData(nsnull), mBorderData(nsnull), mPaddingData(nsnull),
mOutlineData(nsnull), mPositionData(nsnull), mTableData(nsnull), mBackgroundData(nsnull),
mContentData(nsnull), mTextData(nsnull), mUIData(nsnull)
{
#ifdef INCLUDE_XUL
mXULData = nsnull;
#endif
};
void* operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
return result;
}
void ClearInheritedData(PRUint32 aBits) {
if (mDisplayData && (aBits & NS_STYLE_INHERIT_DISPLAY))
mDisplayData = nsnull;
if (mMarginData && (aBits & NS_STYLE_INHERIT_MARGIN))
mMarginData = nsnull;
if (mBorderData && (aBits & NS_STYLE_INHERIT_BORDER))
mBorderData = nsnull;
if (mPaddingData && (aBits & NS_STYLE_INHERIT_PADDING))
mPaddingData = nsnull;
if (mOutlineData && (aBits & NS_STYLE_INHERIT_OUTLINE))
mOutlineData = nsnull;
if (mPositionData && (aBits & NS_STYLE_INHERIT_POSITION))
mPositionData = nsnull;
if (mTableData && (aBits & NS_STYLE_INHERIT_TABLE))
mTableData = nsnull;
if (mBackgroundData && (aBits & NS_STYLE_INHERIT_BACKGROUND))
mBackgroundData = nsnull;
if (mContentData && (aBits & NS_STYLE_INHERIT_CONTENT))
mContentData = nsnull;
if (mTextData && (aBits & NS_STYLE_INHERIT_TEXT_RESET))
mTextData = nsnull;
if (mUIData && (aBits & NS_STYLE_INHERIT_UI_RESET))
mUIData = nsnull;
#ifdef INCLUDE_XUL
if (mXULData && (aBits & NS_STYLE_INHERIT_XUL))
mXULData = nsnull;
#endif
};
void Destroy(PRUint32 aBits, nsIPresContext* aContext) {
if (mDisplayData && !(aBits & NS_STYLE_INHERIT_DISPLAY))
mDisplayData->Destroy(aContext);
if (mMarginData && !(aBits & NS_STYLE_INHERIT_MARGIN))
mMarginData->Destroy(aContext);
if (mBorderData && !(aBits & NS_STYLE_INHERIT_BORDER))
mBorderData->Destroy(aContext);
if (mPaddingData && !(aBits & NS_STYLE_INHERIT_PADDING))
mPaddingData->Destroy(aContext);
if (mOutlineData && !(aBits & NS_STYLE_INHERIT_OUTLINE))
mOutlineData->Destroy(aContext);
if (mPositionData && !(aBits & NS_STYLE_INHERIT_POSITION))
mPositionData->Destroy(aContext);
if (mTableData && !(aBits & NS_STYLE_INHERIT_TABLE))
mTableData->Destroy(aContext);
if (mBackgroundData && !(aBits & NS_STYLE_INHERIT_BACKGROUND))
mBackgroundData->Destroy(aContext);
if (mContentData && !(aBits & NS_STYLE_INHERIT_CONTENT))
mContentData->Destroy(aContext);
if (mTextData && !(aBits & NS_STYLE_INHERIT_TEXT_RESET))
mTextData->Destroy(aContext);
if (mUIData && !(aBits & NS_STYLE_INHERIT_UI_RESET))
mUIData->Destroy(aContext);
#ifdef INCLUDE_XUL
if (mXULData && !(aBits & NS_STYLE_INHERIT_XUL))
mXULData->Destroy(aContext);
#endif
aContext->FreeToShell(sizeof(nsResetStyleData), this);
};
nsStyleDisplay* mDisplayData;
nsStyleMargin* mMarginData;
nsStyleBorder* mBorderData;
nsStylePadding* mPaddingData;
nsStyleOutline* mOutlineData;
nsStylePosition* mPositionData;
nsStyleTable* mTableData;
nsStyleBackground* mBackgroundData;
nsStyleContent* mContentData;
nsStyleTextReset* mTextData;
nsStyleUIReset* mUIData;
#ifdef INCLUDE_XUL
nsStyleXUL* mXULData;
#endif
};
struct nsCachedStyleData
{
struct StyleStructInfo {
ptrdiff_t mCachedStyleDataOffset;
ptrdiff_t mInheritResetOffset;
PRBool mIsReset;
};
static StyleStructInfo gInfo[];
nsInheritedStyleData* mInheritedData;
nsResetStyleData* mResetData;
static PRBool IsReset(const nsStyleStructID& aSID) {
return gInfo[aSID].mIsReset;
};
static PRUint32 GetBitForSID(const nsStyleStructID& aSID) {
return 1 << (aSID - 1);
};
nsStyleStruct* GetStyleData(const nsStyleStructID& aSID) {
const StyleStructInfo& info = gInfo[aSID];
char* resetOrInheritSlot = NS_REINTERPRET_CAST(char*, this) + info.mCachedStyleDataOffset;
char* resetOrInherit = NS_REINTERPRET_CAST(char*, *NS_REINTERPRET_CAST(void**, resetOrInheritSlot));
nsStyleStruct* data = nsnull;
if (resetOrInherit) {
char* dataSlot = resetOrInherit + info.mInheritResetOffset;
data = *NS_REINTERPRET_CAST(nsStyleStruct**, dataSlot);
}
return data;
};
void ClearInheritedData(PRUint32 aBits) {
if (mResetData)
mResetData->ClearInheritedData(aBits);
if (mInheritedData)
mInheritedData->ClearInheritedData(aBits);
}
void Destroy(PRUint32 aBits, nsIPresContext* aContext) {
if (mResetData)
mResetData->Destroy(aBits, aContext);
if (mInheritedData)
mInheritedData->Destroy(aBits, aContext);
mResetData = nsnull;
mInheritedData = nsnull;
}
nsCachedStyleData() :mInheritedData(nsnull), mResetData(nsnull) {};
~nsCachedStyleData() {};
};
struct nsRuleData
{
nsStyleStructID mSID;
nsIPresContext* mPresContext;
nsIStyleContext* mStyleContext;
nsPostResolveFunc mPostResolveCallback;
PRBool mCanStoreInRuleTree;
nsIHTMLMappedAttributes* mAttributes; // Can be cached in the rule data by a content node for a post-resolve callback.
nsCSSFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsCSSDisplay* mDisplayData;
nsCSSMargin* mMarginData;
nsCSSList* mListData;
nsCSSPosition* mPositionData;
nsCSSTable* mTableData;
nsCSSColor* mColorData;
nsCSSContent* mContentData;
nsCSSText* mTextData;
nsCSSUserInterface* mUIData;
#ifdef INCLUDE_XUL
nsCSSXUL* mXULData;
#endif
nsRuleData(const nsStyleStructID& aSID, nsIPresContext* aContext, nsIStyleContext* aStyleContext)
:mSID(aSID), mPresContext(aContext), mStyleContext(aStyleContext), mPostResolveCallback(nsnull),
mAttributes(nsnull), mFontData(nsnull), mDisplayData(nsnull), mMarginData(nsnull), mListData(nsnull),
mPositionData(nsnull), mTableData(nsnull), mColorData(nsnull), mContentData(nsnull), mTextData(nsnull),
mUIData(nsnull)
{
mCanStoreInRuleTree = PR_TRUE;
#ifdef INCLUDE_XUL
mXULData = nsnull;
#endif
};
~nsRuleData() {};
};
class nsRuleNode {
public:
// for purposes of the RuleDetail (and related code),
// * a non-inherited value is one that is specified as a
// non-"inherit" value or as an "inherit" value that is reflected
// in the struct and to the user of the style system with an
// eCSSUnit_Inherit value
// * an inherited value is one that is specified as "inherit" and
// where the inheritance is computed by the style system
enum RuleDetail {
eRuleNone, // No props have been specified at all.
eRulePartialMixed, // At least one prop with a non-inherited value
// has been specified. Some props may also have
// been specified with an inherited value. At
// least one prop remains unspecified.
eRulePartialInherited, // Only props with inherited values have
// have been specified. At least one prop
// remains unspecified.
eRuleFullMixed, // All props have been specified. At least one has
// a non-inherited value.
eRuleFullInherited, // All props have been specified with inherited
// values.
eRuleUnknown // Information unknown (used as a result from a check
// callback to trigger the normal checking codepath)
};
enum { // Types of RuleBits
eNoneBits,
eInheritBits
};
private:
nsIPresContext* mPresContext; // Our pres context.
nsRuleNode* mParent; // A pointer to the parent node in the tree. This enables us to
// walk backwards from the most specific rule matched to the least
// specific rule (which is the optimal order to use for lookups
// of style properties.
nsCOMPtr<nsIStyleRule> mRule; // A pointer to our specific rule.
union {
nsHashtable* mRootChildren; // A hashtable that maps from rules to our RuleNode children.
// When matching rules, we use this table to transition from
// node to node (constructing new nodes as needed to flesh out
// the tree).
nsRuleList* mChildren;
};
nsCachedStyleData mStyleData; // Any data we cached on the rule node.
PRUint32 mInheritBits; // Used to cache the fact that we can look up cached data under a parent
// rule. This is not the same thing as CSS inheritance.
PRUint32 mNoneBits; // Used to cache the fact that this entire branch specifies no data
// for a given struct type. For example, if an entire rule branch
// specifies no color information, then a bit will be set along every
// rule node on that branch, so that you can break out of the rule tree
// early.
static PRUint32 gRefCnt;
friend struct nsRuleList;
protected:
// The callback function for deleting rule nodes from our rule tree.
static PRBool PR_CALLBACK DeleteChildren(nsHashKey *aKey, void *aData, void *closure);
public:
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
// (which comes from the presShell) to perform the allocation.
void* operator new(size_t sz, nsIPresContext* aContext);
void Destroy();
protected:
void PropagateInheritBit(PRUint32 aBit, nsRuleNode* aHighestNode);
void PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode);
PRBool InheritsFromParentRule(const nsStyleStructID aSID);
const nsStyleStruct* SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aContext);
const nsStyleStruct* WalkRuleTree(const nsStyleStructID aSID, nsIStyleContext* aContext,
nsRuleData* aRuleData,
nsCSSStruct* aSpecificData);
const nsStyleStruct* ComputeDisplayData(nsStyleStruct* aStartDisplay, const nsCSSStruct& aDisplayData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeVisibilityData(nsStyleStruct* aStartVisibility, const nsCSSStruct& aDisplayData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeFontData(nsStyleStruct* aStartFont, const nsCSSStruct& aFontData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeColorData(nsStyleStruct* aStartColor, const nsCSSStruct& aColorData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBackgroundData(nsStyleStruct* aStartBackground, const nsCSSStruct& aColorData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeMarginData(nsStyleStruct* aStartMargin, const nsCSSStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBorderData(nsStyleStruct* aStartBorder, const nsCSSStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePaddingData(nsStyleStruct* aStartPadding, const nsCSSStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeOutlineData(nsStyleStruct* aStartOutline, const nsCSSStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeListData(nsStyleStruct* aStartList, const nsCSSStruct& aListData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePositionData(nsStyleStruct* aStartPosition, const nsCSSStruct& aPositionData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableData(nsStyleStruct* aStartTable, const nsCSSStruct& aTableData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableBorderData(nsStyleStruct* aStartTable, const nsCSSStruct& aTableData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeContentData(nsStyleStruct* aStartContent, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeQuotesData(nsStyleStruct* aStartQuotes, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextResetData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeUIData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeUIResetData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#ifdef INCLUDE_XUL
const nsStyleStruct* ComputeXULData(nsStyleStruct* aStartXUL, const nsCSSStruct& aXULData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#endif
typedef const nsStyleStruct*
(nsRuleNode::*ComputeStyleDataFn)(nsStyleStruct* aStartStruct,
const nsCSSStruct& aStartData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail,
PRBool aInherited);
static ComputeStyleDataFn gComputeStyleDataFn[];
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsCSSStruct& aCSSStruct);
const nsStyleStruct* GetParentData(const nsStyleStructID aSID);
const nsStyleStruct* GetDisplayData(nsIStyleContext* aContext);
const nsStyleStruct* GetVisibilityData(nsIStyleContext* aContext);
const nsStyleStruct* GetFontData(nsIStyleContext* aContext);
const nsStyleStruct* GetColorData(nsIStyleContext* aContext);
const nsStyleStruct* GetBackgroundData(nsIStyleContext* aContext);
const nsStyleStruct* GetMarginData(nsIStyleContext* aContext);
const nsStyleStruct* GetBorderData(nsIStyleContext* aContext);
const nsStyleStruct* GetPaddingData(nsIStyleContext* aContext);
const nsStyleStruct* GetOutlineData(nsIStyleContext* aContext);
const nsStyleStruct* GetListData(nsIStyleContext* aContext);
const nsStyleStruct* GetPositionData(nsIStyleContext* aContext);
const nsStyleStruct* GetTableData(nsIStyleContext* aContext);
const nsStyleStruct* GetTableBorderData(nsIStyleContext* aContext);
const nsStyleStruct* GetContentData(nsIStyleContext* aContext);
const nsStyleStruct* GetQuotesData(nsIStyleContext* aContext);
const nsStyleStruct* GetTextData(nsIStyleContext* aContext);
const nsStyleStruct* GetTextResetData(nsIStyleContext* aContext);
const nsStyleStruct* GetUIData(nsIStyleContext* aContext);
const nsStyleStruct* GetUIResetData(nsIStyleContext* aContext);
#ifdef INCLUDE_XUL
const nsStyleStruct* GetXULData(nsIStyleContext* aContext);
#endif
typedef const nsStyleStruct* (nsRuleNode::*GetStyleDataFn)(nsIStyleContext*);
static GetStyleDataFn gGetStyleDataFn[];
public:
nsRuleNode(nsIPresContext* aPresContext, nsIStyleRule* aRule=nsnull, nsRuleNode* aParent=nsnull);
virtual ~nsRuleNode();
static void CreateRootNode(nsIPresContext* aPresContext, nsRuleNode** aResult);
nsresult GetBits(PRInt32 aType, PRUint32* aResult);
nsresult Transition(nsIStyleRule* aRule, nsRuleNode** aResult);
nsRuleNode* GetParent() { return mParent; }
PRBool IsRoot() { return mParent == nsnull; }
nsresult GetRule(nsIStyleRule** aResult);
nsresult ClearCachedData(nsIStyleRule* aRule);
nsresult ClearCachedDataInSubtree(nsIStyleRule* aRule);
nsresult GetPresContext(nsIPresContext** aResult);
nsresult PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched);
const nsStyleStruct* GetStyleData(nsStyleStructID aSID,
nsIStyleContext* aContext);
};
#endif

Просмотреть файл

@ -0,0 +1,69 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsRuleNode.h"
class nsRuleWalker {
public:
nsRuleNode* GetCurrentNode() { return mCurrent; }
void SetCurrentNode(nsRuleNode* aNode) { mCurrent = aNode; }
void Forward(nsIStyleRule* aRule) {
nsRuleNode* next;
mCurrent->Transition(aRule, &next);
mCurrent = next;
}
void Back() {
if (mCurrent != mRoot)
mCurrent = mCurrent->GetParent();
}
void Reset() { mCurrent = mRoot; }
PRBool AtRoot() { return mCurrent == mRoot; }
private:
nsRuleNode* mCurrent; // Our current position.
nsRuleNode* mRoot; // The root of the tree we're walking.
public:
nsRuleWalker(nsRuleNode* aRoot) :mCurrent(aRoot), mRoot(aRoot) { MOZ_COUNT_CTOR(nsRuleWalker); };
~nsRuleWalker() { MOZ_COUNT_DTOR(nsRuleWalker); };
};

Просмотреть файл

@ -52,6 +52,7 @@ CPPSRCS = \
nsHTMLValue.cpp \
nsImageMapUtils.cpp \
nsLayoutAtoms.cpp \
nsRuleNode.cpp \
nsStyleUtil.cpp \
nsTextFragment.cpp \
nsXULAtoms.cpp \

Просмотреть файл

@ -28,6 +28,7 @@ REQUIRES = xpcom \
locale \
dom \
webshell \
docshell \
pref \
necko \
htmlparser \
@ -52,6 +53,7 @@ CPPSRCS = \
nsHTMLValue.cpp \
nsImageMapUtils.cpp \
nsLayoutAtoms.cpp \
nsRuleNode.cpp \
nsStyleUtil.cpp \
nsStyleStruct.cpp \
nsTextFragment.cpp \
@ -69,6 +71,7 @@ CPP_OBJS= \
.\$(OBJDIR)\nsHTMLValue.obj \
.\$(OBJDIR)\nsImageMapUtils.obj \
.\$(OBJDIR)\nsLayoutAtoms.obj \
.\$(OBJDIR)\nsRuleNode.obj \
.\$(OBJDIR)\nsStyleUtil.obj \
.\$(OBJDIR)\nsStyleStruct.obj \
.\$(OBJDIR)\nsTextFragment.obj \

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -37,7 +37,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsString.h"
#include "nsUnitConversion.h"
@ -49,6 +48,7 @@
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsLayoutAtoms.h"
#include "prenv.h"

Просмотреть файл

@ -39,7 +39,6 @@
#include <math.h>
#include "nsStyleUtil.h"
#include "nsCRT.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsUnitConversion.h"
@ -59,7 +58,7 @@
// XXX This is here because nsCachedStyleData is accessed outside of
// the content module; e.g., by nsCSSFrameConstructor.
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
nsCachedStyleData::StyleStructInfo
nsCachedStyleData::gInfo[] = {

Просмотреть файл

@ -554,6 +554,14 @@ nsXBLPrototypeBinding::LoadResources(PRBool* aResult)
resource->GetAttr(kNameSpaceID_None, nsHTMLAtoms::media, media);
PRInt32 numSheets = 0;
doc->GetNumberOfStyleSheets(&numSheets);
#ifdef DEBUG
nsCOMPtr<nsILoadGroup> loadGroup;
doc->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
NS_ASSERTION(loadGroup, "An XBL scoped stylesheet is unable to locate a load group. This means the onload is going to fire too early!");
#endif
rv = cssLoader->LoadStyleLink(nsnull, url, empty, media, kNameSpaceID_Unknown,
numSheets,
nsnull,

Просмотреть файл

@ -121,7 +121,7 @@
#include "nsIBoxObject.h"
#include "nsPIBoxObject.h"
#include "nsXULDocument.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsIDOMViewCSS.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsXULAtoms.h"
@ -3851,13 +3851,13 @@ nsXULElement::HasClass(nsIAtom* aClass, PRBool /*aCaseSensitive*/) const
}
NS_IMETHODIMP
nsXULElement::WalkContentStyleRules(nsIRuleWalker* aRuleWalker)
nsXULElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
{
return NS_OK;
}
NS_IMETHODIMP
nsXULElement::WalkInlineStyleRules(nsIRuleWalker* aRuleWalker)
nsXULElement::WalkInlineStyleRules(nsRuleWalker* aRuleWalker)
{
// Fetch the cached style rule from the attributes.
nsresult result = NS_ERROR_NULL_POINTER;

Просмотреть файл

@ -435,8 +435,8 @@ public:
NS_IMETHOD GetClasses(nsVoidArray& aArray) const;
NS_IMETHOD HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
NS_IMETHOD WalkContentStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkInlineStyleRules(nsIRuleWalker* aRuleWalker);
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD WalkInlineStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
PRInt32& aHint) const;

Просмотреть файл

@ -49,7 +49,6 @@
#include "nsIHTMLAttributes.h"
#include "nsIStyleRule.h"
#include "nsIFrame.h"
#include "nsIStyleContext.h"
#include "nsHTMLAtoms.h"
#include "nsIPresContext.h"
#include "nsILinkHandler.h"
@ -102,7 +101,7 @@
#include "nsIDocShell.h"
#include "nsFormControlHelper.h"
#include "nsObjectFrame.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
#include "nsIXULDocument.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
@ -11312,24 +11311,12 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIPresContext* aPresContext,
// data, we need to blow away our style information if this reframe happened as
// a result of an inline style attribute changing.
if (aInlineStyle) {
if (aStyleContext) {
nsCOMPtr<nsIRuleNode> ruleNode;
aStyleContext->GetRuleNode(getter_AddRefs(ruleNode));
ruleNode->ClearCachedData(aInlineStyleRule); // XXXdwh. If we're willing to *really* special case
// inline style, we could only invalidate the struct data
// that actually changed. For example, if someone changes
// style.left, we really only need to blow away cached
// data in the position struct.
}
if (aStyleContext)
aStyleContext->ClearCachedDataForRule(aInlineStyleRule);
else {
// Ok, our only option left is to just crawl the entire rule
// tree and blow away the data that way.
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
nsCOMPtr<nsIRuleNode> rootNode;
set->GetRuleTree(getter_AddRefs(rootNode));
if (rootNode)
rootNode->ClearCachedDataInSubtree(aInlineStyleRule);
set->ClearCachedDataInRuleTree(aInlineStyleRule);
}
}

Просмотреть файл

@ -41,7 +41,6 @@
#include "nsIStyleFrameConstruction.h"
#include "nsIPresContext.h"
#include "nsCOMPtr.h"
#include "nsIStyleContext.h"
#include "nsILayoutHistoryState.h"
#include "nsIXBLService.h"
#include "nsIServiceManager.h"

Просмотреть файл

@ -34,7 +34,6 @@
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCSSRendering.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIImage.h"
@ -56,6 +55,7 @@
#include "nsIScrollableFrame.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "nsCSSRendering.h"
#define BORDER_FULL 0 //entire side
#define BORDER_INSIDE 1 //inside half

Просмотреть файл

@ -38,8 +38,9 @@
#define nsCSSRendering_h___
#include "nsIRenderingContext.h"
#include "nsIStyleContext.h"
struct nsPoint;
class nsIStyleContext;
class nsIPresContext;
class nsCSSRendering {
public:

Просмотреть файл

@ -55,7 +55,6 @@
#include "nsIStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIStyleContext.h"
#include "nsIFrame.h"
#include "nsIScriptGlobalObjectOwner.h"

Просмотреть файл

@ -1101,7 +1101,7 @@ DumpContext(nsIFrame* aFrame, nsIStyleContext* aContext)
NS_RELEASE(pseudoTag);
}
/* XXXdwh fix debugging here. Need to add a List method to nsIRuleNode
/* XXXdwh fix debugging here. Need to add a List method to nsRuleNode
and have the context call list on its rule node.
PRInt32 count = aContext->GetStyleRuleCount();
if (0 < count) {

Просмотреть файл

@ -48,7 +48,6 @@
#include "nsICSSStyleSheet.h" // XXX for UA sheet loading hack, can this go away please?
#include "nsIDOMCSSStyleSheet.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsIStyleContext.h"
#include "nsIServiceManager.h"
#include "nsFrame.h"
#include "nsIReflowCommand.h"

Просмотреть файл

@ -34,13 +34,21 @@
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIFrame_h___
#define nsIFrame_h___
/* nsIFrame is in the process of being deCOMtaminated, i.e., this file is eventually
going to be eliminated, and all callers will use nsFrame instead. At the moment
we're midway through this process, so you will see inlined functions and member
variables in this file. -dwh */
#include <stdio.h>
#include "nsISupports.h"
#include "nsEvent.h"
#include "nsStyleStruct.h"
#include "nsIStyleContext.h"
#include "nsIContent.h"
/**
* New rules of reflow:
@ -64,12 +72,10 @@ class nsIReflowCommand;
struct nsHTMLReflowMetrics;
class nsIAtom;
class nsIContent;
class nsIPresContext;
class nsIPresShell;
class nsIRenderingContext;
class nsISizeOfHandler;
class nsIStyleContext;
class nsIView;
class nsIWidget;
class nsIDOMRange;
@ -514,7 +520,7 @@ public:
*
* @see nsISupports#Release()
*/
NS_IMETHOD GetContent(nsIContent** aContent) const = 0;
nsresult GetContent(nsIContent** aContent) const { *aContent = mContent; NS_IF_ADDREF(*aContent); return NS_OK; }
/**
* Get the offsets of the frame. most will be 0,0
@ -528,17 +534,41 @@ public:
*
* @see nsISupports#Release()
*/
NS_IMETHOD GetStyleContext(nsIStyleContext** aStyleContext) const = 0;
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aContext) = 0;
nsresult GetStyleContext(nsIStyleContext** aStyleContext) const {
NS_IF_ADDREF(mStyleContext); *aStyleContext = mStyleContext; return NS_OK;
}
nsresult SetStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aContext) {
if (aContext != mStyleContext) {
NS_IF_RELEASE(mStyleContext);
if (nsnull != aContext) {
mStyleContext = aContext;
NS_ADDREF(aContext);
DidSetStyleContext(aPresContext);
}
}
return NS_OK;
}
// Style post processing hook
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext) = 0;
/**
* Get the style data associated with this frame.
*/
NS_IMETHOD GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const = 0;
nsresult GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const {
NS_ASSERTION(mStyleContext, "No style context found!");
aStyleStruct = mStyleContext->GetStyleData(aSID);
return NS_OK;
}
// Fill a style struct with data
NS_IMETHOD GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const = 0;
nsresult GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const {
NS_ASSERTION(mStyleContext, "No style context found!");
mStyleContext->GetStyle(aSID, aStruct);
return NS_OK;
}
// Utility function: more convenient than 2 calls to GetStyleData to get border and padding
NS_IMETHOD CalcBorderPadding(nsMargin& aBorderPadding) const = 0;
@ -560,8 +590,8 @@ public:
/**
* Accessor functions for geometric parent
*/
NS_IMETHOD GetParent(nsIFrame** aParent) const = 0;
NS_IMETHOD SetParent(const nsIFrame* aParent) = 0;
nsresult GetParent(nsIFrame** aParent) const { *aParent = mParent; return NS_OK; }
nsresult SetParent(const nsIFrame* aParent) { mParent = (nsIFrame*)aParent; return NS_OK; }
/**
* Bounding rect of the frame. The values are in twips, and the origin is
@ -571,17 +601,45 @@ public:
* Note: moving or sizing the frame does not affect the view's size or
* position.
*/
NS_IMETHOD GetRect(nsRect& aRect) const = 0;
NS_IMETHOD GetOrigin(nsPoint& aPoint) const = 0;
NS_IMETHOD GetSize(nsSize& aSize) const = 0;
NS_IMETHOD SetRect(nsIPresContext* aPresContext,
const nsRect& aRect) = 0;
NS_IMETHOD MoveTo(nsIPresContext* aPresContext,
nscoord aX,
nscoord aY) = 0;
NS_IMETHOD SizeTo(nsIPresContext* aPresContext,
nscoord aWidth,
nscoord aHeight) = 0;
nsresult GetRect(nsRect& aRect) const {
aRect = mRect;
return NS_OK;
}
nsresult GetOrigin(nsPoint& aPoint) const {
aPoint.x = mRect.x;
aPoint.y = mRect.y;
return NS_OK;
}
nsresult GetSize(nsSize& aSize) const {
aSize.width = mRect.width;
aSize.height = mRect.height;
return NS_OK;
}
nsresult SetRect(nsIPresContext* aPresContext,
const nsRect& aRect) {
MoveTo(aPresContext, aRect.x, aRect.y);
SizeTo(aPresContext, aRect.width, aRect.height);
return NS_OK;
}
nsresult MoveTo(nsIPresContext* aPresContext,
nscoord aX,
nscoord aY) {
mRect.x = aX;
mRect.y = aY;
return NS_OK;
}
nsresult SizeTo(nsIPresContext* aPresContext,
nscoord aWidth,
nscoord aHeight) {
mRect.width = aWidth;
mRect.height = aHeight;
return NS_OK;
}
/**
* Used to iterate the list of additional child list names. Returns the atom
@ -611,8 +669,15 @@ public:
/**
* Child frames are linked together in a singly-linked
*/
NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const = 0;
NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling) = 0;
nsresult GetNextSibling(nsIFrame** aNextSibling) const {
*aNextSibling = mNextSibling;
return NS_OK;
}
nsresult SetNextSibling(nsIFrame* aNextSibling) {
mNextSibling = aNextSibling;
return NS_OK;
}
/**
* Paint is responsible for painting the a frame. The aWhichLayer
@ -701,16 +766,20 @@ public:
/**
* Get the current frame-state value for this frame. aResult is
* filled in with the state bits. The return value has no
* meaning.
* filled in with the state bits.
*/
NS_IMETHOD GetFrameState(nsFrameState* aResult) = 0;
nsresult GetFrameState(nsFrameState* aResult) {
*aResult = mState;
return NS_OK;
}
/**
* Set the current frame-state value for this frame. The return
* value has no meaning.
* Set the current frame-state value for this frame.
*/
NS_IMETHOD SetFrameState(nsFrameState aNewState) = 0;
nsresult SetFrameState(nsFrameState aNewState) {
mState = aNewState;
return NS_OK;
}
/**
* This call is invoked when content is changed in the content tree.
@ -1061,6 +1130,15 @@ public:
void* aPropertyValue) = 0;
#endif // IBMBIDI
protected:
// Members
nsRect mRect;
nsIContent* mContent;
nsIStyleContext* mStyleContext;
nsIFrame* mParent;
nsIFrame* mNextSibling; // singly linked list of frames
nsFrameState mState;
private:
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
NS_IMETHOD_(nsrefcnt) Release(void) = 0;

Просмотреть файл

@ -47,18 +47,17 @@
#include "nsStyleCoord.h"
#include "nsStyleStruct.h"
#include "nsStyleConsts.h"
#include "nsIStyleSet.h"
#include "nsIPresContext.h"
#include "nsCOMPtr.h"
#include "nsILanguageAtom.h"
#include "nsIFrame.h"
class nsISizeOfHandler;
class nsIFrame;
class nsIStyleSet;
class nsIPresContext;
class nsISupportsArray;
class nsIStyleContext;
class nsIRuleNode;
class nsRuleNode;
//----------------------------------------------------------------------
@ -78,7 +77,7 @@ public:
NS_IMETHOD GetPseudoType(nsIAtom*& aPseudoTag) const = 0;
NS_IMETHOD FindChildWithRules(const nsIAtom* aPseudoTag,
nsIRuleNode* aRules,
nsRuleNode* aRules,
nsIStyleContext*& aResult) = 0;
virtual PRBool HasTextDecorations()=0;
@ -89,7 +88,7 @@ public:
// compute the effective difference between two contexts
NS_IMETHOD CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint, PRBool aStopAtFirst = PR_FALSE) = 0;
NS_IMETHOD GetRuleNode(nsIRuleNode** aResult)=0;
NS_IMETHOD GetRuleNode(nsRuleNode** aResult)=0;
NS_IMETHOD AddStyleBit(const PRUint32& aBit)=0;
NS_IMETHOD GetStyleBits(PRUint32* aBits)=0;
@ -115,6 +114,9 @@ public:
// display. Don't add support for new structs or use this method without careful consideration! -dwh
virtual nsStyleStruct* GetUniqueStyleData(nsIPresContext* aPresContext, const nsStyleStructID& aSID) = 0;
// Used only for inline style.
virtual nsresult ClearCachedDataForRule(nsIStyleRule* aRule) = 0;
// Used to clear away the style data for a given style context if it matches the specified |aRule|.
// If |aRule| is null, then the style data is always blown away.
virtual nsresult ClearStyleData(nsIPresContext* aPresContext, nsIStyleRule* aRule) = 0;
@ -129,7 +131,7 @@ extern NS_EXPORT nsresult
NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
nsIStyleContext* aParentContext,
nsIAtom* aPseudoType,
nsIRuleNode* aRuleNode,
nsRuleNode* aRuleNode,
nsIPresContext* aPresContext);

Просмотреть файл

@ -53,7 +53,7 @@ class nsIFrame;
class nsIDocument;
class nsIFrameManager;
class nsISupportsArray;
class nsIRuleNode;
class nsRuleNode;
struct nsFindFrameHint;
#include "nsVoidArray.h"
@ -96,7 +96,8 @@ public:
virtual nsIStyleSheet* GetBackstopStyleSheetAt(PRInt32 aIndex) = 0;
virtual void ReplaceBackstopStyleSheets(nsISupportsArray* aNewSheets) = 0;
virtual nsresult GetRuleTree(nsIRuleNode** aResult) = 0;
virtual nsresult GetRuleTree(nsRuleNode** aResult) = 0;
virtual nsresult ClearCachedDataInRuleTree(nsIStyleRule* aRule) = 0;
virtual nsresult RemoveBodyFixupRule(nsIDocument *aDocument) = 0;

Просмотреть файл

@ -44,7 +44,6 @@
#define nsButtonFrameRenderer_h___
#include "nsCoord.h"
#include "nsIStyleContext.h"
#include "nsCOMPtr.h"
#include "nsFrame.h"

Просмотреть файл

@ -475,15 +475,6 @@ nsFrame::Destroy(nsIPresContext* aPresContext)
return NS_OK;
}
NS_IMETHODIMP
nsFrame::GetContent(nsIContent** aContent) const
{
NS_PRECONDITION(nsnull != aContent, "null OUT parameter pointer");
*aContent = mContent;
NS_IF_ADDREF(*aContent);
return NS_OK;
}
NS_IMETHODIMP
nsFrame::GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const
{
@ -492,58 +483,12 @@ nsFrame::GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const
return NS_OK;
}
NS_IMETHODIMP
nsFrame::GetStyleContext(nsIStyleContext** aStyleContext) const
{
NS_PRECONDITION(nsnull != aStyleContext, "null OUT parameter pointer");
NS_ASSERTION(nsnull != mStyleContext, "frame should always have style context");
NS_IF_ADDREF(mStyleContext);
*aStyleContext = mStyleContext;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* aContext)
{
// NS_PRECONDITION(0 == (mState & NS_FRAME_IN_REFLOW), "Shouldn't set style context during reflow");
NS_PRECONDITION(nsnull != aContext, "null ptr");
if (aContext != mStyleContext) {
NS_IF_RELEASE(mStyleContext);
if (nsnull != aContext) {
mStyleContext = aContext;
NS_ADDREF(aContext);
DidSetStyleContext(aPresContext);
}
}
return NS_OK;
}
// Subclass hook for style post processing
NS_IMETHODIMP nsFrame::DidSetStyleContext(nsIPresContext* aPresContext)
{
return NS_OK;
}
NS_IMETHODIMP nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const
{
NS_ASSERTION(mStyleContext!=nsnull,"null style context");
if (mStyleContext) {
aStyleStruct = mStyleContext->GetStyleData(aSID);
} else {
aStyleStruct = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP nsFrame::GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const {
NS_ASSERTION(mStyleContext!=nsnull,"null style context");
if (mStyleContext) {
return mStyleContext->GetStyle(aSID, aStruct);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsFrame::CalcBorderPadding(nsMargin& aBorderPadding) const {
NS_ASSERTION(mStyleContext!=nsnull,"null style context");
if (mStyleContext) {
@ -576,65 +521,6 @@ nsFrame::SetAdditionalStyleContext(PRInt32 aIndex,
return ((aIndex < 0) ? NS_ERROR_INVALID_ARG : NS_OK);
}
// Geometric parent member functions
NS_IMETHODIMP nsFrame::GetParent(nsIFrame** aParent) const
{
NS_PRECONDITION(nsnull != aParent, "null OUT parameter pointer");
*aParent = mParent;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SetParent(const nsIFrame* aParent)
{
mParent = (nsIFrame*)aParent;
return NS_OK;
}
// Bounding rect member functions
NS_IMETHODIMP nsFrame::GetRect(nsRect& aRect) const
{
aRect = mRect;
return NS_OK;
}
NS_IMETHODIMP nsFrame::GetOrigin(nsPoint& aPoint) const
{
aPoint.x = mRect.x;
aPoint.y = mRect.y;
return NS_OK;
}
NS_IMETHODIMP nsFrame::GetSize(nsSize& aSize) const
{
aSize.width = mRect.width;
aSize.height = mRect.height;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SetRect(nsIPresContext* aPresContext,
const nsRect& aRect)
{
MoveTo(aPresContext, aRect.x, aRect.y);
SizeTo(aPresContext, aRect.width, aRect.height);
return NS_OK;
}
NS_IMETHODIMP nsFrame::MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY)
{
mRect.x = aX;
mRect.y = aY;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight)
{
mRect.width = aWidth;
mRect.height = aHeight;
return NS_OK;
}
// Child frame enumeration
NS_IMETHODIMP
@ -1870,20 +1756,6 @@ nsFrame::GetFrameForPoint(nsIPresContext* aPresContext,
}
// Resize and incremental reflow
NS_IMETHODIMP
nsFrame::GetFrameState(nsFrameState* aResult)
{
NS_PRECONDITION(nsnull != aResult, "null OUT parameter pointer");
*aResult = mState;
return NS_OK;
}
NS_IMETHODIMP
nsFrame::SetFrameState(nsFrameState aNewState)
{
mState = aNewState;
return NS_OK;
}
// nsIHTMLReflow member functions
@ -2308,22 +2180,6 @@ NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const
return NS_OK;
}
// Sibling pointer used to link together frames
NS_IMETHODIMP nsFrame::GetNextSibling(nsIFrame** aNextSibling) const
{
NS_PRECONDITION(nsnull != aNextSibling, "null OUT parameter pointer");
*aNextSibling = mNextSibling;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SetNextSibling(nsIFrame* aNextSibling)
{
NS_ASSERTION(aNextSibling != this, "attempt to create circular frame list");
mNextSibling = aNextSibling;
return NS_OK;
}
NS_IMETHODIMP nsFrame::Scrolled(nsIView *aView)
{
return NS_OK;
@ -4115,9 +3971,9 @@ nsFrame::CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
if (!view)
{
nsresult rv = GetParentWithView(aPresContext, &parent);
if (NS_FAILED(rv))
if (NS_FAILED(rv))
return rv;
if (!parent)
if (!parent)
return NS_ERROR_FAILURE;
parent->GetView(aPresContext,&view);
}
@ -4149,9 +4005,9 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext)
{
nsIFrame *parent;//might be THIS frame thats ok
nsresult rv = GetParentWithView(aPresContext, &parent);
if (NS_FAILED(rv))
if (NS_FAILED(rv))
return rv;
if (!parent)
if (!parent)
return NS_ERROR_FAILURE;
parent->GetView(aPresContext,&view);

Просмотреть файл

@ -184,26 +184,11 @@ public:
nsIFrame* aOldFrame,
nsIFrame* aNewFrame);
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD GetContent(nsIContent** aContent) const;
NS_IMETHOD GetStyleContext(nsIStyleContext** aStyleContext) const;
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aContext);
NS_IMETHOD GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const;
NS_IMETHOD GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const;
NS_IMETHOD CalcBorderPadding(nsMargin& aBorderPadding) const;
NS_IMETHOD GetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext** aStyleContext) const;
NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext* aStyleContext);
NS_IMETHOD GetParent(nsIFrame** aParent) const;
NS_IMETHOD SetParent(const nsIFrame* aParent);
NS_IMETHOD GetRect(nsRect& aRect) const;
NS_IMETHOD GetOrigin(nsPoint& aPoint) const;
NS_IMETHOD GetSize(nsSize& aSize) const;
NS_IMETHOD SetRect(nsIPresContext* aPresContext, const nsRect& aRect);
NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
NS_IMETHOD SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight);
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
@ -243,10 +228,6 @@ public:
PRInt32 aLineStart,
PRInt8 aOutSideLimit
);
NS_IMETHOD GetFrameState(nsFrameState* aResult);
NS_IMETHOD SetFrameState(nsFrameState aNewState);
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
@ -271,8 +252,6 @@ public:
NS_IMETHOD GetWindow(nsIPresContext* aPresContext, nsIWidget**) const;
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD IsPercentageBase(PRBool& aBase) const;
NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const;
NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling);
NS_IMETHOD Scrolled(nsIView *aView);
#ifdef NS_DEBUG
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
@ -499,13 +478,6 @@ protected:
// applies to its situation.
void SetOverflowClipRect(nsIRenderingContext& aRenderingContext);
nsRect mRect;
nsIContent* mContent;
nsIStyleContext* mStyleContext;
nsIFrame* mParent;
nsIFrame* mNextSibling; // singly linked list of frames
nsFrameState mState;
protected:
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);

Просмотреть файл

@ -37,7 +37,6 @@
#include "nsCOMPtr.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsIDeviceContext.h"
#include "nsPageFrame.h"

Просмотреть файл

@ -35,7 +35,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsFrame.h"
#include "nsIContent.h"

Просмотреть файл

@ -34,13 +34,21 @@
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIFrame_h___
#define nsIFrame_h___
/* nsIFrame is in the process of being deCOMtaminated, i.e., this file is eventually
going to be eliminated, and all callers will use nsFrame instead. At the moment
we're midway through this process, so you will see inlined functions and member
variables in this file. -dwh */
#include <stdio.h>
#include "nsISupports.h"
#include "nsEvent.h"
#include "nsStyleStruct.h"
#include "nsIStyleContext.h"
#include "nsIContent.h"
/**
* New rules of reflow:
@ -64,12 +72,10 @@ class nsIReflowCommand;
struct nsHTMLReflowMetrics;
class nsIAtom;
class nsIContent;
class nsIPresContext;
class nsIPresShell;
class nsIRenderingContext;
class nsISizeOfHandler;
class nsIStyleContext;
class nsIView;
class nsIWidget;
class nsIDOMRange;
@ -514,7 +520,7 @@ public:
*
* @see nsISupports#Release()
*/
NS_IMETHOD GetContent(nsIContent** aContent) const = 0;
nsresult GetContent(nsIContent** aContent) const { *aContent = mContent; NS_IF_ADDREF(*aContent); return NS_OK; }
/**
* Get the offsets of the frame. most will be 0,0
@ -528,17 +534,41 @@ public:
*
* @see nsISupports#Release()
*/
NS_IMETHOD GetStyleContext(nsIStyleContext** aStyleContext) const = 0;
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aContext) = 0;
nsresult GetStyleContext(nsIStyleContext** aStyleContext) const {
NS_IF_ADDREF(mStyleContext); *aStyleContext = mStyleContext; return NS_OK;
}
nsresult SetStyleContext(nsIPresContext* aPresContext, nsIStyleContext* aContext) {
if (aContext != mStyleContext) {
NS_IF_RELEASE(mStyleContext);
if (nsnull != aContext) {
mStyleContext = aContext;
NS_ADDREF(aContext);
DidSetStyleContext(aPresContext);
}
}
return NS_OK;
}
// Style post processing hook
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext) = 0;
/**
* Get the style data associated with this frame.
*/
NS_IMETHOD GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const = 0;
nsresult GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const {
NS_ASSERTION(mStyleContext, "No style context found!");
aStyleStruct = mStyleContext->GetStyleData(aSID);
return NS_OK;
}
// Fill a style struct with data
NS_IMETHOD GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const = 0;
nsresult GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const {
NS_ASSERTION(mStyleContext, "No style context found!");
mStyleContext->GetStyle(aSID, aStruct);
return NS_OK;
}
// Utility function: more convenient than 2 calls to GetStyleData to get border and padding
NS_IMETHOD CalcBorderPadding(nsMargin& aBorderPadding) const = 0;
@ -560,8 +590,8 @@ public:
/**
* Accessor functions for geometric parent
*/
NS_IMETHOD GetParent(nsIFrame** aParent) const = 0;
NS_IMETHOD SetParent(const nsIFrame* aParent) = 0;
nsresult GetParent(nsIFrame** aParent) const { *aParent = mParent; return NS_OK; }
nsresult SetParent(const nsIFrame* aParent) { mParent = (nsIFrame*)aParent; return NS_OK; }
/**
* Bounding rect of the frame. The values are in twips, and the origin is
@ -571,17 +601,45 @@ public:
* Note: moving or sizing the frame does not affect the view's size or
* position.
*/
NS_IMETHOD GetRect(nsRect& aRect) const = 0;
NS_IMETHOD GetOrigin(nsPoint& aPoint) const = 0;
NS_IMETHOD GetSize(nsSize& aSize) const = 0;
NS_IMETHOD SetRect(nsIPresContext* aPresContext,
const nsRect& aRect) = 0;
NS_IMETHOD MoveTo(nsIPresContext* aPresContext,
nscoord aX,
nscoord aY) = 0;
NS_IMETHOD SizeTo(nsIPresContext* aPresContext,
nscoord aWidth,
nscoord aHeight) = 0;
nsresult GetRect(nsRect& aRect) const {
aRect = mRect;
return NS_OK;
}
nsresult GetOrigin(nsPoint& aPoint) const {
aPoint.x = mRect.x;
aPoint.y = mRect.y;
return NS_OK;
}
nsresult GetSize(nsSize& aSize) const {
aSize.width = mRect.width;
aSize.height = mRect.height;
return NS_OK;
}
nsresult SetRect(nsIPresContext* aPresContext,
const nsRect& aRect) {
MoveTo(aPresContext, aRect.x, aRect.y);
SizeTo(aPresContext, aRect.width, aRect.height);
return NS_OK;
}
nsresult MoveTo(nsIPresContext* aPresContext,
nscoord aX,
nscoord aY) {
mRect.x = aX;
mRect.y = aY;
return NS_OK;
}
nsresult SizeTo(nsIPresContext* aPresContext,
nscoord aWidth,
nscoord aHeight) {
mRect.width = aWidth;
mRect.height = aHeight;
return NS_OK;
}
/**
* Used to iterate the list of additional child list names. Returns the atom
@ -611,8 +669,15 @@ public:
/**
* Child frames are linked together in a singly-linked
*/
NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const = 0;
NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling) = 0;
nsresult GetNextSibling(nsIFrame** aNextSibling) const {
*aNextSibling = mNextSibling;
return NS_OK;
}
nsresult SetNextSibling(nsIFrame* aNextSibling) {
mNextSibling = aNextSibling;
return NS_OK;
}
/**
* Paint is responsible for painting the a frame. The aWhichLayer
@ -701,16 +766,20 @@ public:
/**
* Get the current frame-state value for this frame. aResult is
* filled in with the state bits. The return value has no
* meaning.
* filled in with the state bits.
*/
NS_IMETHOD GetFrameState(nsFrameState* aResult) = 0;
nsresult GetFrameState(nsFrameState* aResult) {
*aResult = mState;
return NS_OK;
}
/**
* Set the current frame-state value for this frame. The return
* value has no meaning.
* Set the current frame-state value for this frame.
*/
NS_IMETHOD SetFrameState(nsFrameState aNewState) = 0;
nsresult SetFrameState(nsFrameState aNewState) {
mState = aNewState;
return NS_OK;
}
/**
* This call is invoked when content is changed in the content tree.
@ -1061,6 +1130,15 @@ public:
void* aPropertyValue) = 0;
#endif // IBMBIDI
protected:
// Members
nsRect mRect;
nsIContent* mContent;
nsIStyleContext* mStyleContext;
nsIFrame* mParent;
nsIFrame* mNextSibling; // singly linked list of frames
nsFrameState mState;
private:
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
NS_IMETHOD_(nsrefcnt) Release(void) = 0;

Просмотреть файл

@ -475,15 +475,6 @@ nsFrame::Destroy(nsIPresContext* aPresContext)
return NS_OK;
}
NS_IMETHODIMP
nsFrame::GetContent(nsIContent** aContent) const
{
NS_PRECONDITION(nsnull != aContent, "null OUT parameter pointer");
*aContent = mContent;
NS_IF_ADDREF(*aContent);
return NS_OK;
}
NS_IMETHODIMP
nsFrame::GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const
{
@ -492,58 +483,12 @@ nsFrame::GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const
return NS_OK;
}
NS_IMETHODIMP
nsFrame::GetStyleContext(nsIStyleContext** aStyleContext) const
{
NS_PRECONDITION(nsnull != aStyleContext, "null OUT parameter pointer");
NS_ASSERTION(nsnull != mStyleContext, "frame should always have style context");
NS_IF_ADDREF(mStyleContext);
*aStyleContext = mStyleContext;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SetStyleContext(nsIPresContext* aPresContext,nsIStyleContext* aContext)
{
// NS_PRECONDITION(0 == (mState & NS_FRAME_IN_REFLOW), "Shouldn't set style context during reflow");
NS_PRECONDITION(nsnull != aContext, "null ptr");
if (aContext != mStyleContext) {
NS_IF_RELEASE(mStyleContext);
if (nsnull != aContext) {
mStyleContext = aContext;
NS_ADDREF(aContext);
DidSetStyleContext(aPresContext);
}
}
return NS_OK;
}
// Subclass hook for style post processing
NS_IMETHODIMP nsFrame::DidSetStyleContext(nsIPresContext* aPresContext)
{
return NS_OK;
}
NS_IMETHODIMP nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const
{
NS_ASSERTION(mStyleContext!=nsnull,"null style context");
if (mStyleContext) {
aStyleStruct = mStyleContext->GetStyleData(aSID);
} else {
aStyleStruct = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP nsFrame::GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const {
NS_ASSERTION(mStyleContext!=nsnull,"null style context");
if (mStyleContext) {
return mStyleContext->GetStyle(aSID, aStruct);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsFrame::CalcBorderPadding(nsMargin& aBorderPadding) const {
NS_ASSERTION(mStyleContext!=nsnull,"null style context");
if (mStyleContext) {
@ -576,65 +521,6 @@ nsFrame::SetAdditionalStyleContext(PRInt32 aIndex,
return ((aIndex < 0) ? NS_ERROR_INVALID_ARG : NS_OK);
}
// Geometric parent member functions
NS_IMETHODIMP nsFrame::GetParent(nsIFrame** aParent) const
{
NS_PRECONDITION(nsnull != aParent, "null OUT parameter pointer");
*aParent = mParent;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SetParent(const nsIFrame* aParent)
{
mParent = (nsIFrame*)aParent;
return NS_OK;
}
// Bounding rect member functions
NS_IMETHODIMP nsFrame::GetRect(nsRect& aRect) const
{
aRect = mRect;
return NS_OK;
}
NS_IMETHODIMP nsFrame::GetOrigin(nsPoint& aPoint) const
{
aPoint.x = mRect.x;
aPoint.y = mRect.y;
return NS_OK;
}
NS_IMETHODIMP nsFrame::GetSize(nsSize& aSize) const
{
aSize.width = mRect.width;
aSize.height = mRect.height;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SetRect(nsIPresContext* aPresContext,
const nsRect& aRect)
{
MoveTo(aPresContext, aRect.x, aRect.y);
SizeTo(aPresContext, aRect.width, aRect.height);
return NS_OK;
}
NS_IMETHODIMP nsFrame::MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY)
{
mRect.x = aX;
mRect.y = aY;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight)
{
mRect.width = aWidth;
mRect.height = aHeight;
return NS_OK;
}
// Child frame enumeration
NS_IMETHODIMP
@ -1870,20 +1756,6 @@ nsFrame::GetFrameForPoint(nsIPresContext* aPresContext,
}
// Resize and incremental reflow
NS_IMETHODIMP
nsFrame::GetFrameState(nsFrameState* aResult)
{
NS_PRECONDITION(nsnull != aResult, "null OUT parameter pointer");
*aResult = mState;
return NS_OK;
}
NS_IMETHODIMP
nsFrame::SetFrameState(nsFrameState aNewState)
{
mState = aNewState;
return NS_OK;
}
// nsIHTMLReflow member functions
@ -2308,22 +2180,6 @@ NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const
return NS_OK;
}
// Sibling pointer used to link together frames
NS_IMETHODIMP nsFrame::GetNextSibling(nsIFrame** aNextSibling) const
{
NS_PRECONDITION(nsnull != aNextSibling, "null OUT parameter pointer");
*aNextSibling = mNextSibling;
return NS_OK;
}
NS_IMETHODIMP nsFrame::SetNextSibling(nsIFrame* aNextSibling)
{
NS_ASSERTION(aNextSibling != this, "attempt to create circular frame list");
mNextSibling = aNextSibling;
return NS_OK;
}
NS_IMETHODIMP nsFrame::Scrolled(nsIView *aView)
{
return NS_OK;
@ -4115,9 +3971,9 @@ nsFrame::CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
if (!view)
{
nsresult rv = GetParentWithView(aPresContext, &parent);
if (NS_FAILED(rv))
if (NS_FAILED(rv))
return rv;
if (!parent)
if (!parent)
return NS_ERROR_FAILURE;
parent->GetView(aPresContext,&view);
}
@ -4149,9 +4005,9 @@ nsFrame::IsMouseCaptured(nsIPresContext* aPresContext)
{
nsIFrame *parent;//might be THIS frame thats ok
nsresult rv = GetParentWithView(aPresContext, &parent);
if (NS_FAILED(rv))
if (NS_FAILED(rv))
return rv;
if (!parent)
if (!parent)
return NS_ERROR_FAILURE;
parent->GetView(aPresContext,&view);

Просмотреть файл

@ -184,26 +184,11 @@ public:
nsIFrame* aOldFrame,
nsIFrame* aNewFrame);
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD GetContent(nsIContent** aContent) const;
NS_IMETHOD GetStyleContext(nsIStyleContext** aStyleContext) const;
NS_IMETHOD SetStyleContext(nsIPresContext* aPresContext,
nsIStyleContext* aContext);
NS_IMETHOD GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const;
NS_IMETHOD GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const;
NS_IMETHOD CalcBorderPadding(nsMargin& aBorderPadding) const;
NS_IMETHOD GetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext** aStyleContext) const;
NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext* aStyleContext);
NS_IMETHOD GetParent(nsIFrame** aParent) const;
NS_IMETHOD SetParent(const nsIFrame* aParent);
NS_IMETHOD GetRect(nsRect& aRect) const;
NS_IMETHOD GetOrigin(nsPoint& aPoint) const;
NS_IMETHOD GetSize(nsSize& aSize) const;
NS_IMETHOD SetRect(nsIPresContext* aPresContext, const nsRect& aRect);
NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
NS_IMETHOD SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight);
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
@ -243,10 +228,6 @@ public:
PRInt32 aLineStart,
PRInt8 aOutSideLimit
);
NS_IMETHOD GetFrameState(nsFrameState* aResult);
NS_IMETHOD SetFrameState(nsFrameState aNewState);
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent);
@ -271,8 +252,6 @@ public:
NS_IMETHOD GetWindow(nsIPresContext* aPresContext, nsIWidget**) const;
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
NS_IMETHOD IsPercentageBase(PRBool& aBase) const;
NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const;
NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling);
NS_IMETHOD Scrolled(nsIView *aView);
#ifdef NS_DEBUG
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
@ -499,13 +478,6 @@ protected:
// applies to its situation.
void SetOverflowClipRect(nsIRenderingContext& aRenderingContext);
nsRect mRect;
nsIContent* mContent;
nsIStyleContext* mStyleContext;
nsIFrame* mParent;
nsIFrame* mNextSibling; // singly linked list of frames
nsFrameState mState;
protected:
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);

Просмотреть файл

@ -1101,7 +1101,7 @@ DumpContext(nsIFrame* aFrame, nsIStyleContext* aContext)
NS_RELEASE(pseudoTag);
}
/* XXXdwh fix debugging here. Need to add a List method to nsIRuleNode
/* XXXdwh fix debugging here. Need to add a List method to nsRuleNode
and have the context call list on its rule node.
PRInt32 count = aContext->GetStyleRuleCount();
if (0 < count) {

Просмотреть файл

@ -37,7 +37,6 @@
#include "nsCOMPtr.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsIDeviceContext.h"
#include "nsPageFrame.h"

Просмотреть файл

@ -35,7 +35,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsFrame.h"
#include "nsIContent.h"

Просмотреть файл

@ -48,7 +48,6 @@
#include "nsICSSStyleSheet.h" // XXX for UA sheet loading hack, can this go away please?
#include "nsIDOMCSSStyleSheet.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsIStyleContext.h"
#include "nsIServiceManager.h"
#include "nsFrame.h"
#include "nsIReflowCommand.h"

Просмотреть файл

@ -38,7 +38,6 @@
#include "nsCOMPtr.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsIDeviceContext.h"
#include "nsPageFrame.h"

Просмотреть файл

@ -44,7 +44,6 @@
#define nsButtonFrameRenderer_h___
#include "nsCoord.h"
#include "nsIStyleContext.h"
#include "nsCOMPtr.h"
#include "nsFrame.h"

Просмотреть файл

@ -49,7 +49,6 @@
#include "nsIHTMLAttributes.h"
#include "nsIStyleRule.h"
#include "nsIFrame.h"
#include "nsIStyleContext.h"
#include "nsHTMLAtoms.h"
#include "nsIPresContext.h"
#include "nsILinkHandler.h"
@ -102,7 +101,7 @@
#include "nsIDocShell.h"
#include "nsFormControlHelper.h"
#include "nsObjectFrame.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
#include "nsIXULDocument.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
@ -11312,24 +11311,12 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIPresContext* aPresContext,
// data, we need to blow away our style information if this reframe happened as
// a result of an inline style attribute changing.
if (aInlineStyle) {
if (aStyleContext) {
nsCOMPtr<nsIRuleNode> ruleNode;
aStyleContext->GetRuleNode(getter_AddRefs(ruleNode));
ruleNode->ClearCachedData(aInlineStyleRule); // XXXdwh. If we're willing to *really* special case
// inline style, we could only invalidate the struct data
// that actually changed. For example, if someone changes
// style.left, we really only need to blow away cached
// data in the position struct.
}
if (aStyleContext)
aStyleContext->ClearCachedDataForRule(aInlineStyleRule);
else {
// Ok, our only option left is to just crawl the entire rule
// tree and blow away the data that way.
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
nsCOMPtr<nsIRuleNode> rootNode;
set->GetRuleTree(getter_AddRefs(rootNode));
if (rootNode)
rootNode->ClearCachedDataInSubtree(aInlineStyleRule);
set->ClearCachedDataInRuleTree(aInlineStyleRule);
}
}

Просмотреть файл

@ -41,7 +41,6 @@
#include "nsIStyleFrameConstruction.h"
#include "nsIPresContext.h"
#include "nsCOMPtr.h"
#include "nsIStyleContext.h"
#include "nsILayoutHistoryState.h"
#include "nsIXBLService.h"
#include "nsIServiceManager.h"

Просмотреть файл

@ -34,7 +34,6 @@
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCSSRendering.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIImage.h"
@ -56,6 +55,7 @@
#include "nsIScrollableFrame.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "nsCSSRendering.h"
#define BORDER_FULL 0 //entire side
#define BORDER_INSIDE 1 //inside half

Просмотреть файл

@ -38,8 +38,9 @@
#define nsCSSRendering_h___
#include "nsIRenderingContext.h"
#include "nsIStyleContext.h"
struct nsPoint;
class nsIStyleContext;
class nsIPresContext;
class nsCSSRendering {
public:

Просмотреть файл

@ -1227,6 +1227,8 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData)
nsCOMPtr<nsILoadGroup> loadGroup;
mDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup));
NS_ASSERTION(loadGroup, "A stylesheet was unable to locate a load group. This means the onload is going to fire too early!");
#ifdef MOZ_TIMELINE
NS_TIMELINE_MARK_URI("Loading style sheet: %s", urlClone);
NS_TIMELINE_INDENT();

Просмотреть файл

@ -69,7 +69,7 @@
#include "nsINameSpace.h"
#include "nsILookAndFeel.h"
#include "xp_core.h"
#include "nsIRuleNode.h"
#include "nsRuleNode.h"
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"

Просмотреть файл

@ -80,7 +80,7 @@
#include "nsIPresShell.h"
#include "nsICSSParser.h"
#include "nsICSSLoader.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsCSSAtoms.h"
#include "nsINameSpaceManager.h"
#include "nsINameSpace.h"
@ -717,7 +717,7 @@ public:
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -725,7 +725,7 @@ public:
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -3226,7 +3226,7 @@ MOZ_DECL_CTOR_COUNTER(SelectorMatchesData)
struct SelectorMatchesData {
SelectorMatchesData(nsIPresContext* aPresContext, nsIContent* aContent,
nsIRuleWalker* aRuleWalker, nsCompatibility* aCompat = nsnull);
nsRuleWalker* aRuleWalker, nsCompatibility* aCompat = nsnull);
virtual ~SelectorMatchesData()
{
@ -3256,7 +3256,7 @@ struct SelectorMatchesData {
nsIPresContext* mPresContext;
nsIContent* mContent;
nsIContent* mParentContent; // if content, content->GetParent()
nsCOMPtr<nsIRuleWalker> mRuleWalker; // Used to add rules to our results.
nsRuleWalker* mRuleWalker; // Used to add rules to our results.
nsCOMPtr<nsIStyleRuleSupplier> mStyleRuleSupplier; // used to query for the current scope
nsIAtom* mContentTag; // if content, then content->GetTag()
@ -3275,7 +3275,7 @@ struct SelectorMatchesData {
};
SelectorMatchesData::SelectorMatchesData(nsIPresContext* aPresContext, nsIContent* aContent,
nsIRuleWalker* aRuleWalker,
nsRuleWalker* aRuleWalker,
nsCompatibility* aCompat /*= nsnull*/)
{
MOZ_COUNT_CTOR(SelectorMatchesData);
@ -3797,7 +3797,7 @@ static PRBool SelectorMatches(SelectorMatchesData &data,
struct ContentEnumData : public SelectorMatchesData {
ContentEnumData(nsIPresContext* aPresContext, nsIContent* aContent,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
: SelectorMatchesData(aPresContext,aContent,aRuleWalker)
{}
};
@ -3947,7 +3947,7 @@ CSSRuleProcessor::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
NS_PRECONDITION(nsnull != aPresContext, "null arg");
NS_PRECONDITION(nsnull != aContent, "null arg");
@ -3994,7 +3994,7 @@ CSSRuleProcessor::RulesMatching(nsIPresContext* aPresContext,
struct PseudoEnumData : public SelectorMatchesData {
PseudoEnumData(nsIPresContext* aPresContext, nsIContent* aParentContent,
nsIAtom* aPseudoTag, nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
: SelectorMatchesData(aPresContext, aParentContent, aRuleWalker)
{
mPseudoTag = aPseudoTag;
@ -4061,7 +4061,7 @@ CSSRuleProcessor::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
NS_PRECONDITION(nsnull != aPresContext, "null arg");
NS_PRECONDITION(nsnull != aPseudoTag, "null arg");

Просмотреть файл

@ -56,7 +56,7 @@
#include "nsCOMPtr.h"
#include "nsIStyleSet.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsISizeOfHandler.h"
@ -248,7 +248,7 @@ public:
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -256,7 +256,7 @@ public:
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -400,7 +400,7 @@ HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
NS_PRECONDITION(nsnull != aPresContext, "null arg");
NS_PRECONDITION(nsnull != aContent, "null arg");
@ -422,12 +422,10 @@ HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
if (aPseudoTag == nsHTMLAtoms::firstLinePseudo) {
PRBool atRoot = PR_FALSE;
aRuleWalker->AtRoot(&atRoot);
if (!atRoot) {
if (!aRuleWalker->AtRoot()) {
if (nsnull == mFirstLineRule) {
mFirstLineRule = new CSSFirstLineRule(this);
if (mFirstLineRule) {
@ -441,9 +439,7 @@ HTMLCSSStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
}
}
if (aPseudoTag == nsHTMLAtoms::firstLetterPseudo) {
PRBool atRoot = PR_FALSE;
aRuleWalker->AtRoot(&atRoot);
if (!atRoot) {
if (!aRuleWalker->AtRoot()) {
if (nsnull == mFirstLetterRule) {
mFirstLetterRule = new CSSFirstLetterRule(this);
if (mFirstLetterRule) {

Просмотреть файл

@ -59,7 +59,7 @@
#include "nsContentCID.h"
#include "nsLayoutCID.h"
#include "nsIRuleWalker.h"
#include "nsRuleWalker.h"
#include "nsIStyleSet.h"
#include "nsISizeOfHandler.h"
@ -567,7 +567,7 @@ public:
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -575,7 +575,7 @@ public:
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker);
nsRuleWalker* aRuleWalker);
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
nsIAtom* aMedium,
@ -808,7 +808,7 @@ HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
NS_PRECONDITION(nsnull != aPresContext, "null arg");
NS_PRECONDITION(nsnull != aContent, "null arg");
@ -922,7 +922,7 @@ HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsIRuleWalker* aRuleWalker)
nsRuleWalker* aRuleWalker)
{
// no pseudo frame style
return NS_OK;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше