mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Add nsIFrame::GetPresContext, which gets the pres context from the rule node which it gets from the style context. DeCOMtaminate nsStyleContext::GetRuleNode, nsRuleNode::GetRule, and nsRuleNode::GetPresContext. Remove unused nsRuleNode::PathContainsRule. b=208190 r+sr=roc
This commit is contained in:
parent
e2d898f42b
commit
51e6755ccd
@ -102,7 +102,7 @@ public:
|
||||
*/
|
||||
|
||||
struct ChildrenHashEntry : public PLDHashEntryHdr {
|
||||
// key (the rule) is |mRuleNode->Rule()|
|
||||
// key (the rule) is |mRuleNode->GetRule()|
|
||||
nsRuleNode *mRuleNode;
|
||||
};
|
||||
|
||||
@ -110,7 +110,7 @@ PR_STATIC_CALLBACK(const void *)
|
||||
ChildrenHashGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr)
|
||||
{
|
||||
ChildrenHashEntry *entry = NS_STATIC_CAST(ChildrenHashEntry*, hdr);
|
||||
return entry->mRuleNode->Rule();
|
||||
return entry->mRuleNode->GetRule();
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PRBool)
|
||||
@ -119,7 +119,7 @@ ChildrenHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
|
||||
{
|
||||
const ChildrenHashEntry *entry =
|
||||
NS_STATIC_CAST(const ChildrenHashEntry*, hdr);
|
||||
return entry->mRuleNode->Rule() == key;
|
||||
return entry->mRuleNode->GetRule() == key;
|
||||
}
|
||||
|
||||
static PLDHashTableOps ChildrenHashOps = {
|
||||
@ -537,22 +537,6 @@ nsRuleNode::ConvertChildrenToHash()
|
||||
SetChildrenHash(hash);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRuleNode::PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched)
|
||||
{
|
||||
*aMatched = PR_FALSE;
|
||||
nsRuleNode* ruleDest = this;
|
||||
while (ruleDest) {
|
||||
if (ruleDest->mRule == aRule) {
|
||||
*aMatched = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
ruleDest = ruleDest->mParent;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
ClearStyleDataHelper(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
PRUint32 number, void *arg)
|
||||
@ -582,14 +566,6 @@ nsRuleNode::ClearStyleData()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRuleNode::GetPresContext(nsIPresContext** aResult)
|
||||
{
|
||||
*aResult = mPresContext;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline void
|
||||
nsRuleNode::PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode)
|
||||
{
|
||||
@ -1943,10 +1919,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext,
|
||||
PRBool dummy;
|
||||
PRUint32 noneBits;
|
||||
PRUint32 fontBit = nsCachedStyleData::GetBitForSID(eStyleStruct_Font);
|
||||
nsRuleNode* ruleNode = nsnull;
|
||||
|
||||
nsCOMPtr<nsIStyleRule> rule;
|
||||
|
||||
for (; i >= 0; --i) {
|
||||
nsStyleContext* context = (nsStyleContext*)contextPath[i];
|
||||
nsRuleDataFont fontData; // Declare a struct with null CSS values.
|
||||
@ -1954,17 +1927,15 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext,
|
||||
ruleData.mFontData = &fontData;
|
||||
|
||||
// Trimmed down version of ::WalkRuleTree() to re-apply the style rules
|
||||
context->GetRuleNode(&ruleNode);
|
||||
while (ruleNode) {
|
||||
for (nsRuleNode* ruleNode = context->GetRuleNode(); ruleNode;
|
||||
ruleNode = ruleNode->GetParent()) {
|
||||
ruleNode->GetBits(nsRuleNode::eNoneBits, &noneBits);
|
||||
if (noneBits & fontBit) // no more font rules on this branch, get out
|
||||
break;
|
||||
|
||||
ruleNode->GetRule(getter_AddRefs(rule));
|
||||
nsIStyleRule *rule = ruleNode->GetRule();
|
||||
if (rule)
|
||||
rule->MapRuleInfoInto(&ruleData);
|
||||
|
||||
ruleNode = ruleNode->GetParent();
|
||||
}
|
||||
|
||||
// Compute the delta from the information that the rules specified
|
||||
|
@ -92,7 +92,7 @@ nsStyleContext::~nsStyleContext()
|
||||
{
|
||||
NS_ASSERTION((nsnull == mChild) && (nsnull == mEmptyChild), "destructing context with children");
|
||||
|
||||
nsIPresContext *presContext = mRuleNode->PresContext();
|
||||
nsIPresContext *presContext = mRuleNode->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
presContext->GetShell(getter_AddRefs(shell));
|
||||
@ -347,14 +347,13 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct)
|
||||
char* resetOrInherit = NS_REINTERPRET_CAST(char*,
|
||||
*NS_REINTERPRET_CAST(void**, resetOrInheritSlot));
|
||||
if (!resetOrInherit) {
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
mRuleNode->GetPresContext(getter_AddRefs(presContext));
|
||||
nsIPresContext *presContext = mRuleNode->GetPresContext();
|
||||
if (mCachedStyleData.IsReset(aSID)) {
|
||||
mCachedStyleData.mResetData = new (presContext.get()) nsResetStyleData;
|
||||
mCachedStyleData.mResetData = new (presContext) nsResetStyleData;
|
||||
resetOrInherit = NS_REINTERPRET_CAST(char*, mCachedStyleData.mResetData);
|
||||
} else {
|
||||
mCachedStyleData.mInheritedData =
|
||||
new (presContext.get()) nsInheritedStyleData;
|
||||
new (presContext) nsInheritedStyleData;
|
||||
resetOrInherit =
|
||||
NS_REINTERPRET_CAST(char*, mCachedStyleData.mInheritedData);
|
||||
}
|
||||
@ -553,8 +552,7 @@ void nsStyleContext::List(FILE* out, PRInt32 aIndent)
|
||||
fputs("{\n", out);
|
||||
nsRuleNode* ruleNode = mRuleNode;
|
||||
while (ruleNode) {
|
||||
nsCOMPtr<nsIStyleRule> styleRule;
|
||||
ruleNode->GetRule(getter_AddRefs(styleRule));
|
||||
nsIStyleRule *styleRule = ruleNode->GetRule();
|
||||
if (styleRule) {
|
||||
styleRule->List(out, aIndent + 1);
|
||||
}
|
||||
@ -838,8 +836,7 @@ void
|
||||
nsStyleContext::Destroy()
|
||||
{
|
||||
// Get the pres context from our rule node.
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
mRuleNode->GetPresContext(getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsIPresContext> presContext = mRuleNode->GetPresContext();
|
||||
|
||||
// Call our destructor.
|
||||
this->~nsStyleContext();
|
||||
|
@ -91,7 +91,7 @@ struct nsRuleNodeList
|
||||
void Destroy() {
|
||||
if (mNext)
|
||||
mNext->Destroy();
|
||||
mRuleNode->PresContext()->FreeToShell(sizeof(nsRuleNodeList), this);
|
||||
mRuleNode->GetPresContext()->FreeToShell(sizeof(nsRuleNodeList), this);
|
||||
};
|
||||
|
||||
nsRuleNode* mRuleNode;
|
||||
@ -1041,8 +1041,7 @@ StyleSetImpl::AddImportantRules(nsRuleNode* aCurrLevelNode,
|
||||
|
||||
AddImportantRules(aCurrLevelNode->GetParent(), aLastPrevLevelNode);
|
||||
|
||||
nsCOMPtr<nsIStyleRule> rule;;
|
||||
aCurrLevelNode->GetRule(getter_AddRefs(rule));
|
||||
nsIStyleRule *rule = aCurrLevelNode->GetRule();
|
||||
nsCOMPtr<nsICSSStyleRule> cssRule(do_QueryInterface(rule));
|
||||
if (cssRule) {
|
||||
nsCOMPtr<nsIStyleRule> impRule = cssRule->GetImportantRule();
|
||||
@ -1518,8 +1517,7 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
else { // really a new parent
|
||||
nsCOMPtr<nsIAtom> pseudoTag = aStyleContext->GetPseudoType();
|
||||
|
||||
nsRuleNode* ruleNode;
|
||||
aStyleContext->GetRuleNode(&ruleNode);
|
||||
nsRuleNode* ruleNode = aStyleContext->GetRuleNode();
|
||||
EnsureRuleWalker(aPresContext);
|
||||
NS_ENSURE_TRUE(mRuleWalker, nsnull);
|
||||
mRuleWalker->SetCurrentNode(ruleNode);
|
||||
|
@ -808,7 +808,9 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,
|
||||
else if (tag == nsHTMLAtoms::table) {
|
||||
if (aData->mCompatMode == eCompatibility_NavQuirks) {
|
||||
nscolor bodyColor;
|
||||
nsresult rv = GetBodyColor(ruleWalker->GetCurrentNode()->PresContext(), &bodyColor);
|
||||
nsresult rv =
|
||||
GetBodyColor(ruleWalker->GetCurrentNode()->GetPresContext(),
|
||||
&bodyColor);
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(!mDocumentColorRule || bodyColor != mDocumentColorRule->mColor)) {
|
||||
if (mDocumentColorRule) {
|
||||
|
@ -75,7 +75,8 @@ nsInspectorCSSUtils::GetRuleNodeParent(nsRuleNode *aNode, nsRuleNode **aParent)
|
||||
NS_IMETHODIMP
|
||||
nsInspectorCSSUtils::GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule)
|
||||
{
|
||||
return aNode->GetRule(aRule);
|
||||
*aRule = aNode->GetRule();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -181,6 +182,6 @@ nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent,
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsRefPtr<nsStyleContext> sContext = GetStyleContextForContent(aContent, presShell);
|
||||
sContext->GetRuleNode(aRuleNode);
|
||||
*aRuleNode = sContext->GetRuleNode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -539,26 +539,15 @@ public:
|
||||
|
||||
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)
|
||||
{
|
||||
*aResult = mRule;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
nsIStyleRule* Rule() {
|
||||
// NOTE: Does not |AddRef|.
|
||||
return mRule;
|
||||
}
|
||||
nsIPresContext* PresContext() {
|
||||
// NOTE: Does not |AddRef|.
|
||||
return mPresContext;
|
||||
}
|
||||
nsRuleNode* GetParent() const { return mParent; }
|
||||
PRBool IsRoot() const { return mParent == nsnull; }
|
||||
|
||||
// NOTE: Does not |AddRef|.
|
||||
nsIStyleRule* GetRule() const { return mRule; }
|
||||
// NOTE: Does not |AddRef|.
|
||||
nsIPresContext* GetPresContext() const { return mPresContext; }
|
||||
|
||||
nsresult ClearStyleData();
|
||||
nsresult GetPresContext(nsIPresContext** aResult);
|
||||
nsresult PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched);
|
||||
const nsStyleStruct* GetStyleData(nsStyleStructID aSID,
|
||||
nsStyleContext* aContext,
|
||||
PRBool aComputeData);
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
|
||||
void SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct);
|
||||
|
||||
void GetRuleNode(nsRuleNode** aResult) { *aResult = mRuleNode; }
|
||||
nsRuleNode* GetRuleNode() { return mRuleNode; }
|
||||
void AddStyleBit(const PRUint32& aBit) { mBits |= aBit; }
|
||||
void GetStyleBits(PRUint32* aBits) { *aBits = mBits; }
|
||||
|
||||
|
@ -1736,10 +1736,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
NS_ASSERTION(newContext, "failed to get new style context");
|
||||
if (newContext) {
|
||||
if (!parentContext) {
|
||||
nsRuleNode *oldNode, *newNode;
|
||||
oldContext->GetRuleNode(&oldNode);
|
||||
newContext->GetRuleNode(&newNode);
|
||||
if (oldNode == newNode) {
|
||||
if (oldContext->GetRuleNode() == newContext->GetRuleNode()) {
|
||||
// We're the root of the style context tree and the new style
|
||||
// context returned has the same rule node. This means that
|
||||
// we can use FindChildWithRules to keep a lot of the old
|
||||
|
@ -396,6 +396,11 @@ class nsIFrame : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAME_IID)
|
||||
|
||||
nsIPresContext* GetPresContext() {
|
||||
return GetStyleContext()->GetRuleNode()->GetPresContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to initialize the frame. This is called immediately after creating
|
||||
* the frame.
|
||||
|
@ -396,6 +396,11 @@ class nsIFrame : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAME_IID)
|
||||
|
||||
nsIPresContext* GetPresContext() {
|
||||
return GetStyleContext()->GetRuleNode()->GetPresContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to initialize the frame. This is called immediately after creating
|
||||
* the frame.
|
||||
|
@ -1736,10 +1736,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
NS_ASSERTION(newContext, "failed to get new style context");
|
||||
if (newContext) {
|
||||
if (!parentContext) {
|
||||
nsRuleNode *oldNode, *newNode;
|
||||
oldContext->GetRuleNode(&oldNode);
|
||||
newContext->GetRuleNode(&newNode);
|
||||
if (oldNode == newNode) {
|
||||
if (oldContext->GetRuleNode() == newContext->GetRuleNode()) {
|
||||
// We're the root of the style context tree and the new style
|
||||
// context returned has the same rule node. This means that
|
||||
// we can use FindChildWithRules to keep a lot of the old
|
||||
|
@ -808,7 +808,9 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,
|
||||
else if (tag == nsHTMLAtoms::table) {
|
||||
if (aData->mCompatMode == eCompatibility_NavQuirks) {
|
||||
nscolor bodyColor;
|
||||
nsresult rv = GetBodyColor(ruleWalker->GetCurrentNode()->PresContext(), &bodyColor);
|
||||
nsresult rv =
|
||||
GetBodyColor(ruleWalker->GetCurrentNode()->GetPresContext(),
|
||||
&bodyColor);
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(!mDocumentColorRule || bodyColor != mDocumentColorRule->mColor)) {
|
||||
if (mDocumentColorRule) {
|
||||
|
@ -75,7 +75,8 @@ nsInspectorCSSUtils::GetRuleNodeParent(nsRuleNode *aNode, nsRuleNode **aParent)
|
||||
NS_IMETHODIMP
|
||||
nsInspectorCSSUtils::GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule)
|
||||
{
|
||||
return aNode->GetRule(aRule);
|
||||
*aRule = aNode->GetRule();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -181,6 +182,6 @@ nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent,
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsRefPtr<nsStyleContext> sContext = GetStyleContextForContent(aContent, presShell);
|
||||
sContext->GetRuleNode(aRuleNode);
|
||||
*aRuleNode = sContext->GetRuleNode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
*/
|
||||
|
||||
struct ChildrenHashEntry : public PLDHashEntryHdr {
|
||||
// key (the rule) is |mRuleNode->Rule()|
|
||||
// key (the rule) is |mRuleNode->GetRule()|
|
||||
nsRuleNode *mRuleNode;
|
||||
};
|
||||
|
||||
@ -110,7 +110,7 @@ PR_STATIC_CALLBACK(const void *)
|
||||
ChildrenHashGetKey(PLDHashTable *table, PLDHashEntryHdr *hdr)
|
||||
{
|
||||
ChildrenHashEntry *entry = NS_STATIC_CAST(ChildrenHashEntry*, hdr);
|
||||
return entry->mRuleNode->Rule();
|
||||
return entry->mRuleNode->GetRule();
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PRBool)
|
||||
@ -119,7 +119,7 @@ ChildrenHashMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
|
||||
{
|
||||
const ChildrenHashEntry *entry =
|
||||
NS_STATIC_CAST(const ChildrenHashEntry*, hdr);
|
||||
return entry->mRuleNode->Rule() == key;
|
||||
return entry->mRuleNode->GetRule() == key;
|
||||
}
|
||||
|
||||
static PLDHashTableOps ChildrenHashOps = {
|
||||
@ -537,22 +537,6 @@ nsRuleNode::ConvertChildrenToHash()
|
||||
SetChildrenHash(hash);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRuleNode::PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched)
|
||||
{
|
||||
*aMatched = PR_FALSE;
|
||||
nsRuleNode* ruleDest = this;
|
||||
while (ruleDest) {
|
||||
if (ruleDest->mRule == aRule) {
|
||||
*aMatched = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
ruleDest = ruleDest->mParent;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
ClearStyleDataHelper(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
PRUint32 number, void *arg)
|
||||
@ -582,14 +566,6 @@ nsRuleNode::ClearStyleData()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRuleNode::GetPresContext(nsIPresContext** aResult)
|
||||
{
|
||||
*aResult = mPresContext;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
inline void
|
||||
nsRuleNode::PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode)
|
||||
{
|
||||
@ -1943,10 +1919,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext,
|
||||
PRBool dummy;
|
||||
PRUint32 noneBits;
|
||||
PRUint32 fontBit = nsCachedStyleData::GetBitForSID(eStyleStruct_Font);
|
||||
nsRuleNode* ruleNode = nsnull;
|
||||
|
||||
nsCOMPtr<nsIStyleRule> rule;
|
||||
|
||||
for (; i >= 0; --i) {
|
||||
nsStyleContext* context = (nsStyleContext*)contextPath[i];
|
||||
nsRuleDataFont fontData; // Declare a struct with null CSS values.
|
||||
@ -1954,17 +1927,15 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext,
|
||||
ruleData.mFontData = &fontData;
|
||||
|
||||
// Trimmed down version of ::WalkRuleTree() to re-apply the style rules
|
||||
context->GetRuleNode(&ruleNode);
|
||||
while (ruleNode) {
|
||||
for (nsRuleNode* ruleNode = context->GetRuleNode(); ruleNode;
|
||||
ruleNode = ruleNode->GetParent()) {
|
||||
ruleNode->GetBits(nsRuleNode::eNoneBits, &noneBits);
|
||||
if (noneBits & fontBit) // no more font rules on this branch, get out
|
||||
break;
|
||||
|
||||
ruleNode->GetRule(getter_AddRefs(rule));
|
||||
nsIStyleRule *rule = ruleNode->GetRule();
|
||||
if (rule)
|
||||
rule->MapRuleInfoInto(&ruleData);
|
||||
|
||||
ruleNode = ruleNode->GetParent();
|
||||
}
|
||||
|
||||
// Compute the delta from the information that the rules specified
|
||||
|
@ -539,26 +539,15 @@ public:
|
||||
|
||||
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)
|
||||
{
|
||||
*aResult = mRule;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
nsIStyleRule* Rule() {
|
||||
// NOTE: Does not |AddRef|.
|
||||
return mRule;
|
||||
}
|
||||
nsIPresContext* PresContext() {
|
||||
// NOTE: Does not |AddRef|.
|
||||
return mPresContext;
|
||||
}
|
||||
nsRuleNode* GetParent() const { return mParent; }
|
||||
PRBool IsRoot() const { return mParent == nsnull; }
|
||||
|
||||
// NOTE: Does not |AddRef|.
|
||||
nsIStyleRule* GetRule() const { return mRule; }
|
||||
// NOTE: Does not |AddRef|.
|
||||
nsIPresContext* GetPresContext() const { return mPresContext; }
|
||||
|
||||
nsresult ClearStyleData();
|
||||
nsresult GetPresContext(nsIPresContext** aResult);
|
||||
nsresult PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched);
|
||||
const nsStyleStruct* GetStyleData(nsStyleStructID aSID,
|
||||
nsStyleContext* aContext,
|
||||
PRBool aComputeData);
|
||||
|
@ -92,7 +92,7 @@ nsStyleContext::~nsStyleContext()
|
||||
{
|
||||
NS_ASSERTION((nsnull == mChild) && (nsnull == mEmptyChild), "destructing context with children");
|
||||
|
||||
nsIPresContext *presContext = mRuleNode->PresContext();
|
||||
nsIPresContext *presContext = mRuleNode->GetPresContext();
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
presContext->GetShell(getter_AddRefs(shell));
|
||||
@ -347,14 +347,13 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct)
|
||||
char* resetOrInherit = NS_REINTERPRET_CAST(char*,
|
||||
*NS_REINTERPRET_CAST(void**, resetOrInheritSlot));
|
||||
if (!resetOrInherit) {
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
mRuleNode->GetPresContext(getter_AddRefs(presContext));
|
||||
nsIPresContext *presContext = mRuleNode->GetPresContext();
|
||||
if (mCachedStyleData.IsReset(aSID)) {
|
||||
mCachedStyleData.mResetData = new (presContext.get()) nsResetStyleData;
|
||||
mCachedStyleData.mResetData = new (presContext) nsResetStyleData;
|
||||
resetOrInherit = NS_REINTERPRET_CAST(char*, mCachedStyleData.mResetData);
|
||||
} else {
|
||||
mCachedStyleData.mInheritedData =
|
||||
new (presContext.get()) nsInheritedStyleData;
|
||||
new (presContext) nsInheritedStyleData;
|
||||
resetOrInherit =
|
||||
NS_REINTERPRET_CAST(char*, mCachedStyleData.mInheritedData);
|
||||
}
|
||||
@ -553,8 +552,7 @@ void nsStyleContext::List(FILE* out, PRInt32 aIndent)
|
||||
fputs("{\n", out);
|
||||
nsRuleNode* ruleNode = mRuleNode;
|
||||
while (ruleNode) {
|
||||
nsCOMPtr<nsIStyleRule> styleRule;
|
||||
ruleNode->GetRule(getter_AddRefs(styleRule));
|
||||
nsIStyleRule *styleRule = ruleNode->GetRule();
|
||||
if (styleRule) {
|
||||
styleRule->List(out, aIndent + 1);
|
||||
}
|
||||
@ -838,8 +836,7 @@ void
|
||||
nsStyleContext::Destroy()
|
||||
{
|
||||
// Get the pres context from our rule node.
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
mRuleNode->GetPresContext(getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsIPresContext> presContext = mRuleNode->GetPresContext();
|
||||
|
||||
// Call our destructor.
|
||||
this->~nsStyleContext();
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
|
||||
void SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct);
|
||||
|
||||
void GetRuleNode(nsRuleNode** aResult) { *aResult = mRuleNode; }
|
||||
nsRuleNode* GetRuleNode() { return mRuleNode; }
|
||||
void AddStyleBit(const PRUint32& aBit) { mBits |= aBit; }
|
||||
void GetStyleBits(PRUint32* aBits) { *aBits = mBits; }
|
||||
|
||||
|
@ -91,7 +91,7 @@ struct nsRuleNodeList
|
||||
void Destroy() {
|
||||
if (mNext)
|
||||
mNext->Destroy();
|
||||
mRuleNode->PresContext()->FreeToShell(sizeof(nsRuleNodeList), this);
|
||||
mRuleNode->GetPresContext()->FreeToShell(sizeof(nsRuleNodeList), this);
|
||||
};
|
||||
|
||||
nsRuleNode* mRuleNode;
|
||||
@ -1041,8 +1041,7 @@ StyleSetImpl::AddImportantRules(nsRuleNode* aCurrLevelNode,
|
||||
|
||||
AddImportantRules(aCurrLevelNode->GetParent(), aLastPrevLevelNode);
|
||||
|
||||
nsCOMPtr<nsIStyleRule> rule;;
|
||||
aCurrLevelNode->GetRule(getter_AddRefs(rule));
|
||||
nsIStyleRule *rule = aCurrLevelNode->GetRule();
|
||||
nsCOMPtr<nsICSSStyleRule> cssRule(do_QueryInterface(rule));
|
||||
if (cssRule) {
|
||||
nsCOMPtr<nsIStyleRule> impRule = cssRule->GetImportantRule();
|
||||
@ -1518,8 +1517,7 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
else { // really a new parent
|
||||
nsCOMPtr<nsIAtom> pseudoTag = aStyleContext->GetPseudoType();
|
||||
|
||||
nsRuleNode* ruleNode;
|
||||
aStyleContext->GetRuleNode(&ruleNode);
|
||||
nsRuleNode* ruleNode = aStyleContext->GetRuleNode();
|
||||
EnsureRuleWalker(aPresContext);
|
||||
NS_ENSURE_TRUE(mRuleWalker, nsnull);
|
||||
mRuleWalker->SetCurrentNode(ruleNode);
|
||||
|
Loading…
Reference in New Issue
Block a user