From 00dad6c4985bb2bbdc58c7963363e700bf85e156 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sat, 4 Dec 2004 06:31:02 +0000 Subject: [PATCH] Convert callers of old GetStyleData API that have snuck back in. b=197205 r+sr=roc --- layout/generic/nsHTMLFrame.cpp | 3 +- layout/html/base/src/nsHTMLFrame.cpp | 3 +- layout/svg/base/src/nsSVGGlyphFrame.cpp | 30 ++++++++-------- layout/svg/base/src/nsSVGGradientFrame.cpp | 6 ++-- .../svg/base/src/nsSVGPathGeometryFrame.cpp | 36 +++++++++---------- layout/svg/base/src/nsSVGTextFrame.cpp | 4 +-- 6 files changed, 40 insertions(+), 42 deletions(-) diff --git a/layout/generic/nsHTMLFrame.cpp b/layout/generic/nsHTMLFrame.cpp index e17a3c135a8e..d74adbf2286e 100644 --- a/layout/generic/nsHTMLFrame.cpp +++ b/layout/generic/nsHTMLFrame.cpp @@ -415,9 +415,8 @@ CanvasFrame::Paint(nsPresContext* aPresContext, ///////////////////// // draw focus // XXX This is only temporary - const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility); // Only paint the focus if we're visible - if (vis->IsVisible()) { + if (GetStyleVisibility()->IsVisible()) { nsIFrame * parentFrame = GetParent(); nsIView* parentView = parentFrame->GetView(); diff --git a/layout/html/base/src/nsHTMLFrame.cpp b/layout/html/base/src/nsHTMLFrame.cpp index e17a3c135a8e..d74adbf2286e 100644 --- a/layout/html/base/src/nsHTMLFrame.cpp +++ b/layout/html/base/src/nsHTMLFrame.cpp @@ -415,9 +415,8 @@ CanvasFrame::Paint(nsPresContext* aPresContext, ///////////////////// // draw focus // XXX This is only temporary - const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility); // Only paint the focus if we're visible - if (vis->IsVisible()) { + if (GetStyleVisibility()->IsVisible()) { nsIFrame * parentFrame = GetParent(); nsIView* parentView = parentFrame->GetView(); diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index 4644ac23ec5f..04040a3da90e 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -478,7 +478,7 @@ nsSVGGlyphFrame::GetStrokeOpacity(float *aStrokeOpacity) NS_IMETHODIMP nsSVGGlyphFrame::GetStrokeWidth(float *aStrokeWidth) { - *aStrokeWidth = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeWidth; + *aStrokeWidth = GetStyleSVG()->mStrokeWidth; return NS_OK; } @@ -507,7 +507,7 @@ nsSVGGlyphFrame::GetStrokeDashArray(float **arr, PRUint32 *count) NS_IMETHODIMP nsSVGGlyphFrame::GetStrokeDashoffset(float *aStrokeDashoffset) { - *aStrokeDashoffset = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeDashoffset; + *aStrokeDashoffset = GetStyleSVG()->mStrokeDashoffset; return NS_OK; } @@ -515,7 +515,7 @@ nsSVGGlyphFrame::GetStrokeDashoffset(float *aStrokeDashoffset) NS_IMETHODIMP nsSVGGlyphFrame::GetStrokeLinecap(PRUint16 *aStrokeLinecap) { - *aStrokeLinecap = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeLinecap; + *aStrokeLinecap = GetStyleSVG()->mStrokeLinecap; return NS_OK; } @@ -523,7 +523,7 @@ nsSVGGlyphFrame::GetStrokeLinecap(PRUint16 *aStrokeLinecap) NS_IMETHODIMP nsSVGGlyphFrame::GetStrokeLinejoin(PRUint16 *aStrokeLinejoin) { - *aStrokeLinejoin = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeLinejoin; + *aStrokeLinejoin = GetStyleSVG()->mStrokeLinejoin; return NS_OK; } @@ -531,7 +531,7 @@ nsSVGGlyphFrame::GetStrokeLinejoin(PRUint16 *aStrokeLinejoin) NS_IMETHODIMP nsSVGGlyphFrame::GetStrokeMiterlimit(float *aStrokeMiterlimit) { - *aStrokeMiterlimit = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeMiterlimit; + *aStrokeMiterlimit = GetStyleSVG()->mStrokeMiterlimit; return NS_OK; } @@ -548,7 +548,7 @@ nsSVGGlyphFrame::GetFillOpacity(float *aFillOpacity) NS_IMETHODIMP nsSVGGlyphFrame::GetFillRule(PRUint16 *aFillRule) { - *aFillRule = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFillRule; + *aFillRule = GetStyleSVG()->mFillRule; return NS_OK; } @@ -556,7 +556,7 @@ nsSVGGlyphFrame::GetFillRule(PRUint16 *aFillRule) NS_IMETHODIMP nsSVGGlyphFrame::GetStrokePaintType(PRUint16 *aStrokePaintType) { - *aStrokePaintType = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStroke.mType; + *aStrokePaintType = GetStyleSVG()->mStroke.mType; return NS_OK; } @@ -564,7 +564,7 @@ nsSVGGlyphFrame::GetStrokePaintType(PRUint16 *aStrokePaintType) NS_IMETHODIMP nsSVGGlyphFrame::GetStrokePaint(nscolor *aStrokePaint) { - *aStrokePaint = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStroke.mPaint.mColor; + *aStrokePaint = GetStyleSVG()->mStroke.mPaint.mColor; return NS_OK; } @@ -573,7 +573,7 @@ NS_IMETHODIMP nsSVGGlyphFrame::GetStrokeGradient(nsISVGGradient **aGrad) { nsIURI *aServer; - aServer = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStroke.mPaint.mPaintServer; + aServer = GetStyleSVG()->mStroke.mPaint.mPaintServer; if (aServer == nsnull) return NS_ERROR_FAILURE; // Now have the URI. Get the gradient @@ -584,7 +584,7 @@ nsSVGGlyphFrame::GetStrokeGradient(nsISVGGradient **aGrad) NS_IMETHODIMP nsSVGGlyphFrame::GetFillPaintType(PRUint16 *aFillPaintType) { - *aFillPaintType = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFill.mType; + *aFillPaintType = GetStyleSVG()->mFill.mType; return NS_OK; } @@ -592,7 +592,7 @@ nsSVGGlyphFrame::GetFillPaintType(PRUint16 *aFillPaintType) NS_IMETHODIMP nsSVGGlyphFrame::GetFillPaint(nscolor *aFillPaint) { - *aFillPaint = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFill.mPaint.mColor; + *aFillPaint = GetStyleSVG()->mFill.mPaint.mColor; return NS_OK; } @@ -601,7 +601,7 @@ NS_IMETHODIMP nsSVGGlyphFrame::GetFillGradient(nsISVGGradient **aGrad) { nsIURI *aServer; - aServer = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFill.mPaint.mPaintServer; + aServer = GetStyleSVG()->mFill.mPaint.mPaintServer; if (aServer == nsnull) return NS_ERROR_FAILURE; // Now have the URI. Get the gradient @@ -616,7 +616,7 @@ nsSVGGlyphFrame::GetFillGradient(nsISVGGradient **aGrad) NS_IMETHODIMP nsSVGGlyphFrame::GetFont(nsFont *aFont) { - *aFont = ((const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font))->mFont; + *aFont = GetStyleFont()->mFont; // XXX eventually we will have to treat decorations separately from // fonts, because they can have a different color than the current @@ -627,7 +627,7 @@ nsSVGGlyphFrame::GetFont(nsFont *aFont) NS_ASSERTION(parentContext, "no style context on parent"); PRUint8 styleDecorations = - ((const nsStyleTextReset*)parentContext->GetStyleData(eStyleStruct_TextReset))->mTextDecoration; + parentContext->GetStyleTextReset()->mTextDecoration; if (styleDecorations & NS_STYLE_TEXT_DECORATION_UNDERLINE) aFont->decorations |= NS_FONT_DECORATION_UNDERLINE; if (styleDecorations & NS_STYLE_TEXT_DECORATION_OVERLINE) @@ -650,7 +650,7 @@ nsSVGGlyphFrame::GetCharacterData(nsAString & aCharacterData) NS_IMETHODIMP nsSVGGlyphFrame::GetTextRendering(PRUint16 *aTextRendering) { - *aTextRendering = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mTextRendering; + *aTextRendering = GetStyleSVG()->mTextRendering; return NS_OK; } diff --git a/layout/svg/base/src/nsSVGGradientFrame.cpp b/layout/svg/base/src/nsSVGGradientFrame.cpp index c70a57be553f..ca2ac8744fb3 100644 --- a/layout/svg/base/src/nsSVGGradientFrame.cpp +++ b/layout/svg/base/src/nsSVGGradientFrame.cpp @@ -197,7 +197,7 @@ nsSVGGradientFrame::GetStopColorType(PRInt32 aIndex, PRUint16 *aStopColorType) { return NS_ERROR_FAILURE; } - *aStopColorType = ((const nsStyleSVG*) stopFrame->GetStyleContext()->GetStyleData(eStyleStruct_SVG))->mStopColor.mType; + *aStopColorType = stopFrame->GetStyleSVG()->mStopColor.mType; return NS_OK; } @@ -227,7 +227,7 @@ nsSVGGradientFrame::GetStopColor(PRInt32 aIndex, nscolor *aStopColor) { *aStopColor = 0; return NS_ERROR_FAILURE; } - *aStopColor = ((const nsStyleSVG*) stopFrame->GetStyleContext()->GetStyleData(eStyleStruct_SVG))->mStopColor.mPaint.mColor; + *aStopColor = stopFrame->GetStyleSVG()->mStopColor.mPaint.mColor; return NS_OK; } @@ -256,7 +256,7 @@ nsSVGGradientFrame::GetStopOpacity(PRInt32 aIndex, float *aStopOpacity) { return NS_ERROR_FAILURE; } - *aStopOpacity = ((const nsStyleSVG*) stopFrame->GetStyleContext()->GetStyleData(eStyleStruct_SVG))->mStopOpacity; + *aStopOpacity = stopFrame->GetStyleSVG()->mStopOpacity; return NS_OK; } diff --git a/layout/svg/base/src/nsSVGPathGeometryFrame.cpp b/layout/svg/base/src/nsSVGPathGeometryFrame.cpp index ca94e4d7fae9..58b3a74f63f3 100644 --- a/layout/svg/base/src/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/base/src/nsSVGPathGeometryFrame.cpp @@ -325,7 +325,7 @@ nsSVGPathGeometryFrame::GetStrokeOpacity(float *aStrokeOpacity) NS_IMETHODIMP nsSVGPathGeometryFrame::GetStrokeWidth(float *aStrokeWidth) { - *aStrokeWidth = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeWidth; + *aStrokeWidth = GetStyleSVG()->mStrokeWidth; return NS_OK; } @@ -354,7 +354,7 @@ nsSVGPathGeometryFrame::GetStrokeDashArray(float **arr, PRUint32 *count) NS_IMETHODIMP nsSVGPathGeometryFrame::GetStrokeDashoffset(float *aStrokeDashoffset) { - *aStrokeDashoffset = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeDashoffset; + *aStrokeDashoffset = GetStyleSVG()->mStrokeDashoffset; return NS_OK; } @@ -362,7 +362,7 @@ nsSVGPathGeometryFrame::GetStrokeDashoffset(float *aStrokeDashoffset) NS_IMETHODIMP nsSVGPathGeometryFrame::GetStrokeLinecap(PRUint16 *aStrokeLinecap) { - *aStrokeLinecap = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeLinecap; + *aStrokeLinecap = GetStyleSVG()->mStrokeLinecap; return NS_OK; } @@ -370,7 +370,7 @@ nsSVGPathGeometryFrame::GetStrokeLinecap(PRUint16 *aStrokeLinecap) NS_IMETHODIMP nsSVGPathGeometryFrame::GetStrokeLinejoin(PRUint16 *aStrokeLinejoin) { - *aStrokeLinejoin = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeLinejoin; + *aStrokeLinejoin = GetStyleSVG()->mStrokeLinejoin; return NS_OK; } @@ -378,7 +378,7 @@ nsSVGPathGeometryFrame::GetStrokeLinejoin(PRUint16 *aStrokeLinejoin) NS_IMETHODIMP nsSVGPathGeometryFrame::GetStrokeMiterlimit(float *aStrokeMiterlimit) { - *aStrokeMiterlimit = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStrokeMiterlimit; + *aStrokeMiterlimit = GetStyleSVG()->mStrokeMiterlimit; return NS_OK; } @@ -395,7 +395,7 @@ nsSVGPathGeometryFrame::GetFillOpacity(float *aFillOpacity) NS_IMETHODIMP nsSVGPathGeometryFrame::GetFillRule(PRUint16 *aFillRule) { - *aFillRule = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFillRule; + *aFillRule = GetStyleSVG()->mFillRule; return NS_OK; } @@ -403,7 +403,7 @@ nsSVGPathGeometryFrame::GetFillRule(PRUint16 *aFillRule) NS_IMETHODIMP nsSVGPathGeometryFrame::GetStrokePaintType(PRUint16 *aStrokePaintType) { - *aStrokePaintType = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStroke.mType; + *aStrokePaintType = GetStyleSVG()->mStroke.mType; return NS_OK; } @@ -411,7 +411,7 @@ nsSVGPathGeometryFrame::GetStrokePaintType(PRUint16 *aStrokePaintType) NS_IMETHODIMP nsSVGPathGeometryFrame::GetStrokePaint(nscolor *aStrokePaint) { - *aStrokePaint = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStroke.mPaint.mColor; + *aStrokePaint = GetStyleSVG()->mStroke.mPaint.mColor; return NS_OK; } @@ -420,7 +420,7 @@ NS_IMETHODIMP nsSVGPathGeometryFrame::GetStrokeGradient(nsISVGGradient **aGrad) { nsIURI *aServer; - aServer = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStroke.mPaint.mPaintServer; + aServer = GetStyleSVG()->mStroke.mPaint.mPaintServer; if (aServer == nsnull) return NS_ERROR_FAILURE; // Now have the URI. Get the gradient @@ -431,7 +431,7 @@ nsSVGPathGeometryFrame::GetStrokeGradient(nsISVGGradient **aGrad) NS_IMETHODIMP nsSVGPathGeometryFrame::GetFillPaintType(PRUint16 *aFillPaintType) { - *aFillPaintType = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFill.mType; + *aFillPaintType = GetStyleSVG()->mFill.mType; return NS_OK; } @@ -439,7 +439,7 @@ nsSVGPathGeometryFrame::GetFillPaintType(PRUint16 *aFillPaintType) NS_IMETHODIMP nsSVGPathGeometryFrame::GetFillPaint(nscolor *aFillPaint) { - *aFillPaint = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFill.mPaint.mColor; + *aFillPaint = GetStyleSVG()->mFill.mPaint.mColor; return NS_OK; } @@ -448,7 +448,7 @@ NS_IMETHODIMP nsSVGPathGeometryFrame::GetFillGradient(nsISVGGradient **aGrad) { nsIURI *aServer; - aServer = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFill.mPaint.mPaintServer; + aServer = GetStyleSVG()->mFill.mPaint.mPaintServer; if (aServer == nsnull) return NS_ERROR_FAILURE; // Now have the URI. Get the gradient @@ -463,14 +463,14 @@ nsSVGPathGeometryFrame::GetHittestMask(PRUint16 *aHittestMask) { *aHittestMask=0; - switch(((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mPointerEvents) { + switch(GetStyleSVG()->mPointerEvents) { case NS_STYLE_POINTER_EVENTS_NONE: break; case NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED: if (GetStyleVisibility()->IsVisible()) { - if (((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFill.mType != eStyleSVGPaintType_None) + if (GetStyleSVG()->mFill.mType != eStyleSVGPaintType_None) *aHittestMask |= HITTEST_MASK_FILL; - if (((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStroke.mType != eStyleSVGPaintType_None) + if (GetStyleSVG()->mStroke.mType != eStyleSVGPaintType_None) *aHittestMask |= HITTEST_MASK_STROKE; } break; @@ -491,9 +491,9 @@ nsSVGPathGeometryFrame::GetHittestMask(PRUint16 *aHittestMask) } break; case NS_STYLE_POINTER_EVENTS_PAINTED: - if (((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mFill.mType != eStyleSVGPaintType_None) + if (GetStyleSVG()->mFill.mType != eStyleSVGPaintType_None) *aHittestMask |= HITTEST_MASK_FILL; - if (((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mStroke.mType != eStyleSVGPaintType_None) + if (GetStyleSVG()->mStroke.mType != eStyleSVGPaintType_None) *aHittestMask |= HITTEST_MASK_STROKE; break; case NS_STYLE_POINTER_EVENTS_FILL: @@ -518,7 +518,7 @@ nsSVGPathGeometryFrame::GetHittestMask(PRUint16 *aHittestMask) NS_IMETHODIMP nsSVGPathGeometryFrame::GetShapeRendering(PRUint16 *aShapeRendering) { - *aShapeRendering = ((const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG))->mShapeRendering; + *aShapeRendering = GetStyleSVG()->mShapeRendering; return NS_OK; } diff --git a/layout/svg/base/src/nsSVGTextFrame.cpp b/layout/svg/base/src/nsSVGTextFrame.cpp index 08b2a2c42729..f88001857d8e 100644 --- a/layout/svg/base/src/nsSVGTextFrame.cpp +++ b/layout/svg/base/src/nsSVGTextFrame.cpp @@ -1021,7 +1021,7 @@ nsSVGTextFrame::UpdateGlyphPositioning() // determine x offset based on text_anchor: - PRUint8 anchor = ((const nsStyleSVG*)mStyleContext->GetStyleData(eStyleStruct_SVG))->mTextAnchor; + PRUint8 anchor = GetStyleSVG()->mTextAnchor; float chunkLength = 0.0f; if (anchor != NS_STYLE_TEXT_ANCHOR_START) { @@ -1048,7 +1048,7 @@ nsSVGTextFrame::UpdateGlyphPositioning() // XXX should actually inspect 'alignment-baseline' for each fragment PRUint8 baseline; - switch(((const nsStyleSVGReset*)mStyleContext->GetStyleData(eStyleStruct_SVGReset))->mDominantBaseline) { + switch(GetStyleSVGReset()->mDominantBaseline) { case NS_STYLE_DOMINANT_BASELINE_TEXT_BEFORE_EDGE: baseline = nsISVGRendererGlyphMetrics::BASELINE_TEXT_BEFORE_EDGE; break;