Make GetParent on nsStyleContext return an
already_AddRefed<nsIStyleContext>. Bug 171808, r=jkeiser, sr=dbaron git-svn-id: svn://10.0.0.236/trunk@131531 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
9eabf13be7
commit
a70a392a2c
@ -1589,8 +1589,7 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
|
||||
// All information must necessarily be inherited from our parent style context.
|
||||
// In the absence of any computed data in the rule tree and with
|
||||
// no rules specified that didn't have values of 'inherit', we should check our parent.
|
||||
nsCOMPtr<nsIStyleContext> parentContext =
|
||||
dont_AddRef(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
if (parentContext) {
|
||||
// We have a parent, and so we should just inherit from the parent.
|
||||
// Set the inherit bits on our context. These bits tell the style context that
|
||||
@ -2076,7 +2075,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
|
||||
{
|
||||
// walk up the contexts until a context with the desired generic font
|
||||
nsAutoVoidArray contextPath;
|
||||
nsCOMPtr<nsIStyleContext> higherContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> higherContext = aContext->GetParent();
|
||||
while (higherContext) {
|
||||
contextPath.AppendElement(higherContext);
|
||||
const nsStyleFont* higherFont = (const nsStyleFont*)higherContext->GetStyleData(eStyleStruct_Font);
|
||||
@ -2084,7 +2083,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
|
||||
// done walking up the higher contexts
|
||||
break;
|
||||
}
|
||||
higherContext = getter_AddRefs(higherContext->GetParent());
|
||||
higherContext = higherContext->GetParent();
|
||||
}
|
||||
|
||||
// re-apply the cascading rules, starting from the higher context
|
||||
@ -2169,7 +2168,7 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSFont& fontData = NS_STATIC_CAST(const nsCSSFont&, aData);
|
||||
nsStyleFont* font = nsnull;
|
||||
@ -2298,7 +2297,7 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSText& textData = NS_STATIC_CAST(const nsCSSText&, aData);
|
||||
nsStyleText* text = nsnull;
|
||||
@ -2418,7 +2417,7 @@ nsRuleNode::ComputeTextResetData(nsStyleStruct* aStartData, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSText& textData = NS_STATIC_CAST(const nsCSSText&, aData);
|
||||
nsStyleTextReset* text;
|
||||
@ -2504,7 +2503,7 @@ nsRuleNode::ComputeUserInterfaceData(nsStyleStruct* aStartData,
|
||||
const RuleDetail& aRuleDetail,
|
||||
PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSUserInterface& uiData = NS_STATIC_CAST(const nsCSSUserInterface&, aData);
|
||||
nsStyleUserInterface* ui = nsnull;
|
||||
@ -2614,7 +2613,7 @@ nsRuleNode::ComputeUIResetData(nsStyleStruct* aStartData, const nsCSSStruct& aDa
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSUserInterface& uiData = NS_STATIC_CAST(const nsCSSUserInterface&, aData);
|
||||
nsStyleUIReset* ui;
|
||||
@ -2703,7 +2702,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSDisplay& displayData = NS_STATIC_CAST(const nsCSSDisplay&, aData);
|
||||
nsStyleDisplay* display;
|
||||
@ -2956,7 +2955,7 @@ nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSDisplay& displayData = NS_STATIC_CAST(const nsCSSDisplay&, aData);
|
||||
nsStyleVisibility* visibility = nsnull;
|
||||
@ -3066,7 +3065,7 @@ nsRuleNode::ComputeColorData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDa
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSColor& colorData = NS_STATIC_CAST(const nsCSSColor&, aData);
|
||||
nsStyleColor* color = nsnull;
|
||||
@ -3122,7 +3121,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSColor& colorData = NS_STATIC_CAST(const nsCSSColor&, aData);
|
||||
nsStyleBackground* bg;
|
||||
@ -3285,7 +3284,7 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct, const nsCSSStruct& aD
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSMargin& marginData = NS_STATIC_CAST(const nsCSSMargin&, aData);
|
||||
nsStyleMargin* margin;
|
||||
@ -3350,7 +3349,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, const nsCSSStruct& aD
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSMargin& marginData = NS_STATIC_CAST(const nsCSSMargin&, aData);
|
||||
nsStyleBorder* border;
|
||||
@ -3630,7 +3629,7 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSMargin& marginData = NS_STATIC_CAST(const nsCSSMargin&, aData);
|
||||
nsStylePadding* padding;
|
||||
@ -3695,7 +3694,7 @@ nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSMargin& marginData = NS_STATIC_CAST(const nsCSSMargin&, aData);
|
||||
nsStyleOutline* outline;
|
||||
@ -3767,7 +3766,7 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSList& listData = NS_STATIC_CAST(const nsCSSList&, aData);
|
||||
nsStyleList* list = nsnull;
|
||||
@ -3883,7 +3882,7 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct, const nsCSSStruct&
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSPosition& posData = NS_STATIC_CAST(const nsCSSPosition&, aData);
|
||||
nsStylePosition* pos;
|
||||
@ -3991,7 +3990,7 @@ nsRuleNode::ComputeTableData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDa
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSTable& tableData = NS_STATIC_CAST(const nsCSSTable&, aData);
|
||||
nsStyleTable* table;
|
||||
@ -4061,7 +4060,7 @@ nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct, const nsCSSStruc
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSTable& tableData = NS_STATIC_CAST(const nsCSSTable&, aData);
|
||||
nsStyleTableBorder* table = nsnull;
|
||||
@ -4159,7 +4158,7 @@ nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSContent& contentData = NS_STATIC_CAST(const nsCSSContent&, aData);
|
||||
nsStyleContent* content;
|
||||
@ -4354,7 +4353,7 @@ nsRuleNode::ComputeQuotesData(nsStyleStruct* aStartStruct, const nsCSSStruct& aD
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSContent& contentData = NS_STATIC_CAST(const nsCSSContent&, aData);
|
||||
nsStyleQuotes* quotes = nsnull;
|
||||
@ -4447,7 +4446,7 @@ nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct, const nsCSSStruct& aData
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSXUL& xulData = NS_STATIC_CAST(const nsCSSXUL&, aData);
|
||||
nsStyleXUL* xul = nsnull;
|
||||
@ -4596,7 +4595,7 @@ nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct, const nsCSSStruct& aData
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
nsStyleSVG* svg = nsnull;
|
||||
nsStyleSVG* parentSVG = svg;
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual nsIStyleContext* GetParent(void) const;
|
||||
virtual already_AddRefed<nsIStyleContext> GetParent(void) const;
|
||||
NS_IMETHOD GetFirstChild(nsIStyleContext** aContext);
|
||||
|
||||
NS_IMETHOD GetPseudoType(nsIAtom*& aPseudoTag) const;
|
||||
@ -189,7 +189,7 @@ NS_IMPL_ADDREF(nsStyleContext)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(nsStyleContext, Destroy())
|
||||
NS_IMPL_QUERY_INTERFACE1(nsStyleContext, nsIStyleContext)
|
||||
|
||||
nsIStyleContext* nsStyleContext::GetParent(void) const
|
||||
already_AddRefed<nsIStyleContext> nsStyleContext::GetParent(void) const
|
||||
{
|
||||
NS_IF_ADDREF(mParent);
|
||||
return mParent;
|
||||
|
||||
@ -102,8 +102,6 @@ struct nsRuleNodeList
|
||||
|
||||
// =====================================================
|
||||
|
||||
static NS_DEFINE_IID(kIStyleFrameConstructionIID, NS_ISTYLE_FRAME_CONSTRUCTION_IID);
|
||||
|
||||
class StyleSetImpl : public nsIStyleSet
|
||||
#ifdef MOZ_PERF_METRICS
|
||||
, public nsITimeRecorder
|
||||
@ -664,7 +662,7 @@ void StyleSetImpl::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocumen
|
||||
}
|
||||
|
||||
if (nsnull == mFrameConstructor) {
|
||||
aSheet->QueryInterface(kIStyleFrameConstructionIID, (void **)&mFrameConstructor);
|
||||
CallQueryInterface(aSheet, &mFrameConstructor);
|
||||
}
|
||||
ClearDocRuleProcessors();
|
||||
}
|
||||
@ -1412,7 +1410,7 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsresult result = NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aPresContext && aStyleContext && aNewStyleContext) {
|
||||
nsIStyleContext* oldParent = aStyleContext->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> oldParent = aStyleContext->GetParent();
|
||||
|
||||
if (oldParent == aNewParentContext) {
|
||||
result = NS_OK;
|
||||
@ -1421,8 +1419,8 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
}
|
||||
else { // really a new parent
|
||||
nsIStyleContext* newChild = nsnull;
|
||||
nsIAtom* pseudoTag = nsnull;
|
||||
aStyleContext->GetPseudoType(pseudoTag);
|
||||
nsCOMPtr<nsIAtom> pseudoTag;
|
||||
aStyleContext->GetPseudoType(*getter_AddRefs(pseudoTag));
|
||||
|
||||
nsRuleNode* ruleNode;
|
||||
aStyleContext->GetRuleNode(&ruleNode);
|
||||
@ -1436,11 +1434,7 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
result = NS_NewStyleContext(aNewStyleContext, aNewParentContext, pseudoTag,
|
||||
ruleNode, aPresContext);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(pseudoTag);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(oldParent);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ static void PostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleDa
|
||||
{
|
||||
nsStyleText* text = (nsStyleText*)aStyleStruct;
|
||||
if (text->mTextAlign == NS_STYLE_TEXT_ALIGN_DEFAULT) {
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aRuleData->mStyleContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aRuleData->mStyleContext->GetParent();
|
||||
|
||||
if (parentContext) {
|
||||
const nsStyleText* parentStyleText =
|
||||
@ -430,9 +430,13 @@ ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
|
||||
{
|
||||
if (!aStyleStruct || !aRuleData || !aRuleData->mPresContext) return;
|
||||
|
||||
nsCOMPtr<nsIStyleContext> tableContext = getter_AddRefs(aRuleData->mStyleContext->GetParent()); if (!tableContext) return;
|
||||
nsCOMPtr<nsIStyleContext> tableContext = aRuleData->mStyleContext->GetParent();
|
||||
if (!tableContext)
|
||||
return;
|
||||
if (!aGroup) {
|
||||
tableContext = getter_AddRefs(tableContext->GetParent()); if (!tableContext) return;
|
||||
tableContext = tableContext->GetParent();
|
||||
if (!tableContext)
|
||||
return;
|
||||
}
|
||||
|
||||
const nsStyleTable* tableData =
|
||||
@ -441,10 +445,14 @@ ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
|
||||
(aRulesArg2 == tableData->mRules) ||
|
||||
(aRulesArg3 == tableData->mRules))) {
|
||||
const nsStyleBorder* tableBorderData =
|
||||
(const nsStyleBorder*)tableContext->GetStyleData(eStyleStruct_Border); if (!tableBorderData) return;
|
||||
(const nsStyleBorder*)tableContext->GetStyleData(eStyleStruct_Border);
|
||||
if (!tableBorderData)
|
||||
return;
|
||||
PRUint8 tableBorderStyle = tableBorderData->GetBorderStyle(aSide);
|
||||
|
||||
nsStyleBorder* borderData = (nsStyleBorder*)aStyleStruct; if (!borderData) return;
|
||||
nsStyleBorder* borderData = (nsStyleBorder*)aStyleStruct;
|
||||
if (!borderData)
|
||||
return;
|
||||
PRUint8 borderStyle = borderData->GetBorderStyle(aSide);
|
||||
// XXX It appears that the style system erronously applies the custom style rule after css style,
|
||||
// consequently it does not properly fit into the casade. For now, assume that a border style of none
|
||||
|
||||
@ -135,7 +135,7 @@ nsInspectorCSSUtils::GetStyleContextForFrame(nsIFrame* aFrame,
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (frameType == nsLayoutAtoms::tableOuterFrame) {
|
||||
*aStyleContext = styleContext->GetParent();
|
||||
*aStyleContext = styleContext->GetParent().get();
|
||||
} else {
|
||||
*aStyleContext = styleContext;
|
||||
NS_ADDREF(*aStyleContext);
|
||||
|
||||
@ -1575,8 +1575,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
||||
NS_NewInlineFrame(aPresShell, aWrapperFrame);
|
||||
wrapperPseudo = nsCSSAtoms::mozGCWrapperInline;
|
||||
}
|
||||
nsCOMPtr<nsIStyleContext> parentSC =
|
||||
dont_AddRef(aStyleContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentSC = aStyleContext->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> wrapperSC;
|
||||
aPresContext->ResolvePseudoStyleContextFor(nsnull, wrapperPseudo,
|
||||
parentSC, getter_AddRefs(wrapperSC));
|
||||
@ -4004,8 +4003,7 @@ nsCSSFrameConstructor::CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// The placeholder frame gets a pseudo style context
|
||||
nsCOMPtr<nsIStyleContext> placeholderStyle;
|
||||
nsCOMPtr<nsIStyleContext> parentContext =
|
||||
dont_AddRef(aStyleContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aStyleContext->GetParent();
|
||||
aPresContext->ResolveStyleContextForNonElement(parentContext,
|
||||
getter_AddRefs(placeholderStyle));
|
||||
placeholderFrame->Init(aPresContext, aContent, aParentFrame,
|
||||
|
||||
@ -2377,12 +2377,11 @@ nsCSSRendering::FindNonTransparentBackground(nsIStyleContext* aContext,
|
||||
PRBool aStartAtParent /*= PR_FALSE*/)
|
||||
{
|
||||
const nsStyleBackground* result = nsnull;
|
||||
nsIStyleContext* context;
|
||||
nsCOMPtr<nsIStyleContext> context;
|
||||
if (aStartAtParent) {
|
||||
context = aContext->GetParent(); // balance ending release
|
||||
context = aContext->GetParent();
|
||||
} else {
|
||||
context = aContext;
|
||||
NS_IF_ADDREF(context); // balance ending release
|
||||
}
|
||||
NS_ASSERTION(context, "Cannot find NonTransparentBackground in a null context" );
|
||||
|
||||
@ -2391,11 +2390,8 @@ nsCSSRendering::FindNonTransparentBackground(nsIStyleContext* aContext,
|
||||
if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT))
|
||||
break;
|
||||
|
||||
nsIStyleContext* last = context;
|
||||
context = context->GetParent();
|
||||
NS_RELEASE(last);
|
||||
}
|
||||
NS_IF_RELEASE(context);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1357,13 +1357,13 @@ VerifySameTree(nsIStyleContext* aContext1, nsIStyleContext* aContext2)
|
||||
nsCOMPtr<nsIStyleContext> top2 = aContext2;
|
||||
nsCOMPtr<nsIStyleContext> parent;
|
||||
for (;;) {
|
||||
parent = dont_AddRef(top1->GetParent());
|
||||
parent = top1->GetParent();
|
||||
if (!parent)
|
||||
break;
|
||||
top1 = parent;
|
||||
}
|
||||
for (;;) {
|
||||
parent = dont_AddRef(top2->GetParent());
|
||||
parent = top2->GetParent();
|
||||
if (!parent)
|
||||
break;
|
||||
top2 = parent;
|
||||
@ -1403,7 +1403,7 @@ VerifyContextParent(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
NS_ASSERTION(aContext, "Failure to get required contexts");
|
||||
nsIStyleContext* actualParentContext = aContext->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> actualParentContext = aContext->GetParent();
|
||||
|
||||
if (aParentContext) {
|
||||
if (aParentContext != actualParentContext) {
|
||||
@ -1430,7 +1430,6 @@ VerifyContextParent(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(actualParentContext);
|
||||
NS_IF_RELEASE(aParentContext);
|
||||
NS_IF_RELEASE(aContext);
|
||||
}
|
||||
@ -1503,12 +1502,10 @@ FrameManager::DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFram
|
||||
{
|
||||
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);
|
||||
if (aFrame) {
|
||||
nsIStyleContext* context;
|
||||
aFrame->GetStyleContext(&context);
|
||||
nsIStyleContext* parentContext = context->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> context;
|
||||
aFrame->GetStyleContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIStyleContext> parentContext = context->GetParent();
|
||||
VerifyStyleTree(aPresContext, aFrame, parentContext);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
NS_RELEASE(context);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public:
|
||||
|
||||
virtual PRBool Equals(const nsIStyleContext* aOther) const = 0;
|
||||
|
||||
virtual nsIStyleContext* GetParent(void) const = 0;
|
||||
virtual already_AddRefed<nsIStyleContext> GetParent(void) const = 0;
|
||||
NS_IMETHOD GetFirstChild(nsIStyleContext** aContext)=0;
|
||||
|
||||
NS_IMETHOD GetPseudoType(nsIAtom*& aPseudoTag) const = 0;
|
||||
|
||||
@ -794,21 +794,17 @@ nsStyleUnit
|
||||
nsBlockReflowContext::GetRealMarginLeftUnit()
|
||||
{
|
||||
nsStyleUnit unit = eStyleUnit_Inherit;
|
||||
nsIStyleContext* sc;
|
||||
mFrame->GetStyleContext(&sc);
|
||||
while ((nsnull != sc) && (eStyleUnit_Inherit == unit)) {
|
||||
nsCOMPtr<nsIStyleContext> sc;
|
||||
mFrame->GetStyleContext(getter_AddRefs(sc));
|
||||
while (sc && eStyleUnit_Inherit == unit) {
|
||||
// Get parent style context
|
||||
nsIStyleContext* psc;
|
||||
psc = sc->GetParent();
|
||||
NS_RELEASE(sc);
|
||||
sc = psc;
|
||||
if (nsnull != sc) {
|
||||
sc = sc->GetParent();
|
||||
if (sc) {
|
||||
const nsStyleMargin* margin = (const nsStyleMargin*)
|
||||
sc->GetStyleData(eStyleStruct_Margin);
|
||||
unit = margin->mMargin.GetLeftUnit();
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(sc);
|
||||
return unit;
|
||||
}
|
||||
|
||||
@ -819,20 +815,16 @@ nsStyleUnit
|
||||
nsBlockReflowContext::GetRealMarginRightUnit()
|
||||
{
|
||||
nsStyleUnit unit = eStyleUnit_Inherit;
|
||||
nsIStyleContext* sc;
|
||||
mFrame->GetStyleContext(&sc);
|
||||
while ((nsnull != sc) && (eStyleUnit_Inherit == unit)) {
|
||||
nsCOMPtr<nsIStyleContext> sc;
|
||||
mFrame->GetStyleContext(getter_AddRefs(sc));
|
||||
while (sc && eStyleUnit_Inherit == unit) {
|
||||
// Get parent style context
|
||||
nsIStyleContext* psc;
|
||||
psc = sc->GetParent();
|
||||
NS_RELEASE(sc);
|
||||
sc = psc;
|
||||
if (nsnull != sc) {
|
||||
sc = sc->GetParent();
|
||||
if (sc) {
|
||||
const nsStyleMargin* margin = (const nsStyleMargin*)
|
||||
sc->GetStyleData(eStyleStruct_Margin);
|
||||
unit = margin->mMargin.GetRightUnit();
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(sc);
|
||||
return unit;
|
||||
}
|
||||
|
||||
@ -137,12 +137,11 @@ nsFirstLetterFrame::Init(nsIPresContext* aPresContext,
|
||||
// Get proper style context for ourselves. We're creating the frame
|
||||
// that represents everything *except* the first letter, so just create
|
||||
// a style context like we would for a text node.
|
||||
nsIStyleContext* parentStyleContext = aContext->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> parentStyleContext = aContext->GetParent();
|
||||
if (parentStyleContext) {
|
||||
rv = aPresContext->ResolveStyleContextForNonElement(
|
||||
parentStyleContext,
|
||||
getter_AddRefs(newSC));
|
||||
NS_RELEASE(parentStyleContext);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
||||
@ -1804,7 +1804,7 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
||||
nscolor overColor;
|
||||
nscolor underColor;
|
||||
nscolor strikeColor;
|
||||
nsIStyleContext* context = aStyleContext;
|
||||
nsCOMPtr<nsIStyleContext> context = aStyleContext;
|
||||
|
||||
PRBool useOverride = PR_FALSE;
|
||||
nscolor overrideColor;
|
||||
@ -1814,7 +1814,6 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH; // A mask of all possible decorations.
|
||||
PRBool hasDecorations = context->HasTextDecorations();
|
||||
|
||||
NS_ADDREF(context);
|
||||
do { // find decoration colors
|
||||
const nsStyleTextReset* styleText =
|
||||
(const nsStyleTextReset*)context->GetStyleData(eStyleStruct_TextReset);
|
||||
@ -1848,13 +1847,12 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
||||
}
|
||||
}
|
||||
if (0 != decorMask) {
|
||||
nsIStyleContext* lastContext = context;
|
||||
context = context->GetParent();
|
||||
hasDecorations = context->HasTextDecorations();
|
||||
NS_RELEASE(lastContext);
|
||||
if (context) {
|
||||
hasDecorations = context->HasTextDecorations();
|
||||
}
|
||||
}
|
||||
} while ((nsnull != context) && hasDecorations && (0 != decorMask));
|
||||
NS_IF_RELEASE(context);
|
||||
} while (context && hasDecorations && (0 != decorMask));
|
||||
|
||||
nscoord offset;
|
||||
nscoord size;
|
||||
|
||||
@ -794,21 +794,17 @@ nsStyleUnit
|
||||
nsBlockReflowContext::GetRealMarginLeftUnit()
|
||||
{
|
||||
nsStyleUnit unit = eStyleUnit_Inherit;
|
||||
nsIStyleContext* sc;
|
||||
mFrame->GetStyleContext(&sc);
|
||||
while ((nsnull != sc) && (eStyleUnit_Inherit == unit)) {
|
||||
nsCOMPtr<nsIStyleContext> sc;
|
||||
mFrame->GetStyleContext(getter_AddRefs(sc));
|
||||
while (sc && eStyleUnit_Inherit == unit) {
|
||||
// Get parent style context
|
||||
nsIStyleContext* psc;
|
||||
psc = sc->GetParent();
|
||||
NS_RELEASE(sc);
|
||||
sc = psc;
|
||||
if (nsnull != sc) {
|
||||
sc = sc->GetParent();
|
||||
if (sc) {
|
||||
const nsStyleMargin* margin = (const nsStyleMargin*)
|
||||
sc->GetStyleData(eStyleStruct_Margin);
|
||||
unit = margin->mMargin.GetLeftUnit();
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(sc);
|
||||
return unit;
|
||||
}
|
||||
|
||||
@ -819,20 +815,16 @@ nsStyleUnit
|
||||
nsBlockReflowContext::GetRealMarginRightUnit()
|
||||
{
|
||||
nsStyleUnit unit = eStyleUnit_Inherit;
|
||||
nsIStyleContext* sc;
|
||||
mFrame->GetStyleContext(&sc);
|
||||
while ((nsnull != sc) && (eStyleUnit_Inherit == unit)) {
|
||||
nsCOMPtr<nsIStyleContext> sc;
|
||||
mFrame->GetStyleContext(getter_AddRefs(sc));
|
||||
while (sc && eStyleUnit_Inherit == unit) {
|
||||
// Get parent style context
|
||||
nsIStyleContext* psc;
|
||||
psc = sc->GetParent();
|
||||
NS_RELEASE(sc);
|
||||
sc = psc;
|
||||
if (nsnull != sc) {
|
||||
sc = sc->GetParent();
|
||||
if (sc) {
|
||||
const nsStyleMargin* margin = (const nsStyleMargin*)
|
||||
sc->GetStyleData(eStyleStruct_Margin);
|
||||
unit = margin->mMargin.GetRightUnit();
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(sc);
|
||||
return unit;
|
||||
}
|
||||
|
||||
@ -137,12 +137,11 @@ nsFirstLetterFrame::Init(nsIPresContext* aPresContext,
|
||||
// Get proper style context for ourselves. We're creating the frame
|
||||
// that represents everything *except* the first letter, so just create
|
||||
// a style context like we would for a text node.
|
||||
nsIStyleContext* parentStyleContext = aContext->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> parentStyleContext = aContext->GetParent();
|
||||
if (parentStyleContext) {
|
||||
rv = aPresContext->ResolveStyleContextForNonElement(
|
||||
parentStyleContext,
|
||||
getter_AddRefs(newSC));
|
||||
NS_RELEASE(parentStyleContext);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
||||
@ -1357,13 +1357,13 @@ VerifySameTree(nsIStyleContext* aContext1, nsIStyleContext* aContext2)
|
||||
nsCOMPtr<nsIStyleContext> top2 = aContext2;
|
||||
nsCOMPtr<nsIStyleContext> parent;
|
||||
for (;;) {
|
||||
parent = dont_AddRef(top1->GetParent());
|
||||
parent = top1->GetParent();
|
||||
if (!parent)
|
||||
break;
|
||||
top1 = parent;
|
||||
}
|
||||
for (;;) {
|
||||
parent = dont_AddRef(top2->GetParent());
|
||||
parent = top2->GetParent();
|
||||
if (!parent)
|
||||
break;
|
||||
top2 = parent;
|
||||
@ -1403,7 +1403,7 @@ VerifyContextParent(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
NS_ASSERTION(aContext, "Failure to get required contexts");
|
||||
nsIStyleContext* actualParentContext = aContext->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> actualParentContext = aContext->GetParent();
|
||||
|
||||
if (aParentContext) {
|
||||
if (aParentContext != actualParentContext) {
|
||||
@ -1430,7 +1430,6 @@ VerifyContextParent(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(actualParentContext);
|
||||
NS_IF_RELEASE(aParentContext);
|
||||
NS_IF_RELEASE(aContext);
|
||||
}
|
||||
@ -1503,12 +1502,10 @@ FrameManager::DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFram
|
||||
{
|
||||
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);
|
||||
if (aFrame) {
|
||||
nsIStyleContext* context;
|
||||
aFrame->GetStyleContext(&context);
|
||||
nsIStyleContext* parentContext = context->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> context;
|
||||
aFrame->GetStyleContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIStyleContext> parentContext = context->GetParent();
|
||||
VerifyStyleTree(aPresContext, aFrame, parentContext);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
NS_RELEASE(context);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1804,7 +1804,7 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
||||
nscolor overColor;
|
||||
nscolor underColor;
|
||||
nscolor strikeColor;
|
||||
nsIStyleContext* context = aStyleContext;
|
||||
nsCOMPtr<nsIStyleContext> context = aStyleContext;
|
||||
|
||||
PRBool useOverride = PR_FALSE;
|
||||
nscolor overrideColor;
|
||||
@ -1814,7 +1814,6 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH; // A mask of all possible decorations.
|
||||
PRBool hasDecorations = context->HasTextDecorations();
|
||||
|
||||
NS_ADDREF(context);
|
||||
do { // find decoration colors
|
||||
const nsStyleTextReset* styleText =
|
||||
(const nsStyleTextReset*)context->GetStyleData(eStyleStruct_TextReset);
|
||||
@ -1848,13 +1847,12 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
||||
}
|
||||
}
|
||||
if (0 != decorMask) {
|
||||
nsIStyleContext* lastContext = context;
|
||||
context = context->GetParent();
|
||||
hasDecorations = context->HasTextDecorations();
|
||||
NS_RELEASE(lastContext);
|
||||
if (context) {
|
||||
hasDecorations = context->HasTextDecorations();
|
||||
}
|
||||
}
|
||||
} while ((nsnull != context) && hasDecorations && (0 != decorMask));
|
||||
NS_IF_RELEASE(context);
|
||||
} while (context && hasDecorations && (0 != decorMask));
|
||||
|
||||
nscoord offset;
|
||||
nscoord size;
|
||||
|
||||
@ -1575,8 +1575,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
||||
NS_NewInlineFrame(aPresShell, aWrapperFrame);
|
||||
wrapperPseudo = nsCSSAtoms::mozGCWrapperInline;
|
||||
}
|
||||
nsCOMPtr<nsIStyleContext> parentSC =
|
||||
dont_AddRef(aStyleContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentSC = aStyleContext->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> wrapperSC;
|
||||
aPresContext->ResolvePseudoStyleContextFor(nsnull, wrapperPseudo,
|
||||
parentSC, getter_AddRefs(wrapperSC));
|
||||
@ -4004,8 +4003,7 @@ nsCSSFrameConstructor::CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// The placeholder frame gets a pseudo style context
|
||||
nsCOMPtr<nsIStyleContext> placeholderStyle;
|
||||
nsCOMPtr<nsIStyleContext> parentContext =
|
||||
dont_AddRef(aStyleContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aStyleContext->GetParent();
|
||||
aPresContext->ResolveStyleContextForNonElement(parentContext,
|
||||
getter_AddRefs(placeholderStyle));
|
||||
placeholderFrame->Init(aPresContext, aContent, aParentFrame,
|
||||
|
||||
@ -2377,12 +2377,11 @@ nsCSSRendering::FindNonTransparentBackground(nsIStyleContext* aContext,
|
||||
PRBool aStartAtParent /*= PR_FALSE*/)
|
||||
{
|
||||
const nsStyleBackground* result = nsnull;
|
||||
nsIStyleContext* context;
|
||||
nsCOMPtr<nsIStyleContext> context;
|
||||
if (aStartAtParent) {
|
||||
context = aContext->GetParent(); // balance ending release
|
||||
context = aContext->GetParent();
|
||||
} else {
|
||||
context = aContext;
|
||||
NS_IF_ADDREF(context); // balance ending release
|
||||
}
|
||||
NS_ASSERTION(context, "Cannot find NonTransparentBackground in a null context" );
|
||||
|
||||
@ -2391,11 +2390,8 @@ nsCSSRendering::FindNonTransparentBackground(nsIStyleContext* aContext,
|
||||
if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT))
|
||||
break;
|
||||
|
||||
nsIStyleContext* last = context;
|
||||
context = context->GetParent();
|
||||
NS_RELEASE(last);
|
||||
}
|
||||
NS_IF_RELEASE(context);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1468,7 +1468,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext,
|
||||
// mStyleContext is a leaf context used only when stretching happens.
|
||||
// For the base size, the default font should come from the parent context
|
||||
nsAutoString fontName;
|
||||
nsCOMPtr<nsIStyleContext> parentContext(dont_AddRef(mStyleContext->GetParent()));
|
||||
nsCOMPtr<nsIStyleContext> parentContext(mStyleContext->GetParent());
|
||||
const nsStyleFont *font = NS_STATIC_CAST(const nsStyleFont*,
|
||||
parentContext->GetStyleData(eStyleStruct_Font));
|
||||
nsFont theFont(font->mFont);
|
||||
@ -1868,7 +1868,7 @@ nsMathMLChar::Paint(nsIPresContext* aPresContext,
|
||||
const nsRect* aSelectedRect)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIStyleContext> parentContext(dont_AddRef(mStyleContext->GetParent()));
|
||||
nsCOMPtr<nsIStyleContext> parentContext(mStyleContext->GetParent());
|
||||
nsIStyleContext* styleContext = mStyleContext;
|
||||
|
||||
if (NS_STRETCH_DIRECTION_UNSUPPORTED == mDirection) {
|
||||
|
||||
@ -596,7 +596,7 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsIPresContext* aPresContext,
|
||||
|
||||
nsCOMPtr<nsIStyleContext> oldStyleContext;
|
||||
aFrame->GetStyleContext(getter_AddRefs(oldStyleContext));
|
||||
nsCOMPtr<nsIStyleContext> parentContext(dont_AddRef(oldStyleContext->GetParent()));
|
||||
nsCOMPtr<nsIStyleContext> parentContext(oldStyleContext->GetParent());
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
aFrame->GetContent(getter_AddRefs(content));
|
||||
|
||||
@ -397,7 +397,7 @@ static void PostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleDa
|
||||
{
|
||||
nsStyleText* text = (nsStyleText*)aStyleStruct;
|
||||
if (text->mTextAlign == NS_STYLE_TEXT_ALIGN_DEFAULT) {
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aRuleData->mStyleContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aRuleData->mStyleContext->GetParent();
|
||||
|
||||
if (parentContext) {
|
||||
const nsStyleText* parentStyleText =
|
||||
@ -430,9 +430,13 @@ ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
|
||||
{
|
||||
if (!aStyleStruct || !aRuleData || !aRuleData->mPresContext) return;
|
||||
|
||||
nsCOMPtr<nsIStyleContext> tableContext = getter_AddRefs(aRuleData->mStyleContext->GetParent()); if (!tableContext) return;
|
||||
nsCOMPtr<nsIStyleContext> tableContext = aRuleData->mStyleContext->GetParent();
|
||||
if (!tableContext)
|
||||
return;
|
||||
if (!aGroup) {
|
||||
tableContext = getter_AddRefs(tableContext->GetParent()); if (!tableContext) return;
|
||||
tableContext = tableContext->GetParent();
|
||||
if (!tableContext)
|
||||
return;
|
||||
}
|
||||
|
||||
const nsStyleTable* tableData =
|
||||
@ -441,10 +445,14 @@ ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
|
||||
(aRulesArg2 == tableData->mRules) ||
|
||||
(aRulesArg3 == tableData->mRules))) {
|
||||
const nsStyleBorder* tableBorderData =
|
||||
(const nsStyleBorder*)tableContext->GetStyleData(eStyleStruct_Border); if (!tableBorderData) return;
|
||||
(const nsStyleBorder*)tableContext->GetStyleData(eStyleStruct_Border);
|
||||
if (!tableBorderData)
|
||||
return;
|
||||
PRUint8 tableBorderStyle = tableBorderData->GetBorderStyle(aSide);
|
||||
|
||||
nsStyleBorder* borderData = (nsStyleBorder*)aStyleStruct; if (!borderData) return;
|
||||
nsStyleBorder* borderData = (nsStyleBorder*)aStyleStruct;
|
||||
if (!borderData)
|
||||
return;
|
||||
PRUint8 borderStyle = borderData->GetBorderStyle(aSide);
|
||||
// XXX It appears that the style system erronously applies the custom style rule after css style,
|
||||
// consequently it does not properly fit into the casade. For now, assume that a border style of none
|
||||
|
||||
@ -135,7 +135,7 @@ nsInspectorCSSUtils::GetStyleContextForFrame(nsIFrame* aFrame,
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (frameType == nsLayoutAtoms::tableOuterFrame) {
|
||||
*aStyleContext = styleContext->GetParent();
|
||||
*aStyleContext = styleContext->GetParent().get();
|
||||
} else {
|
||||
*aStyleContext = styleContext;
|
||||
NS_ADDREF(*aStyleContext);
|
||||
|
||||
@ -1589,8 +1589,7 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
|
||||
// All information must necessarily be inherited from our parent style context.
|
||||
// In the absence of any computed data in the rule tree and with
|
||||
// no rules specified that didn't have values of 'inherit', we should check our parent.
|
||||
nsCOMPtr<nsIStyleContext> parentContext =
|
||||
dont_AddRef(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
if (parentContext) {
|
||||
// We have a parent, and so we should just inherit from the parent.
|
||||
// Set the inherit bits on our context. These bits tell the style context that
|
||||
@ -2076,7 +2075,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
|
||||
{
|
||||
// walk up the contexts until a context with the desired generic font
|
||||
nsAutoVoidArray contextPath;
|
||||
nsCOMPtr<nsIStyleContext> higherContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> higherContext = aContext->GetParent();
|
||||
while (higherContext) {
|
||||
contextPath.AppendElement(higherContext);
|
||||
const nsStyleFont* higherFont = (const nsStyleFont*)higherContext->GetStyleData(eStyleStruct_Font);
|
||||
@ -2084,7 +2083,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsIStyleContext* aContext,
|
||||
// done walking up the higher contexts
|
||||
break;
|
||||
}
|
||||
higherContext = getter_AddRefs(higherContext->GetParent());
|
||||
higherContext = higherContext->GetParent();
|
||||
}
|
||||
|
||||
// re-apply the cascading rules, starting from the higher context
|
||||
@ -2169,7 +2168,7 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSFont& fontData = NS_STATIC_CAST(const nsCSSFont&, aData);
|
||||
nsStyleFont* font = nsnull;
|
||||
@ -2298,7 +2297,7 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSText& textData = NS_STATIC_CAST(const nsCSSText&, aData);
|
||||
nsStyleText* text = nsnull;
|
||||
@ -2418,7 +2417,7 @@ nsRuleNode::ComputeTextResetData(nsStyleStruct* aStartData, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSText& textData = NS_STATIC_CAST(const nsCSSText&, aData);
|
||||
nsStyleTextReset* text;
|
||||
@ -2504,7 +2503,7 @@ nsRuleNode::ComputeUserInterfaceData(nsStyleStruct* aStartData,
|
||||
const RuleDetail& aRuleDetail,
|
||||
PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSUserInterface& uiData = NS_STATIC_CAST(const nsCSSUserInterface&, aData);
|
||||
nsStyleUserInterface* ui = nsnull;
|
||||
@ -2614,7 +2613,7 @@ nsRuleNode::ComputeUIResetData(nsStyleStruct* aStartData, const nsCSSStruct& aDa
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSUserInterface& uiData = NS_STATIC_CAST(const nsCSSUserInterface&, aData);
|
||||
nsStyleUIReset* ui;
|
||||
@ -2703,7 +2702,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSDisplay& displayData = NS_STATIC_CAST(const nsCSSDisplay&, aData);
|
||||
nsStyleDisplay* display;
|
||||
@ -2956,7 +2955,7 @@ nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSDisplay& displayData = NS_STATIC_CAST(const nsCSSDisplay&, aData);
|
||||
nsStyleVisibility* visibility = nsnull;
|
||||
@ -3066,7 +3065,7 @@ nsRuleNode::ComputeColorData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDa
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSColor& colorData = NS_STATIC_CAST(const nsCSSColor&, aData);
|
||||
nsStyleColor* color = nsnull;
|
||||
@ -3122,7 +3121,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct, const nsCSSStruct
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSColor& colorData = NS_STATIC_CAST(const nsCSSColor&, aData);
|
||||
nsStyleBackground* bg;
|
||||
@ -3285,7 +3284,7 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct, const nsCSSStruct& aD
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSMargin& marginData = NS_STATIC_CAST(const nsCSSMargin&, aData);
|
||||
nsStyleMargin* margin;
|
||||
@ -3350,7 +3349,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, const nsCSSStruct& aD
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSMargin& marginData = NS_STATIC_CAST(const nsCSSMargin&, aData);
|
||||
nsStyleBorder* border;
|
||||
@ -3630,7 +3629,7 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSMargin& marginData = NS_STATIC_CAST(const nsCSSMargin&, aData);
|
||||
nsStylePadding* padding;
|
||||
@ -3695,7 +3694,7 @@ nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSMargin& marginData = NS_STATIC_CAST(const nsCSSMargin&, aData);
|
||||
nsStyleOutline* outline;
|
||||
@ -3767,7 +3766,7 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDat
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSList& listData = NS_STATIC_CAST(const nsCSSList&, aData);
|
||||
nsStyleList* list = nsnull;
|
||||
@ -3883,7 +3882,7 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct, const nsCSSStruct&
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSPosition& posData = NS_STATIC_CAST(const nsCSSPosition&, aData);
|
||||
nsStylePosition* pos;
|
||||
@ -3991,7 +3990,7 @@ nsRuleNode::ComputeTableData(nsStyleStruct* aStartStruct, const nsCSSStruct& aDa
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSTable& tableData = NS_STATIC_CAST(const nsCSSTable&, aData);
|
||||
nsStyleTable* table;
|
||||
@ -4061,7 +4060,7 @@ nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct, const nsCSSStruc
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSTable& tableData = NS_STATIC_CAST(const nsCSSTable&, aData);
|
||||
nsStyleTableBorder* table = nsnull;
|
||||
@ -4159,7 +4158,7 @@ nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct, const nsCSSStruct& a
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSContent& contentData = NS_STATIC_CAST(const nsCSSContent&, aData);
|
||||
nsStyleContent* content;
|
||||
@ -4354,7 +4353,7 @@ nsRuleNode::ComputeQuotesData(nsStyleStruct* aStartStruct, const nsCSSStruct& aD
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSContent& contentData = NS_STATIC_CAST(const nsCSSContent&, aData);
|
||||
nsStyleQuotes* quotes = nsnull;
|
||||
@ -4447,7 +4446,7 @@ nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct, const nsCSSStruct& aData
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
const nsCSSXUL& xulData = NS_STATIC_CAST(const nsCSSXUL&, aData);
|
||||
nsStyleXUL* xul = nsnull;
|
||||
@ -4596,7 +4595,7 @@ nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct, const nsCSSStruct& aData
|
||||
nsRuleNode* aHighestNode,
|
||||
const RuleDetail& aRuleDetail, PRBool aInherited)
|
||||
{
|
||||
nsCOMPtr<nsIStyleContext> parentContext = getter_AddRefs(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parentContext = aContext->GetParent();
|
||||
|
||||
nsStyleSVG* svg = nsnull;
|
||||
nsStyleSVG* parentSVG = svg;
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual nsIStyleContext* GetParent(void) const;
|
||||
virtual already_AddRefed<nsIStyleContext> GetParent(void) const;
|
||||
NS_IMETHOD GetFirstChild(nsIStyleContext** aContext);
|
||||
|
||||
NS_IMETHOD GetPseudoType(nsIAtom*& aPseudoTag) const;
|
||||
@ -189,7 +189,7 @@ NS_IMPL_ADDREF(nsStyleContext)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(nsStyleContext, Destroy())
|
||||
NS_IMPL_QUERY_INTERFACE1(nsStyleContext, nsIStyleContext)
|
||||
|
||||
nsIStyleContext* nsStyleContext::GetParent(void) const
|
||||
already_AddRefed<nsIStyleContext> nsStyleContext::GetParent(void) const
|
||||
{
|
||||
NS_IF_ADDREF(mParent);
|
||||
return mParent;
|
||||
|
||||
@ -102,8 +102,6 @@ struct nsRuleNodeList
|
||||
|
||||
// =====================================================
|
||||
|
||||
static NS_DEFINE_IID(kIStyleFrameConstructionIID, NS_ISTYLE_FRAME_CONSTRUCTION_IID);
|
||||
|
||||
class StyleSetImpl : public nsIStyleSet
|
||||
#ifdef MOZ_PERF_METRICS
|
||||
, public nsITimeRecorder
|
||||
@ -664,7 +662,7 @@ void StyleSetImpl::AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocumen
|
||||
}
|
||||
|
||||
if (nsnull == mFrameConstructor) {
|
||||
aSheet->QueryInterface(kIStyleFrameConstructionIID, (void **)&mFrameConstructor);
|
||||
CallQueryInterface(aSheet, &mFrameConstructor);
|
||||
}
|
||||
ClearDocRuleProcessors();
|
||||
}
|
||||
@ -1412,7 +1410,7 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsresult result = NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aPresContext && aStyleContext && aNewStyleContext) {
|
||||
nsIStyleContext* oldParent = aStyleContext->GetParent();
|
||||
nsCOMPtr<nsIStyleContext> oldParent = aStyleContext->GetParent();
|
||||
|
||||
if (oldParent == aNewParentContext) {
|
||||
result = NS_OK;
|
||||
@ -1421,8 +1419,8 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
}
|
||||
else { // really a new parent
|
||||
nsIStyleContext* newChild = nsnull;
|
||||
nsIAtom* pseudoTag = nsnull;
|
||||
aStyleContext->GetPseudoType(pseudoTag);
|
||||
nsCOMPtr<nsIAtom> pseudoTag;
|
||||
aStyleContext->GetPseudoType(*getter_AddRefs(pseudoTag));
|
||||
|
||||
nsRuleNode* ruleNode;
|
||||
aStyleContext->GetRuleNode(&ruleNode);
|
||||
@ -1436,11 +1434,7 @@ StyleSetImpl::ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
result = NS_NewStyleContext(aNewStyleContext, aNewParentContext, pseudoTag,
|
||||
ruleNode, aPresContext);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(pseudoTag);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(oldParent);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ nsSplitterFrame::Init(nsIPresContext* aPresContext,
|
||||
if (str.IsEmpty()) {
|
||||
aContent->SetAttr(kNameSpaceID_None, nsXULAtoms::orient,
|
||||
NS_LITERAL_STRING("vertical"), PR_FALSE);
|
||||
nsCOMPtr<nsIStyleContext> parent = dont_AddRef(aContext->GetParent());
|
||||
nsCOMPtr<nsIStyleContext> parent = aContext->GetParent();
|
||||
aPresContext->ResolveStyleContextFor(aContent, parent,
|
||||
getter_AddRefs(newContext));
|
||||
aContext = newContext;
|
||||
|
||||
@ -345,14 +345,13 @@ nsTextBoxFrame::PaintTitle(nsIPresContext* aPresContext,
|
||||
nscolor overColor;
|
||||
nscolor underColor;
|
||||
nscolor strikeColor;
|
||||
nsIStyleContext* context = mStyleContext;
|
||||
nsCOMPtr<nsIStyleContext> context = mStyleContext;
|
||||
|
||||
PRUint8 decorations = NS_STYLE_TEXT_DECORATION_NONE; // Begin with no decorations
|
||||
PRUint8 decorMask = NS_STYLE_TEXT_DECORATION_UNDERLINE | NS_STYLE_TEXT_DECORATION_OVERLINE |
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH; // A mask of all possible decorations.
|
||||
PRBool hasDecorations = context->HasTextDecorations();
|
||||
|
||||
NS_ADDREF(context);
|
||||
do { // find decoration colors
|
||||
const nsStyleTextReset* styleText =
|
||||
(const nsStyleTextReset*)context->GetStyleData(eStyleStruct_TextReset);
|
||||
@ -378,13 +377,12 @@ nsTextBoxFrame::PaintTitle(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
if (0 != decorMask) {
|
||||
nsIStyleContext* lastContext = context;
|
||||
context = context->GetParent();
|
||||
hasDecorations = context->HasTextDecorations();
|
||||
NS_RELEASE(lastContext);
|
||||
if (context) {
|
||||
hasDecorations = context->HasTextDecorations();
|
||||
}
|
||||
}
|
||||
} while ((nsnull != context) && hasDecorations && (0 != decorMask));
|
||||
NS_IF_RELEASE(context);
|
||||
} while (context && hasDecorations && (0 != decorMask));
|
||||
|
||||
nsStyleFont* fontStyle = (nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user