Clean up API (and its callers) for getting style data: remove unneeded null checks and switch to new inline member functions (one for each struct) that return values. b=197205 r+sr=roc a=brendan

This commit is contained in:
dbaron%dbaron.org 2003-05-15 03:42:21 +00:00
Родитель de72fd6d40
Коммит 75ff60c62f
189 изменённых файлов: 1601 добавлений и 3140 удалений

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

@ -666,15 +666,11 @@ NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset,
shell->CreateRenderingContext(frame, getter_AddRefs(rc));
NS_ENSURE_TRUE(rc, NS_ERROR_FAILURE);
const nsStyleFont *font;
frame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct *&)font);
NS_ENSURE_TRUE(font, NS_ERROR_FAILURE);
const nsStyleFont *font = frame->GetStyleFont();
const nsStyleVisibility *visibility;
frame->GetStyleData(eStyleStruct_Visibility,
(const nsStyleStruct *&)visibility);
const nsStyleVisibility *visibility = frame->GetStyleVisibility();
nsCOMPtr<nsIAtom> langGroup;
if (visibility && visibility->mLanguage) {
if (visibility->mLanguage) {
visibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}

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

@ -447,9 +447,7 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
return PR_FALSE;
// If visibility:hidden or visibility:collapsed then mark with STATE_INVISIBLE
const nsStyleVisibility* vis;
::GetStyleData(frame, &vis);
if (!vis || !vis->IsVisible())
if (!frame->GetStyleVisibility()->IsVisible())
{
return PR_FALSE;
}
@ -1023,10 +1021,9 @@ NS_IMETHODIMP nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent
// If this text is inside a block level frame (as opposed to span level), we need to add spaces around that
// block's text, so we don't get words jammed together in final name
// Extra spaces will be trimmed out later
const nsStyleDisplay* display;
::GetStyleData(frame, &display);
if (display && (display->IsBlockLevel() ||
display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL))
const nsStyleDisplay* display = frame->GetStyleDisplay();
if (display->IsBlockLevel() ||
display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL)
{
isHTMLBlock = PR_TRUE;
if (!aFlatString->IsEmpty())

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

@ -121,10 +121,9 @@ NS_IMETHODIMP nsXULTabAccessible::GetAccState(PRUint32 *_retval)
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
if (presShell && content) {
nsIFrame *frame = nsnull;
const nsStyleUserInterface* ui;
presShell->GetPrimaryFrameFor(content, &frame);
if (frame) {
frame->GetStyleData(eStyleStruct_UserInterface, ((const nsStyleStruct*&)ui));
const nsStyleUserInterface* ui = frame->GetStyleUserInterface();
if (ui->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL)
*_retval |= STATE_FOCUSABLE;
}

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

@ -2579,9 +2579,7 @@ nsPrintEngine::ReflowDocList(nsPrintObject* aPO, PRBool aSetPixelScale, PRBool a
nsIFrame * frame;
aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent, &frame);
if (frame) {
const nsStyleVisibility* vis;
::GetStyleData(frame, &vis);
if (!vis->IsVisible()) {
if (!frame->GetStyleVisibility()->IsVisible()) {
aPO->mDontPrint = PR_TRUE;
}
}

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

@ -208,22 +208,29 @@ nscoord CalcLength(const nsCSSValue& aValue,
return aValue.GetLengthTwips();
}
nsCSSUnit unit = aValue.GetUnit();
if (unit == eCSSUnit_Pixel) {
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
return NSFloatPixelsToTwips(aValue.GetFloatValue(), p2t);
}
// Common code for all units other than pixels:
aInherited = PR_TRUE;
const nsFont* font;
if (aStyleContext) {
font = &aStyleContext->GetStyleFont()->mFont;
} else {
font = aFont;
}
switch (unit) {
case eCSSUnit_EM:
case eCSSUnit_Char: {
aInherited = PR_TRUE;
const nsFont* font = aStyleContext ? &(((nsStyleFont*)aStyleContext->GetStyleData(eStyleStruct_Font))->mFont) : aFont;
return NSToCoordRound(aValue.GetFloatValue() * (float)font->size);
// XXX scale against font metrics height instead?
}
case eCSSUnit_EN: {
aInherited = PR_TRUE;
const nsFont* font = aStyleContext ? &(((nsStyleFont*)aStyleContext->GetStyleData(eStyleStruct_Font))->mFont) : aFont;
return NSToCoordRound((aValue.GetFloatValue() * (float)font->size) / 2.0f);
}
case eCSSUnit_XHeight: {
aInherited = PR_TRUE;
const nsFont* font = aStyleContext ? &(((nsStyleFont*)aStyleContext->GetStyleData(eStyleStruct_Font))->mFont) : aFont;
nsCOMPtr<nsIFontMetrics> fm;
aPresContext->GetMetricsFor(*font, getter_AddRefs(fm));
nscoord xHeight;
@ -232,15 +239,9 @@ nscoord CalcLength(const nsCSSValue& aValue,
}
case eCSSUnit_CapHeight: {
NS_NOTYETIMPLEMENTED("cap height unit");
aInherited = PR_TRUE;
const nsFont* font = aStyleContext ? &(((nsStyleFont*)aStyleContext->GetStyleData(eStyleStruct_Font))->mFont) : aFont;
nscoord capHeight = ((font->size / 3) * 2); // XXX HACK!
return NSToCoordRound(aValue.GetFloatValue() * (float)capHeight);
}
case eCSSUnit_Pixel:
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
return NSFloatPixelsToTwips(aValue.GetFloatValue(), p2t);
default:
NS_NOTREACHED("unexpected unit");
break;
@ -2086,7 +2087,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext,
nsStyleContext* higherContext = aContext->GetParent();
while (higherContext) {
contextPath.AppendElement(higherContext);
const nsStyleFont* higherFont = (const nsStyleFont*)higherContext->GetStyleData(eStyleStruct_Font);
const nsStyleFont* higherFont = higherContext->GetStyleFont();
if (higherFont && higherFont->mFlags & aGenericFontID) {
// done walking up the higher contexts
break;
@ -2107,7 +2108,7 @@ SetGenericFont(nsIPresContext* aPresContext, nsStyleContext* aContext,
PRInt32 i = contextPath.Count() - 1;
if (higherContext) {
nsStyleContext* context = (nsStyleContext*)contextPath[i];
nsStyleFont* tmpFont = (nsStyleFont*)context->GetStyleData(eStyleStruct_Font);
const nsStyleFont* tmpFont = context->GetStyleFont();
parentFont.mFlags = tmpFont->mFlags;
parentFont.mFont = tmpFont->mFont;
parentFont.mSize = tmpFont->mSize;
@ -2190,8 +2191,7 @@ nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct,
(fontData.mSize.IsRelativeLengthUnit() &&
fontData.mSize.GetUnit() != eCSSUnit_Pixel) ||
fontData.mSize.GetUnit() == eCSSUnit_Percent))
parentFont = NS_STATIC_CAST(const nsStyleFont*,
parentContext->GetStyleData(eStyleStruct_Font));
parentFont = parentContext->GetStyleFont();
if (aStartStruct)
// We only need to compute the delta between this computed data and our
// computed data.
@ -2313,8 +2313,7 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct,
PRBool inherited = aInherited;
if (parentContext && aRuleDetail != eRuleFullReset)
parentText = NS_STATIC_CAST(const nsStyleText*,
parentContext->GetStyleData(eStyleStruct_Text));
parentText = parentContext->GetStyleText();
if (aStartStruct)
// We only need to compute the delta between this computed data and our
// computed data.
@ -2342,8 +2341,7 @@ nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct,
// line-height: normal, number, length, percent, inherit
if (eCSSUnit_Percent == textData.mLineHeight.GetUnit()) {
aInherited = PR_TRUE;
const nsStyleFont* font = NS_STATIC_CAST(const nsStyleFont*,
aContext->GetStyleData(eStyleStruct_Font));
const nsStyleFont* font = aContext->GetStyleFont();
text->mLineHeight.SetCoordValue((nscoord)((float)(font->mSize) *
textData.mLineHeight.GetPercentValue()));
} else {
@ -2436,13 +2434,13 @@ nsRuleNode::ComputeTextResetData(nsStyleStruct* aStartData,
text = new (mPresContext) nsStyleTextReset(*NS_STATIC_CAST(nsStyleTextReset*, aStartData));
else
text = new (mPresContext) nsStyleTextReset();
nsStyleTextReset* parentText = text;
const nsStyleTextReset* parentText = text;
if (parentContext &&
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentText = (nsStyleTextReset*)parentContext->GetStyleData(eStyleStruct_TextReset);
parentText = parentContext->GetStyleTextReset();
PRBool inherited = aInherited;
// vertical-align: enum, length, percent, inherit
@ -2511,15 +2509,14 @@ nsRuleNode::ComputeUserInterfaceData(nsStyleStruct* aStartData,
PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataUserInterface& uiData = NS_STATIC_CAST(const nsRuleDataUserInterface&, aData);
nsStyleUserInterface* ui = nsnull;
const nsStyleUserInterface* parentUI = nsnull;
PRBool inherited = aInherited;
if (parentContext && aRuleDetail != eRuleFullReset)
parentUI = NS_STATIC_CAST(const nsStyleUserInterface*,
parentContext->GetStyleData(eStyleStruct_UserInterface));
parentUI = parentContext->GetStyleUserInterface();
if (aStartData)
// We only need to compute the delta between this computed data and our
// computed data.
@ -2622,7 +2619,7 @@ nsRuleNode::ComputeUIResetData(nsStyleStruct* aStartData,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataUserInterface& uiData = NS_STATIC_CAST(const nsRuleDataUserInterface&, aData);
nsStyleUIReset* ui;
if (aStartData)
@ -2637,8 +2634,7 @@ nsRuleNode::ComputeUIResetData(nsStyleStruct* aStartData,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentUI = NS_STATIC_CAST(const nsStyleUIReset*,
parentContext->GetStyleData(eStyleStruct_UIReset));
parentUI = parentContext->GetStyleUIReset();
PRBool inherited = aInherited;
// user-select: none, enum, inherit
@ -2712,7 +2708,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataDisplay& displayData = NS_STATIC_CAST(const nsRuleDataDisplay&, aData);
nsStyleDisplay* display;
if (aStartStruct)
@ -2732,8 +2728,7 @@ nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone) ||
generatedContent))
parentDisplay = NS_STATIC_CAST(const nsStyleDisplay*,
parentContext->GetStyleData(eStyleStruct_Display));
parentDisplay = parentContext->GetStyleDisplay();
PRBool inherited = aInherited;
// display: enum, none, inherit
@ -2970,15 +2965,14 @@ nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataDisplay& displayData = NS_STATIC_CAST(const nsRuleDataDisplay&, aData);
nsStyleVisibility* visibility = nsnull;
const nsStyleVisibility* parentVisibility = nsnull;
PRBool inherited = aInherited;
if (parentContext && aRuleDetail != eRuleFullReset)
parentVisibility = NS_STATIC_CAST(const nsStyleVisibility*,
parentContext->GetStyleData(eStyleStruct_Visibility));
parentVisibility = parentContext->GetStyleVisibility();
if (aStartStruct)
// We only need to compute the delta between this computed data and our
// computed data.
@ -3067,15 +3061,14 @@ nsRuleNode::ComputeColorData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataColor& colorData = NS_STATIC_CAST(const nsRuleDataColor&, aData);
nsStyleColor* color = nsnull;
const nsStyleColor* parentColor = nsnull;
PRBool inherited = aInherited;
if (parentContext && aRuleDetail != eRuleFullReset)
parentColor = NS_STATIC_CAST(const nsStyleColor*,
parentContext->GetStyleData(eStyleStruct_Color));
parentColor = parentContext->GetStyleColor();
if (aStartStruct)
// We only need to compute the delta between this computed data and our
// computed data.
@ -3124,7 +3117,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataColor& colorData = NS_STATIC_CAST(const nsRuleDataColor&, aData);
nsStyleBackground* bg;
if (aStartStruct)
@ -3139,8 +3132,7 @@ nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentBG = NS_STATIC_CAST(const nsStyleBackground*,
parentContext->GetStyleData(eStyleStruct_Background));
parentBG = parentContext->GetStyleBackground();
PRBool inherited = aInherited;
// save parentFlags in case bg == parentBG and we clobber them later
PRUint8 parentFlags = parentBG->mBackgroundFlags;
@ -3314,7 +3306,7 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataMargin& marginData = NS_STATIC_CAST(const nsRuleDataMargin&, aData);
nsStyleMargin* margin;
if (aStartStruct)
@ -3329,8 +3321,7 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentMargin = NS_STATIC_CAST(const nsStyleMargin*,
parentContext->GetStyleData(eStyleStruct_Margin));
parentMargin = parentContext->GetStyleMargin();
PRBool inherited = aInherited;
// margin: length, percent, auto, inherit
@ -3371,7 +3362,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataMargin& marginData = NS_STATIC_CAST(const nsRuleDataMargin&, aData);
nsStyleBorder* border;
if (aStartStruct)
@ -3386,8 +3377,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentBorder = NS_STATIC_CAST(const nsStyleBorder*,
parentContext->GetStyleData(eStyleStruct_Border));
parentBorder = parentContext->GetStyleBorder();
PRBool inherited = aInherited;
// border-size: length, enum, inherit
@ -3471,9 +3461,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
// used. We can ensure that the data for the parent are fully
// computed (unlike for the element where this will be used, for
// which the color could be specified on a more specific rule).
const nsStyleColor *parentColor;
::GetStyleData(parentContext, &parentColor);
border->SetBorderColor(side, parentColor->mColor);
border->SetBorderColor(side, parentContext->GetStyleColor()->mColor);
} else
border->SetBorderColor(side, borderColor);
}
@ -3539,7 +3527,7 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataMargin& marginData = NS_STATIC_CAST(const nsRuleDataMargin&, aData);
nsStylePadding* padding;
if (aStartStruct)
@ -3554,8 +3542,7 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentPadding = NS_STATIC_CAST(const nsStylePadding*,
parentContext->GetStyleData(eStyleStruct_Padding));
parentPadding = parentContext->GetStylePadding();
PRBool inherited = aInherited;
// padding: length, percent, inherit
@ -3596,7 +3583,7 @@ nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataMargin& marginData = NS_STATIC_CAST(const nsRuleDataMargin&, aData);
nsStyleOutline* outline;
if (aStartStruct)
@ -3611,8 +3598,7 @@ nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentOutline = NS_STATIC_CAST(const nsStyleOutline*,
parentContext->GetStyleData(eStyleStruct_Outline));
parentOutline = parentContext->GetStyleOutline();
PRBool inherited = aInherited;
// outline-width: length, enum, inherit
@ -3669,15 +3655,14 @@ nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataList& listData = NS_STATIC_CAST(const nsRuleDataList&, aData);
nsStyleList* list = nsnull;
const nsStyleList* parentList = nsnull;
PRBool inherited = aInherited;
if (parentContext && aRuleDetail != eRuleFullReset)
parentList = NS_STATIC_CAST(const nsStyleList*,
parentContext->GetStyleData(eStyleStruct_List));
parentList = parentContext->GetStyleList();
if (aStartStruct)
// We only need to compute the delta between this computed data and our
// computed data.
@ -3786,7 +3771,7 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataPosition& posData = NS_STATIC_CAST(const nsRuleDataPosition&, aData);
nsStylePosition* pos;
if (aStartStruct)
@ -3801,8 +3786,7 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentPos = NS_STATIC_CAST(const nsStylePosition*,
parentContext->GetStyleData(eStyleStruct_Position));
parentPos = parentContext->GetStylePosition();
PRBool inherited = aInherited;
// box offsets: length, percent, auto, inherit
@ -3895,7 +3879,7 @@ nsRuleNode::ComputeTableData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataTable& tableData = NS_STATIC_CAST(const nsRuleDataTable&, aData);
nsStyleTable* table;
if (aStartStruct)
@ -3910,8 +3894,7 @@ nsRuleNode::ComputeTableData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentTable = NS_STATIC_CAST(const nsStyleTable*,
parentContext->GetStyleData(eStyleStruct_Table));
parentTable = parentContext->GetStyleTable();
PRBool inherited = aInherited;
// table-layout: auto, enum, inherit
@ -3966,15 +3949,14 @@ nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataTable& tableData = NS_STATIC_CAST(const nsRuleDataTable&, aData);
nsStyleTableBorder* table = nsnull;
const nsStyleTableBorder* parentTable = nsnull;
PRBool inherited = aInherited;
if (parentContext && aRuleDetail != eRuleFullReset)
parentTable = NS_STATIC_CAST(const nsStyleTableBorder*,
parentContext->GetStyleData(eStyleStruct_TableBorder));
parentTable = parentContext->GetStyleTableBorder();
if (aStartStruct)
// We only need to compute the delta between this computed data and our
// computed data.
@ -4065,7 +4047,7 @@ nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataContent& contentData = NS_STATIC_CAST(const nsRuleDataContent&, aData);
nsStyleContent* content;
if (aStartStruct)
@ -4080,8 +4062,7 @@ nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentContent = NS_STATIC_CAST(const nsStyleContent*,
parentContext->GetStyleData(eStyleStruct_Content));
parentContent = parentContext->GetStyleContent();
PRBool inherited = aInherited;
// content: [string, url, counter, attr, enum]+, inherit
@ -4261,15 +4242,14 @@ nsRuleNode::ComputeQuotesData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataContent& contentData = NS_STATIC_CAST(const nsRuleDataContent&, aData);
nsStyleQuotes* quotes = nsnull;
const nsStyleQuotes* parentQuotes = nsnull;
PRBool inherited = aInherited;
if (parentContext && aRuleDetail != eRuleFullReset)
parentQuotes = NS_STATIC_CAST(const nsStyleQuotes*,
parentContext->GetStyleData(eStyleStruct_Quotes));
parentQuotes = parentContext->GetStyleQuotes();
if (aStartStruct)
// We only need to compute the delta between this computed data and our
// computed data.
@ -4354,7 +4334,7 @@ nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct,
const RuleDetail& aRuleDetail, PRBool aInherited)
{
nsStyleContext* parentContext = aContext->GetParent();
const nsRuleDataXUL& xulData = NS_STATIC_CAST(const nsRuleDataXUL&, aData);
nsStyleXUL* xul = nsnull;
@ -4370,8 +4350,7 @@ nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct,
aRuleDetail != eRuleFullReset &&
aRuleDetail != eRulePartialReset &&
aRuleDetail != eRuleNone)
parentXUL = NS_STATIC_CAST(const nsStyleXUL*,
parentContext->GetStyleData(eStyleStruct_XUL));
parentXUL = parentContext->GetStyleXUL();
PRBool inherited = aInherited;
@ -4504,29 +4483,32 @@ nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct,
{
nsStyleContext* parentContext = aContext->GetParent();
nsStyleSVG* svg = nsnull;
nsStyleSVG* parentSVG = svg;
PRBool inherited = aInherited;
const nsRuleDataSVG& SVGData = NS_STATIC_CAST(const nsRuleDataSVG&, aData);
nsStyleSVG* svg = nsnull;
const nsStyleSVG* parentSVG = nsnull;
PRBool inherited = aInherited;
if (parentContext && aRuleDetail != eRuleFullReset)
parentSVG = parentContext->GetStyleSVG();
if (aStartStruct)
// We only need to compute the delta between this computed data and our
// computed data.
svg = new (mPresContext) nsStyleSVG(*NS_STATIC_CAST(nsStyleSVG*,aStartStruct));
svg = new (mPresContext) nsStyleSVG(*NS_STATIC_CAST(nsStyleSVG*, aStartStruct));
else {
if (aRuleDetail != eRuleFullMixed) {
// XXXldb What about eRuleFullInherited? Which path is faster?
if (aRuleDetail != eRuleFullMixed && aRuleDetail != eRuleFullReset) {
// No question. We will have to inherit. Go ahead and init
// with inherited vals from parent.
inherited = PR_TRUE;
if (parentContext)
parentSVG = (nsStyleSVG*)parentContext->GetStyleData(eStyleStruct_SVG);
if (parentSVG)
svg = new (mPresContext) nsStyleSVG(*parentSVG);
}
}
if (!svg)
svg = parentSVG = new (mPresContext) nsStyleSVG();
svg = new (mPresContext) nsStyleSVG();
if (!parentSVG)
parentSVG = svg;
// fill:
SetSVGPaint(SVGData.mFill, parentSVG->mFill, mPresContext, svg->mFill, inherited);

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

@ -3317,10 +3317,7 @@ nsSelection::FrameOrParentHasSpecialSelectionStyle(nsIFrame* aFrame, PRUint8 aSe
while (thisFrame)
{
const nsStyleUIReset* userinterface;
thisFrame->GetStyleData(eStyleStruct_UIReset, (const nsStyleStruct*&)userinterface);
if (userinterface->mUserSelect == aSelectionStyle)
if (thisFrame->GetStyleUIReset()->mUserSelect == aSelectionStyle)
{
*foundFrame = thisFrame;
return NS_OK;

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

@ -273,10 +273,8 @@ void
nsStyleContext::GetBorderPaddingFor(nsStyleBorderPadding& aBorderPadding)
{
nsMargin border, padding;
const nsStyleBorder* borderData = (const nsStyleBorder*)GetStyleData(eStyleStruct_Border);
const nsStylePadding* paddingData = (const nsStylePadding*)GetStyleData(eStyleStruct_Padding);
if (borderData->GetBorder(border)) {
if (paddingData->GetPadding(padding)) {
if (GetStyleBorder()->GetBorder(border)) {
if (GetStylePadding()->GetPadding(padding)) {
border += padding;
aBorderPadding.SetBorderPadding(border);
}
@ -292,7 +290,7 @@ nsStyleContext::GetUniqueStyleData(nsIPresContext* aPresContext, const nsStyleSt
nsStyleStruct* result = nsnull;
switch (aSID) {
case eStyleStruct_Display: {
const nsStyleDisplay* dis = (const nsStyleDisplay*)GetStyleData(aSID);
const nsStyleDisplay* dis = GetStyleDisplay();
nsStyleDisplay* newDis = new (aPresContext) nsStyleDisplay(*dis);
SetStyle(aSID, newDis);
result = newDis;
@ -300,7 +298,7 @@ nsStyleContext::GetUniqueStyleData(nsIPresContext* aPresContext, const nsStyleSt
break;
}
case eStyleStruct_Background: {
const nsStyleBackground* bg = (const nsStyleBackground*)GetStyleData(aSID);
const nsStyleBackground* bg = GetStyleBackground();
nsStyleBackground* newBG = new (aPresContext) nsStyleBackground(*bg);
SetStyle(aSID, newBG);
result = newBG;
@ -308,7 +306,7 @@ nsStyleContext::GetUniqueStyleData(nsIPresContext* aPresContext, const nsStyleSt
break;
}
case eStyleStruct_Text: {
const nsStyleText* text = (const nsStyleText*)GetStyleData(aSID);
const nsStyleText* text = GetStyleText();
nsStyleText* newText = new (aPresContext) nsStyleText(*text);
SetStyle(aSID, newText);
result = newText;
@ -316,7 +314,7 @@ nsStyleContext::GetUniqueStyleData(nsIPresContext* aPresContext, const nsStyleSt
break;
}
case eStyleStruct_TextReset: {
const nsStyleTextReset* reset = (const nsStyleTextReset*)GetStyleData(aSID);
const nsStyleTextReset* reset = GetStyleTextReset();
nsStyleTextReset* newReset = new (aPresContext) nsStyleTextReset(*reset);
SetStyle(aSID, newReset);
result = newReset;
@ -374,19 +372,19 @@ nsStyleContext::ApplyStyleFixups(nsIPresContext* aPresContext)
mBits |= NS_STYLE_HAS_TEXT_DECORATIONS;
else {
// We might have defined a decoration.
const nsStyleTextReset* text = (const nsStyleTextReset*)GetStyleData(eStyleStruct_TextReset);
const nsStyleTextReset* text = GetStyleTextReset();
if (text->mTextDecoration != NS_STYLE_TEXT_DECORATION_NONE &&
text->mTextDecoration != NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL)
mBits |= NS_STYLE_HAS_TEXT_DECORATIONS;
}
// Correct tables.
const nsStyleDisplay* disp = (const nsStyleDisplay*)GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = GetStyleDisplay();
if (disp->mDisplay == NS_STYLE_DISPLAY_TABLE) {
// -moz-center and -moz-right are used for HTML's alignment
// This is covering the <div align="right"><table>...</table></div> case.
// In this case, we don't want to inherit the text alignment into the table.
const nsStyleText* text = (const nsStyleText*)GetStyleData(eStyleStruct_Text);
const nsStyleText* text = GetStyleText();
if (text->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_CENTER ||
text->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_RIGHT)
@ -602,7 +600,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// FONT
IndentBy(out,aIndent);
const nsStyleFont* font = (const nsStyleFont*)GetStyleData(eStyleStruct_Font);
const nsStyleFont* font = GetStyleFont();
fprintf(out, "<font %s %d %d %d />\n",
NS_ConvertUCS2toUTF8(font->mFont.name).get(),
font->mFont.size,
@ -611,13 +609,13 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// COLOR
IndentBy(out,aIndent);
const nsStyleColor* color = (const nsStyleColor*)GetStyleData(eStyleStruct_Color);
const nsStyleColor* color = GetStyleColor();
fprintf(out, "<color data=\"%ld\"/>\n",
(long)color->mColor);
// BACKGROUND
IndentBy(out,aIndent);
const nsStyleBackground* bg = (const nsStyleBackground*)GetStyleData(eStyleStruct_Background);
const nsStyleBackground* bg = GetStyleBackground();
fprintf(out, "<background data=\"%d %d %d %ld %ld %ld %s\"/>\n",
(int)bg->mBackgroundAttachment,
(int)bg->mBackgroundFlags,
@ -631,21 +629,21 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
IndentBy(out,aIndent);
fprintf(out, "<spacing data=\"");
const nsStyleMargin* margin = (const nsStyleMargin*)GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* margin = GetStyleMargin();
margin->mMargin.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
const nsStylePadding* padding = (const nsStylePadding*)GetStyleData(eStyleStruct_Padding);
const nsStylePadding* padding = GetStylePadding();
padding->mPadding.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
const nsStyleBorder* border = (const nsStyleBorder*)GetStyleData(eStyleStruct_Border);
const nsStyleBorder* border = GetStyleBorder();
border->mBorder.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
border->mBorderRadius.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
const nsStyleOutline* outline = (const nsStyleOutline*)GetStyleData(eStyleStruct_Outline);
const nsStyleOutline* outline = GetStyleOutline();
outline->mOutlineRadius.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
outline->mOutlineWidth.ToString(str);
@ -655,7 +653,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// LIST
IndentBy(out,aIndent);
const nsStyleList* list = (const nsStyleList*)GetStyleData(eStyleStruct_List);
const nsStyleList* list = GetStyleList();
fprintf(out, "<list data=\"%d %d %s\" />\n",
(int)list->mListStyleType,
(int)list->mListStyleType,
@ -663,7 +661,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// POSITION
IndentBy(out,aIndent);
const nsStylePosition* pos = (const nsStylePosition*)GetStyleData(eStyleStruct_Position);
const nsStylePosition* pos = GetStylePosition();
fprintf(out, "<position data=\"");
pos->mOffset.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
@ -686,7 +684,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// TEXT
IndentBy(out,aIndent);
const nsStyleText* text = (const nsStyleText*)GetStyleData(eStyleStruct_Text);
const nsStyleText* text = GetStyleText();
fprintf(out, "<text data=\"%d %d %d ",
(int)text->mTextAlign,
(int)text->mTextTransform,
@ -703,7 +701,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// TEXT RESET
IndentBy(out,aIndent);
const nsStyleTextReset* textReset = (const nsStyleTextReset*)GetStyleData(eStyleStruct_TextReset);
const nsStyleTextReset* textReset = GetStyleTextReset();
fprintf(out, "<textreset data=\"%d ",
(int)textReset->mTextDecoration);
textReset->mVerticalAlign.ToString(str);
@ -712,7 +710,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// DISPLAY
IndentBy(out,aIndent);
const nsStyleDisplay* disp = (const nsStyleDisplay*)GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = GetStyleDisplay();
fprintf(out, "<display data=\"%d %d %d %d %d %d %d %d %ld %ld %ld %ld %s\" />\n",
(int)disp->mPosition,
(int)disp->mDisplay,
@ -731,7 +729,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// VISIBILITY
IndentBy(out,aIndent);
const nsStyleVisibility* vis = (const nsStyleVisibility*)GetStyleData(eStyleStruct_Visibility);
const nsStyleVisibility* vis = GetStyleVisibility();
fprintf(out, "<visibility data=\"%d %d %f\" />\n",
(int)vis->mDirection,
(int)vis->mVisible,
@ -740,7 +738,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// TABLE
IndentBy(out,aIndent);
const nsStyleTable* table = (const nsStyleTable*)GetStyleData(eStyleStruct_Table);
const nsStyleTable* table = GetStyleTable();
fprintf(out, "<table data=\"%d %d %d ",
(int)table->mLayoutStrategy,
(int)table->mFrame,
@ -752,7 +750,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// TABLEBORDER
IndentBy(out,aIndent);
const nsStyleTableBorder* tableBorder = (const nsStyleTableBorder*)GetStyleData(eStyleStruct_TableBorder);
const nsStyleTableBorder* tableBorder = GetStyleTableBorder();
fprintf(out, "<tableborder data=\"%d ",
(int)tableBorder->mBorderCollapse);
tableBorder->mBorderSpacingX.ToString(str);
@ -766,7 +764,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// CONTENT
IndentBy(out,aIndent);
const nsStyleContent* content = (const nsStyleContent*)GetStyleData(eStyleStruct_Content);
const nsStyleContent* content = GetStyleContent();
fprintf(out, "<content data=\"%ld %ld %ld ",
(long)content->ContentCount(),
(long)content->CounterIncrementCount(),
@ -778,7 +776,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// QUOTES
IndentBy(out,aIndent);
const nsStyleQuotes* quotes = (const nsStyleQuotes*)GetStyleData(eStyleStruct_Quotes);
const nsStyleQuotes* quotes = GetStyleQuotes();
fprintf(out, "<quotes data=\"%ld ",
(long)quotes->QuotesCount());
// XXX: iterate over the quotes...
@ -786,7 +784,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// UI
IndentBy(out,aIndent);
const nsStyleUserInterface* ui = (const nsStyleUserInterface*)GetStyleData(eStyleStruct_UserInterface);
const nsStyleUserInterface* ui = GetStyleUserInterface();
fprintf(out, "<ui data=\"%d %d %d %d %s\" />\n",
(int)ui->mUserInput,
(int)ui->mUserModify,
@ -796,7 +794,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// UIReset
IndentBy(out,aIndent);
const nsStyleUIReset* uiReset = (const nsStyleUIReset*)GetStyleData(eStyleStruct_UIReset);
const nsStyleUIReset* uiReset = GetStyleUIReset();
fprintf(out, "<uireset data=\"%d %d %d\" />\n",
(int)uiReset->mUserSelect,
(int)uiReset->mKeyEquivalent,
@ -804,7 +802,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// XUL
IndentBy(out,aIndent);
const nsStyleXUL* xul = (const nsStyleXUL*)GetStyleData(eStyleStruct_XUL);
const nsStyleXUL* xul = GetStyleXUL();
fprintf(out, "<xul data=\"%d %d %d %d %d %d",
(int)xul->mBoxAlign,
(int)xul->mBoxDirection,
@ -817,7 +815,7 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out,
// SVG
#ifdef MOZ_SVG
IndentBy(out,aIndent);
const nsStyleSVG* svg = (const nsStyleSVG*)GetStyleData(eStyleStruct_SVG);
const nsStyleSVG* svg = GetStyleSVG();
fprintf(out, "<svg data=\"%d %f %f %d %f",
(int)svg->mStroke.mType,
svg->mStrokeWidth,

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

@ -1387,10 +1387,8 @@ StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
if (result &&
(aPseudoTag == nsCSSPseudoElements::before ||
aPseudoTag == nsCSSPseudoElements::after)) {
const nsStyleDisplay *display;
const nsStyleContent *content;
::GetStyleData(result, &display);
::GetStyleData(result, &content);
const nsStyleDisplay *display = result->GetStyleDisplay();
const nsStyleContent *content = result->GetStyleContent();
// XXXldb What is contentCount for |content: ""|?
if (display->mDisplay == NS_STYLE_DISPLAY_NONE ||
content->ContentCount() == 0) {

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

@ -937,9 +937,7 @@ nsEventStateManager::HandleAccessKey(nsIPresContext* aPresContext,
presShell->GetPrimaryFrameFor(content, &frame);
if (frame) {
const nsStyleVisibility* vis;
frame->GetStyleData(eStyleStruct_Visibility,
((const nsStyleStruct *&)vis));
const nsStyleVisibility* vis = frame->GetStyleVisibility();
PRBool viewShown = PR_TRUE;
nsIView* frameView = nsnull;
@ -1884,8 +1882,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
PRBool suppressBlur = PR_FALSE;
if (mCurrentTarget) {
mCurrentTarget->GetContentForEvent(mPresContext, aEvent, getter_AddRefs(newFocus));
const nsStyleUserInterface* ui;
::GetStyleData(mCurrentTarget, &ui);
const nsStyleUserInterface* ui = mCurrentTarget->GetStyleUserInterface();
suppressBlur = (ui->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE);
}
@ -1898,15 +1895,13 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
while (currFrame) {
// If the mousedown happened inside a popup, don't
// try to set focus on one of its containing elements
const nsStyleDisplay* display;
::GetStyleData(currFrame, &display);
const nsStyleDisplay* display = currFrame->GetStyleDisplay();
if (display->mDisplay == NS_STYLE_DISPLAY_POPUP) {
newFocus = nsnull;
break;
}
const nsStyleUserInterface* ui;
::GetStyleData(currFrame, &ui);
const nsStyleUserInterface* ui = currFrame->GetStyleUserInterface();
if ((ui->mUserFocus != NS_STYLE_USER_FOCUS_IGNORE) &&
(ui->mUserFocus != NS_STYLE_USER_FOCUS_NONE)) {
currFrame->GetContent(getter_AddRefs(newFocus));
@ -3487,11 +3482,8 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
nsCOMPtr<nsIContent> child;
currentFrame->GetContent(getter_AddRefs(child));
const nsStyleVisibility* vis;
currentFrame->GetStyleData(eStyleStruct_Visibility, ((const nsStyleStruct *&)vis));
const nsStyleUserInterface* ui;
currentFrame->GetStyleData(eStyleStruct_UserInterface, ((const nsStyleStruct*&)ui));
const nsStyleVisibility* vis = currentFrame->GetStyleVisibility();
const nsStyleUserInterface* ui = currentFrame->GetStyleUserInterface();
PRBool viewShown = PR_TRUE;
@ -3943,8 +3935,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
// XXX This doesn't consider that |aState| is a bitfield.
if (mCurrentTarget && (aState == NS_EVENT_STATE_ACTIVE || aState == NS_EVENT_STATE_HOVER))
{
const nsStyleUserInterface* ui;
mCurrentTarget->GetStyleData(eStyleStruct_UserInterface, ((const nsStyleStruct*&)ui));
const nsStyleUserInterface* ui = mCurrentTarget->GetStyleUserInterface();
if (ui->mUserInput == NS_STYLE_USER_INPUT_NONE)
return NS_OK;
}

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

@ -612,7 +612,6 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect,
}
}
const nsStyleDisplay* display = nsnull;
nsPoint origin(0, 0);
if (!done) {
@ -621,9 +620,9 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect,
frame->GetOrigin(origin);
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
const nsStyleDisplay* display = frame->GetStyleDisplay();
if (display && display->IsPositioned()) {
if (display->IsPositioned()) {
if (display->IsAbsolutelyPositioned()) {
// If the primary frame or a parent is absolutely positioned
// (fixed or absolute) we stop walking up the frame parent
@ -639,18 +638,15 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect,
frame->GetParent(&parent);
while (parent) {
parent->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
display = parent->GetStyleDisplay();
if (display) {
if (display->IsPositioned()) {
// Stop at the first *parent* that is positioned (fixed,
// absolute, or relatiive)
if (display->IsPositioned()) {
// Stop at the first *parent* that is positioned (fixed,
// absolute, or relatiive)
parent->GetContent(aOffsetParent);
parent->GetContent(aOffsetParent);
break;
}
break;
}
// Add the parent's origin to our own to get to the
@ -710,7 +706,6 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect,
}
// For the origin, add in the border for the frame
const nsStyleBorder* border = nsnull;
nsStyleCoord coord;
#if 0
@ -718,38 +713,31 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect,
// calculations, but I think that's wrong. My tests show that we
// work more like IE if we don't do this, so lets try this and see
// if people agree.
frame->GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border);
const nsStyleBorder* border = frame->GetStyleBorder();
if (border) {
if (eStyleUnit_Coord == border->mBorder.GetLeftUnit()) {
origin.x += border->mBorder.GetLeft(coord).GetCoordValue();
}
if (eStyleUnit_Coord == border->mBorder.GetTopUnit()) {
origin.y += border->mBorder.GetTop(coord).GetCoordValue();
}
if (eStyleUnit_Coord == border->mBorder.GetLeftUnit()) {
origin.x += border->mBorder.GetLeft(coord).GetCoordValue();
}
if (eStyleUnit_Coord == border->mBorder.GetTopUnit()) {
origin.y += border->mBorder.GetTop(coord).GetCoordValue();
}
#endif
// And subtract out the border for the parent
if (parent) {
PRBool includeBorder = PR_TRUE; // set to false if border-box sizing is used
const nsStylePosition* position = nsnull;
parent->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position);
if (position && position->mBoxSizing == NS_STYLE_BOX_SIZING_BORDER) {
const nsStylePosition* position = parent->GetStylePosition();
if (position->mBoxSizing == NS_STYLE_BOX_SIZING_BORDER) {
includeBorder = PR_FALSE;
}
if (includeBorder) {
border = nsnull;
parent->GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border);
if (border) {
if (eStyleUnit_Coord == border->mBorder.GetLeftUnit()) {
origin.x -= border->mBorder.GetLeft(coord).GetCoordValue();
}
if (eStyleUnit_Coord == border->mBorder.GetTopUnit()) {
origin.y -= border->mBorder.GetTop(coord).GetCoordValue();
}
const nsStyleBorder* border = parent->GetStyleBorder();
if (eStyleUnit_Coord == border->mBorder.GetLeftUnit()) {
origin.x -= border->mBorder.GetLeft(coord).GetCoordValue();
}
if (eStyleUnit_Coord == border->mBorder.GetTopUnit()) {
origin.y -= border->mBorder.GetTop(coord).GetCoordValue();
}
}
}
@ -1189,15 +1177,12 @@ nsGenericHTMLElement::GetClientAreaSize(nsIFrame *aFrame)
nsRect rect;
aFrame->GetRect(rect);
const nsStyleBorder* border = nsnull;
aFrame->GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border);
const nsStyleBorder* border = aFrame->GetStyleBorder();
if (border) {
nsMargin border_size;
border->CalcBorderFor(aFrame, border_size);
nsMargin border_size;
border->CalcBorderFor(aFrame, border_size);
rect.Deflate(border_size);
}
rect.Deflate(border_size);
return nsSize(rect.width, rect.height);
}

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

@ -430,12 +430,7 @@ nsHTMLBodyElement::GetBgColor(nsAString& aBgColor)
NS_ENSURE_SUCCESS(rv, rv);
if (frame) {
const nsStyleBackground* StyleBackground;
rv = frame->GetStyleData(eStyleStruct_Background,
(const nsStyleStruct*&)StyleBackground);
NS_ENSURE_SUCCESS(rv, rv);
bgcolor = StyleBackground->mBackgroundColor;
bgcolor = frame->GetStyleBackground()->mBackgroundColor;
nsHTMLValue(bgcolor).ToString(aBgColor);
}
}

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

@ -450,9 +450,7 @@ nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,
CallQueryInterface(formControlFrame, &formFrame);
if (formFrame) {
const nsStyleUserInterface* uiStyle;
formFrame->GetStyleData(eStyleStruct_UserInterface,
(const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)

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

@ -1300,9 +1300,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
nsIFrame* formFrame = nsnull;
CallQueryInterface(formControlFrame, &formFrame);
if (formFrame) {
const nsStyleUserInterface* uiStyle;
formFrame->GetStyleData(eStyleStruct_UserInterface,
(const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED) {

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

@ -199,9 +199,7 @@ nsHTMLOptGroupElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
if (formFrame) {
const nsStyleUserInterface* uiStyle;
formFrame->GetStyleData(eStyleStruct_UserInterface,
(const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED) {
return NS_OK;

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

@ -1927,9 +1927,7 @@ nsHTMLSelectElement::HandleDOMEvent(nsIPresContext* aPresContext,
NS_SUCCEEDED(CallQueryInterface(formControlFrame, &formFrame)) &&
formFrame)
{
const nsStyleUserInterface* uiStyle;
formFrame->GetStyleData(eStyleStruct_UserInterface,
(const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED) {

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

@ -306,8 +306,7 @@ SpacerMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (aData->mPositionData) {
nsHTMLValue value;
const nsStyleDisplay* display = (const nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = aData->mStyleContext->GetStyleDisplay();
PRBool typeIsBlock = (display->mDisplay == NS_STYLE_DISPLAY_BLOCK);

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

@ -306,8 +306,7 @@ SpacerMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (aData->mPositionData) {
nsHTMLValue value;
const nsStyleDisplay* display = (const nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = aData->mStyleContext->GetStyleDisplay();
PRBool typeIsBlock = (display->mDisplay == NS_STYLE_DISPLAY_BLOCK);

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

@ -1236,9 +1236,8 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
aData->mPresContext->GetCompatibilityMode(&mode);
if (aData->mSID == eStyleStruct_TableBorder && aData->mTableData) {
const nsStyleDisplay* readDisplay = (nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
if (readDisplay && readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
const nsStyleDisplay* readDisplay = aData->mStyleContext->GetStyleDisplay();
if (readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
// cellspacing
nsHTMLValue value;
aAttributes->GetAttribute(nsHTMLAtoms::cellspacing, value);
@ -1259,9 +1258,8 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
}
if (aData->mSID == eStyleStruct_Table && aData->mTableData) {
const nsStyleDisplay* readDisplay = (nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
if (readDisplay && readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
const nsStyleDisplay* readDisplay = aData->mStyleContext->GetStyleDisplay();
if (readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
MapTableBorderInto(aAttributes, aData, 0);
nsHTMLValue value;
@ -1288,10 +1286,9 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
}
}
else if (aData->mSID == eStyleStruct_Margin && aData->mMarginData) {
const nsStyleDisplay* readDisplay = (nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* readDisplay = aData->mStyleContext->GetStyleDisplay();
if (readDisplay && readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
if (readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
// align; Check for enumerated type (it may be another type if
// illegal)
nsHTMLValue value;
@ -1335,11 +1332,9 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
}
}
else if (aData->mSID == eStyleStruct_Padding && aData->mMarginData) {
const nsStyleDisplay* readDisplay = (nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* readDisplay = aData->mStyleContext->GetStyleDisplay();
if (readDisplay &&
(readDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL)) {
if (readDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL) {
nsHTMLValue value;
aAttributes->GetAttribute(nsHTMLAtoms::cellpadding, value);
if (value.GetUnit() == eHTMLUnit_Pixel || value.GetUnit() == eHTMLUnit_Percent) {
@ -1371,11 +1366,9 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
}
}
else if (aData->mPositionData) {
const nsStyleDisplay* readDisplay = (nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* readDisplay = aData->mStyleContext->GetStyleDisplay();
if (readDisplay &&
(readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL)) {
if (readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
nsHTMLValue value;
// width: value
if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
@ -1397,21 +1390,16 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
}
}
else if (aData->mSID == eStyleStruct_Visibility) {
const nsStyleDisplay* readDisplay = (nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* readDisplay = aData->mStyleContext->GetStyleDisplay();
if (readDisplay &&
(readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL))
if (readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL)
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
else if (aData->mSID == eStyleStruct_Border && aData->mMarginData) {
if (!aData->mStyleContext) return;
const nsStyleTableBorder* tableStyle =
(const nsStyleTableBorder*)aData->mStyleContext->GetStyleData(eStyleStruct_TableBorder);
const nsStyleDisplay* readDisplay =
(nsStyleDisplay*) aData->mStyleContext->GetStyleData(eStyleStruct_Display);
if (readDisplay &&
(readDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL)) {
const nsStyleTableBorder* tableStyle = aData->mStyleContext->GetStyleTableBorder();
const nsStyleDisplay* readDisplay = aData->mStyleContext->GetStyleDisplay();
if (readDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL) {
if (NS_STYLE_BORDER_SEPARATE == tableStyle->mBorderCollapse) {
// Set the cell's border from the table in the separate border model. If there is a border
// on the table, then the mapping to rules=all will take care of borders in the collapsing model.
@ -1492,11 +1480,9 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
}
if (aData->mSID == eStyleStruct_Background) {
const nsStyleDisplay* readDisplay = (nsStyleDisplay*)
aData->mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* readDisplay = aData->mStyleContext->GetStyleDisplay();
if (readDisplay &&
(readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL))
if (readDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL)
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
}
}

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

@ -682,9 +682,7 @@ nsHTMLTextAreaElement::HandleDOMEvent(nsIPresContext* aPresContext,
if (formControlFrame &&
NS_SUCCEEDED(CallQueryInterface(formControlFrame, &formFrame)) &&
formFrame) {
const nsStyleUserInterface* uiStyle;
formFrame->GetStyleData(eStyleStruct_UserInterface,
(const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED) {

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

@ -541,8 +541,7 @@ nsImageDocument::CheckOverflowing()
nsRefPtr<nsStyleContext> styleContext =
context->ResolveStyleContextFor(content, nsnull);
const nsStyleMargin* marginData =
(const nsStyleMargin*)styleContext->GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* marginData = styleContext->GetStyleMargin();
nsMargin margin;
marginData->GetMargin(margin);
visibleArea.Deflate(margin);

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

@ -2872,11 +2872,6 @@ nsComputedDOMStyle::GetRelativeOffset(PRUint8 aSide, nsIFrame* aFrame,
}
nsIFrame* container = nsnull;
const nsStyleBorder* borderData = nsnull;
const nsStylePadding* paddingData = nsnull;
nsMargin border;
nsMargin padding;
nsSize size;
switch(coord.GetUnit()) {
case eStyleUnit_Coord:
val->SetTwips(sign * coord.GetCoordValue());
@ -2884,16 +2879,11 @@ nsComputedDOMStyle::GetRelativeOffset(PRUint8 aSide, nsIFrame* aFrame,
case eStyleUnit_Percent:
container = GetContainingBlock(aFrame);
if (container) {
container->GetStyleData(eStyleStruct_Border,
(const nsStyleStruct*&)borderData);
if (borderData) {
borderData->CalcBorderFor(container, border);
}
container->GetStyleData(eStyleStruct_Padding,
(const nsStyleStruct*&)paddingData);
if (paddingData) {
paddingData->CalcPaddingFor(container, padding);
}
nsMargin border;
nsMargin padding;
nsSize size;
container->GetStyleBorder()->CalcBorderFor(container, border);
container->GetStylePadding()->CalcPaddingFor(container, padding);
container->GetSize(size);
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
val->SetTwips(sign * coord.GetPercentValue() *
@ -3020,7 +3010,7 @@ nsComputedDOMStyle::GetStyleData(nsStyleStructID aID,
nsIFrame* aFrame)
{
if (aFrame && !mPseudo) {
aFrame->GetStyleData(aID, aStyleStruct);
aStyleStruct = aFrame->GetStyleData(aID);
} else if (mStyleContextHolder) {
aStyleStruct = mStyleContextHolder->GetStyleData(aID);
} else {

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

@ -177,9 +177,7 @@ HTMLDocumentColorRule::Initialize(nsIPresContext* aPresContext)
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
if (!bodyFrame)
return;
const nsStyleColor *bodyColor;
::GetStyleData(bodyFrame, &bodyColor);
mColor = bodyColor->mColor;
mColor = bodyFrame->GetStyleColor()->mColor;
}
class GenericTableRule: public nsIStyleRule {
@ -261,8 +259,7 @@ static void PostResolveCallback(nsStyleStruct* aStyleStruct, nsRuleData* aRuleDa
nsStyleContext* parentContext = aRuleData->mStyleContext->GetParent();
if (parentContext) {
const nsStyleText* parentStyleText =
(const nsStyleText*)parentContext->GetStyleData(eStyleStruct_Text);
const nsStyleText* parentStyleText = parentContext->GetStyleText();
PRUint8 parentAlign = parentStyleText->mTextAlign;
text->mTextAlign = (NS_STYLE_TEXT_ALIGN_DEFAULT == parentAlign)
? NS_STYLE_TEXT_ALIGN_CENTER : parentAlign;
@ -300,15 +297,11 @@ ProcessTableRulesAttribute(nsStyleStruct* aStyleStruct,
return;
}
const nsStyleTable* tableData =
(const nsStyleTable*)tableContext->GetStyleData(eStyleStruct_Table);
if (tableData && ((aRulesArg1 == tableData->mRules) ||
(aRulesArg2 == tableData->mRules) ||
(aRulesArg3 == tableData->mRules))) {
const nsStyleBorder* tableBorderData =
(const nsStyleBorder*)tableContext->GetStyleData(eStyleStruct_Border);
if (!tableBorderData)
return;
const nsStyleTable* tableData = tableContext->GetStyleTable();
if (aRulesArg1 == tableData->mRules ||
aRulesArg2 == tableData->mRules ||
aRulesArg3 == tableData->mRules) {
const nsStyleBorder* tableBorderData = tableContext->GetStyleBorder();
PRUint8 tableBorderStyle = tableBorderData->GetBorderStyle(aSide);
nsStyleBorder* borderData = (nsStyleBorder*)aStyleStruct;

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

@ -88,8 +88,7 @@ nsInspectorCSSUtils::IsRuleNodeRoot(nsRuleNode *aNode, PRBool *aIsRoot)
NS_IMETHODIMP
nsInspectorCSSUtils::AdjustRectForMargins(nsIFrame* aFrame, nsRect& aRect)
{
const nsStyleMargin* margins;
::GetStyleData(aFrame, &margins);
const nsStyleMargin* margins = aFrame->GetStyleMargin();
// adjust coordinates for margins
nsStyleCoord coord;

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

@ -110,15 +110,31 @@ public:
* given a valid style struct ID, so the result does not need to be
* null-checked.
*
* The typesafe global helper function |GetStyleData| (below) is
* preferred to the use of this function (and is a simple typesafe
* wrapper for this function).
* The typesafe functions below are preferred to the use of this
* function.
*
* See also |nsIFrame::GetStyleData| and the other global
* |GetStyleData| in nsIFrame.h.
*/
const nsStyleStruct* GetStyleData(nsStyleStructID aSID);
/**
* Define typesafe getter functions for each style struct by
* preprocessing the list of style structs. These functions are the
* preferred way to get style data. The macro creates functions like:
* const nsStyleBorder* GetStyleBorder();
* const nsStyleColor* GetStyleColor();
*/
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
const nsStyle##name_ * GetStyle##name_() { \
return NS_STATIC_CAST(const nsStyle##name_*, \
GetStyleData(eStyleStruct_##name_)); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
const nsStyleStruct* PeekStyleData(nsStyleStructID aSID);
nsStyleStruct* GetUniqueStyleData(nsIPresContext* aPresContext, const nsStyleStructID& aSID);
@ -172,16 +188,4 @@ NS_NewStyleContext(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsRuleNode* aRuleNode,
nsIPresContext* aPresContext);
// typesafe way to access style data. See nsStyleStruct.h and also
// overloaded function in nsIFrame.h.
template <class T>
inline void
GetStyleData(nsStyleContext* aStyleContext, const T** aStyleStruct)
{
*aStyleStruct = NS_STATIC_CAST(const T*,
aStyleContext->GetStyleData(NS_GET_STYLESTRUCTID(T)));
}
#endif

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

@ -1157,17 +1157,17 @@ struct nsStyleSVG : public nsStyleStruct {
nsChangeHint CalcDifference(const nsStyleSVG& aOther) const;
// all [inherit]ed
nsStyleSVGPaint mFill;
float mFillOpacity;
PRUint8 mFillRule; // see nsStyleConsts.h
nsStyleSVGPaint mStroke;
nsString mStrokeDasharray; // XXX we want a parsed value here
float mStrokeDashoffset;
PRUint8 mStrokeLinecap; // see nsStyleConsts.h
PRUint8 mStrokeLinejoin; // see nsStyleConsts.h
float mStrokeMiterlimit;
float mStrokeOpacity;
float mStrokeWidth; // in pixels
nsStyleSVGPaint mFill; // [inherited]
float mFillOpacity; // [inherited]
PRUint8 mFillRule; // [inherited] see nsStyleConsts.h
nsStyleSVGPaint mStroke; // [inherited]
nsString mStrokeDasharray; // [inherited] XXX we want a parsed value here
float mStrokeDashoffset; // [inherited]
PRUint8 mStrokeLinecap; // [inherited] see nsStyleConsts.h
PRUint8 mStrokeLinejoin; // [inherited] see nsStyleConsts.h
float mStrokeMiterlimit; // [inherited]
float mStrokeOpacity; // [inherited]
float mStrokeWidth; // [inherited] in pixels
};
#endif
@ -1223,9 +1223,4 @@ inline nsBorderEdges::nsBorderEdges()
mOutsideEdge = PR_TRUE;
};
// typesafe mechanisms for accessing style data, global function
// templates |GetStyleData(nsIFrame*, const T**)| and
// |GetStyleData(nsStyleContext*, const T**)|, where T is derived from
// nsStyleStruct, are located in nsStyleContext.h and nsIFrame.h
#endif /* nsStyleStruct_h___ */

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

@ -85,21 +85,21 @@ inline nscoord CalcSideFor(const nsIFrame* aFrame, const nsStyleCoord& aCoord,
switch (aSpacing) {
case NS_SPACING_MARGIN:
{
const nsStyleMargin* parentMargin = (const nsStyleMargin*)parentContext->GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* parentMargin = parentContext->GetStyleMargin();
parentMargin->CalcMarginFor(parentFrame, parentSpacing);
}
break;
case NS_SPACING_PADDING:
{
const nsStylePadding* parentPadding = (const nsStylePadding*)parentContext->GetStyleData(eStyleStruct_Padding);
const nsStylePadding* parentPadding = parentContext->GetStylePadding();
parentPadding->CalcPaddingFor(parentFrame, parentSpacing);
}
break;
case NS_SPACING_BORDER:
{
const nsStyleBorder* parentBorder = (const nsStyleBorder*)parentContext->GetStyleData(eStyleStruct_Border);
const nsStyleBorder* parentBorder = parentContext->GetStyleBorder();
parentBorder->CalcBorderFor(parentFrame, parentSpacing);
}
@ -128,30 +128,17 @@ inline nscoord CalcSideFor(const nsIFrame* aFrame, const nsStyleCoord& aCoord,
frame->GetSize(size);
baseWidth = size.width;
// subtract border of containing block
const nsStyleBorder* borderData = nsnull;
frame->GetStyleData(eStyleStruct_Border,
(const nsStyleStruct*&)borderData);
if (borderData) {
nsMargin border;
borderData->CalcBorderFor(frame, border);
baseWidth -= (border.left + border.right);
}
nsMargin border;
frame->GetStyleBorder()->CalcBorderFor(frame, border);
baseWidth -= (border.left + border.right);
// if aFrame is not absolutely positioned, subtract
// padding of containing block
const nsStyleDisplay* displayData = nsnull;
aFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)displayData);
if (displayData &&
displayData->mPosition != NS_STYLE_POSITION_ABSOLUTE &&
const nsStyleDisplay* displayData = aFrame->GetStyleDisplay();
if (displayData->mPosition != NS_STYLE_POSITION_ABSOLUTE &&
displayData->mPosition != NS_STYLE_POSITION_FIXED) {
const nsStylePadding* paddingData = nsnull;
frame->GetStyleData(eStyleStruct_Padding,
(const nsStyleStruct*&)paddingData);
if (paddingData) {
nsMargin padding;
paddingData->CalcPaddingFor(frame, padding);
baseWidth -= (padding.left + padding.right);
}
nsMargin padding;
frame->GetStylePadding()->CalcPaddingFor(frame, padding);
baseWidth -= (padding.left + padding.right);
}
break;
}

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

@ -323,8 +323,7 @@ XULPopupListenerImpl::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
if (!targetFrame) return NS_ERROR_FAILURE;
PRBool suppressBlur = PR_FALSE;
const nsStyleUserInterface* ui;
targetFrame->GetStyleData(eStyleStruct_UserInterface, ((const nsStyleStruct*&)ui));
const nsStyleUserInterface* ui = targetFrame->GetStyleUserInterface();
suppressBlur = (ui->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE);
nsCOMPtr<nsIDOMElement> element;
@ -333,8 +332,7 @@ XULPopupListenerImpl::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
nsIFrame* currFrame = targetFrame;
// Look for the nearest enclosing focusable frame.
while (currFrame) {
const nsStyleUserInterface* ui;
currFrame->GetStyleData(eStyleStruct_UserInterface, ((const nsStyleStruct*&)ui));
const nsStyleUserInterface* ui = currFrame->GetStyleUserInterface();
if ((ui->mUserFocus != NS_STYLE_USER_FOCUS_IGNORE) &&
(ui->mUserFocus != NS_STYLE_USER_FOCUS_NONE))
{

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

@ -4126,11 +4126,7 @@ nsEditor::GetEndNodeAndOffset(nsISelection *aSelection,
nsresult
nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
{
nsresult result;
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
nsIFrame *frame;
const nsStyleText* styleText;
PRBool bPreformatted;
if (!aResult || !content) return NS_ERROR_NULL_POINTER;
@ -4138,13 +4134,12 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
if (!ps) return NS_ERROR_NOT_INITIALIZED;
result = ps->GetPrimaryFrameFor(content, &frame);
nsIFrame *frame;
nsresult result = ps->GetPrimaryFrameFor(content, &frame);
if (NS_FAILED(result)) return result;
NS_ASSERTION(frame, "no frame, see bug #188946");
if (frame)
::GetStyleData(frame, &styleText);
if (!frame || !styleText)
if (!frame)
{
// Consider nodes without a style context to be NOT preformatted:
// For instance, this is true of JS tags inside the body (which show
@ -4153,10 +4148,10 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
return NS_OK;
}
bPreformatted = (NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace);
const nsStyleText* styleText = frame->GetStyleText();
*aResult = bPreformatted;
*aResult = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
return NS_OK;
}

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

@ -269,7 +269,7 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode * aDOMNode, imgIRequest
{
// look for a background image on the element
do {
::GetStyleData(frame, &bg);
bg = frame->GetStyleBackground();
frame->GetParent(&frame);
} while (bg && bg->mBackgroundImage.IsEmpty() && frame);

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

@ -488,14 +488,7 @@ PRBool nsFind::IsVisibleNode(nsIDOMNode *aDOMNode)
return PR_FALSE;
}
const nsStyleVisibility* vis;
::GetStyleData(frame, &vis);
if (!vis || !vis->IsVisible())
{
return PR_FALSE;
}
return PR_TRUE;
return frame->GetStyleVisibility()->IsVisible();
}
PRBool nsFind::SkipNode(nsIContent* aContent)

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

@ -108,11 +108,9 @@ inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode,
nsCOMPtr<nsIContent> content = do_QueryInterface(aDataNode);
presShell->GetPrimaryFrameFor(content, &frame);
if (frame) {
const nsStyleText* text;
::GetStyleData(frame, &text);
if (text)
*aReturn = (text->mWhiteSpace != NS_STYLE_WHITESPACE_PRE &&
text->mWhiteSpace != NS_STYLE_WHITESPACE_MOZ_PRE_WRAP);
const nsStyleText* text = frame->GetStyleText();
*aReturn = text->mWhiteSpace != NS_STYLE_WHITESPACE_PRE &&
text->mWhiteSpace != NS_STYLE_WHITESPACE_MOZ_PRE_WRAP;
}
else {
// empty inter-tag text node without frame, e.g., in between <table>\n<tr>

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

@ -2545,9 +2545,7 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
return PR_FALSE;
}
const nsStyleVisibility* vis = nsnull;
::GetStyleData(frame, &vis);
if (!vis || !vis->IsVisible()) {
if (!frame->GetStyleVisibility()->IsVisible()) {
return PR_FALSE;
}

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

@ -157,12 +157,8 @@ nsBidiPresUtils::Resolve(nsIPresContext* aPresContext,
// handle bidi-override being set on the block itself before calling
// InitLogicalArray.
const nsStyleVisibility* vis;
aBlockFrame->GetStyleData(eStyleStruct_Visibility,
NS_REINTERPRET_CAST(const nsStyleStruct*&, vis));
const nsStyleTextReset* text;
aBlockFrame->GetStyleData(eStyleStruct_TextReset,
NS_REINTERPRET_CAST(const nsStyleStruct*&, text));
const nsStyleVisibility* vis = aBlockFrame->GetStyleVisibility();
const nsStyleTextReset* text = aBlockFrame->GetStyleTextReset();
if (text->mUnicodeBidi == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
nsresult rv = NS_OK;
@ -344,7 +340,6 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext,
nsIFrame* directionalFrame;
nsIFrame* kid;
nsCOMPtr<nsIAtom> frameType;
const nsStyleDisplay* display;
nsresult rv;
nsresult res = NS_OK;
@ -353,15 +348,11 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext,
frame->GetNextSibling(&frame) ) {
rv = NS_ERROR_FAILURE;
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
const nsStyleDisplay* display = frame->GetStyleDisplay();
if (aAddMarkers && !display->IsBlockLevel() ) {
const nsStyleVisibility* vis;
frame->GetStyleData(eStyleStruct_Visibility,
NS_REINTERPRET_CAST(const nsStyleStruct*&, vis));
const nsStyleTextReset* text;
frame->GetStyleData(eStyleStruct_TextReset,
NS_REINTERPRET_CAST(const nsStyleStruct*&, text));
const nsStyleVisibility* vis = frame->GetStyleVisibility();
const nsStyleTextReset* text = frame->GetStyleTextReset();
switch (text->mUnicodeBidi) {
case NS_STYLE_UNICODE_BIDI_NORMAL:
break;
@ -633,8 +624,7 @@ nsBidiPresUtils::RepositionInlineFrames(nsIPresContext* aPresContext,
frame->GetBidiProperty(aPresContext, nsLayoutAtoms::baseLevel,
(void**) &alignRight,sizeof(alignRight));
if (0 == (alignRight & 1) ) {
const nsStyleText* styleText;
frame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
const nsStyleText* styleText = frame->GetStyleText();
if (NS_STYLE_TEXT_ALIGN_RIGHT == styleText->mTextAlign
|| NS_STYLE_TEXT_ALIGN_MOZ_RIGHT == styleText->mTextAlign) {

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

@ -468,9 +468,7 @@ static PRBool
IsInlineFrame(nsIFrame* aFrame)
{
// XXXwaterson why don't we use |! display->IsBlockLevel()| here?
const nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
switch (display->mDisplay) {
switch (aFrame->GetStyleDisplay()->mDisplay) {
case NS_STYLE_DISPLAY_INLINE:
case NS_STYLE_DISPLAY_INLINE_BLOCK:
case NS_STYLE_DISPLAY_INLINE_TABLE:
@ -491,9 +489,7 @@ IsInlineFrame(nsIFrame* aFrame)
static PRBool
IsInlineFrame2(nsIFrame* aFrame)
{
const nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
return (display) ? !display->IsBlockLevel() : PR_TRUE;
return !aFrame->GetStyleDisplay()->IsBlockLevel();
}
//----------------------------------------------------------------------
@ -513,8 +509,7 @@ IsBlockFrame(nsIPresContext* aPresContext, nsIFrame* aFrame)
// XXXwaterson this seems wrong; see IsInlineFrame() immediately
// above, which will treat inline-block (e.g.) as an inline. Why
// don't we use display->IsBlockLevel() here?
const nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
return NS_STYLE_DISPLAY_INLINE != display->mDisplay;
}
@ -942,14 +937,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext,
// Get the display data for the outOfFlowFrame so we can
// figure out if it is a floater or absolutely positioned element.
const nsStyleDisplay* display = nsnull;
outOfFlowFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
if (!display) {
NS_WARNING("outOfFlowFrame has no display data!");
return;
}
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
// Update the parent pointer for outOfFlowFrame if it's
// containing block has changed as the result of reparenting,
@ -1232,19 +1220,15 @@ GetChildListNameFor(nsIPresContext* aPresContext,
aChildFrame->GetFrameState(&frameState);
if (frameState & NS_FRAME_OUT_OF_FLOW) {
// Look at the style information to tell
const nsStyleDisplay* disp;
aChildFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)disp);
const nsStyleDisplay* disp = aChildFrame->GetStyleDisplay();
if (NS_STYLE_POSITION_ABSOLUTE == disp->mPosition) {
listName = nsLayoutAtoms::absoluteList;
} else if (NS_STYLE_POSITION_FIXED == disp->mPosition) {
listName = nsLayoutAtoms::fixedList;
} else {
#ifdef NS_DEBUG
const nsStyleDisplay* display;
aChildFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
NS_ASSERTION(display->IsFloating(), "not a floated frame");
#endif
NS_ASSERTION(aChildFrame->GetStyleDisplay()->IsFloating(),
"not a floated frame");
listName = nsLayoutAtoms::floaterList;
}
@ -1498,7 +1482,7 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
case eStyleContentType_OpenQuote:
case eStyleContentType_CloseQuote:
{
const nsStyleQuotes* quotes = (const nsStyleQuotes*)aStyleContext->GetStyleData(eStyleStruct_Quotes);
const nsStyleQuotes* quotes = aStyleContext->GetStyleQuotes();
PRUint32 quotesCount = quotes->QuotesCount();
if (quotesCount > 0) {
nsAutoString openQuote, closeQuote;
@ -1594,10 +1578,8 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
// |ContentCount()| of the 'content' property for us.
if (aWrapperFrame) {
if (!*aWrapperFrame) {
const nsStyleDisplay *display;
::GetStyleData(aStyleContext, &display);
nsIAtom *wrapperPseudo;
if (display->IsBlockLevel()) {
if (aStyleContext->GetStyleDisplay()->IsBlockLevel()) {
NS_NewBlockFrame(aPresShell, aWrapperFrame);
wrapperPseudo = nsCSSAnonBoxes::mozGCWrapperBlock;
} else {
@ -1621,9 +1603,8 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
nsIFrame* containerFrame;
nsFrameItems childFrames;
const nsStyleDisplay *display;
::GetStyleData(pseudoStyleContext.get(), &display);
if (NS_STYLE_DISPLAY_BLOCK == display->mDisplay) {
if (NS_STYLE_DISPLAY_BLOCK ==
pseudoStyleContext->GetStyleDisplay()->mDisplay) {
NS_NewBlockFrame(aPresShell, &containerFrame);
} else {
NS_NewInlineFrame(aPresShell, &containerFrame);
@ -1648,8 +1629,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
// Now create content objects (and child frames) for each value of the
// 'content' property
const nsStyleContent *styleContent;
::GetStyleData(pseudoStyleContext.get(), &styleContent);
const nsStyleContent* styleContent = pseudoStyleContext->GetStyleContent();
PRUint32 contentCount = styleContent->ContentCount();
for (PRUint32 contentIndex = 0; contentIndex < contentCount; contentIndex++) {
nsIFrame* frame;
@ -2674,8 +2654,7 @@ nsCSSFrameConstructor::ConstructTableRowGroupFrame(nsIPresShell* aPre
}
}
const nsStyleDisplay* styleDisplay =
(const nsStyleDisplay*) aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* styleDisplay = aStyleContext->GetStyleDisplay();
rv = aTableCreator.CreateTableRowGroupFrame(&aNewFrame);
@ -2995,12 +2974,11 @@ nsCSSFrameConstructor::MustGeneratePseudoParent(nsIPresContext* aPresContext,
nsIContent* aContent,
nsStyleContext* aStyleContext)
{
if (!aStyleContext) return PR_FALSE;
if (!aStyleContext)
return PR_FALSE;
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
if (NS_STYLE_DISPLAY_NONE == display->mDisplay) return PR_FALSE;
if (NS_STYLE_DISPLAY_NONE == aStyleContext->GetStyleDisplay()->mDisplay)
return PR_FALSE;
// check tags first
@ -3163,10 +3141,7 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell,
// Resolve the style context and get its display
childStyleContext = ResolveStyleContext(aPresContext, aParentFrame,
aChildContent);
const nsStyleDisplay* styleDisplay = (const nsStyleDisplay*)
childStyleContext->GetStyleData(eStyleStruct_Display);
switch (styleDisplay->mDisplay) {
switch (childStyleContext->GetStyleDisplay()->mDisplay) {
case NS_STYLE_DISPLAY_TABLE:
{
PRBool pageBreakAfter = PR_FALSE;
@ -3284,15 +3259,12 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell,
}
const nsStyleDisplay*
nsCSSFrameConstructor:: GetDisplay(nsIFrame* aFrame)
nsCSSFrameConstructor::GetDisplay(nsIFrame* aFrame)
{
if (nsnull == aFrame) {
return nsnull;
}
nsStyleContext* styleContext = aFrame->GetStyleContext();
const nsStyleDisplay* display =
(const nsStyleDisplay*)styleContext->GetStyleData(eStyleStruct_Display);
return display;
return aFrame->GetStyleContext()->GetStyleDisplay();
}
/***********************************************
@ -3392,8 +3364,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
styleContext = aPresContext->ResolveStyleContextFor(aDocElement,
aParentStyleContext);
const nsStyleDisplay* display = (const nsStyleDisplay*)
styleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
// Ensure that our XBL bindings are installed.
if (!display->mBinding.IsEmpty()) {
@ -3773,13 +3744,10 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
nsRefPtr<nsStyleContext> styleContext;
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, nsnull);
if (styleContext) {
const nsStyleDisplay* display = (const nsStyleDisplay*)
styleContext->GetStyleData(eStyleStruct_Display);
if (display) {
if (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN ||
display->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE) {
isScrollable = PR_FALSE;
}
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
if (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN ||
display->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE) {
isScrollable = PR_FALSE;
}
}
@ -3815,13 +3783,10 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
bodyContext = aPresContext->ResolveStyleContextFor(bodyElement,
styleContext);
if (bodyContext) {
const nsStyleDisplay* display = (const nsStyleDisplay*)
bodyContext->GetStyleData(eStyleStruct_Display);
if (display) {
if (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN ||
display->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE) {
isScrollable = PR_FALSE;
}
const nsStyleDisplay* display = bodyContext->GetStyleDisplay();
if (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN ||
display->mOverflow == NS_STYLE_OVERFLOW_SCROLLBARS_NONE) {
isScrollable = PR_FALSE;
}
}
}
@ -4467,8 +4432,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
aStyleContext, aParentFrame, PR_FALSE);
// cache our display type
const nsStyleDisplay* styleDisplay;
newFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
const nsStyleDisplay* styleDisplay = newFrame->GetStyleDisplay();
nsIFrame* areaFrame;
NS_NewAreaFrame(shell, &areaFrame, NS_BLOCK_SPACE_MGR | NS_BLOCK_SHRINK_WRAP);
@ -4634,8 +4598,7 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
nsresult rv = NS_OK;
// See if the element is absolute or fixed positioned
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
if (NS_STYLE_POSITION_ABSOLUTE == display->mPosition) {
isAbsolutelyPositioned = PR_TRUE;
}
@ -5293,8 +5256,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
if (aTag == nsnull)
return NS_OK;
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
PRBool isXULNS = (aNameSpaceID == kNameSpaceID_XUL);
PRBool isXULDisplay = IsXULDisplayType(display);
@ -6799,8 +6761,7 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
nsIFrame* newFrame = nsnull;
// See if the element is absolute or fixed positioned
const nsStyleDisplay* disp = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = aStyleContext->GetStyleDisplay();
if (NS_STYLE_POSITION_ABSOLUTE == disp->mPosition) {
isAbsolutelyPositioned = PR_TRUE;
}
@ -6913,8 +6874,7 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
else if (aTag == nsMathMLAtoms::math) {
// root <math> element
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
PRBool isBlock = (NS_STYLE_DISPLAY_BLOCK == display->mDisplay);
rv = NS_NewMathMLmathFrame(aPresShell, &newFrame, isBlock);
}
@ -7018,8 +6978,7 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell,
//nsSVGTableCreator svgTableCreator(aPresShell); // Used to make table views.
// See if the element is absolute or fixed positioned
const nsStyleDisplay* disp = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = aStyleContext->GetStyleDisplay();
if (NS_STYLE_POSITION_ABSOLUTE == disp->mPosition) {
isAbsolutelyPositioned = PR_TRUE;
}
@ -7135,8 +7094,7 @@ nsCSSFrameConstructor::PageBreakBefore(nsIPresShell* aPresShell,
nsStyleContext* aStyleContext,
nsFrameItems& aFrameItems)
{
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
// See if page-break-before is set for all elements except row groups, rows, cells
// (these are handled internally by tables) and construct a page break frame if so.
@ -7244,8 +7202,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
// The following code allows the user to specify the base tag
// of an element using XBL. XUL and HTML objects (like boxes, menus, etc.)
// can then be extended arbitrarily.
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
nsRefPtr<nsStyleContext> styleContext(aStyleContext);
nsCOMPtr<nsIXBLBinding> binding;
if (!aXBLBaseTag)
@ -7312,8 +7269,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
// pres context, and this needs to happen before we start reflow, so
// do it now, when constructing frames. See bug 115291.
{
const nsStyleVisibility *vis;
::GetStyleData(styleContext.get(), &vis);
styleContext->GetStyleVisibility();
}
nsIFrame* lastChild = aFrameItems.lastChild;
@ -7546,8 +7502,7 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell,
} else {
// If the primary frame is a scroll frame, then get the scrolled frame.
// That's the frame that gets the reflow command
const nsStyleDisplay* display;
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
const nsStyleDisplay* display = frame->GetStyleDisplay();
// If the primary frame supports IScrollableFrame, then get the scrolled frame.
// That's the frame that gets the reflow command
@ -7583,8 +7538,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext,
// Is it positioned?
// If it's a table then ignore it, because for the time being tables
// are not containers for absolutely positioned child frames
const nsStyleDisplay* disp;
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)disp);
const nsStyleDisplay* disp = frame->GetStyleDisplay();
if (disp->IsPositioned() && disp->mDisplay != NS_STYLE_DISPLAY_TABLE) {
nsCOMPtr<nsIAtom> frameType;
@ -7635,9 +7589,7 @@ nsCSSFrameConstructor::GetFloaterContainingBlock(nsIPresContext* aPresContext,
// or a floated inline or absolutely positioned inline frame
nsIFrame* containingBlock = aFrame;
while (nsnull != containingBlock) {
const nsStyleDisplay* display;
containingBlock->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = containingBlock->GetStyleDisplay();
if ((NS_STYLE_DISPLAY_BLOCK == display->mDisplay) ||
(NS_STYLE_DISPLAY_LIST_ITEM == display->mDisplay)) {
break;
@ -7818,9 +7770,7 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
// If the frame is out-of-flow, GPFF() will have returned the
// out-of-flow frame; we want the placeholder.
const nsStyleDisplay* display;
prevSibling->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = prevSibling->GetStyleDisplay();
if (display->IsFloating() || display->IsAbsolutelyPositioned()) {
nsIFrame* placeholderFrame;
@ -7896,9 +7846,7 @@ FindNextAnonymousSibling(nsIPresShell* aPresShell,
// If the frame is out-of-flow, GPFF() will have returned the
// out-of-flow frame; we want the placeholder.
const nsStyleDisplay* display;
nextSibling->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = nextSibling->GetStyleDisplay();
if (display->IsFloating() || display->IsAbsolutelyPositioned()) {
nsIFrame* placeholderFrame;
@ -7944,9 +7892,7 @@ nsCSSFrameConstructor::IsValidSibling(nsIPresShell& aPresShell,
nsRefPtr<nsStyleContext> styleContext;
styleContext = ResolveStyleContext(context, parent, &aContent);
if (!styleContext) return PR_FALSE;
const nsStyleDisplay* display =
(const nsStyleDisplay*) styleContext->GetStyleData(eStyleStruct_Display);
if (!display) return PR_FALSE;
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
aDisplay = display->mDisplay;
}
switch (aSiblingDisplay) {
@ -8017,9 +7963,7 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIPresShell* aPresShell,
// If the frame is out-of-flow, GPFF() will have returned the
// out-of-flow frame; we want the placeholder.
// XXXldb Why not check NS_FRAME_OUT_OF_FLOW state bit?
const nsStyleDisplay* display;
prevSibling->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = prevSibling->GetStyleDisplay();
if (aChild && !IsValidSibling(*aPresShell, aContainerFrame, *prevSibling,
display->mDisplay, (nsIContent&)*aChild, childDisplay))
@ -8088,9 +8032,7 @@ nsCSSFrameConstructor::FindNextSibling(nsIPresShell* aPresShell,
// If the frame is out-of-flow, GPFF() will have returned the
// out-of-flow frame; we want the placeholder.
const nsStyleDisplay* display;
nextSibling->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = nextSibling->GetStyleDisplay();
if (aChild && !IsValidSibling(*aPresShell, aContainerFrame, *nextSibling,
display->mDisplay, (nsIContent&)*aChild, childDisplay))
@ -8346,9 +8288,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
// If this frame is the anonymous block frame, then all's well:
// just append frames as usual.
const nsStyleDisplay* display;
parentFrame->GetStyleData(eStyleStruct_Display,
NS_REINTERPRET_CAST(const nsStyleStruct*&, display));
const nsStyleDisplay* display = parentFrame->GetStyleDisplay();
if (NS_STYLE_DISPLAY_BLOCK != display->mDisplay) {
// Nope, it's an inline, so just reframe the entire stinkin' mess if the
@ -8360,11 +8300,9 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
if (child && child->IsContentOfType(nsIContent::eELEMENT)) {
nsRefPtr<nsStyleContext> styleContext;
styleContext = ResolveStyleContext(aPresContext, parentFrame, child);
const nsStyleDisplay* display =
(const nsStyleDisplay*) styleContext->GetStyleData(eStyleStruct_Display);
// XXX since the block child goes in the last inline of the sacred triad, frames would
// need to be moved into the 2nd triad (block) but that is more work, for now bail.
needReframe = display->IsBlockLevel();
needReframe = styleContext->GetStyleDisplay()->IsBlockLevel();
}
if (needReframe)
return ReframeContainingBlock(aPresContext, parentFrame);
@ -8718,9 +8656,7 @@ nsCSSFrameConstructor::NeedSpecialFrameReframe(nsIPresShell* aPresShell,
if (aChild->IsContentOfType(nsIContent::eELEMENT)) {
nsRefPtr<nsStyleContext> styleContext;
styleContext = ResolveStyleContext(aPresContext, aParentFrame, aChild);
const nsStyleDisplay* display =
(const nsStyleDisplay*) styleContext->GetStyleData(eStyleStruct_Display);
childIsBlock = display->IsBlockLevel();
childIsBlock = styleContext->GetStyleDisplay()->IsBlockLevel();
}
nsIFrame* prevParent; // parent of prev sibling
nsIFrame* nextParent; // parent of next sibling
@ -9044,9 +8980,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
// containing block haveFirst* flags if the parent frame where
// the insertion/append is occuring is an inline or block
// container. For other types of containers this isn't relevant.
const nsStyleDisplay* parentDisplay;
parentFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)parentDisplay);
const nsStyleDisplay* parentDisplay = parentFrame->GetStyleDisplay();
// Examine the parentFrame where the insertion is taking
// place. If its a certain kind of container then some special
@ -9353,9 +9287,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
// one of its ancestor frames or if it is a popup frame.
// If aRemovedFrame is an ancestor of the out-of-flow frame, then
// the out-of-flow frame will be destroyed by aRemovedFrame.
const nsStyleDisplay* display;
outOfFlowFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
if (display->mDisplay == NS_STYLE_DISPLAY_POPUP || !IsAncestorFrame(outOfFlowFrame, aRemovedFrame)) {
if (aDestroyQueue.IndexOf(outOfFlowFrame) < 0)
aDestroyQueue.AppendElement(outOfFlowFrame);
@ -9426,9 +9358,7 @@ DeletingFrameSubtree(nsIPresContext* aPresContext,
nsIFrame* outOfFlowFrame = NS_STATIC_CAST(nsIFrame*, destroyQueue[i]);
#ifdef MOZ_XUL
const nsStyleDisplay* display;
outOfFlowFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
if (display->mDisplay == NS_STYLE_DISPLAY_POPUP) {
// Locate the root popup set and remove ourselves from the popup set's list
// of popup frames.
@ -9703,9 +9633,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
// See if the child frame is a floating frame
// (positioned frames are handled below in the "else" clause)
const nsStyleDisplay* display;
childFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = childFrame->GetStyleDisplay();
nsPlaceholderFrame* placeholderFrame = nsnull;
if (display->mDisplay == NS_STYLE_DISPLAY_POPUP)
// Get the placeholder frame
@ -9955,8 +9883,7 @@ DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
// XXX This rect inflation should be done when the rects are
// being accumulated in UpdateViewsForTree, not in
// DoApplyRenderingChangeToTree
const nsStyleOutline* outline;
aFrame->GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline);
const nsStyleOutline* outline = aFrame->GetStyleOutline();
nscoord width;
outline->GetOutlineWidth(width);
if (width > 0) {
@ -10302,9 +10229,7 @@ nsCSSFrameConstructor::ContentStatesChanged(nsIPresContext* aPresContext,
if (aContent1) {
shell->GetPrimaryFrameFor(aContent1, &primaryFrame1);
if (primaryFrame1) {
const nsStyleDisplay* disp;
::GetStyleData(primaryFrame1, &disp);
app1 = disp->mAppearance;
app1 = primaryFrame1->GetStyleDisplay()->mAppearance;
}
// XXXldb Why check app1 here when you could just do the code
@ -10323,9 +10248,7 @@ nsCSSFrameConstructor::ContentStatesChanged(nsIPresContext* aPresContext,
if (aContent2) {
shell->GetPrimaryFrameFor(aContent2, &primaryFrame2);
if (primaryFrame2) {
const nsStyleDisplay* disp;
::GetStyleData(primaryFrame2, &disp);
app2 = disp->mAppearance;
app2 = primaryFrame2->GetStyleDisplay()->mAppearance;
}
// XXXldb Why check app2 here when you could just do the code
@ -10508,10 +10431,8 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
// See if we have appearance information for a theme.
if (primaryFrame) {
const nsStyleDisplay* disp;
primaryFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)disp);
if (disp && disp->mAppearance) {
const nsStyleDisplay* disp = primaryFrame->GetStyleDisplay();
if (disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
if (theme && theme->ThemeSupportsWidget(aPresContext, primaryFrame, disp->mAppearance)) {
@ -10727,8 +10648,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
// Create either an inline frame, block frame, or area frame
nsIFrame* containerFrame;
PRBool isOutOfFlow = PR_FALSE;
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
if (display->IsAbsolutelyPositioned()) {
NS_NewAbsoluteItemWrapperFrame(aPresShell, &containerFrame);
@ -10957,8 +10877,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
absoluteContainingBlock,
floaterContainingBlock);
nsFrameItems frameItems;
const nsStyleDisplay* display =
NS_STATIC_CAST(const nsStyleDisplay*, styleContext->GetStyleData(eStyleStruct_Display));
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
// Create a new frame based on the display type.
// Note: if the old frame was out-of-flow, then so will the new frame
@ -11129,12 +11048,10 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
// XXX remove this code and the above checks. We don't want to replicate
// the caption (that is what the thead is for). This code is not executed
// anyway, because the caption was put in a different child list.
nsIContent* caption;
nsStyleContext* captionStyle = childFrame->GetStyleContext();
const nsStyleDisplay* display;
nsIContent* caption;
childFrame->GetContent(&caption);
display = (const nsStyleDisplay*)captionStyle->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = captionStyle->GetStyleDisplay();
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_CAPTION == display->mDisplay, "expected caption");
// Replicate the caption frame
@ -11199,9 +11116,7 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
while (rowGroupFrame) {
// See if it's a header/footer
nsStyleContext* rowGroupStyle = rowGroupFrame->GetStyleContext();
const nsStyleDisplay* display;
display = (const nsStyleDisplay*)rowGroupStyle->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = rowGroupStyle->GetStyleDisplay();
if ((NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == display->mDisplay) ||
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == display->mDisplay)) {
@ -12689,8 +12604,7 @@ nsCSSFrameConstructor::CreateLetterFrame(nsIPresShell* aPresShell, nsIPresContex
NS_NewTextFrame(aPresShell, &textFrame);
// Create the right type of first-letter frame
const nsStyleDisplay* display = (const nsStyleDisplay*)
sc->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = sc->GetStyleDisplay();
if (display->IsFloating()) {
// Make a floating first-letter frame
CreateFloatingLetterFrame(aPresShell, aPresContext, aState,
@ -13142,8 +13056,7 @@ nsCSSFrameConstructor::CreateListBoxContent(nsIPresContext* aPresContext,
// Pre-check for display "none" - only if we find that, do we create
// any frame at all
const nsStyleDisplay* display = (const nsStyleDisplay*)
styleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
if (NS_STYLE_DISPLAY_NONE == display->mDisplay) {
*aNewFrame = nsnull;
@ -13745,8 +13658,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
if (!aBlockContent)
return PR_FALSE;
const nsStyleDisplay* parentDisplay;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&) parentDisplay);
const nsStyleDisplay* parentDisplay = aFrame->GetStyleDisplay();
if (NS_STYLE_DISPLAY_INLINE == parentDisplay->mDisplay) {
if (!AreAllKidsInline(aFrameList)) {
// XXXwaterson temporary code until we figure out why bug 102931

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

@ -1566,8 +1566,7 @@ PRBool GetBGColorForHTMLElement( nsIPresContext *aPresContext,
if (NS_SUCCEEDED(shell->GetPrimaryFrameFor(pContent, &pFrame)) && pFrame) {
nsStyleContext *pContext = pFrame->GetStyleContext();
if (pContext) {
const nsStyleBackground* color = (const nsStyleBackground*)pContext->GetStyleData(eStyleStruct_Background);
NS_ASSERTION(color,"ColorStyleData should not be null");
const nsStyleBackground* color = pContext->GetStyleBackground();
if (0 == (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
aBGColor = color;
// set the reslt to TRUE to indicate we mapped the color
@ -1689,7 +1688,7 @@ void nsCSSRendering::PaintBorder(nsIPresContext* aPresContext,
// Check to see if we have an appearance defined. If so, we let the theme
// renderer draw the border. DO not get the data from aForFrame, since the passed in style context
// may be different! Always use |aStyleContext|!
const nsStyleDisplay* displayData = (const nsStyleDisplay*)aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* displayData = aStyleContext->GetStyleDisplay();
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
@ -1697,7 +1696,7 @@ void nsCSSRendering::PaintBorder(nsIPresContext* aPresContext,
return; // Let the theme handle it.
}
// Get our style context's color struct.
const nsStyleColor* ourColor = (const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleColor* ourColor = aStyleContext->GetStyleColor();
// in NavQuirks mode we want to use the parent's context as a starting point
// for determining the background color
@ -2120,7 +2119,7 @@ const nsStyleBackground* bgColor = nsCSSRendering::FindNonTransparentBackground(
nscoord width;
// Get our style context's color struct.
const nsStyleColor* ourColor = (const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleColor* ourColor = aStyleContext->GetStyleColor();
aOutlineStyle.GetOutlineWidth(width);
@ -2582,7 +2581,7 @@ nsCSSRendering::FindNonTransparentBackground(nsStyleContext* aContext,
// Have to .get() because some compilers won't match the template
// otherwise (they don't look for implicit type conversions while doing
// template matching?).
::GetStyleData(context, &result);
result = context->GetStyleBackground();
if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT))
break;
@ -2661,8 +2660,7 @@ FindCanvasBackground(nsIPresContext* aPresContext,
nsIFrame *firstChild;
aForFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (firstChild) {
const nsStyleBackground *result;
GetStyleData(firstChild, &result);
const nsStyleBackground* result = firstChild->GetStyleBackground();
// for printing and print preview.. this should be a pageContentFrame
nsCOMPtr<nsIAtom> frameType;
@ -2675,12 +2673,9 @@ FindCanvasBackground(nsIPresContext* aPresContext,
while(firstChild){
for (nsIFrame* kidFrame = firstChild; nsnull != kidFrame; ) {
parentContext = kidFrame->GetStyleContext();
// Need to .get() because some compilers will not do the
// implicit .get() to match the template.
// See also rev 3.188 of this file.
::GetStyleData(parentContext, &result);
result = parentContext->GetStyleBackground();
if (!result->IsTransparent()) {
GetStyleData(kidFrame, aBackground);
*aBackground = kidFrame->GetStyleBackground();
return PR_TRUE;
} else {
kidFrame->GetNextSibling(&kidFrame);
@ -2720,7 +2715,7 @@ FindCanvasBackground(nsIPresContext* aPresContext,
nsIFrame *bodyFrame;
nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
if (NS_SUCCEEDED(rv) && bodyFrame)
::GetStyleData(bodyFrame, &result);
result = bodyFrame->GetStyleBackground();
}
}
}
@ -2731,7 +2726,7 @@ FindCanvasBackground(nsIPresContext* aPresContext,
// This should always give transparent, so we'll fill it in with the
// default color if needed. This seems to happen a bit while a page is
// being loaded.
GetStyleData(aForFrame, aBackground);
*aBackground = aForFrame->GetStyleBackground();
}
return PR_TRUE;
@ -2753,7 +2748,7 @@ FindElementBackground(nsIPresContext* aPresContext,
return PR_FALSE; // Background was already drawn for the canvas.
}
::GetStyleData(aForFrame, aBackground);
*aBackground = aForFrame->GetStyleBackground();
nsCOMPtr<nsIContent> content;
aForFrame->GetContent(getter_AddRefs(content));
@ -2776,8 +2771,7 @@ FindElementBackground(nsIPresContext* aPresContext,
if (!htmlDoc)
return PR_TRUE;
const nsStyleBackground *htmlBG;
::GetStyleData(parentFrame, &htmlBG);
const nsStyleBackground* htmlBG = parentFrame->GetStyleBackground();
return !htmlBG->IsTransparent();
}
@ -2822,18 +2816,17 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
// a root, other wise keep going in order to let the theme stuff
// draw the background. The canvas really should be drawing the
// bg, but there's no way to hook that up via css.
const nsStyleDisplay* displayData = nsnull;
aForFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct*&)displayData));
const nsStyleDisplay* displayData = aForFrame->GetStyleDisplay();
if (displayData->mAppearance) {
nsCOMPtr<nsIContent> content;
aForFrame->GetContent(getter_AddRefs(content));
if ( content ) {
if (content) {
nsCOMPtr<nsIContent> parent;
content->GetParent(*getter_AddRefs(parent));
if ( parent )
if (parent)
return;
else
::GetStyleData(aForFrame, &color);
color = aForFrame->GetStyleBackground();
}
else
return;
@ -2922,8 +2915,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
// Check to see if we have an appearance defined. If so, we let the theme
// renderer draw the background and bail out.
const nsStyleDisplay* displayData;
aForFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct*&)displayData));
const nsStyleDisplay* displayData = aForFrame->GetStyleDisplay();
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
@ -3212,8 +3204,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsIPresContext* aPresContext,
firstRootElementFrame->GetRect(firstRootElementFrameArea);
// Take the border out of the frame's rect
const nsStyleBorder* borderStyle;
firstRootElementFrame->GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderStyle);
const nsStyleBorder* borderStyle = firstRootElementFrame->GetStyleBorder();
nsMargin border;
borderStyle->GetBorder(border);
firstRootElementFrameArea.Deflate(border);
@ -3744,7 +3735,7 @@ nsCSSRendering::RenderSide(nsFloatPoint aPoints[],nsIRenderingContext& aRenderin
PRInt16 thickness;
// Get our style context's color struct.
const nsStyleColor* ourColor = (const nsStyleColor*)aStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleColor* ourColor = aStyleContext->GetStyleColor();
NS_ASSERTION((aIsOutline && aOutlineStyle) || (!aIsOutline && aBorderStyle), "null params not allowed");
// set the style information

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

@ -569,8 +569,6 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
#ifdef IBMBIDI
PRUint8 bidiLevel=0;
// Mamdouh : modification of the caret to work at rtl and ltr with Bidi
const nsStyleVisibility* vis;
theFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&) vis);
//
// Direction Style from this->GetStyleData()
// now in (visibility->mDirection)
@ -594,7 +592,9 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
bidiLevel &= ~BIDI_LEVEL_UNDEFINED;
// There has been a reflow, so we reset the cursor Bidi level to the level of the current frame
if (!presContext) // Use the style default or default to 0
newBidiLevel = (vis) ? vis->mDirection : 0;
{
newBidiLevel = theFrame->GetStyleVisibility()->mDirection;
}
else
{
theFrame->GetBidiProperty(presContext, nsLayoutAtoms::embeddingLevel,
@ -740,21 +740,17 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
#endif // IBMBIDI
// now we have a frame, check whether it's appropriate to show the caret here
const nsStyleUserInterface* userinterface;
theFrame->GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface);
if (userinterface)
{
if (
const nsStyleUserInterface* userinterface = theFrame->GetStyleUserInterface();
if (
#ifdef SUPPORT_USER_MODIFY
// editable content still defaults to NS_STYLE_USER_MODIFY_READ_ONLY at present. See bug 15284
(userinterface->mUserModify == NS_STYLE_USER_MODIFY_READ_ONLY) ||
// editable content still defaults to NS_STYLE_USER_MODIFY_READ_ONLY at present. See bug 15284
(userinterface->mUserModify == NS_STYLE_USER_MODIFY_READ_ONLY) ||
#endif
(userinterface->mUserInput == NS_STYLE_USER_INPUT_NONE) ||
(userinterface->mUserInput == NS_STYLE_USER_INPUT_DISABLED))
{
return PR_FALSE;
}
}
(userinterface->mUserInput == NS_STYLE_USER_INPUT_NONE) ||
(userinterface->mUserInput == NS_STYLE_USER_INPUT_DISABLED))
{
return PR_FALSE;
}
// mark the frame, so we get notified on deletion.
// frames are never unmarked, which means that we'll touch every frame we visit.
@ -1035,12 +1031,10 @@ void nsCaret::GetCaretRectAndInvert()
// after we've got an RC.
if (frameRect.height == 0)
{
const nsStyleFont* fontStyle;
const nsStyleVisibility* vis;
mLastCaretFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)fontStyle);
mLastCaretFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleFont* fontStyle = mLastCaretFrame->GetStyleFont();
const nsStyleVisibility* vis = mLastCaretFrame->GetStyleVisibility();
nsCOMPtr<nsIAtom> langGroup;
if (vis && vis->mLanguage)
if (vis->mLanguage)
vis->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
mRendContext->SetFont(fontStyle->mFont, langGroup);
@ -1097,10 +1091,8 @@ void nsCaret::GetCaretRectAndInvert()
{
caretRect.x -= caretXMost - frameXMost;
const nsStyleVisibility* vis;
const nsStyleText* textStyle;
mLastCaretFrame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textStyle);
mLastCaretFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleText* textStyle = mLastCaretFrame->GetStyleText();
const nsStyleVisibility* vis = mLastCaretFrame->GetStyleVisibility();
if ((vis->mDirection == NS_STYLE_DIRECTION_LTR &&
textStyle->mTextAlign == NS_STYLE_TEXT_ALIGN_RIGHT) ||

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

@ -1591,7 +1591,7 @@ HasAttributeContent(nsStyleContext* aStyleContext,
{
PRBool result = PR_FALSE;
if (aStyleContext) {
const nsStyleContent* content = (const nsStyleContent*)aStyleContext->GetStyleData(eStyleStruct_Content);
const nsStyleContent* content = aStyleContext->GetStyleContent();
PRUint32 count = content->ContentCount();
while ((0 < count) && (! result)) {
nsStyleContentType contentType;
@ -1769,11 +1769,11 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// if old context had image and new context does not have the same image,
// stop the image load for the frame
const nsStyleBackground* oldColor = (const nsStyleBackground*)oldContext->GetStyleData(eStyleStruct_Background);
const nsStyleBackground* newColor = (const nsStyleBackground*)newContext->GetStyleData(eStyleStruct_Background);
const nsStyleBackground* oldColor = oldContext->GetStyleBackground();
const nsStyleBackground* newColor = newContext->GetStyleBackground();
if(oldColor->mBackgroundImage.Length() > 0 &&
oldColor->mBackgroundImage != newColor->mBackgroundImage ){
if (oldColor->mBackgroundImage.Length() > 0 &&
oldColor->mBackgroundImage != newColor->mBackgroundImage) {
// stop the image loading for the frame, the image has changed
aPresContext->StopImagesFor(aFrame);
}
@ -1859,8 +1859,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
newContext);
}
if (undisplayedContext) {
const nsStyleDisplay* display;
::GetStyleData(undisplayedContext.get(), &display);
const nsStyleDisplay* display = undisplayedContext->GetStyleDisplay();
if (display->mDisplay != NS_STYLE_DISPLAY_NONE) {
aChangeList.AppendChange(nsnull,
undisplayed->mContent

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

@ -544,9 +544,7 @@ nsFocusIterator::GetRealFrame(nsIFrame* aFrame)
PRBool
nsFocusIterator::IsPopupFrame(nsIFrame* aFrame)
{
nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
return (display->mDisplay == NS_STYLE_DISPLAY_POPUP);
return (aFrame->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_POPUP);
}
nsIFrame*

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

@ -257,7 +257,7 @@ nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
// with the damaged rect.
nsStyleContext* styleContext;
mFrame->GetStyleContext(&styleContext);
const nsStyleBackground* bg = (const nsStyleBackground*)styleContext->GetStyleData(eStyleStruct_Background);
const nsStyleBackground* bg = styleContext->GetStyleBackground();
if ((bg->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE) ||
(bg->mBackgroundRepeat == NS_STYLE_BG_REPEAT_OFF)) {

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

@ -986,11 +986,7 @@ nsPresContext::GetXBLBindingURL(nsIContent* aContent, nsAString& aResult)
sc = ResolveStyleContextFor(aContent, nsnull);
NS_ENSURE_TRUE(sc, NS_ERROR_FAILURE);
const nsStyleDisplay* display;
::GetStyleData(sc.get(), &display);
NS_ENSURE_TRUE(display, NS_ERROR_NULL_POINTER);
aResult = display->mBinding;
aResult = sc->GetStyleDisplay()->mBinding;
return NS_OK;
}

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

@ -5453,9 +5453,7 @@ BuildFramechangeList(nsIFrame *aFrame, void *aClosure)
nsStyleChangeList *changeList = NS_STATIC_CAST(nsStyleChangeList*, aClosure);
// Ok, get our binding information.
const nsStyleDisplay* oldDisplay;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)oldDisplay);
if (!oldDisplay->mBinding.IsEmpty()) {
if (!aFrame->GetStyleDisplay()->mBinding.IsEmpty()) {
// We had a binding.
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
@ -5811,8 +5809,7 @@ PresShell::BidiStyleChangeReflow()
// Return TRUE if any clipping is to be done.
static PRBool ComputeClipRect(nsIFrame* aFrame, nsRect& aResult) {
const nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
// 'clip' only applies to absolutely positioned elements, and is
// relative to the element's border edge. 'clip' applies to the entire

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

@ -579,29 +579,39 @@ public:
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext) = 0;
/**
* Get the style data associated with this frame. This fills in a
* Get the style data associated with this frame. This returns a
* const style struct pointer that should never be modified. See
* |nsIStyleContext::GetStyleData| for more information.
*
* The use of the typesafe global helper function |GetStyleData|,
* below, is preferred to direct use of this function.
* The use of the typesafe functions below is preferred to direct use
* of this function.
*/
NS_IMETHOD GetStyleDataExternal(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const = 0;
virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const = 0;
const nsStyleStruct* GetStyleData(nsStyleStructID aSID) const {
#ifdef _IMPL_NS_LAYOUT
nsresult GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const {
NS_ASSERTION(mStyleContext, "No style context found!");
aStyleStruct = mStyleContext->GetStyleData(aSID);
return NS_OK;
}
return mStyleContext->GetStyleData(aSID);
#else
nsresult GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const {
return GetStyleDataExternal(aSID, aStyleStruct);
}
return GetStyleDataExternal(aSID);
#endif
}
/**
* Define typesafe getter functions for each style struct by
* preprocessing the list of style structs. These functions are the
* preferred way to get style data. The macro creates functions like:
* const nsStyleBorder* GetStyleBorder();
* const nsStyleColor* GetStyleColor();
*/
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
const nsStyle##name_ * GetStyle##name_() const { \
return NS_STATIC_CAST(const nsStyle##name_*, \
GetStyleData(eStyleStruct_##name_)); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
// Utility function: more convenient than 2 calls to GetStyleData to get border and padding
NS_IMETHOD CalcBorderPadding(nsMargin& aBorderPadding) const = 0;
@ -1256,14 +1266,4 @@ private:
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
};
// typesafe way to access style data. See comment in nsStyleStruct.h
// and also overloaded function in nsStyleContext.h
template <class T>
inline void
GetStyleData(nsIFrame* aFrame, const T** aStyleStruct)
{
aFrame->GetStyleData(NS_GET_STYLESTRUCTID(T),
*NS_REINTERPRET_CAST(const nsStyleStruct**, aStyleStruct));
}
#endif /* nsIFrame_h___ */

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

@ -157,12 +157,8 @@ nsBidiPresUtils::Resolve(nsIPresContext* aPresContext,
// handle bidi-override being set on the block itself before calling
// InitLogicalArray.
const nsStyleVisibility* vis;
aBlockFrame->GetStyleData(eStyleStruct_Visibility,
NS_REINTERPRET_CAST(const nsStyleStruct*&, vis));
const nsStyleTextReset* text;
aBlockFrame->GetStyleData(eStyleStruct_TextReset,
NS_REINTERPRET_CAST(const nsStyleStruct*&, text));
const nsStyleVisibility* vis = aBlockFrame->GetStyleVisibility();
const nsStyleTextReset* text = aBlockFrame->GetStyleTextReset();
if (text->mUnicodeBidi == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
nsresult rv = NS_OK;
@ -344,7 +340,6 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext,
nsIFrame* directionalFrame;
nsIFrame* kid;
nsCOMPtr<nsIAtom> frameType;
const nsStyleDisplay* display;
nsresult rv;
nsresult res = NS_OK;
@ -353,15 +348,11 @@ nsBidiPresUtils::InitLogicalArray(nsIPresContext* aPresContext,
frame->GetNextSibling(&frame) ) {
rv = NS_ERROR_FAILURE;
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
const nsStyleDisplay* display = frame->GetStyleDisplay();
if (aAddMarkers && !display->IsBlockLevel() ) {
const nsStyleVisibility* vis;
frame->GetStyleData(eStyleStruct_Visibility,
NS_REINTERPRET_CAST(const nsStyleStruct*&, vis));
const nsStyleTextReset* text;
frame->GetStyleData(eStyleStruct_TextReset,
NS_REINTERPRET_CAST(const nsStyleStruct*&, text));
const nsStyleVisibility* vis = frame->GetStyleVisibility();
const nsStyleTextReset* text = frame->GetStyleTextReset();
switch (text->mUnicodeBidi) {
case NS_STYLE_UNICODE_BIDI_NORMAL:
break;
@ -633,8 +624,7 @@ nsBidiPresUtils::RepositionInlineFrames(nsIPresContext* aPresContext,
frame->GetBidiProperty(aPresContext, nsLayoutAtoms::baseLevel,
(void**) &alignRight,sizeof(alignRight));
if (0 == (alignRight & 1) ) {
const nsStyleText* styleText;
frame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
const nsStyleText* styleText = frame->GetStyleText();
if (NS_STYLE_TEXT_ALIGN_RIGHT == styleText->mTextAlign
|| NS_STYLE_TEXT_ALIGN_MOZ_RIGHT == styleText->mTextAlign) {

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

@ -569,8 +569,6 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
#ifdef IBMBIDI
PRUint8 bidiLevel=0;
// Mamdouh : modification of the caret to work at rtl and ltr with Bidi
const nsStyleVisibility* vis;
theFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&) vis);
//
// Direction Style from this->GetStyleData()
// now in (visibility->mDirection)
@ -594,7 +592,9 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
bidiLevel &= ~BIDI_LEVEL_UNDEFINED;
// There has been a reflow, so we reset the cursor Bidi level to the level of the current frame
if (!presContext) // Use the style default or default to 0
newBidiLevel = (vis) ? vis->mDirection : 0;
{
newBidiLevel = theFrame->GetStyleVisibility()->mDirection;
}
else
{
theFrame->GetBidiProperty(presContext, nsLayoutAtoms::embeddingLevel,
@ -740,21 +740,17 @@ PRBool nsCaret::SetupDrawingFrameAndOffset(nsIDOMNode* aNode, PRInt32 aOffset, n
#endif // IBMBIDI
// now we have a frame, check whether it's appropriate to show the caret here
const nsStyleUserInterface* userinterface;
theFrame->GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface);
if (userinterface)
{
if (
const nsStyleUserInterface* userinterface = theFrame->GetStyleUserInterface();
if (
#ifdef SUPPORT_USER_MODIFY
// editable content still defaults to NS_STYLE_USER_MODIFY_READ_ONLY at present. See bug 15284
(userinterface->mUserModify == NS_STYLE_USER_MODIFY_READ_ONLY) ||
// editable content still defaults to NS_STYLE_USER_MODIFY_READ_ONLY at present. See bug 15284
(userinterface->mUserModify == NS_STYLE_USER_MODIFY_READ_ONLY) ||
#endif
(userinterface->mUserInput == NS_STYLE_USER_INPUT_NONE) ||
(userinterface->mUserInput == NS_STYLE_USER_INPUT_DISABLED))
{
return PR_FALSE;
}
}
(userinterface->mUserInput == NS_STYLE_USER_INPUT_NONE) ||
(userinterface->mUserInput == NS_STYLE_USER_INPUT_DISABLED))
{
return PR_FALSE;
}
// mark the frame, so we get notified on deletion.
// frames are never unmarked, which means that we'll touch every frame we visit.
@ -1035,12 +1031,10 @@ void nsCaret::GetCaretRectAndInvert()
// after we've got an RC.
if (frameRect.height == 0)
{
const nsStyleFont* fontStyle;
const nsStyleVisibility* vis;
mLastCaretFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)fontStyle);
mLastCaretFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleFont* fontStyle = mLastCaretFrame->GetStyleFont();
const nsStyleVisibility* vis = mLastCaretFrame->GetStyleVisibility();
nsCOMPtr<nsIAtom> langGroup;
if (vis && vis->mLanguage)
if (vis->mLanguage)
vis->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
mRendContext->SetFont(fontStyle->mFont, langGroup);
@ -1097,10 +1091,8 @@ void nsCaret::GetCaretRectAndInvert()
{
caretRect.x -= caretXMost - frameXMost;
const nsStyleVisibility* vis;
const nsStyleText* textStyle;
mLastCaretFrame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textStyle);
mLastCaretFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleText* textStyle = mLastCaretFrame->GetStyleText();
const nsStyleVisibility* vis = mLastCaretFrame->GetStyleVisibility();
if ((vis->mDirection == NS_STYLE_DIRECTION_LTR &&
textStyle->mTextAlign == NS_STYLE_TEXT_ALIGN_RIGHT) ||

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

@ -544,9 +544,7 @@ nsFocusIterator::GetRealFrame(nsIFrame* aFrame)
PRBool
nsFocusIterator::IsPopupFrame(nsIFrame* aFrame)
{
nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
return (display->mDisplay == NS_STYLE_DISPLAY_POPUP);
return (aFrame->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_POPUP);
}
nsIFrame*

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

@ -257,7 +257,7 @@ nsImageLoader::RedrawDirtyFrame(const nsRect* aDamageRect)
// with the damaged rect.
nsStyleContext* styleContext;
mFrame->GetStyleContext(&styleContext);
const nsStyleBackground* bg = (const nsStyleBackground*)styleContext->GetStyleData(eStyleStruct_Background);
const nsStyleBackground* bg = styleContext->GetStyleBackground();
if ((bg->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE) ||
(bg->mBackgroundRepeat == NS_STYLE_BG_REPEAT_OFF)) {

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

@ -986,11 +986,7 @@ nsPresContext::GetXBLBindingURL(nsIContent* aContent, nsAString& aResult)
sc = ResolveStyleContextFor(aContent, nsnull);
NS_ENSURE_TRUE(sc, NS_ERROR_FAILURE);
const nsStyleDisplay* display;
::GetStyleData(sc.get(), &display);
NS_ENSURE_TRUE(display, NS_ERROR_NULL_POINTER);
aResult = display->mBinding;
aResult = sc->GetStyleDisplay()->mBinding;
return NS_OK;
}

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

@ -144,8 +144,7 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext* aPresContext,
GetButtonOuterFocusRect(aRect, rect);
const nsStyleBorder* border;
::GetStyleData(mOuterFocusStyle.get(), &border);
const nsStyleBorder* border = mOuterFocusStyle->GetStyleBorder();
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
aDirtyRect, rect, *border, mOuterFocusStyle, 0);
}
@ -155,8 +154,7 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext* aPresContext,
GetButtonInnerFocusRect(aRect, rect);
const nsStyleBorder* border;
::GetStyleData(mInnerFocusStyle.get(), &border);
const nsStyleBorder* border = mInnerFocusStyle->GetStyleBorder();
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
aDirtyRect, rect, *border, mInnerFocusStyle, 0);
}
@ -176,10 +174,8 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsIPresContext* aPresContext,
nsStyleContext* context = mFrame->GetStyleContext();
const nsStyleBorder* border =
(const nsStyleBorder*)context->GetStyleData(eStyleStruct_Border);
const nsStylePadding* padding =
(const nsStylePadding*)context->GetStyleData(eStyleStruct_Padding);
const nsStyleBorder* border = context->GetStyleBorder();
const nsStylePadding* padding = context->GetStylePadding();
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
aDirtyRect, buttonRect, *border, *padding,
@ -267,7 +263,7 @@ nsButtonFrameRenderer::GetButtonInnerFocusMargin()
if (mInnerFocusStyle) {
// get the outer focus border and padding
const nsStyleMargin* margin = (const nsStyleMargin*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* margin = mInnerFocusStyle->GetStyleMargin();
margin->GetMargin(innerFocusMargin);
}

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

@ -839,8 +839,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize)
{
//printf("*****************\n");
const nsStyleFont* dspFont;
mDisplayFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct *&)dspFont);
const nsStyleFont* dspFont = mDisplayFrame->GetStyleFont();
nsCOMPtr<nsIDeviceContext> deviceContext;
aPresContext->GetDeviceContext(getter_AddRefs(deviceContext));
NS_ASSERTION(deviceContext, "Couldn't get the device context");
@ -1021,8 +1020,7 @@ nsComboboxControlFrame::ReflowCombobox(nsIPresContext * aPresContext,
kidReflowState.reason = reason;
#ifdef IBMBIDI
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = GetStyleVisibility();
// M14 didn't calculate the RightEdge in the reflow
// Unless we set the width to some thing other than unrestricted
@ -1780,9 +1778,7 @@ nsComboboxControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
if ( mRect.Contains(aPoint) &&
(aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) ) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (vis->IsVisible()) {
if (GetStyleVisibility()->IsVisible()) {
*aFrame = this;
return NS_OK;
}
@ -2117,8 +2113,7 @@ nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
// If we have style that affects how we are selected, feed event down to
// nsFrame::HandleEvent so that selection takes place when appropriate.
const nsStyleUserInterface* uiStyle;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
return nsAreaFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
@ -2545,10 +2540,8 @@ nsComboboxControlFrame::Paint(nsIPresContext* 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()) {
nsCOMPtr<nsIEventStateManager> stateManager;
nsresult rv = mPresContext->GetEventStateManager(getter_AddRefs(stateManager));
if (NS_SUCCEEDED(rv)) {
@ -2556,9 +2549,7 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
aRenderingContext.SetLineStyle(nsLineStyle_kDotted);
aRenderingContext.SetColor(0);
} else {
const nsStyleBackground* myColor =
(const nsStyleBackground*)mStyleContext->GetStyleData(eStyleStruct_Background);
aRenderingContext.SetColor(myColor->mBackgroundColor);
aRenderingContext.SetColor(GetStyleBackground()->mBackgroundColor);
aRenderingContext.SetLineStyle(nsLineStyle_kSolid);
}
//aRenderingContext.DrawRect(clipRect);

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

@ -196,10 +196,8 @@ nsFieldSetFrame::Paint(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) &&
isVisible && mRect.width && mRect.height) {
PRIntn skipSides = GetSkipSides();
const nsStyleBorder* borderStyle =
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
const nsStylePadding* paddingStyle =
(const nsStylePadding*)mStyleContext->GetStyleData(eStyleStruct_Padding);
const nsStyleBorder* borderStyle = GetStyleBorder();
const nsStylePadding* paddingStyle = GetStylePadding();
nsMargin border;
if (!borderStyle->GetBorder(border)) {
@ -390,9 +388,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
nsMargin legendMargin(0,0,0,0);
// reflow the legend only if needed
if (mLegendFrame) {
const nsStyleMargin* marginStyle;
mLegendFrame->GetStyleData(eStyleStruct_Margin,
(const nsStyleStruct*&) marginStyle);
const nsStyleMargin* marginStyle = mLegendFrame->GetStyleMargin();
marginStyle->GetMargin(legendMargin);
if (reflowLegend) {
@ -528,9 +524,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
} else {
// if we don't need to reflow just get the old size
mContentFrame->GetRect(contentRect);
const nsStyleMargin* marginStyle;
mContentFrame->GetStyleData(eStyleStruct_Margin,
(const nsStyleStruct*&) marginStyle);
const nsStyleMargin* marginStyle = mContentFrame->GetStyleMargin();
nsMargin m(0,0,0,0);
marginStyle->GetMargin(m);

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

@ -374,8 +374,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
// except for when style is used to change its size.
nsresult rv = nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
if (NS_SUCCEEDED(rv) && mTextFrame != nsnull) {
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = GetStyleVisibility();
nsIFrame * child;
FirstChild(aPresContext, nsnull, &child);
@ -558,10 +557,7 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
{
#ifndef DEBUG_NEWFRAME
if ( nsFormControlHelper::GetDisabled(mContent) && mRect.Contains(aPoint) ) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (vis->IsVisible()) {
if (GetStyleVisibility()->IsVisible()) {
*aFrame = this;
return NS_OK;
}

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

@ -499,9 +499,9 @@ nsFormControlFrame::DidReflow(nsIPresContext* aPresContext,
nsIView* view = nsnull;
GetView(aPresContext, &view);
if (view) {
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, ((const nsStyleStruct *&)vis));
nsViewVisibility newVis = vis->IsVisible() ? nsViewVisibility_kShow : nsViewVisibility_kHide;
nsViewVisibility newVis = GetStyleVisibility()->IsVisible()
? nsViewVisibility_kShow
: nsViewVisibility_kHide;
nsViewVisibility oldVis;
// only change if different.
view->GetVisibility(oldVis);
@ -734,8 +734,7 @@ nsFormControlFrame::HandleEvent(nsIPresContext* aPresContext,
}
// Check for user-input:none style
const nsStyleUserInterface* uiStyle;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);

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

@ -197,9 +197,7 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
}
// Compress whitespace out of label if needed.
const nsStyleText* textStyle;
GetStyleData(eStyleStruct_Text, (const nsStyleStruct *&)textStyle);
if (!textStyle->WhiteSpaceIsSignificant()) {
if (!GetStyleText()->WhiteSpaceIsSignificant()) {
value.CompressWhitespace();
} else if (value.Length() > 2 && value[0] == ' ' &&
value[value.Length() - 1] == ' '){
@ -422,8 +420,7 @@ nsGfxButtonControlFrame::HandleEvent(nsIPresContext* aPresContext,
// takes cares of calling MouseClicked for us.
// do we have user-input style?
const nsStyleUserInterface* uiStyle;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);

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

@ -178,7 +178,7 @@ nsGfxCheckboxControlFrame::PaintCheckBox(nsIPresContext* aPresContext,
const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer)
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = GetStyleDisplay();
if (disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
@ -197,8 +197,7 @@ nsGfxCheckboxControlFrame::PaintCheckBox(nsIPresContext* aPresContext,
nsRect checkRect(0,0, mRect.width, mRect.height);
checkRect.Deflate(borderPadding);
const nsStyleColor* color = (const nsStyleColor*)
mStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleColor* color = GetStyleColor();
aRenderingContext.SetColor(color->mColor);
// Get current checked state through content model.
@ -230,16 +229,12 @@ nsGfxCheckboxControlFrame::Paint(nsIPresContext* aPresContext,
PRBool doDefaultPainting = PR_TRUE;
// Paint the checkmark
if (!mCheckButtonFaceStyle && GetCheckboxState()) {
const nsStyleBackground* myColor = (const nsStyleBackground*)
mCheckButtonFaceStyle->GetStyleData(eStyleStruct_Background);
const nsStyleBackground* myColor = mCheckButtonFaceStyle->GetStyleBackground();
if (myColor->mBackgroundImage.Length() > 0) {
const nsStyleBorder* myBorder = (const nsStyleBorder*)
mCheckButtonFaceStyle->GetStyleData(eStyleStruct_Border);
const nsStylePadding* myPadding = (const nsStylePadding*)
mCheckButtonFaceStyle->GetStyleData(eStyleStruct_Padding);
const nsStylePosition* myPosition = (const nsStylePosition*)
mCheckButtonFaceStyle->GetStyleData(eStyleStruct_Position);
const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder();
const nsStylePadding* myPadding = mCheckButtonFaceStyle->GetStylePadding();
const nsStylePosition* myPosition = mCheckButtonFaceStyle->GetStylePosition();
nscoord width = myPosition->mWidth.GetCoordValue();
nscoord height = myPosition->mHeight.GetCoordValue();

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

@ -155,8 +155,7 @@ nsGfxRadioControlFrame::HandleEvent(nsIPresContext* aPresContext,
nsEventStatus* aEventStatus)
{
// Check for user-input:none style
const nsStyleUserInterface* uiStyle;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
@ -170,7 +169,7 @@ nsGfxRadioControlFrame::PaintRadioButton(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect)
{
const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = GetStyleDisplay();
if (disp->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
@ -183,18 +182,11 @@ nsGfxRadioControlFrame::PaintRadioButton(nsIPresContext* aPresContext,
if (checked) {
// Paint the button for the radio button using CSS background rendering code
if (nsnull != mRadioButtonFaceStyle) {
const nsStyleBackground* myColor = (const nsStyleBackground*)
mRadioButtonFaceStyle->GetStyleData(eStyleStruct_Background);
const nsStyleColor* color = (const nsStyleColor*)
mRadioButtonFaceStyle->GetStyleData(eStyleStruct_Color);
const nsStyleBorder* myBorder = (const nsStyleBorder*)
mRadioButtonFaceStyle->GetStyleData(eStyleStruct_Border);
const nsStylePadding* myPadding = (const nsStylePadding*)
mRadioButtonFaceStyle->GetStyleData(eStyleStruct_Padding);
const nsStylePosition* myPosition = (const nsStylePosition*)
mRadioButtonFaceStyle->GetStyleData(eStyleStruct_Position);
const nsStyleBackground* myColor = mRadioButtonFaceStyle->GetStyleBackground();
const nsStyleColor* color = mRadioButtonFaceStyle->GetStyleColor();
const nsStyleBorder* myBorder = mRadioButtonFaceStyle->GetStyleBorder();
const nsStylePadding* myPadding = mRadioButtonFaceStyle->GetStylePadding();
const nsStylePosition* myPosition = mRadioButtonFaceStyle->GetStylePosition();
nscoord width = myPosition->mWidth.GetCoordValue();
nscoord height = myPosition->mHeight.GetCoordValue();

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

@ -129,9 +129,7 @@ nsHTMLButtonControlFrame::Init(nsIPresContext* aPresContext,
nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
mRenderer.SetFrame(this,aPresContext);
// cache our display type
const nsStyleDisplay* styleDisplay;
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay);
mInline = (NS_STYLE_DISPLAY_BLOCK != GetStyleDisplay()->mDisplay);
PRUint32 flags = NS_BLOCK_SPACE_MGR;
if (mInline) {
@ -309,10 +307,7 @@ nsHTMLButtonControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
{
if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND &&
mRect.Contains(aPoint)) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (vis->IsVisible()) {
if (GetStyleVisibility()->IsVisible()) {
*aFrame = this;
return NS_OK;
}
@ -380,8 +375,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext* aPresContext,
// but the real problem is the FirstChild (the AreaFrame)
// isn't being constrained properly
// Bug #17474
const nsStyleBorder* borderStyle;
GetStyleData(eStyleStruct_Border, (const nsStyleStruct *&)borderStyle);
const nsStyleBorder* borderStyle = GetStyleBorder();
nsMargin border;
border.SizeTo(0, 0, 0, 0);
borderStyle->CalcBorderFor(this, border);
@ -465,9 +459,8 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
viewMan->InsertChild(parView, view, 0);
SetView(view);
const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color);
// set the opacity
viewMan->SetViewOpacity(view, color->mOpacity);
viewMan->SetViewOpacity(view, GetStyleColor()->mOpacity);
}
mDidInit = PR_TRUE;

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

@ -325,8 +325,7 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
}
// do we have user-input style?
const nsStyleUserInterface* uiStyle;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
@ -411,13 +410,8 @@ nsImageControlFrame::GetCursor(nsIPresContext* aPresContext,
{
// Use style defined cursor if one is provided, otherwise when
// the cursor style is "auto" we use the pointer cursor.
const nsStyleUserInterface* ui = (const nsStyleUserInterface*) mStyleContext->GetStyleData(eStyleStruct_UserInterface);
if (ui) {
aCursor = ui->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_POINTER;
}
} else {
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_POINTER;
}
return NS_OK;

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

@ -145,9 +145,7 @@ PRInt32 nsLegendFrame::GetAlign()
{
PRInt32 intValue = NS_STYLE_TEXT_ALIGN_LEFT;
#ifdef IBMBIDI
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
if (NS_STYLE_DIRECTION_RTL == GetStyleVisibility()->mDirection) {
intValue = NS_STYLE_TEXT_ALIGN_RIGHT;
}
#endif // IBMBIDI

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

@ -479,10 +479,7 @@ nsListControlFrame::Paint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
PRUint32 aFlags)
{
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
return PR_FALSE;
}
@ -526,8 +523,7 @@ nsListControlFrame::Paint(nsIPresContext* aPresContext,
if (isVisible) {
if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND) {
const nsStyleDisplay* displayData;
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct*&)displayData));
const nsStyleDisplay* displayData = GetStyleDisplay();
if (displayData->mAppearance) {
nsCOMPtr<nsITheme> theme;
aPresContext->GetTheme(getter_AddRefs(theme));
@ -939,8 +935,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
printf("\n");
#if 0
{
const nsStyleDisplay* display;
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
const nsStyleDisplay* display = GetStyleDisplay();
printf("+++++++++++++++++++++++++++++++++ ");
switch (display->mVisible) {
case NS_STYLE_VISIBILITY_COLLAPSE: printf("NS_STYLE_VISIBILITY_COLLAPSE\n");break;
@ -1183,7 +1178,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(result) && optFrame != nsnull) {
nsStyleContext* optStyle = optFrame->GetStyleContext();
if (optStyle) {
const nsStyleFont* styleFont = (const nsStyleFont*)optStyle->GetStyleData(eStyleStruct_Font);
const nsStyleFont* styleFont = optStyle->GetStyleFont();
nsCOMPtr<nsIDeviceContext> deviceContext;
aPresContext->GetDeviceContext(getter_AddRefs(deviceContext));
NS_ASSERTION(deviceContext, "Couldn't get the device context");
@ -1743,8 +1738,7 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext,
// do we have style that affects how we are selected?
// do we have user-input style?
const nsStyleUserInterface* uiStyle;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct *&)uiStyle);
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
@ -2787,8 +2781,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
}
}
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
const nsStyleVisibility* vis = GetStyleVisibility();
if (!vis->IsVisible()) {
REFLOW_DEBUG_MSG(">>>>>> Select is NOT visible");

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

@ -1690,8 +1690,7 @@ nsTextControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
rv = divContent->SetAttr(kNameSpaceID_None,nsHTMLAtoms::style, NS_ConvertASCIItoUCS2(DIV_STRING_SINGLELINE), PR_FALSE);
else {
nsAutoString divStr; divStr.AssignWithConversion(DIV_STRING);
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = GetStyleDisplay();
if (disp->mOverflow == NS_STYLE_OVERFLOW_SCROLL)
divStr += NS_LITERAL_STRING("overflow:scroll;");
else if (disp->mOverflow == NS_STYLE_OVERFLOW_HIDDEN)
@ -1942,8 +1941,7 @@ nsTextControlFrame::Reflow(nsIPresContext* aPresContext,
{ // fix for bug 40596, width:auto means the control sets it's mMaxElementWidth to it's default width
if (aDesiredSize.mComputeMEW)
{
nsStylePosition *stylePosition;
GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)stylePosition);
const nsStylePosition* stylePosition = GetStylePosition();
nsStyleUnit widthUnit = stylePosition->mWidth.GetUnit();
if (eStyleUnit_Auto == widthUnit) {
aDesiredSize.mMaxElementWidth = aDesiredSize.width;

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

@ -181,14 +181,12 @@ nsBlockBandData::ComputeAvailSpaceRect()
#ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT
printf("band %p checking !Avail trap %p with frame %p\n", this, trapezoid, trapezoid->mFrame);
#endif
const nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) {
PRInt32 j, numFrames = trapezoid->mFrames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (j = 0; j < numFrames; j++) {
nsIFrame* f = (nsIFrame*) trapezoid->mFrames->ElementAt(j);
f->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = f->GetStyleDisplay();
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
leftFloaters++;
}
@ -200,8 +198,7 @@ nsBlockBandData::ComputeAvailSpaceRect()
}
}
} else {
trapezoid->mFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = trapezoid->mFrame->GetStyleDisplay();
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
leftFloaters++;
}
@ -233,7 +230,6 @@ nsBlockBandData::ComputeAvailSpaceRect()
// When there is no available space, we still need a proper X
// coordinate to place objects that end up here anyway.
if (nsBandTrapezoid::Available != trapezoid->mState) {
const nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) {
// It's not clear what coordinate to use when there is no
// available space and the space is multiply occupied...So: If
@ -244,8 +240,7 @@ nsBlockBandData::ComputeAvailSpaceRect()
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (j = 0; j < numFrames; j++) {
nsIFrame* f = (nsIFrame*) trapezoid->mFrames->ElementAt(j);
f->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = f->GetStyleDisplay();
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
mAvailSpace.x = mAvailSpace.XMost();
break;
@ -253,8 +248,7 @@ nsBlockBandData::ComputeAvailSpaceRect()
}
}
else {
trapezoid->mFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = trapezoid->mFrame->GetStyleDisplay();
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
mAvailSpace.x = mAvailSpace.XMost();
}
@ -280,22 +274,18 @@ PRBool
nsBlockBandData::ShouldClearFrame(nsIFrame* aFrame, PRUint8 aBreakType)
{
PRBool result = PR_FALSE;
const nsStyleDisplay* display;
nsresult rv = aFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
if (NS_SUCCEEDED(rv) && (nsnull != display)) {
if (NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType) {
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
if (NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType) {
result = PR_TRUE;
}
else if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
if (NS_STYLE_CLEAR_LEFT == aBreakType) {
result = PR_TRUE;
}
else if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
if (NS_STYLE_CLEAR_LEFT == aBreakType) {
result = PR_TRUE;
}
}
else if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
if (NS_STYLE_CLEAR_RIGHT == aBreakType) {
result = PR_TRUE;
}
}
else if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
if (NS_STYLE_CLEAR_RIGHT == aBreakType) {
result = PR_TRUE;
}
}
return result;

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

@ -442,8 +442,7 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(it); // reference passed to caller
const nsStyleVisibility* visibility;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&) visibility);
const nsStyleVisibility* visibility = GetStyleVisibility();
nsresult rv = it->Init(mLines,
visibility->mDirection == NS_STYLE_DIRECTION_RTL);
if (NS_FAILED(rv)) {
@ -1224,38 +1223,22 @@ IsPercentageAwareChild(const nsIFrame* aFrame)
NS_ASSERTION(aFrame, "null frame is not allowed");
nsresult rv;
const nsStyleMargin* margin;
rv = aFrame->GetStyleData(eStyleStruct_Margin,(const nsStyleStruct*&) margin);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStyleMargin* margin = aFrame->GetStyleMargin();
if (nsLineLayout::IsPercentageUnitSides(&margin->mMargin)) {
return PR_TRUE;
}
const nsStylePadding* padding;
rv = aFrame->GetStyleData(eStyleStruct_Padding,(const nsStyleStruct*&) padding);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStylePadding* padding = aFrame->GetStylePadding();
if (nsLineLayout::IsPercentageUnitSides(&padding->mPadding)) {
return PR_TRUE;
}
const nsStyleBorder* border;
rv = aFrame->GetStyleData(eStyleStruct_Border,(const nsStyleStruct*&) border);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStyleBorder* border = aFrame->GetStyleBorder();
if (nsLineLayout::IsPercentageUnitSides(&border->mBorder)) {
return PR_TRUE;
}
const nsStylePosition* pos;
rv = aFrame->GetStyleData(eStyleStruct_Position,(const nsStyleStruct*&) pos);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStylePosition* pos = aFrame->GetStylePosition();
if (eStyleUnit_Percent == pos->mWidth.GetUnit()
|| eStyleUnit_Percent == pos->mMaxWidth.GetUnit()
@ -1745,8 +1728,7 @@ nsBlockFrame::RetargetInlineIncrementalReflow(nsReflowPath::iterator &aTarget,
nsIFrame *frame = NS_STATIC_CAST(nsIFrame *, path->ElementAt(i));
// Stop if we encounter a non-inline frame in the reflow path.
const nsStyleDisplay *display;
::GetStyleData(frame, &display);
const nsStyleDisplay* display = frame->GetStyleDisplay();
if (NS_STYLE_DISPLAY_INLINE != display->mDisplay)
break;
@ -1770,8 +1752,7 @@ PRBool
nsBlockFrame::IsLineEmpty(nsIPresContext* aPresContext,
const nsLineBox* aLine) const
{
const nsStyleText* styleText;
::GetStyleData(mStyleContext, &styleText);
const nsStyleText* styleText = GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
@ -1823,8 +1804,7 @@ nsBlockFrame::UpdateBulletPosition(nsBlockReflowState& aState)
// Don't bother if there is no bullet
return NS_OK;
}
const nsStyleList* styleList;
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&) styleList);
const nsStyleList* styleList = GetStyleList();
if (NS_STYLE_LIST_STYLE_POSITION_INSIDE == styleList->mListStylePosition) {
if (mBullet && HaveOutsideBullet()) {
// We now have an inside bullet, but used to have an outside
@ -1925,8 +1905,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
(NS_UNCONSTRAINEDSIZE != aState.mReflowState.availableWidth)) {
// If the text is left-aligned, then we try and avoid reflowing the lines
const nsStyleText* styleText = (const nsStyleText*)
mStyleContext->GetStyleData(eStyleStruct_Text);
const nsStyleText* styleText = GetStyleText();
if ((NS_STYLE_TEXT_ALIGN_LEFT == styleText->mTextAlign) ||
((NS_STYLE_TEXT_ALIGN_DEFAULT == styleText->mTextAlign) &&
@ -1941,14 +1920,13 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
}
if (gNoisyReflow) {
if (!tryAndSkipLines) {
const nsStyleText* mStyleText = (const nsStyleText*)
mStyleContext->GetStyleData(eStyleStruct_Text);
const nsStyleText* styleText = GetStyleText();
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n",
aState.mReflowState.reason,
aState.mReflowState.availableWidth,
mStyleText->mTextAlign);
styleText->mTextAlign);
}
}
#endif
@ -2954,8 +2932,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
shell->AppendReflowCommand(reflowCmd);
}
else if (nsHTMLAtoms::value == aAttribute) {
const nsStyleDisplay* styleDisplay;
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
const nsStyleDisplay* styleDisplay = GetStyleDisplay();
if (NS_STYLE_DISPLAY_LIST_ITEM == styleDisplay->mDisplay) {
nsIFrame* nextAncestor = mParent;
nsBlockFrame* blockParent = nsnull;
@ -3026,8 +3003,7 @@ nsBlockFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
// empty.
*aResult = PR_FALSE;
const nsStylePosition* position;
::GetStyleData(this, &position);
const nsStylePosition* position = GetStylePosition();
switch (position->mMinHeight.GetUnit()) {
case eStyleUnit_Coord:
@ -3057,10 +3033,8 @@ nsBlockFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
return NS_OK;
}
const nsStyleBorder* border = NS_STATIC_CAST(const nsStyleBorder*,
mStyleContext->GetStyleData(eStyleStruct_Border));
const nsStylePadding* padding = NS_STATIC_CAST(const nsStylePadding*,
mStyleContext->GetStyleData(eStyleStruct_Padding));
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsStyleCoord coord;
if ((border->IsBorderSideVisible(NS_SIDE_TOP) &&
!IsBorderZero(border->mBorder.GetTopUnit(),
@ -3075,8 +3049,7 @@ nsBlockFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
return NS_OK;
}
const nsStyleText* styleText;
::GetStyleData(this, &styleText);
const nsStyleText* styleText = GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
// Now the only thing that could make us non-empty is one of the lines
@ -3113,8 +3086,7 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
// Determine if this line is "essentially" the first line
//
const nsStyleText* styleText;
::GetStyleData(this, &styleText);
const nsStyleText* styleText = GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
@ -3235,9 +3207,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
}
// Prepare the block reflow engine
const nsStyleDisplay* display;
frame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&) display);
const nsStyleDisplay* display = frame->GetStyleDisplay();
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowState,
aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH),
aState.GetFlag(BRS_COMPUTEMAXWIDTH));
@ -4268,8 +4238,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
// Only block frames horizontally align their children because
// inline frames "shrink-wrap" around their children (therefore
// there is no extra horizontal space).
const nsStyleText* styleText = (const nsStyleText*)
mStyleContext->GetStyleData(eStyleStruct_Text);
const nsStyleText* styleText = GetStyleText();
PRBool allowJustify = NS_STYLE_TEXT_ALIGN_JUSTIFY == styleText->mTextAlign &&
!aLineLayout.GetLineEndsInBR() &&
ShouldJustifyLine(aState, aLine);
@ -4599,9 +4568,8 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
if (nsLayoutAtoms::placeholderFrame == frameType.get()) {
nsIFrame *outOfFlowFrame = NS_STATIC_CAST(nsPlaceholderFrame*, frame)->GetOutOfFlowFrame();
if (outOfFlowFrame) {
const nsStyleDisplay* display = nsnull;
outOfFlowFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
if (display && !display->IsAbsolutelyPositioned()) {
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
if (!display->IsAbsolutelyPositioned()) {
// It's not an absolute or fixed positioned frame, so it
// must be a floater!
outOfFlowFrame->SetParent(this);
@ -5003,9 +4971,7 @@ nsBlockFrame::DoRemoveOutOfFlowFrame(nsIPresContext* aPresContext,
nsBlockFrame::DoRemoveOutOfFlowFrame(aPresContext, nextInFlow);
}
// Now remove aFrame
const nsStyleDisplay* display = nsnull;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
NS_ASSERTION(display, "program error");
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
// find the containing block, this is either the parent or the grandparent
// if the parent is an inline frame
nsIFrame* parent;
@ -5271,9 +5237,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
availWidth = NS_UNCONSTRAINEDSIZE;
}
else {
const nsStyleDisplay* floaterDisplay;
floater->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)floaterDisplay);
const nsStyleDisplay* floaterDisplay = floater->GetStyleDisplay();
nsCompatibility mode;
aState.mPresContext->GetCompatibilityMode(&mode);
@ -5312,9 +5276,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
// If the floater's width is automatic, we can't let the floater's
// width shrink below its maxElementWidth.
const nsStylePosition* position;
floater->GetStyleData(eStyleStruct_Position,
NS_REINTERPRET_CAST(const nsStyleStruct*&, position));
const nsStylePosition* position = floater->GetStylePosition();
PRBool isAutoWidth = (eStyleUnit_Auto == position->mWidth.GetUnit());
// We'll need to compute the max element size if either 1) we're
@ -5521,9 +5483,7 @@ nsBlockFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
{
// first check to see if we are visible
if (aCheckVis) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
*aIsVisible = PR_FALSE;
return NS_OK;
}
@ -5607,8 +5567,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext,
if (paintingSuppressed)
return NS_OK;
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = GetStyleDisplay();
// If overflow is hidden then set the clip rect so that children don't
// leak out of us. Note that because overflow'-clip' only applies to
@ -6103,8 +6062,7 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
nsFrameState childState;
aChild->GetFrameState(&childState);
if (childState & NS_FRAME_OUT_OF_FLOW) {
const nsStyleDisplay* disp;
aChild->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)disp);
const nsStyleDisplay* disp = aChild->GetStyleDisplay();
if (disp->IsAbsolutelyPositioned()) {
// Generate a reflow command to reflow our dirty absolutely
@ -6304,14 +6262,12 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
// Create list bullet if this is a list-item. Note that this is done
// here so that RenumberLists will work (it needs the bullets to
// store the bullet numbers).
const nsStyleDisplay* styleDisplay;
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
const nsStyleDisplay* styleDisplay = GetStyleDisplay();
if ((nsnull == mPrevInFlow) &&
(NS_STYLE_DISPLAY_LIST_ITEM == styleDisplay->mDisplay) &&
(nsnull == mBullet)) {
// Resolve style for the bullet frame
const nsStyleList* styleList;
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&) styleList);
const nsStyleList* styleList = GetStyleList();
nsIAtom *pseudoElement;
switch (styleList->mListStyleType) {
case NS_STYLE_LIST_STYLE_DISC:
@ -6354,9 +6310,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
PRBool
nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
{
const nsStyleContent* styleContent;
aFrame->GetStyleData(eStyleStruct_Content,
(const nsStyleStruct*&) styleContent);
const nsStyleContent* styleContent = aFrame->GetStyleContent();
if (0 != styleContent->CounterResetCount()) {
// Winner
return PR_TRUE;
@ -6453,9 +6407,7 @@ nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
// If the frame is a list-item and the frame implements our
// block frame API then get its bullet and set the list item
// ordinal.
const nsStyleDisplay* display;
kid->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&) display);
const nsStyleDisplay* display = kid->GetStyleDisplay();
if (NS_STYLE_DISPLAY_LIST_ITEM == display->mDisplay) {
// Make certain that the frame is a block frame in case
// something foreign has crept in.
@ -6543,10 +6495,6 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
mBullet->WillReflow(aState.mPresContext);
mBullet->Reflow(aState.mPresContext, aMetrics, reflowState, status);
#ifdef IBMBIDI
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
#endif // IBMBIDI
// Place the bullet now; use its right margin to distance it
// from the rest of the frames in the line
nscoord x =
@ -6554,7 +6502,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
// For direction RTL: set x to the right margin for now.
// This value will be used to indent the bullet from the right most
// egde of the previous frame in nsLineLayout::HorizontalAlignFrames.
(NS_STYLE_DIRECTION_RTL == vis->mDirection)
(NS_STYLE_DIRECTION_RTL == GetStyleVisibility()->mDirection)
? reflowState.mComputedMargin.right :
#endif // IBMBIDI
- reflowState.mComputedMargin.right - aMetrics.width;

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

@ -111,8 +111,7 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(nsIPresContext* aPresContext,
nsCompatibility compat;
aPresContext->GetCompatibilityMode(&compat);
const nsStyleText* text;
::GetStyleData(bf, &text);
const nsStyleText* text = bf->GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == text->mWhiteSpace;
@ -374,11 +373,9 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
* All other blocks proceed normally.
*/
// XXXldb We should really fix this in nsHTMLReflowState::InitConstraints instead.
const nsStylePosition* position;
mFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position);
const nsStylePosition* position = mFrame->GetStylePosition();
nsStyleUnit widthUnit = position->mWidth.GetUnit();
const nsStyleDisplay* display;
mFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
const nsStyleDisplay* display = mFrame->GetStyleDisplay();
if ((eStyleUnit_Auto == widthUnit) &&
((NS_STYLE_FLOAT_LEFT == display->mFloats) ||
@ -723,9 +720,7 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
mMetrics.height);
// Apply CSS relative positioning to update x,y coordinates
const nsStyleDisplay* styleDisp;
mFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisp);
const nsStyleDisplay* styleDisp = mFrame->GetStyleDisplay();
if (NS_STYLE_POSITION_RELATIVE == styleDisp->mPosition) {
x += aComputedOffsets.left;
y += aComputedOffsets.top;
@ -791,8 +786,7 @@ nsBlockReflowContext::GetRealMarginLeftUnit()
// Get parent style context
sc = sc->GetParent();
if (sc) {
const nsStyleMargin* margin = (const nsStyleMargin*)
sc->GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* margin = sc->GetStyleMargin();
unit = margin->mMargin.GetLeftUnit();
}
}
@ -811,8 +805,7 @@ nsBlockReflowContext::GetRealMarginRightUnit()
// Get parent style context
sc = sc->GetParent();
if (sc) {
const nsStyleMargin* margin = (const nsStyleMargin*)
sc->GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* margin = sc->GetStyleMargin();
unit = margin->mMargin.GetRightUnit();
}
}

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

@ -150,9 +150,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
mPrevChild = nsnull;
mCurrentLine = aFrame->end_lines();
const nsStyleText* styleText;
mBlock->GetStyleData(eStyleStruct_Text,
(const nsStyleStruct*&) styleText);
const nsStyleText* styleText = mBlock->GetStyleText();
switch (styleText->mWhiteSpace) {
case NS_STYLE_WHITESPACE_PRE:
case NS_STYLE_WHITESPACE_NOWRAP:
@ -251,9 +249,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
if (mBand.GetFloaterCount()) {
// Use the float-edge property to determine how the child block
// will interact with the floater.
const nsStyleBorder* borderStyle;
aFrame->GetStyleData(eStyleStruct_Border,
(const nsStyleStruct*&) borderStyle);
const nsStyleBorder* borderStyle = aFrame->GetStyleBorder();
switch (borderStyle->mFloatEdge) {
default:
case NS_STYLE_FLOAT_EDGE_CONTENT: // content and only content does runaround of floaters
@ -270,9 +266,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
// The child block's border should be placed adjacent to,
// but not overlap the floater(s).
nsMargin m(0, 0, 0, 0);
const nsStyleMargin* styleMargin;
aFrame->GetStyleData(eStyleStruct_Margin,
(const nsStyleStruct*&) styleMargin);
const nsStyleMargin* styleMargin = aFrame->GetStyleMargin();
styleMargin->GetMargin(m); // XXX percentage margins
if (NS_STYLE_FLOAT_EDGE_PADDING == borderStyle->mFloatEdge) {
// Add in border too
@ -447,8 +441,7 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
mPrevBottomMargin.Zero();
nsBlockFrame *block = mBlock;
const nsStyleText* styleText;
::GetStyleData(block, &styleText);
const nsStyleText* styleText = block->GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
@ -855,9 +848,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
nsIFrame* floater = placeholder->GetOutOfFlowFrame();
// Grab the floater's display information
const nsStyleDisplay* floaterDisplay;
floater->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)floaterDisplay);
const nsStyleDisplay* floaterDisplay = floater->GetStyleDisplay();
// This will hold the floater's geometry when we've found a place
// for it to live.

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

@ -124,7 +124,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext,
nsresult rv = nsFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
const nsStyleList* myList = GetStyleList();
if (!myList->mListStyleImage.IsEmpty()) {
nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1", &rv));
@ -198,7 +198,7 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
PRBool isVisible;
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) && isVisible) {
const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
const nsStyleList* myList = GetStyleList();
PRUint8 listStyleType = myList->mListStyleType;
if (!myList->mListStyleImage.IsEmpty() && mImageRequest) {
@ -220,8 +220,8 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
}
}
const nsStyleFont* myFont = (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font);
const nsStyleColor* myColor = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleFont* myFont = GetStyleFont();
const nsStyleColor* myColor = GetStyleColor();
nsCOMPtr<nsIFontMetrics> fm;
aRenderingContext.SetColor(myColor->mColor);
@ -230,7 +230,7 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
nsCharType charType = eCharType_LeftToRight;
PRUint8 level = 0;
PRBool isBidiSystem = PR_FALSE;
const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
const nsStyleVisibility* vis = GetStyleVisibility();
PRUint32 hints = 0;
#endif // IBMBIDI
@ -1118,8 +1118,7 @@ nsBulletFrame::GetListItemText(nsIPresContext* aCX,
nsString& result)
{
#ifdef IBMBIDI
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = GetStyleVisibility();
// XXX For some of these systems, "." is wrong! This should really be
// pushed down into the individual cases!
@ -1366,7 +1365,7 @@ nsBulletFrame::GetDesiredSize(nsIPresContext* aCX,
const nsHTMLReflowState& aReflowState,
nsHTMLReflowMetrics& aMetrics)
{
const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
const nsStyleList* myList = GetStyleList();
nscoord ascent;
if (!myList->mListStyleImage.IsEmpty() && mImageRequest) {
@ -1463,8 +1462,7 @@ nsBulletFrame::GetDesiredSize(nsIPresContext* aCX,
}
}
const nsStyleFont* myFont =
(const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font);
const nsStyleFont* myFont = GetStyleFont();
nsCOMPtr<nsIFontMetrics> fm;
aCX->GetMetricsFor(myFont->mFont, getter_AddRefs(fm));
nscoord bulletSize;
@ -1589,7 +1587,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
nsCOMPtr<nsIURI> baseURI;
GetBaseURI(getter_AddRefs(baseURI));
const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
const nsStyleList* myList = GetStyleList();
if (!myList->mListStyleImage.IsEmpty()) {

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

@ -342,9 +342,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
}
if ( inThisFrame && aConsiderSelf ) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (vis->IsVisible()) {
if (GetStyleVisibility()->IsVisible()) {
*aFrame = this;
return NS_OK;
}
@ -517,8 +515,7 @@ NonZeroStyleCoord(const nsStyleCoord& aCoord) {
static PRBool
HasNonZeroBorderRadius(nsStyleContext* aStyleContext) {
const nsStyleBorder* border;
::GetStyleData(aStyleContext, &border);
const nsStyleBorder* border = aStyleContext->GetStyleBorder();
nsStyleCoord coord;
border->mBorderRadius.GetTop(coord);
@ -598,8 +595,7 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
}
// XXX we should also set widget transparency for XUL popups
const nsStyleDisplay* display;
::GetStyleData(aStyleContext, &display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
nsFrameState kidState;
aFrame->GetFrameState(&kidState);
@ -607,8 +603,7 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
// If we're showing the view but the frame is hidden, then the view is transparent
nsViewVisibility visibility;
aView->GetVisibility(visibility);
const nsStyleVisibility* vis;
::GetStyleData(aStyleContext, &vis);
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
if ((nsViewVisibility_kShow == visibility
&& NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible)
|| (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow
@ -659,10 +654,8 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
}
if (hasOverflowClip) {
const nsStyleBorder* borderStyle;
::GetStyleData(aStyleContext, &borderStyle);
const nsStylePadding* paddingStyle;
::GetStyleData(aStyleContext, &paddingStyle);
const nsStyleBorder* borderStyle = aStyleContext->GetStyleBorder();
const nsStylePadding* paddingStyle = aStyleContext->GetStylePadding();
nsMargin border, padding;
// XXX We don't support the 'overflow-clip' property yet so just use the
@ -794,8 +787,7 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
aStyleContext = aFrame->GetStyleContext();
}
const nsStyleVisibility* vis;
::GetStyleData(aStyleContext, &vis);
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
// Set the view's opacity
vm->SetViewOpacity(aView, vis->mOpacity);
@ -832,15 +824,13 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
nsViewVisibility_kHide);
}
const nsStyleDisplay* display;
::GetStyleData(aStyleContext, &display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
// See if the frame is being relatively positioned or absolutely
// positioned
PRBool isTopMostView = display->IsPositioned();
// Make sure z-index is correct
const nsStylePosition* position;
::GetStyleData(aStyleContext, &position);
const nsStylePosition* position = aStyleContext->GetStylePosition();
PRInt32 zIndex = 0;
PRBool autoZIndex = PR_FALSE;
@ -861,8 +851,7 @@ nsContainerFrame::FrameNeedsView(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsStyleContext* aStyleContext)
{
const nsStyleVisibility* vis;
::GetStyleData(aStyleContext, &vis);
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
if (vis->mOpacity != 1.0f) {
return PR_TRUE;
@ -878,8 +867,7 @@ nsContainerFrame::FrameNeedsView(nsIPresContext* aPresContext,
return PR_TRUE;
}
const nsStyleDisplay* display;
::GetStyleData(aStyleContext, &display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
if (NS_STYLE_POSITION_RELATIVE == display->mPosition) {
return PR_TRUE;

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

@ -398,22 +398,15 @@ nsresult NS_NewSelectionImageService(nsISelectionImageService** aResult)
// a handy utility to set font
void SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC)
{
const nsStyleFont *font = (const nsStyleFont*)
aSC->GetStyleData(eStyleStruct_Font);
NS_ASSERTION(font, "invalid font in style context");
const nsStyleFont* font = aSC->GetStyleFont();
const nsStyleVisibility* visibility = aSC->GetStyleVisibility();
if (font) {
const nsStyleVisibility* visibility = (const nsStyleVisibility*)
aSC->GetStyleData(eStyleStruct_Visibility);
NS_ASSERTION(visibility, "invalid visibility in style context");
nsCOMPtr<nsIAtom> langGroup;
if (visibility && visibility->mLanguage) {
visibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}
aRC->SetFont(font->mFont, langGroup);
nsCOMPtr<nsIAtom> langGroup;
if (visibility->mLanguage) {
visibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}
aRC->SetFont(font->mFont, langGroup);
}
nsresult
@ -754,10 +747,8 @@ nsFrame::SetOverflowClipRect(nsIRenderingContext& aRenderingContext)
// 'overflow-clip' only applies to block-level elements and replaced
// elements that have 'overflow' set to 'hidden', and it is relative
// to the content area and applies to content only (not border or background)
const nsStyleBorder* borderStyle;
const nsStylePadding* paddingStyle;
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderStyle);
GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingStyle);
const nsStyleBorder* borderStyle = GetStyleBorder();
const nsStylePadding* paddingStyle = GetStylePadding();
// Start with the 'auto' values and then factor in user specified values
nsRect clipRect(0, 0, mRect.width, mRect.height);
@ -959,12 +950,9 @@ nsFrame::PaintSelf(nsIPresContext* aPresContext,
}
// Paint our background and border
const nsStyleBorder* border;
::GetStyleData(mStyleContext, &border);
const nsStylePadding* padding;
::GetStyleData(mStyleContext, &padding);
const nsStyleOutline* outline;
::GetStyleData(mStyleContext, &outline);
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
const nsStyleOutline* outline = GetStyleOutline();
nsRect rect(0, 0, mRect.width, mRect.height);
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
@ -1166,10 +1154,7 @@ nsFrame::FrameOrParentHasSpecialSelectionStyle(PRUint8 aSelectionStyle, nsIFrame
while (thisFrame)
{
const nsStyleUserInterface* userinterface;
thisFrame->GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface);
if (userinterface->mUserSelect == aSelectionStyle)
if (thisFrame->GetStyleUserInterface()->mUserSelect == aSelectionStyle)
{
*foundFrame = thisFrame;
return NS_OK;
@ -1211,23 +1196,20 @@ nsFrame::IsSelectable(PRBool* aSelectable, PRUint8* aSelectStyle) const
nsIFrame* frame = (nsIFrame*)this;
while (frame && NS_SUCCEEDED(result)) {
const nsStyleUIReset* userinterface;
frame->GetStyleData(eStyleStruct_UIReset, (const nsStyleStruct*&)userinterface);
if (userinterface) {
switch (userinterface->mUserSelect) {
case NS_STYLE_USER_SELECT_ALL:
case NS_STYLE_USER_SELECT_NONE:
case NS_STYLE_USER_SELECT_MOZ_ALL:
// override the previous values
const nsStyleUIReset* userinterface = frame->GetStyleUIReset();
switch (userinterface->mUserSelect) {
case NS_STYLE_USER_SELECT_ALL:
case NS_STYLE_USER_SELECT_NONE:
case NS_STYLE_USER_SELECT_MOZ_ALL:
// override the previous values
selectStyle = userinterface->mUserSelect;
break;
default:
// otherwise return the first value which is not 'auto'
if (selectStyle == NS_STYLE_USER_SELECT_AUTO) {
selectStyle = userinterface->mUserSelect;
break;
default:
// otherwise return the first value which is not 'auto'
if (selectStyle == NS_STYLE_USER_SELECT_AUTO) {
selectStyle = userinterface->mUserSelect;
}
break;
}
}
break;
}
result = frame->GetParent(&frame);
}
@ -2224,9 +2206,7 @@ nsFrame::GetCursor(nsIPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
{
const nsStyleUserInterface* styleUserInterface;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)styleUserInterface);
aCursor = styleUserInterface->mCursor;
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_DEFAULT;
}
@ -2241,9 +2221,7 @@ nsFrame::GetFrameForPoint(nsIPresContext* aPresContext,
{
if ((aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) &&
(mRect.Contains(aPoint))) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)((nsStyleContext*)mStyleContext)->GetStyleData(eStyleStruct_Visibility);
if (vis->IsVisible()) {
if (GetStyleVisibility()->IsVisible()) {
*aFrame = this;
return NS_OK;
}
@ -2743,10 +2721,8 @@ nsFrame::Invalidate(nsIPresContext* aPresContext,
// Checks to see if the damaged rect should be infalted
// to include the outline
const nsStyleOutline* outline;
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline);
nscoord width;
outline->GetOutlineWidth(width);
GetStyleOutline()->GetOutlineWidth(width);
if (width > 0) {
damageRect.Inflate(width, width);
}
@ -2807,8 +2783,7 @@ nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
// Style sizing methods
NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const
{
const nsStyleDisplay* display;
::GetStyleData(mStyleContext, &display);
const nsStyleDisplay* display = GetStyleDisplay();
// Absolute positioning causes |display->mDisplay| to be set to block,
// if needed.
@ -3027,9 +3002,7 @@ nsFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
{
// first check to see if we are visible
if (aCheckVis) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)((nsStyleContext*)mStyleContext)->GetStyleData(eStyleStruct_Visibility);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
*aIsVisible = PR_FALSE;
return NS_OK;
}
@ -4828,17 +4801,11 @@ nsFrame::GetProperty(nsIPresContext* aPresContext,
return value;
}
NS_IMETHODIMP
nsFrame::GetStyleDataExternal(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const
/* virtual */ const nsStyleStruct*
nsFrame::GetStyleDataExternal(nsStyleStructID aSID) const
{
if (!mStyleContext) {
aStyleStruct = nsnull;
return NS_ERROR_FAILURE;
}
aStyleStruct = mStyleContext->GetStyleData(aSID);
return NS_OK;
NS_ASSERTION(mStyleContext, "unexpected null pointer");
return mStyleContext->GetStyleData(aSID);
}
#ifdef IBMBIDI

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

@ -394,8 +394,7 @@ public:
void* aPropertyValue,
NSFramePropertyDtorFunc aPropDtorFunc);
NS_IMETHOD GetStyleDataExternal(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const;
virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const;
#ifdef IBMBIDI
NS_IMETHOD GetBidiProperty(nsIPresContext* aPresContext,

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

@ -402,9 +402,7 @@ nsHTMLFrameOuterFrame::Init(nsIPresContext* aPresContext,
GetView(aPresContext, &view);
}
const nsStyleDisplay* disp;
aParent->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)disp));
if (disp->mDisplay == NS_STYLE_DISPLAY_DECK) {
if (aParent->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_DECK) {
nsCOMPtr<nsIWidget> widget;
view->GetWidget(*getter_AddRefs(widget));
@ -805,6 +803,9 @@ PRInt32 nsHTMLFrameInnerFrame::GetScrolling(nsIContent* aContent)
if (NS_SUCCEEDED(rv) && content) {
nsHTMLValue value;
// XXXldb This code belongs in the attribute mapping code for the
// content node -- otherwise it doesn't follow the CSS cascading
// rules correctly.
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetHTMLAttribute(nsHTMLAtoms::scrolling, value)) {
if (eHTMLUnit_Enumerated == value.GetUnit()) {
switch (value.GetIntValue()) {
@ -829,8 +830,7 @@ PRInt32 nsHTMLFrameInnerFrame::GetScrolling(nsIContent* aContent)
}
// Check style for overflow
const nsStyleDisplay* display;
GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display));
const nsStyleDisplay* display = GetStyleDisplay();
if (display->mOverflow)
returnValue = display->mOverflow;
}
@ -946,9 +946,7 @@ nsHTMLFrameInnerFrame::Paint(nsIPresContext* aPresContext,
GetDocShell(getter_AddRefs(docShell));
if (!docShell) {
const nsStyleBackground* color =
(const nsStyleBackground*)mStyleContext->
GetStyleData(eStyleStruct_Background);
const nsStyleBackground* color = GetStyleBackground();
aRenderingContext.SetColor(color->mBackgroundColor);
aRenderingContext.FillRect(mRect);
@ -1032,9 +1030,9 @@ nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext,
nsIView* view = nsnull;
GetView(aPresContext, &view);
if (view) {
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, ((const nsStyleStruct *&)vis));
nsViewVisibility newVis = vis->IsVisible() ? nsViewVisibility_kShow : nsViewVisibility_kHide;
nsViewVisibility newVis = GetStyleVisibility()->IsVisible()
? nsViewVisibility_kShow
: nsViewVisibility_kHide;
nsViewVisibility oldVis;
// only change if different.
view->GetVisibility(oldVis);
@ -1162,9 +1160,7 @@ nsHTMLFrameInnerFrame::CreateViewAndWidget(nsIPresContext* aPresContext,
// XXX the following should be unnecessary, given the above Sync call
// if the visibility is hidden, reflect that in the view
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, ((const nsStyleStruct *&)vis));
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
viewMan->SetViewVisibility(view, nsViewVisibility_kHide);
}
view->GetWidget(*aWidget);

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

@ -274,12 +274,7 @@ nsGfxScrollFrame::ScrollTo(nsIPresContext* aContext, nscoord aX, nscoord aY, PRU
NS_IMETHODIMP
nsGfxScrollFrame::GetScrollPreference(nsIPresContext* aPresContext, nsScrollPref* aScrollPreference) const
{
const nsStyleDisplay* styleDisplay = nsnull;
GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
switch (styleDisplay->mOverflow)
switch (GetStyleDisplay()->mOverflow)
{
case NS_STYLE_OVERFLOW_SCROLL:
*aScrollPreference = AlwaysScroll;
@ -702,10 +697,7 @@ nsGfxScrollFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
nsIFrame* frame = nsnull;
GetFrame(&frame);
const nsStyleDisplay* styleDisplay = nsnull;
frame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
const nsStyleDisplay* styleDisplay = frame->GetStyleDisplay();
nsSize vSize(0,0);
if (mInner->mVScrollbarBox &&
@ -796,10 +788,7 @@ nsGfxScrollFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
nsIFrame* frame = nsnull;
GetFrame(&frame);
const nsStyleDisplay* styleDisplay = nsnull;
frame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
const nsStyleDisplay* styleDisplay = frame->GetStyleDisplay();
nsresult rv = mInner->mScrollAreaBox->GetMinSize(aState, aSize);
@ -1114,8 +1103,7 @@ nsGfxScrollFrameInner::AddHorizontalScrollbar(nsBoxLayoutState& aState, nsRect&
#ifdef IBMBIDI
PRInt32 dir = GetIntegerAttribute(mHScrollbarBox, nsXULAtoms::dir, -1);
const nsStyleVisibility* vis;
mOuter->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = mOuter->GetStyleVisibility();
// when creating the scrollbar for the first time, or whenever
// display direction is changed, scroll the view horizontally
@ -1308,8 +1296,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
PRBool scrollBarBottom = PR_TRUE;
#ifdef IBMBIDI
const nsStyleVisibility* vis;
mOuter->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = mOuter->GetStyleVisibility();
//
// Direction Style from this->GetStyleData()
@ -1333,11 +1320,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
nsIFrame* frame = nsnull;
mOuter->GetFrame(&frame);
const nsStyleDisplay* styleDisplay = nsnull;
frame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
const nsStyleDisplay* styleDisplay = frame->GetStyleDisplay();
// get the content rect
nsRect clientRect(0,0,0,0);
@ -1455,8 +1438,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
}
#ifdef IBMBIDI
const nsStyleVisibility* ourVis;
frame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)ourVis);
const nsStyleVisibility* ourVis = frame->GetStyleVisibility();
if (NS_STYLE_DIRECTION_RTL == ourVis->mDirection) {
nsCOMPtr<nsITextControlFrame> textControl(
@ -1499,8 +1481,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
float p2t;
presContext->GetScaledPixelsToTwips(&p2t);
mOnePixel = NSIntPixelsToTwips(1, p2t);
const nsStyleFont* font;
mOuter->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&) font);
const nsStyleFont* font = mOuter->GetStyleFont();
const nsFont& f = font->mFont;
nsCOMPtr<nsIFontMetrics> fm;
presContext->GetMetricsFor(f, getter_AddRefs(fm));

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

@ -117,8 +117,7 @@ nsHTMLContainerFrame::PaintDecorationsAndChildren(
if (decorations & (NS_STYLE_TEXT_DECORATION_UNDERLINE |
NS_STYLE_TEXT_DECORATION_OVERLINE |
NS_STYLE_TEXT_DECORATION_LINE_THROUGH)) {
const nsStyleFont* font;
::GetStyleData(this, &font);
const nsStyleFont* font = GetStyleFont();
NS_ASSERTION(font->mFont.decorations == NS_FONT_DECORATION_NONE,
"fonts on style structs shouldn't have decorations");
@ -170,14 +169,10 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext,
NS_STYLE_TEXT_DECORATION_OVERLINE |
NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
const nsStyleTextReset* styleText;
::GetStyleData(mStyleContext, &styleText);
if (!aIsBlock) {
aDecorations = styleText->mTextDecoration & decorMask;
aDecorations = GetStyleTextReset()->mTextDecoration & decorMask;
if (aDecorations) {
const nsStyleColor* styleColor;
::GetStyleData(mStyleContext, &styleColor);
const nsStyleColor* styleColor = GetStyleColor();
aUnderColor = styleColor->mColor;
aOverColor = styleColor->mColor;
aStrikeColor = styleColor->mColor;
@ -189,8 +184,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext,
// find text-decorations. "Inherit" from parent *block* frames
nsStyleContext* styleContext = frame->GetStyleContext();
const nsStyleDisplay* styleDisplay;
::GetStyleData(styleContext, &styleDisplay);
const nsStyleDisplay* styleDisplay = styleContext->GetStyleDisplay();
if (!styleDisplay->IsBlockLevel() &&
styleDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
// If an inline frame is discovered while walking up the tree,
@ -199,25 +193,24 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext,
break;
}
::GetStyleData(styleContext, &styleText);
const nsStyleTextReset* styleText = styleContext->GetStyleTextReset();
PRUint8 decors = decorMask & styleText->mTextDecoration;
if (decors) {
// A *new* text-decoration is found.
const nsStyleColor* styleColor;
::GetStyleData(styleContext, &styleColor);
nscolor color = styleContext->GetStyleColor()->mColor;
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decors) {
aUnderColor = styleColor->mColor;
aUnderColor = color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
aDecorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
}
if (NS_STYLE_TEXT_DECORATION_OVERLINE & decors) {
aOverColor = styleColor->mColor;
aOverColor = color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
aDecorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
}
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & decors) {
aStrikeColor = styleColor->mColor;
aStrikeColor = color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
aDecorations |= NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
}
@ -249,8 +242,7 @@ HasTextFrameDescendant(nsIPresContext* aPresContext, nsIFrame* aParent)
// See bug 20163.
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
const nsStyleText* styleText;
::GetStyleData(kid, &styleText);
const nsStyleText* styleText = kid->GetStyleText();
// XXXldb This is the wrong way to set |isPre|.
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
@ -676,8 +668,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
// XXX If it's fixed positioned, then create a widget so it floats
// above the scrolling area
const nsStyleDisplay* display;
::GetStyleData(aStyleContext, &display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
if (NS_STYLE_POSITION_FIXED == display->mPosition) {
view->CreateWidget(kCChildCID);
}
@ -716,8 +707,7 @@ nsHTMLContainerFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
// Currently we actually paint 'outline' inside the element so this code
// isn't strictly necessary. But we're trying to get ready to switch to
// CSS2 compliance.
const nsStyleOutline* outline;
::GetStyleData(this, &outline);
const nsStyleOutline* outline = GetStyleOutline();
PRUint8 outlineStyle = outline->GetOutlineStyle();
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE
&& outlineStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
@ -733,8 +723,7 @@ nsHTMLContainerFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
// Invalidate the old frame if the frame has borders. Those borders
// may be moving.
const nsStyleBorder* border;
::GetStyleData(this, &border);
const nsStyleBorder* border = GetStyleBorder();
if (border->IsBorderSideVisible(NS_SIDE_LEFT)
|| border->IsBorderSideVisible(NS_SIDE_RIGHT)
|| border->IsBorderSideVisible(NS_SIDE_TOP)
@ -745,8 +734,7 @@ nsHTMLContainerFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
// Invalidate the old frame if the frame has a background
// whose position depends on the size of the frame
const nsStyleBackground* background;
::GetStyleData(this, &background);
const nsStyleBackground* background = GetStyleBackground();
if (background->mBackgroundFlags &
(NS_STYLE_BG_X_POSITION_PERCENT | NS_STYLE_BG_Y_POSITION_PERCENT)) {
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));

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

@ -324,13 +324,13 @@ nsHTMLReflowState::Init(nsIPresContext* aPresContext,
mDebugHook = nsnull;
#endif
GetStyleData(frame, &mStylePosition);
GetStyleData(frame, &mStyleDisplay);
GetStyleData(frame, &mStyleVisibility);
GetStyleData(frame, &mStyleBorder);
GetStyleData(frame, &mStyleMargin);
GetStyleData(frame, &mStylePadding);
GetStyleData(frame, &mStyleText);
mStylePosition = frame->GetStylePosition();
mStyleDisplay = frame->GetStyleDisplay();
mStyleVisibility = frame->GetStyleVisibility();
mStyleBorder = frame->GetStyleBorder();
mStyleMargin = frame->GetStyleMargin();
mStylePadding = frame->GetStylePadding();
mStyleText = frame->GetStyleText();
mFrameType = DetermineFrameType(frame, mStyleDisplay);
InitCBReflowState();
@ -379,9 +379,7 @@ nsHTMLReflowState::GetContainingBlockContentWidth(const nsHTMLReflowState* aPare
nsCSSFrameType
nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame)
{
const nsStyleDisplay* styleDisplay;
aFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
const nsStyleDisplay* styleDisplay = aFrame->GetStyleDisplay();
return DetermineFrameType(aFrame, styleDisplay);
}
@ -484,8 +482,7 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
// If neither 'left' not 'right' are auto, then we're over-constrained and
// we ignore one of them
if (!leftIsAuto && !rightIsAuto) {
const nsStyleVisibility* vis;
frame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = frame->GetStyleVisibility();
if (NS_STYLE_DIRECTION_LTR == vis->mDirection) {
rightIsAuto = PR_TRUE;
@ -845,8 +842,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext,
}
// Get the 'direction' of the block
const nsStyleVisibility* blockVis;
aBlockFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)blockVis);
const nsStyleVisibility* blockVis = aBlockFrame->GetStyleVisibility();
// Get the placeholder x-offset and y-offset in the coordinate
// space of the block frame that contains it
@ -946,10 +942,9 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext,
// The specified offsets are relative to the absolute containing block's padding
// edge, and our current values are relative to the border edge so translate
nsMargin border;
const nsStyleBorder* borderStyle;
aAbsoluteContainingBlockFrame->GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderStyle);
const nsStyleBorder* borderStyle =
aAbsoluteContainingBlockFrame->GetStyleBorder();
nsMargin border;
if (!borderStyle->GetBorder(border)) {
NS_NOTYETIMPLEMENTED("percentage border");
}
@ -2003,9 +1998,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
// Check for blinking text and permission to display it
mFlags.mBlinks = (parentReflowState && parentReflowState->mFlags.mBlinks);
if (!mFlags.mBlinks && BlinkIsAllowed()) {
const nsStyleTextReset* st;
frame->GetStyleData(eStyleStruct_TextReset,
(const nsStyleStruct*&)st);
const nsStyleTextReset* st = frame->GetStyleTextReset();
mFlags.mBlinks =
((st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK) != 0);
}
@ -2322,12 +2315,9 @@ ComputeLineHeight(nsIPresContext* aPresContext,
nscoord lineHeight = -1;
const nsStyleText* text;
GetStyleData(aStyleContext, &text);
const nsStyleFont* font;
GetStyleData(aStyleContext, &font);
const nsStyleVisibility* vis;
GetStyleData(aStyleContext, &vis);
const nsStyleText* text = aStyleContext->GetStyleText();
const nsStyleFont* font = aStyleContext->GetStyleFont();
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
nsStyleUnit unit = text->mLineHeight.GetUnit();
@ -2383,8 +2373,7 @@ nsHTMLReflowState::CalcLineHeight(nsIPresContext* aPresContext,
if (lineHeight < 0) {
// Negative line-heights are not allowed by the spec. Translate
// them into "normal" when found.
const nsStyleFont* font = (const nsStyleFont*)
sc->GetStyleData(eStyleStruct_Font);
const nsStyleFont* font = sc->GetStyleFont();
if (UseComputedHeight()) {
lineHeight = font->mFont.size;
}

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

@ -579,29 +579,39 @@ public:
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext) = 0;
/**
* Get the style data associated with this frame. This fills in a
* Get the style data associated with this frame. This returns a
* const style struct pointer that should never be modified. See
* |nsIStyleContext::GetStyleData| for more information.
*
* The use of the typesafe global helper function |GetStyleData|,
* below, is preferred to direct use of this function.
* The use of the typesafe functions below is preferred to direct use
* of this function.
*/
NS_IMETHOD GetStyleDataExternal(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const = 0;
virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const = 0;
const nsStyleStruct* GetStyleData(nsStyleStructID aSID) const {
#ifdef _IMPL_NS_LAYOUT
nsresult GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const {
NS_ASSERTION(mStyleContext, "No style context found!");
aStyleStruct = mStyleContext->GetStyleData(aSID);
return NS_OK;
}
return mStyleContext->GetStyleData(aSID);
#else
nsresult GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const {
return GetStyleDataExternal(aSID, aStyleStruct);
}
return GetStyleDataExternal(aSID);
#endif
}
/**
* Define typesafe getter functions for each style struct by
* preprocessing the list of style structs. These functions are the
* preferred way to get style data. The macro creates functions like:
* const nsStyleBorder* GetStyleBorder();
* const nsStyleColor* GetStyleColor();
*/
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
const nsStyle##name_ * GetStyle##name_() const { \
return NS_STATIC_CAST(const nsStyle##name_*, \
GetStyleData(eStyleStruct_##name_)); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
// Utility function: more convenient than 2 calls to GetStyleData to get border and padding
NS_IMETHOD CalcBorderPadding(nsMargin& aBorderPadding) const = 0;
@ -1256,14 +1266,4 @@ private:
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
};
// typesafe way to access style data. See comment in nsStyleStruct.h
// and also overloaded function in nsStyleContext.h
template <class T>
inline void
GetStyleData(nsIFrame* aFrame, const T** aStyleStruct)
{
aFrame->GetStyleData(NS_GET_STYLESTRUCTID(T),
*NS_REINTERPRET_CAST(const nsStyleStruct**, aStyleStruct));
}
#endif /* nsIFrame_h___ */

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

@ -126,13 +126,13 @@
nsImageFrame::IconLoad* nsImageFrame::mIconLoad = nsnull;
// test if the width and height are fixed, looking at the style data
static PRBool HaveFixedSize(const struct nsStylePosition& aStylePosition)
static PRBool HaveFixedSize(const nsStylePosition* aStylePosition)
{
// check the width and height values in the reflow state's style struct
// - if width and height are specified as either coord or percentage, then
// the size of the image frame is constrained
nsStyleUnit widthUnit = aStylePosition.mWidth.GetUnit();
nsStyleUnit heightUnit = aStylePosition.mHeight.GetUnit();
nsStyleUnit widthUnit = aStylePosition->mWidth.GetUnit();
nsStyleUnit heightUnit = aStylePosition->mHeight.GetUnit();
return ((widthUnit == eStyleUnit_Coord ||
widthUnit == eStyleUnit_Percent) &&
@ -158,7 +158,7 @@ inline PRBool HaveFixedSize(const nsHTMLReflowState& aReflowState)
(eStyleUnit_Percent == widthUnit && (NS_UNCONSTRAINEDSIZE == aReflowState.mComputedWidth ||
0 == aReflowState.mComputedWidth)))
? PR_FALSE
: HaveFixedSize(*(aReflowState.mStylePosition));
: HaveFixedSize(aReflowState.mStylePosition);
}
nsresult
@ -477,9 +477,7 @@ nsImageFrame::HandleLoadError(nsresult aStatus, nsIPresShell* aPresShell)
PRBool useSizedBox;
const nsStyleUIReset* uiResetData;
::GetStyleData(this, &uiResetData);
NS_ASSERTION(uiResetData, "null style position: frame is corrupted");
const nsStyleUIReset* uiResetData = GetStyleUIReset();
if (uiResetData->mForceBrokenImageIcon) {
useSizedBox = PR_TRUE;
}
@ -508,11 +506,7 @@ nsImageFrame::HandleLoadError(nsresult aStatus, nsIPresShell* aPresShell)
}
else {
// check whether we have fixed size
const nsStylePosition* stylePosition;
::GetStyleData(this, &stylePosition);
NS_ASSERTION(stylePosition, "null style position: frame is corrupted");
useSizedBox = HaveFixedSize(*stylePosition);
useSizedBox = HaveFixedSize(GetStylePosition());
}
}
}
@ -707,10 +701,7 @@ nsImageFrame::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *aNewFrame,
nsRect *aDirtyRect)
{
const nsStyleVisibility* vis;
::GetStyleData(this, &vis);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
return NS_OK;
}
@ -1053,10 +1044,8 @@ nsImageFrame::DisplayAltText(nsIPresContext* aPresContext,
const nsString& aAltText,
const nsRect& aRect)
{
const nsStyleColor* color =
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
// Set font and color
aRenderingContext.SetColor(color->mColor);
aRenderingContext.SetColor(GetStyleColor()->mColor);
SetFontFromStyle(&aRenderingContext, mStyleContext);
// Format the text to display within the formatting rect
@ -1260,8 +1249,7 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
// FOREGROUND or BACKGROUND paint layer if the element is
// inline-level or block-level, respectively (bug 36710). (See
// CSS2 9.5, which is the rationale for paint layers.)
const nsStyleDisplay *display;
::GetStyleData(mStyleContext, &display);
const nsStyleDisplay* display = GetStyleDisplay();
nsFramePaintLayer backgroundLayer = display->IsBlockLevel()
? NS_FRAME_PAINT_LAYER_BACKGROUND
: NS_FRAME_PAINT_LAYER_FOREGROUND;
@ -1384,10 +1372,8 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
// paint the outline in the overlay layer (or if there is an image map) until the
// general problem of painting it outside the border box is solved.
if (paintOutline) {
const nsStyleBorder* myBorder = (const nsStyleBorder*)
mStyleContext->GetStyleData(eStyleStruct_Border);
const nsStyleOutline* myOutline = (const nsStyleOutline*)
mStyleContext->GetStyleData(eStyleStruct_Outline);
const nsStyleBorder* myBorder = GetStyleBorder();
const nsStyleOutline* myOutline = GetStyleOutline();
nsRect rect(0, 0, mRect.width, mRect.height);
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *myBorder,
@ -1778,9 +1764,7 @@ nsImageFrame::GetCursor(nsIPresContext* aPresContext,
if (map->IsInside(p.x, p.y)) {
// Use style defined cursor if one is provided, otherwise when
// the cursor style is "auto" we use the pointer cursor.
const nsStyleUserInterface* styleUserInterface;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)styleUserInterface);
aCursor = styleUserInterface->mCursor;
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_POINTER;
}

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

@ -151,12 +151,9 @@ nsInlineFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
return NS_OK;
}
#endif
const nsStyleMargin* margin = NS_STATIC_CAST(const nsStyleMargin*,
mStyleContext->GetStyleData(eStyleStruct_Margin));
const nsStyleBorder* border = NS_STATIC_CAST(const nsStyleBorder*,
mStyleContext->GetStyleData(eStyleStruct_Border));
const nsStylePadding* padding = NS_STATIC_CAST(const nsStylePadding*,
mStyleContext->GetStyleData(eStyleStruct_Padding));
const nsStyleMargin* margin = GetStyleMargin();
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsStyleCoord coord;
// XXX Top and bottom removed, since they shouldn't affect things, but this
// doesn't really match with nsLineLayout.cpp's setting of
@ -660,8 +657,7 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext,
// little hack lets us override that behavior to allow for more
// precise layout in the face of imprecise fonts.
if (nsHTMLReflowState::UseComputedHeight()) {
const nsStyleFont* font;
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font);
const nsStyleFont* font = GetStyleFont();
aMetrics.height = font->mFont.size +
aReflowState.mComputedBorderPadding.top +
aReflowState.mComputedBorderPadding.bottom;

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

@ -165,8 +165,7 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
MOZ_COUNT_CTOR(nsLineLayout);
// Stash away some style data that we need
aOuterReflowState->frame->GetStyleData(eStyleStruct_Text,
(const nsStyleStruct*&) mStyleText);
mStyleText = aOuterReflowState->frame->GetStyleText();
mTextAlign = mStyleText->mTextAlign;
mLineNumber = 0;
mColumn = 0;
@ -546,9 +545,7 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame,
psd->mX = aLeftEdge;
psd->mRightEdge = aRightEdge;
const nsStyleText* styleText;
aSpanReflowState->frame->GetStyleData(eStyleStruct_Text,
(const nsStyleStruct*&) styleText);
const nsStyleText* styleText = aSpanReflowState->frame->GetStyleText();
switch (styleText->mWhiteSpace) {
case NS_STYLE_WHITESPACE_PRE:
case NS_STYLE_WHITESPACE_NOWRAP:
@ -1087,10 +1084,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
if (nsLayoutAtoms::placeholderFrame == frameType.get()) {
nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)aFrame)->GetOutOfFlowFrame();
if (outOfFlowFrame) {
const nsStyleDisplay* display;
// Make sure it's floated and not absolutely positioned
outOfFlowFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
if (!display->IsAbsolutelyPositioned()) {
if (eReflowReason_Incremental == reason) {
InitFloater((nsPlaceholderFrame*)aFrame, aReflowStatus);
@ -1705,40 +1700,22 @@ nsLineLayout::IsPercentageAwareReplacedElement(nsIPresContext *aPresContext,
if (nsLayoutAtoms::brFrame != frameType.get() &&
nsLayoutAtoms::textFrame != frameType.get())
{
nsresult rv;
const nsStyleMargin* margin;
rv = aFrame->GetStyleData(eStyleStruct_Margin,(const nsStyleStruct*&) margin);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStyleMargin* margin = aFrame->GetStyleMargin();
if (IsPercentageUnitSides(&margin->mMargin)) {
return PR_TRUE;
}
const nsStylePadding* padding;
rv = aFrame->GetStyleData(eStyleStruct_Padding,(const nsStyleStruct*&) padding);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStylePadding* padding = aFrame->GetStylePadding();
if (IsPercentageUnitSides(&padding->mPadding)) {
return PR_TRUE;
}
const nsStyleBorder* border;
rv = aFrame->GetStyleData(eStyleStruct_Border,(const nsStyleStruct*&) border);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStyleBorder* border = aFrame->GetStyleBorder();
if (IsPercentageUnitSides(&border->mBorder)) {
return PR_TRUE;
}
const nsStylePosition* pos;
rv = aFrame->GetStyleData(eStyleStruct_Position,(const nsStyleStruct*&) pos);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStylePosition* pos = aFrame->GetStylePosition();
if (eStyleUnit_Percent == pos->mWidth.GetUnit()
|| eStyleUnit_Percent == pos->mMaxWidth.GetUnit()
|| eStyleUnit_Percent == pos->mMinWidth.GetUnit()
@ -2289,8 +2266,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
}
// Get vertical-align property
const nsStyleTextReset* textStyle;
frame->GetStyleData(eStyleStruct_TextReset, (const nsStyleStruct*&)textStyle);
const nsStyleTextReset* textStyle = frame->GetStyleTextReset();
nsStyleUnit verticalAlignUnit = textStyle->mVerticalAlign.GetUnit();
#ifdef DEBUG
if (eStyleUnit_Inherit == verticalAlignUnit) {
@ -2496,8 +2472,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// Only consider non empty text frames when line-height=normal
PRBool canUpdate = !pfd->GetFlag(PFD_ISTEXTFRAME);
if (!canUpdate && pfd->GetFlag(PFD_ISNONWHITESPACETEXTFRAME)) {
const nsStyleText* textStyle;
frame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textStyle);
const nsStyleText* textStyle = frame->GetStyleText();
canUpdate = textStyle->mLineHeight.GetUnit() == eStyleUnit_Normal ||
textStyle->mLineHeight.GetUnit() == eStyleUnit_Null;
}
@ -2602,9 +2577,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
nscoord fontAscent, fontHeight;
fm->GetMaxAscent(fontAscent);
if (nsHTMLReflowState::UseComputedHeight()) {
const nsStyleFont* parentFont;
spanFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)parentFont);
fontHeight = parentFont->mFont.size;
fontHeight = spanFrame->GetStyleFont()->mFont.size;
}
else
{
@ -3004,8 +2977,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
}
}
const nsStyleMargin* margin;
::GetStyleData(hrFrame, &margin);
const nsStyleMargin* margin = hrFrame->GetStyleMargin();
textAlign = NS_STYLE_TEXT_ALIGN_CENTER;
nsStyleCoord zero(nscoord(0));
nsStyleCoord temp;
@ -3326,9 +3298,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
if (! aFrame)
break;
const nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, NS_REINTERPRET_CAST(const nsStyleStruct*&, display));
if (NS_STYLE_DISPLAY_INLINE != display->mDisplay)
if (NS_STYLE_DISPLAY_INLINE != aFrame->GetStyleDisplay()->mDisplay)
break;
}
@ -3401,8 +3371,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
PRBool
nsLineLayout::TreatFrameAsBlock(nsIFrame* aFrame)
{
const nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
if (NS_STYLE_POSITION_ABSOLUTE == display->mPosition) {
return PR_FALSE;
}

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

@ -859,8 +859,7 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext,
// Sometimes, a frame doesn't have a background color or is transparent. In this
// case, walk up the frame tree until we do find a frame with a background color
for (nsIFrame* frame = this; frame; frame->GetParent(&frame)) {
const nsStyleBackground* background;
::GetStyleData(frame, &background);
const nsStyleBackground* background = frame->GetStyleBackground();
if (!background->IsTransparent()) { // make sure we got an actual color
nsCOMPtr<nsIWidget> win;
view->GetWidget(*getter_AddRefs(win));
@ -1428,8 +1427,7 @@ PRBool
nsObjectFrame::IsHidden(PRBool aCheckVisibilityStyle) const
{
if (aCheckVisibilityStyle) {
const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (vis && !vis->IsVisibleOrCollapsed())
if (!GetStyleVisibility()->IsVisibleOrCollapsed())
return PR_TRUE;
}
@ -1596,8 +1594,7 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
PRUint32 aFlags)
{
const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if ((vis != nsnull) && !vis->IsVisibleOrCollapsed())
if (!GetStyleVisibility()->IsVisibleOrCollapsed())
return NS_OK;
nsIFrame * child = mFrames.FirstChild();

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

@ -749,12 +749,8 @@ nsPageFrame::DrawBackground(nsIPresContext* aPresContext,
nsRect rect;
pageContentFrame->GetRect(rect);
const nsStyleBorder* border =
NS_STATIC_CAST(const nsStyleBorder*,
mStyleContext->GetStyleData(eStyleStruct_Border));
const nsStylePadding* padding =
NS_STATIC_CAST(const nsStylePadding*,
mStyleContext->GetStyleData(eStyleStruct_Padding));
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *border, *padding,

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

@ -3317,10 +3317,7 @@ nsSelection::FrameOrParentHasSpecialSelectionStyle(nsIFrame* aFrame, PRUint8 aSe
while (thisFrame)
{
const nsStyleUIReset* userinterface;
thisFrame->GetStyleData(eStyleStruct_UIReset, (const nsStyleStruct*&)userinterface);
if (userinterface->mUserSelect == aSelectionStyle)
if (thisFrame->GetStyleUIReset()->mUserSelect == aSelectionStyle)
{
*foundFrame = thisFrame;
return NS_OK;

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

@ -105,8 +105,7 @@ SpacerFrame::Reflow(nsIPresContext* aPresContext,
aMetrics.ascent = 0;
aMetrics.descent = 0;
const nsStylePosition* position;
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position);
const nsStylePosition* position = GetStylePosition();
PRUint8 type = GetType();
switch (type) {

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

@ -532,18 +532,15 @@ public:
nsIRenderingContext& aRenderingContext,
nsStyleContext* sc)
{
mFont = nsnull;
mText = nsnull;
mColor = nsnull;
mNormalFont = nsnull;
mSmallFont = nsnull;
mLastFont = nsnull;
mNormalFont = nsnull;
mSmallFont = nsnull;
mLastFont = nsnull;
// Get style data
mColor = (const nsStyleColor*) sc->GetStyleData(eStyleStruct_Color);
mFont = (const nsStyleFont*) sc->GetStyleData(eStyleStruct_Font);
mText = (const nsStyleText*) sc->GetStyleData(eStyleStruct_Text);
mVisibility = (const nsStyleVisibility*) sc->GetStyleData(eStyleStruct_Visibility);
mColor = sc->GetStyleColor();
mFont = sc->GetStyleFont();
mText = sc->GetStyleText();
mVisibility = sc->GetStyleVisibility();
// Cache the original decorations and reuse the current font
// to query metrics, rather than creating a new font which is expensive.
@ -1039,12 +1036,11 @@ DrawSelectionIterator::DrawSelectionIterator(nsIContent *aContent,
aStyleContext);
if (sc) {
mSelectionPseudoStyle = PR_TRUE;
const nsStyleBackground* bg = (const nsStyleBackground*)sc->GetStyleData(eStyleStruct_Background);
const nsStyleBackground* bg = sc->GetStyleBackground();
mSelectionPseudoBGIsTransparent = PRBool(bg->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
if (!mSelectionPseudoBGIsTransparent )
mSelectionPseudoBGcolor = bg->mBackgroundColor;
const nsStyleColor* color =(const nsStyleColor*) sc->GetStyleData(eStyleStruct_Color);
mSelectionPseudoFGcolor = color->mColor;
mSelectionPseudoFGcolor = sc->GetStyleColor()->mColor;
}
}
@ -1378,9 +1374,7 @@ nsTextFrame::GetCursor(nsIPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
{
const nsStyleUserInterface* ui = (const nsStyleUserInterface*)
mStyleContext->GetStyleData(eStyleStruct_UserInterface);
aCursor = ui->mCursor;
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_TEXT;
}
@ -1805,36 +1799,32 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
PRBool hasDecorations = context->HasTextDecorations();
while (hasDecorations) {
const nsStyleTextReset* styleText;
::GetStyleData(context, &styleText);
const nsStyleTextReset* styleText = context->GetStyleTextReset();
if (!useOverride &&
(NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL &
styleText->mTextDecoration)) {
// This handles the <a href="blah.html"><font color="green">La
// la la</font></a> case. The link underline should be green.
const nsStyleColor* styleColor;
::GetStyleData(context, &styleColor);
useOverride = PR_TRUE;
overrideColor = styleColor->mColor;
overrideColor = context->GetStyleColor()->mColor;
}
PRUint8 useDecorations = decorMask & styleText->mTextDecoration;
if (useDecorations) {// a decoration defined here
const nsStyleColor* styleColor;
::GetStyleData(context, &styleColor);
nscolor color = context->GetStyleColor()->mColor;
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & useDecorations) {
underColor = useOverride ? overrideColor : styleColor->mColor;
underColor = useOverride ? overrideColor : color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
decorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
}
if (NS_STYLE_TEXT_DECORATION_OVERLINE & useDecorations) {
overColor = useOverride ? overrideColor : styleColor->mColor;
overColor = useOverride ? overrideColor : color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
decorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
}
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & useDecorations) {
strikeColor = useOverride ? overrideColor : styleColor->mColor;
strikeColor = useOverride ? overrideColor : color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
decorations |= NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
}
@ -2210,9 +2200,7 @@ nsTextFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
PRBool* aIsVisible)
{
if (aCheckVis) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
*aIsVisible = PR_FALSE;
return NS_OK;
}
@ -5644,8 +5632,7 @@ nsTextFrame::TrimTrailingWhiteSpace(nsIPresContext* aPresContext,
}
nscoord dw = 0;
const nsStyleText* textStyle = (const nsStyleText*)
mStyleContext->GetStyleData(eStyleStruct_Text);
const nsStyleText* textStyle = GetStyleText();
if (mContentLength &&
(NS_STYLE_WHITESPACE_PRE != textStyle->mWhiteSpace) &&
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP != textStyle->mWhiteSpace)) {

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

@ -258,8 +258,7 @@ nsTextTransformer::Init(nsIFrame* aFrame,
mOffset = aStartingOffset;
// Get the frames text style information
const nsStyleText* styleText;
aFrame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) styleText);
const nsStyleText* styleText = aFrame->GetStyleText();
if (NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) {
mMode = ePreformatted;
}

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

@ -181,14 +181,12 @@ nsBlockBandData::ComputeAvailSpaceRect()
#ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT
printf("band %p checking !Avail trap %p with frame %p\n", this, trapezoid, trapezoid->mFrame);
#endif
const nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) {
PRInt32 j, numFrames = trapezoid->mFrames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (j = 0; j < numFrames; j++) {
nsIFrame* f = (nsIFrame*) trapezoid->mFrames->ElementAt(j);
f->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = f->GetStyleDisplay();
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
leftFloaters++;
}
@ -200,8 +198,7 @@ nsBlockBandData::ComputeAvailSpaceRect()
}
}
} else {
trapezoid->mFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = trapezoid->mFrame->GetStyleDisplay();
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
leftFloaters++;
}
@ -233,7 +230,6 @@ nsBlockBandData::ComputeAvailSpaceRect()
// When there is no available space, we still need a proper X
// coordinate to place objects that end up here anyway.
if (nsBandTrapezoid::Available != trapezoid->mState) {
const nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) {
// It's not clear what coordinate to use when there is no
// available space and the space is multiply occupied...So: If
@ -244,8 +240,7 @@ nsBlockBandData::ComputeAvailSpaceRect()
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (j = 0; j < numFrames; j++) {
nsIFrame* f = (nsIFrame*) trapezoid->mFrames->ElementAt(j);
f->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = f->GetStyleDisplay();
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
mAvailSpace.x = mAvailSpace.XMost();
break;
@ -253,8 +248,7 @@ nsBlockBandData::ComputeAvailSpaceRect()
}
}
else {
trapezoid->mFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
const nsStyleDisplay* display = trapezoid->mFrame->GetStyleDisplay();
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
mAvailSpace.x = mAvailSpace.XMost();
}
@ -280,22 +274,18 @@ PRBool
nsBlockBandData::ShouldClearFrame(nsIFrame* aFrame, PRUint8 aBreakType)
{
PRBool result = PR_FALSE;
const nsStyleDisplay* display;
nsresult rv = aFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)display);
if (NS_SUCCEEDED(rv) && (nsnull != display)) {
if (NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType) {
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
if (NS_STYLE_CLEAR_LEFT_AND_RIGHT == aBreakType) {
result = PR_TRUE;
}
else if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
if (NS_STYLE_CLEAR_LEFT == aBreakType) {
result = PR_TRUE;
}
else if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
if (NS_STYLE_CLEAR_LEFT == aBreakType) {
result = PR_TRUE;
}
}
else if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
if (NS_STYLE_CLEAR_RIGHT == aBreakType) {
result = PR_TRUE;
}
}
else if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
if (NS_STYLE_CLEAR_RIGHT == aBreakType) {
result = PR_TRUE;
}
}
return result;

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

@ -442,8 +442,7 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(it); // reference passed to caller
const nsStyleVisibility* visibility;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&) visibility);
const nsStyleVisibility* visibility = GetStyleVisibility();
nsresult rv = it->Init(mLines,
visibility->mDirection == NS_STYLE_DIRECTION_RTL);
if (NS_FAILED(rv)) {
@ -1224,38 +1223,22 @@ IsPercentageAwareChild(const nsIFrame* aFrame)
NS_ASSERTION(aFrame, "null frame is not allowed");
nsresult rv;
const nsStyleMargin* margin;
rv = aFrame->GetStyleData(eStyleStruct_Margin,(const nsStyleStruct*&) margin);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStyleMargin* margin = aFrame->GetStyleMargin();
if (nsLineLayout::IsPercentageUnitSides(&margin->mMargin)) {
return PR_TRUE;
}
const nsStylePadding* padding;
rv = aFrame->GetStyleData(eStyleStruct_Padding,(const nsStyleStruct*&) padding);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStylePadding* padding = aFrame->GetStylePadding();
if (nsLineLayout::IsPercentageUnitSides(&padding->mPadding)) {
return PR_TRUE;
}
const nsStyleBorder* border;
rv = aFrame->GetStyleData(eStyleStruct_Border,(const nsStyleStruct*&) border);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStyleBorder* border = aFrame->GetStyleBorder();
if (nsLineLayout::IsPercentageUnitSides(&border->mBorder)) {
return PR_TRUE;
}
const nsStylePosition* pos;
rv = aFrame->GetStyleData(eStyleStruct_Position,(const nsStyleStruct*&) pos);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStylePosition* pos = aFrame->GetStylePosition();
if (eStyleUnit_Percent == pos->mWidth.GetUnit()
|| eStyleUnit_Percent == pos->mMaxWidth.GetUnit()
@ -1745,8 +1728,7 @@ nsBlockFrame::RetargetInlineIncrementalReflow(nsReflowPath::iterator &aTarget,
nsIFrame *frame = NS_STATIC_CAST(nsIFrame *, path->ElementAt(i));
// Stop if we encounter a non-inline frame in the reflow path.
const nsStyleDisplay *display;
::GetStyleData(frame, &display);
const nsStyleDisplay* display = frame->GetStyleDisplay();
if (NS_STYLE_DISPLAY_INLINE != display->mDisplay)
break;
@ -1770,8 +1752,7 @@ PRBool
nsBlockFrame::IsLineEmpty(nsIPresContext* aPresContext,
const nsLineBox* aLine) const
{
const nsStyleText* styleText;
::GetStyleData(mStyleContext, &styleText);
const nsStyleText* styleText = GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
@ -1823,8 +1804,7 @@ nsBlockFrame::UpdateBulletPosition(nsBlockReflowState& aState)
// Don't bother if there is no bullet
return NS_OK;
}
const nsStyleList* styleList;
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&) styleList);
const nsStyleList* styleList = GetStyleList();
if (NS_STYLE_LIST_STYLE_POSITION_INSIDE == styleList->mListStylePosition) {
if (mBullet && HaveOutsideBullet()) {
// We now have an inside bullet, but used to have an outside
@ -1925,8 +1905,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
(NS_UNCONSTRAINEDSIZE != aState.mReflowState.availableWidth)) {
// If the text is left-aligned, then we try and avoid reflowing the lines
const nsStyleText* styleText = (const nsStyleText*)
mStyleContext->GetStyleData(eStyleStruct_Text);
const nsStyleText* styleText = GetStyleText();
if ((NS_STYLE_TEXT_ALIGN_LEFT == styleText->mTextAlign) ||
((NS_STYLE_TEXT_ALIGN_DEFAULT == styleText->mTextAlign) &&
@ -1941,14 +1920,13 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
}
if (gNoisyReflow) {
if (!tryAndSkipLines) {
const nsStyleText* mStyleText = (const nsStyleText*)
mStyleContext->GetStyleData(eStyleStruct_Text);
const nsStyleText* styleText = GetStyleText();
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n",
aState.mReflowState.reason,
aState.mReflowState.availableWidth,
mStyleText->mTextAlign);
styleText->mTextAlign);
}
}
#endif
@ -2954,8 +2932,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
shell->AppendReflowCommand(reflowCmd);
}
else if (nsHTMLAtoms::value == aAttribute) {
const nsStyleDisplay* styleDisplay;
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
const nsStyleDisplay* styleDisplay = GetStyleDisplay();
if (NS_STYLE_DISPLAY_LIST_ITEM == styleDisplay->mDisplay) {
nsIFrame* nextAncestor = mParent;
nsBlockFrame* blockParent = nsnull;
@ -3026,8 +3003,7 @@ nsBlockFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
// empty.
*aResult = PR_FALSE;
const nsStylePosition* position;
::GetStyleData(this, &position);
const nsStylePosition* position = GetStylePosition();
switch (position->mMinHeight.GetUnit()) {
case eStyleUnit_Coord:
@ -3057,10 +3033,8 @@ nsBlockFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
return NS_OK;
}
const nsStyleBorder* border = NS_STATIC_CAST(const nsStyleBorder*,
mStyleContext->GetStyleData(eStyleStruct_Border));
const nsStylePadding* padding = NS_STATIC_CAST(const nsStylePadding*,
mStyleContext->GetStyleData(eStyleStruct_Padding));
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsStyleCoord coord;
if ((border->IsBorderSideVisible(NS_SIDE_TOP) &&
!IsBorderZero(border->mBorder.GetTopUnit(),
@ -3075,8 +3049,7 @@ nsBlockFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
return NS_OK;
}
const nsStyleText* styleText;
::GetStyleData(this, &styleText);
const nsStyleText* styleText = GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
// Now the only thing that could make us non-empty is one of the lines
@ -3113,8 +3086,7 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
// Determine if this line is "essentially" the first line
//
const nsStyleText* styleText;
::GetStyleData(this, &styleText);
const nsStyleText* styleText = GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
@ -3235,9 +3207,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
}
// Prepare the block reflow engine
const nsStyleDisplay* display;
frame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&) display);
const nsStyleDisplay* display = frame->GetStyleDisplay();
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowState,
aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH),
aState.GetFlag(BRS_COMPUTEMAXWIDTH));
@ -4268,8 +4238,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
// Only block frames horizontally align their children because
// inline frames "shrink-wrap" around their children (therefore
// there is no extra horizontal space).
const nsStyleText* styleText = (const nsStyleText*)
mStyleContext->GetStyleData(eStyleStruct_Text);
const nsStyleText* styleText = GetStyleText();
PRBool allowJustify = NS_STYLE_TEXT_ALIGN_JUSTIFY == styleText->mTextAlign &&
!aLineLayout.GetLineEndsInBR() &&
ShouldJustifyLine(aState, aLine);
@ -4599,9 +4568,8 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
if (nsLayoutAtoms::placeholderFrame == frameType.get()) {
nsIFrame *outOfFlowFrame = NS_STATIC_CAST(nsPlaceholderFrame*, frame)->GetOutOfFlowFrame();
if (outOfFlowFrame) {
const nsStyleDisplay* display = nsnull;
outOfFlowFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
if (display && !display->IsAbsolutelyPositioned()) {
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
if (!display->IsAbsolutelyPositioned()) {
// It's not an absolute or fixed positioned frame, so it
// must be a floater!
outOfFlowFrame->SetParent(this);
@ -5003,9 +4971,7 @@ nsBlockFrame::DoRemoveOutOfFlowFrame(nsIPresContext* aPresContext,
nsBlockFrame::DoRemoveOutOfFlowFrame(aPresContext, nextInFlow);
}
// Now remove aFrame
const nsStyleDisplay* display = nsnull;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
NS_ASSERTION(display, "program error");
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
// find the containing block, this is either the parent or the grandparent
// if the parent is an inline frame
nsIFrame* parent;
@ -5271,9 +5237,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
availWidth = NS_UNCONSTRAINEDSIZE;
}
else {
const nsStyleDisplay* floaterDisplay;
floater->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)floaterDisplay);
const nsStyleDisplay* floaterDisplay = floater->GetStyleDisplay();
nsCompatibility mode;
aState.mPresContext->GetCompatibilityMode(&mode);
@ -5312,9 +5276,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
// If the floater's width is automatic, we can't let the floater's
// width shrink below its maxElementWidth.
const nsStylePosition* position;
floater->GetStyleData(eStyleStruct_Position,
NS_REINTERPRET_CAST(const nsStyleStruct*&, position));
const nsStylePosition* position = floater->GetStylePosition();
PRBool isAutoWidth = (eStyleUnit_Auto == position->mWidth.GetUnit());
// We'll need to compute the max element size if either 1) we're
@ -5521,9 +5483,7 @@ nsBlockFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
{
// first check to see if we are visible
if (aCheckVis) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
*aIsVisible = PR_FALSE;
return NS_OK;
}
@ -5607,8 +5567,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext,
if (paintingSuppressed)
return NS_OK;
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
const nsStyleDisplay* disp = GetStyleDisplay();
// If overflow is hidden then set the clip rect so that children don't
// leak out of us. Note that because overflow'-clip' only applies to
@ -6103,8 +6062,7 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
nsFrameState childState;
aChild->GetFrameState(&childState);
if (childState & NS_FRAME_OUT_OF_FLOW) {
const nsStyleDisplay* disp;
aChild->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)disp);
const nsStyleDisplay* disp = aChild->GetStyleDisplay();
if (disp->IsAbsolutelyPositioned()) {
// Generate a reflow command to reflow our dirty absolutely
@ -6304,14 +6262,12 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
// Create list bullet if this is a list-item. Note that this is done
// here so that RenumberLists will work (it needs the bullets to
// store the bullet numbers).
const nsStyleDisplay* styleDisplay;
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay);
const nsStyleDisplay* styleDisplay = GetStyleDisplay();
if ((nsnull == mPrevInFlow) &&
(NS_STYLE_DISPLAY_LIST_ITEM == styleDisplay->mDisplay) &&
(nsnull == mBullet)) {
// Resolve style for the bullet frame
const nsStyleList* styleList;
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&) styleList);
const nsStyleList* styleList = GetStyleList();
nsIAtom *pseudoElement;
switch (styleList->mListStyleType) {
case NS_STYLE_LIST_STYLE_DISC:
@ -6354,9 +6310,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
PRBool
nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
{
const nsStyleContent* styleContent;
aFrame->GetStyleData(eStyleStruct_Content,
(const nsStyleStruct*&) styleContent);
const nsStyleContent* styleContent = aFrame->GetStyleContent();
if (0 != styleContent->CounterResetCount()) {
// Winner
return PR_TRUE;
@ -6453,9 +6407,7 @@ nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
// If the frame is a list-item and the frame implements our
// block frame API then get its bullet and set the list item
// ordinal.
const nsStyleDisplay* display;
kid->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&) display);
const nsStyleDisplay* display = kid->GetStyleDisplay();
if (NS_STYLE_DISPLAY_LIST_ITEM == display->mDisplay) {
// Make certain that the frame is a block frame in case
// something foreign has crept in.
@ -6543,10 +6495,6 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
mBullet->WillReflow(aState.mPresContext);
mBullet->Reflow(aState.mPresContext, aMetrics, reflowState, status);
#ifdef IBMBIDI
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
#endif // IBMBIDI
// Place the bullet now; use its right margin to distance it
// from the rest of the frames in the line
nscoord x =
@ -6554,7 +6502,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
// For direction RTL: set x to the right margin for now.
// This value will be used to indent the bullet from the right most
// egde of the previous frame in nsLineLayout::HorizontalAlignFrames.
(NS_STYLE_DIRECTION_RTL == vis->mDirection)
(NS_STYLE_DIRECTION_RTL == GetStyleVisibility()->mDirection)
? reflowState.mComputedMargin.right :
#endif // IBMBIDI
- reflowState.mComputedMargin.right - aMetrics.width;

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

@ -111,8 +111,7 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(nsIPresContext* aPresContext,
nsCompatibility compat;
aPresContext->GetCompatibilityMode(&compat);
const nsStyleText* text;
::GetStyleData(bf, &text);
const nsStyleText* text = bf->GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == text->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == text->mWhiteSpace;
@ -374,11 +373,9 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
* All other blocks proceed normally.
*/
// XXXldb We should really fix this in nsHTMLReflowState::InitConstraints instead.
const nsStylePosition* position;
mFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position);
const nsStylePosition* position = mFrame->GetStylePosition();
nsStyleUnit widthUnit = position->mWidth.GetUnit();
const nsStyleDisplay* display;
mFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
const nsStyleDisplay* display = mFrame->GetStyleDisplay();
if ((eStyleUnit_Auto == widthUnit) &&
((NS_STYLE_FLOAT_LEFT == display->mFloats) ||
@ -723,9 +720,7 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
mMetrics.height);
// Apply CSS relative positioning to update x,y coordinates
const nsStyleDisplay* styleDisp;
mFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisp);
const nsStyleDisplay* styleDisp = mFrame->GetStyleDisplay();
if (NS_STYLE_POSITION_RELATIVE == styleDisp->mPosition) {
x += aComputedOffsets.left;
y += aComputedOffsets.top;
@ -791,8 +786,7 @@ nsBlockReflowContext::GetRealMarginLeftUnit()
// Get parent style context
sc = sc->GetParent();
if (sc) {
const nsStyleMargin* margin = (const nsStyleMargin*)
sc->GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* margin = sc->GetStyleMargin();
unit = margin->mMargin.GetLeftUnit();
}
}
@ -811,8 +805,7 @@ nsBlockReflowContext::GetRealMarginRightUnit()
// Get parent style context
sc = sc->GetParent();
if (sc) {
const nsStyleMargin* margin = (const nsStyleMargin*)
sc->GetStyleData(eStyleStruct_Margin);
const nsStyleMargin* margin = sc->GetStyleMargin();
unit = margin->mMargin.GetRightUnit();
}
}

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

@ -150,9 +150,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
mPrevChild = nsnull;
mCurrentLine = aFrame->end_lines();
const nsStyleText* styleText;
mBlock->GetStyleData(eStyleStruct_Text,
(const nsStyleStruct*&) styleText);
const nsStyleText* styleText = mBlock->GetStyleText();
switch (styleText->mWhiteSpace) {
case NS_STYLE_WHITESPACE_PRE:
case NS_STYLE_WHITESPACE_NOWRAP:
@ -251,9 +249,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
if (mBand.GetFloaterCount()) {
// Use the float-edge property to determine how the child block
// will interact with the floater.
const nsStyleBorder* borderStyle;
aFrame->GetStyleData(eStyleStruct_Border,
(const nsStyleStruct*&) borderStyle);
const nsStyleBorder* borderStyle = aFrame->GetStyleBorder();
switch (borderStyle->mFloatEdge) {
default:
case NS_STYLE_FLOAT_EDGE_CONTENT: // content and only content does runaround of floaters
@ -270,9 +266,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
// The child block's border should be placed adjacent to,
// but not overlap the floater(s).
nsMargin m(0, 0, 0, 0);
const nsStyleMargin* styleMargin;
aFrame->GetStyleData(eStyleStruct_Margin,
(const nsStyleStruct*&) styleMargin);
const nsStyleMargin* styleMargin = aFrame->GetStyleMargin();
styleMargin->GetMargin(m); // XXX percentage margins
if (NS_STYLE_FLOAT_EDGE_PADDING == borderStyle->mFloatEdge) {
// Add in border too
@ -447,8 +441,7 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
mPrevBottomMargin.Zero();
nsBlockFrame *block = mBlock;
const nsStyleText* styleText;
::GetStyleData(block, &styleText);
const nsStyleText* styleText = block->GetStyleText();
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
@ -855,9 +848,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
nsIFrame* floater = placeholder->GetOutOfFlowFrame();
// Grab the floater's display information
const nsStyleDisplay* floaterDisplay;
floater->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)floaterDisplay);
const nsStyleDisplay* floaterDisplay = floater->GetStyleDisplay();
// This will hold the floater's geometry when we've found a place
// for it to live.

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

@ -124,7 +124,7 @@ nsBulletFrame::Init(nsIPresContext* aPresContext,
nsresult rv = nsFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
const nsStyleList* myList = GetStyleList();
if (!myList->mListStyleImage.IsEmpty()) {
nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1", &rv));
@ -198,7 +198,7 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
PRBool isVisible;
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) && isVisible) {
const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
const nsStyleList* myList = GetStyleList();
PRUint8 listStyleType = myList->mListStyleType;
if (!myList->mListStyleImage.IsEmpty() && mImageRequest) {
@ -220,8 +220,8 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
}
}
const nsStyleFont* myFont = (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font);
const nsStyleColor* myColor = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleFont* myFont = GetStyleFont();
const nsStyleColor* myColor = GetStyleColor();
nsCOMPtr<nsIFontMetrics> fm;
aRenderingContext.SetColor(myColor->mColor);
@ -230,7 +230,7 @@ nsBulletFrame::Paint(nsIPresContext* aPresContext,
nsCharType charType = eCharType_LeftToRight;
PRUint8 level = 0;
PRBool isBidiSystem = PR_FALSE;
const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
const nsStyleVisibility* vis = GetStyleVisibility();
PRUint32 hints = 0;
#endif // IBMBIDI
@ -1118,8 +1118,7 @@ nsBulletFrame::GetListItemText(nsIPresContext* aCX,
nsString& result)
{
#ifdef IBMBIDI
const nsStyleVisibility* vis;
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = GetStyleVisibility();
// XXX For some of these systems, "." is wrong! This should really be
// pushed down into the individual cases!
@ -1366,7 +1365,7 @@ nsBulletFrame::GetDesiredSize(nsIPresContext* aCX,
const nsHTMLReflowState& aReflowState,
nsHTMLReflowMetrics& aMetrics)
{
const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
const nsStyleList* myList = GetStyleList();
nscoord ascent;
if (!myList->mListStyleImage.IsEmpty() && mImageRequest) {
@ -1463,8 +1462,7 @@ nsBulletFrame::GetDesiredSize(nsIPresContext* aCX,
}
}
const nsStyleFont* myFont =
(const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font);
const nsStyleFont* myFont = GetStyleFont();
nsCOMPtr<nsIFontMetrics> fm;
aCX->GetMetricsFor(myFont->mFont, getter_AddRefs(fm));
nscoord bulletSize;
@ -1589,7 +1587,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
nsCOMPtr<nsIURI> baseURI;
GetBaseURI(getter_AddRefs(baseURI));
const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
const nsStyleList* myList = GetStyleList();
if (!myList->mListStyleImage.IsEmpty()) {

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

@ -342,9 +342,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
}
if ( inThisFrame && aConsiderSelf ) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (vis->IsVisible()) {
if (GetStyleVisibility()->IsVisible()) {
*aFrame = this;
return NS_OK;
}
@ -517,8 +515,7 @@ NonZeroStyleCoord(const nsStyleCoord& aCoord) {
static PRBool
HasNonZeroBorderRadius(nsStyleContext* aStyleContext) {
const nsStyleBorder* border;
::GetStyleData(aStyleContext, &border);
const nsStyleBorder* border = aStyleContext->GetStyleBorder();
nsStyleCoord coord;
border->mBorderRadius.GetTop(coord);
@ -598,8 +595,7 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
}
// XXX we should also set widget transparency for XUL popups
const nsStyleDisplay* display;
::GetStyleData(aStyleContext, &display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
nsFrameState kidState;
aFrame->GetFrameState(&kidState);
@ -607,8 +603,7 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
// If we're showing the view but the frame is hidden, then the view is transparent
nsViewVisibility visibility;
aView->GetVisibility(visibility);
const nsStyleVisibility* vis;
::GetStyleData(aStyleContext, &vis);
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
if ((nsViewVisibility_kShow == visibility
&& NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible)
|| (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow
@ -659,10 +654,8 @@ SyncFrameViewGeometryDependentProperties(nsIPresContext* aPresContext,
}
if (hasOverflowClip) {
const nsStyleBorder* borderStyle;
::GetStyleData(aStyleContext, &borderStyle);
const nsStylePadding* paddingStyle;
::GetStyleData(aStyleContext, &paddingStyle);
const nsStyleBorder* borderStyle = aStyleContext->GetStyleBorder();
const nsStylePadding* paddingStyle = aStyleContext->GetStylePadding();
nsMargin border, padding;
// XXX We don't support the 'overflow-clip' property yet so just use the
@ -794,8 +787,7 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
aStyleContext = aFrame->GetStyleContext();
}
const nsStyleVisibility* vis;
::GetStyleData(aStyleContext, &vis);
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
// Set the view's opacity
vm->SetViewOpacity(aView, vis->mOpacity);
@ -832,15 +824,13 @@ nsContainerFrame::SyncFrameViewProperties(nsIPresContext* aPresContext,
nsViewVisibility_kHide);
}
const nsStyleDisplay* display;
::GetStyleData(aStyleContext, &display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
// See if the frame is being relatively positioned or absolutely
// positioned
PRBool isTopMostView = display->IsPositioned();
// Make sure z-index is correct
const nsStylePosition* position;
::GetStyleData(aStyleContext, &position);
const nsStylePosition* position = aStyleContext->GetStylePosition();
PRInt32 zIndex = 0;
PRBool autoZIndex = PR_FALSE;
@ -861,8 +851,7 @@ nsContainerFrame::FrameNeedsView(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsStyleContext* aStyleContext)
{
const nsStyleVisibility* vis;
::GetStyleData(aStyleContext, &vis);
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
if (vis->mOpacity != 1.0f) {
return PR_TRUE;
@ -878,8 +867,7 @@ nsContainerFrame::FrameNeedsView(nsIPresContext* aPresContext,
return PR_TRUE;
}
const nsStyleDisplay* display;
::GetStyleData(aStyleContext, &display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
if (NS_STYLE_POSITION_RELATIVE == display->mPosition) {
return PR_TRUE;

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

@ -398,22 +398,15 @@ nsresult NS_NewSelectionImageService(nsISelectionImageService** aResult)
// a handy utility to set font
void SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC)
{
const nsStyleFont *font = (const nsStyleFont*)
aSC->GetStyleData(eStyleStruct_Font);
NS_ASSERTION(font, "invalid font in style context");
const nsStyleFont* font = aSC->GetStyleFont();
const nsStyleVisibility* visibility = aSC->GetStyleVisibility();
if (font) {
const nsStyleVisibility* visibility = (const nsStyleVisibility*)
aSC->GetStyleData(eStyleStruct_Visibility);
NS_ASSERTION(visibility, "invalid visibility in style context");
nsCOMPtr<nsIAtom> langGroup;
if (visibility && visibility->mLanguage) {
visibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}
aRC->SetFont(font->mFont, langGroup);
nsCOMPtr<nsIAtom> langGroup;
if (visibility->mLanguage) {
visibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}
aRC->SetFont(font->mFont, langGroup);
}
nsresult
@ -754,10 +747,8 @@ nsFrame::SetOverflowClipRect(nsIRenderingContext& aRenderingContext)
// 'overflow-clip' only applies to block-level elements and replaced
// elements that have 'overflow' set to 'hidden', and it is relative
// to the content area and applies to content only (not border or background)
const nsStyleBorder* borderStyle;
const nsStylePadding* paddingStyle;
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderStyle);
GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingStyle);
const nsStyleBorder* borderStyle = GetStyleBorder();
const nsStylePadding* paddingStyle = GetStylePadding();
// Start with the 'auto' values and then factor in user specified values
nsRect clipRect(0, 0, mRect.width, mRect.height);
@ -959,12 +950,9 @@ nsFrame::PaintSelf(nsIPresContext* aPresContext,
}
// Paint our background and border
const nsStyleBorder* border;
::GetStyleData(mStyleContext, &border);
const nsStylePadding* padding;
::GetStyleData(mStyleContext, &padding);
const nsStyleOutline* outline;
::GetStyleData(mStyleContext, &outline);
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
const nsStyleOutline* outline = GetStyleOutline();
nsRect rect(0, 0, mRect.width, mRect.height);
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
@ -1166,10 +1154,7 @@ nsFrame::FrameOrParentHasSpecialSelectionStyle(PRUint8 aSelectionStyle, nsIFrame
while (thisFrame)
{
const nsStyleUserInterface* userinterface;
thisFrame->GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)userinterface);
if (userinterface->mUserSelect == aSelectionStyle)
if (thisFrame->GetStyleUserInterface()->mUserSelect == aSelectionStyle)
{
*foundFrame = thisFrame;
return NS_OK;
@ -1211,23 +1196,20 @@ nsFrame::IsSelectable(PRBool* aSelectable, PRUint8* aSelectStyle) const
nsIFrame* frame = (nsIFrame*)this;
while (frame && NS_SUCCEEDED(result)) {
const nsStyleUIReset* userinterface;
frame->GetStyleData(eStyleStruct_UIReset, (const nsStyleStruct*&)userinterface);
if (userinterface) {
switch (userinterface->mUserSelect) {
case NS_STYLE_USER_SELECT_ALL:
case NS_STYLE_USER_SELECT_NONE:
case NS_STYLE_USER_SELECT_MOZ_ALL:
// override the previous values
const nsStyleUIReset* userinterface = frame->GetStyleUIReset();
switch (userinterface->mUserSelect) {
case NS_STYLE_USER_SELECT_ALL:
case NS_STYLE_USER_SELECT_NONE:
case NS_STYLE_USER_SELECT_MOZ_ALL:
// override the previous values
selectStyle = userinterface->mUserSelect;
break;
default:
// otherwise return the first value which is not 'auto'
if (selectStyle == NS_STYLE_USER_SELECT_AUTO) {
selectStyle = userinterface->mUserSelect;
break;
default:
// otherwise return the first value which is not 'auto'
if (selectStyle == NS_STYLE_USER_SELECT_AUTO) {
selectStyle = userinterface->mUserSelect;
}
break;
}
}
break;
}
result = frame->GetParent(&frame);
}
@ -2224,9 +2206,7 @@ nsFrame::GetCursor(nsIPresContext* aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
{
const nsStyleUserInterface* styleUserInterface;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)styleUserInterface);
aCursor = styleUserInterface->mCursor;
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_DEFAULT;
}
@ -2241,9 +2221,7 @@ nsFrame::GetFrameForPoint(nsIPresContext* aPresContext,
{
if ((aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) &&
(mRect.Contains(aPoint))) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)((nsStyleContext*)mStyleContext)->GetStyleData(eStyleStruct_Visibility);
if (vis->IsVisible()) {
if (GetStyleVisibility()->IsVisible()) {
*aFrame = this;
return NS_OK;
}
@ -2743,10 +2721,8 @@ nsFrame::Invalidate(nsIPresContext* aPresContext,
// Checks to see if the damaged rect should be infalted
// to include the outline
const nsStyleOutline* outline;
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline);
nscoord width;
outline->GetOutlineWidth(width);
GetStyleOutline()->GetOutlineWidth(width);
if (width > 0) {
damageRect.Inflate(width, width);
}
@ -2807,8 +2783,7 @@ nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
// Style sizing methods
NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const
{
const nsStyleDisplay* display;
::GetStyleData(mStyleContext, &display);
const nsStyleDisplay* display = GetStyleDisplay();
// Absolute positioning causes |display->mDisplay| to be set to block,
// if needed.
@ -3027,9 +3002,7 @@ nsFrame::IsVisibleForPainting(nsIPresContext * aPresContext,
{
// first check to see if we are visible
if (aCheckVis) {
const nsStyleVisibility* vis =
(const nsStyleVisibility*)((nsStyleContext*)mStyleContext)->GetStyleData(eStyleStruct_Visibility);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
*aIsVisible = PR_FALSE;
return NS_OK;
}
@ -4828,17 +4801,11 @@ nsFrame::GetProperty(nsIPresContext* aPresContext,
return value;
}
NS_IMETHODIMP
nsFrame::GetStyleDataExternal(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const
/* virtual */ const nsStyleStruct*
nsFrame::GetStyleDataExternal(nsStyleStructID aSID) const
{
if (!mStyleContext) {
aStyleStruct = nsnull;
return NS_ERROR_FAILURE;
}
aStyleStruct = mStyleContext->GetStyleData(aSID);
return NS_OK;
NS_ASSERTION(mStyleContext, "unexpected null pointer");
return mStyleContext->GetStyleData(aSID);
}
#ifdef IBMBIDI

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

@ -394,8 +394,7 @@ public:
void* aPropertyValue,
NSFramePropertyDtorFunc aPropDtorFunc);
NS_IMETHOD GetStyleDataExternal(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const;
virtual const nsStyleStruct* GetStyleDataExternal(nsStyleStructID aSID) const;
#ifdef IBMBIDI
NS_IMETHOD GetBidiProperty(nsIPresContext* aPresContext,

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

@ -1591,7 +1591,7 @@ HasAttributeContent(nsStyleContext* aStyleContext,
{
PRBool result = PR_FALSE;
if (aStyleContext) {
const nsStyleContent* content = (const nsStyleContent*)aStyleContext->GetStyleData(eStyleStruct_Content);
const nsStyleContent* content = aStyleContext->GetStyleContent();
PRUint32 count = content->ContentCount();
while ((0 < count) && (! result)) {
nsStyleContentType contentType;
@ -1769,11 +1769,11 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// if old context had image and new context does not have the same image,
// stop the image load for the frame
const nsStyleBackground* oldColor = (const nsStyleBackground*)oldContext->GetStyleData(eStyleStruct_Background);
const nsStyleBackground* newColor = (const nsStyleBackground*)newContext->GetStyleData(eStyleStruct_Background);
const nsStyleBackground* oldColor = oldContext->GetStyleBackground();
const nsStyleBackground* newColor = newContext->GetStyleBackground();
if(oldColor->mBackgroundImage.Length() > 0 &&
oldColor->mBackgroundImage != newColor->mBackgroundImage ){
if (oldColor->mBackgroundImage.Length() > 0 &&
oldColor->mBackgroundImage != newColor->mBackgroundImage) {
// stop the image loading for the frame, the image has changed
aPresContext->StopImagesFor(aFrame);
}
@ -1859,8 +1859,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
newContext);
}
if (undisplayedContext) {
const nsStyleDisplay* display;
::GetStyleData(undisplayedContext.get(), &display);
const nsStyleDisplay* display = undisplayedContext->GetStyleDisplay();
if (display->mDisplay != NS_STYLE_DISPLAY_NONE) {
aChangeList.AppendChange(nsnull,
undisplayed->mContent

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

@ -274,12 +274,7 @@ nsGfxScrollFrame::ScrollTo(nsIPresContext* aContext, nscoord aX, nscoord aY, PRU
NS_IMETHODIMP
nsGfxScrollFrame::GetScrollPreference(nsIPresContext* aPresContext, nsScrollPref* aScrollPreference) const
{
const nsStyleDisplay* styleDisplay = nsnull;
GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
switch (styleDisplay->mOverflow)
switch (GetStyleDisplay()->mOverflow)
{
case NS_STYLE_OVERFLOW_SCROLL:
*aScrollPreference = AlwaysScroll;
@ -702,10 +697,7 @@ nsGfxScrollFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
nsIFrame* frame = nsnull;
GetFrame(&frame);
const nsStyleDisplay* styleDisplay = nsnull;
frame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
const nsStyleDisplay* styleDisplay = frame->GetStyleDisplay();
nsSize vSize(0,0);
if (mInner->mVScrollbarBox &&
@ -796,10 +788,7 @@ nsGfxScrollFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
nsIFrame* frame = nsnull;
GetFrame(&frame);
const nsStyleDisplay* styleDisplay = nsnull;
frame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
const nsStyleDisplay* styleDisplay = frame->GetStyleDisplay();
nsresult rv = mInner->mScrollAreaBox->GetMinSize(aState, aSize);
@ -1114,8 +1103,7 @@ nsGfxScrollFrameInner::AddHorizontalScrollbar(nsBoxLayoutState& aState, nsRect&
#ifdef IBMBIDI
PRInt32 dir = GetIntegerAttribute(mHScrollbarBox, nsXULAtoms::dir, -1);
const nsStyleVisibility* vis;
mOuter->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = mOuter->GetStyleVisibility();
// when creating the scrollbar for the first time, or whenever
// display direction is changed, scroll the view horizontally
@ -1308,8 +1296,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
PRBool scrollBarBottom = PR_TRUE;
#ifdef IBMBIDI
const nsStyleVisibility* vis;
mOuter->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = mOuter->GetStyleVisibility();
//
// Direction Style from this->GetStyleData()
@ -1333,11 +1320,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
nsIFrame* frame = nsnull;
mOuter->GetFrame(&frame);
const nsStyleDisplay* styleDisplay = nsnull;
frame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
const nsStyleDisplay* styleDisplay = frame->GetStyleDisplay();
// get the content rect
nsRect clientRect(0,0,0,0);
@ -1455,8 +1438,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
}
#ifdef IBMBIDI
const nsStyleVisibility* ourVis;
frame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)ourVis);
const nsStyleVisibility* ourVis = frame->GetStyleVisibility();
if (NS_STYLE_DIRECTION_RTL == ourVis->mDirection) {
nsCOMPtr<nsITextControlFrame> textControl(
@ -1499,8 +1481,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
float p2t;
presContext->GetScaledPixelsToTwips(&p2t);
mOnePixel = NSIntPixelsToTwips(1, p2t);
const nsStyleFont* font;
mOuter->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&) font);
const nsStyleFont* font = mOuter->GetStyleFont();
const nsFont& f = font->mFont;
nsCOMPtr<nsIFontMetrics> fm;
presContext->GetMetricsFor(f, getter_AddRefs(fm));

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

@ -119,9 +119,7 @@ HRuleFrame::Paint(nsIPresContext* aPresContext,
return NS_OK;
}
const nsStyleVisibility* vis =
(const nsStyleVisibility*)((nsStyleContext*)mStyleContext)->GetStyleData(eStyleStruct_Visibility);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
return NS_OK;
}
@ -201,8 +199,8 @@ HRuleFrame::Paint(nsIPresContext* aPresContext,
if (!noShadeAttribute) {
nsRect rect(x0, y0, width, height);
const nsStyleBorder* border = (const nsStyleBorder*) mStyleContext->GetStyleData(eStyleStruct_Border);
const nsStylePadding* padding = (const nsStylePadding*) mStyleContext->GetStyleData(eStyleStruct_Padding);
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext,
this,aDirtyRect, rect,
@ -302,8 +300,7 @@ HRuleFrame::Reflow(nsIPresContext* aPresContext,
// Compute height of "line" that hrule will layout within. Use the
// font-size to do this.
nscoord minLineHeight = thickness + twoPixels;
const nsStyleFont* font;
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&) font);
const nsStyleFont* font = GetStyleFont();
const nsFont& f = font->mFont;
nsCOMPtr<nsIFontMetrics> fm;
aPresContext->GetMetricsFor(f, getter_AddRefs(fm));

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

@ -117,8 +117,7 @@ nsHTMLContainerFrame::PaintDecorationsAndChildren(
if (decorations & (NS_STYLE_TEXT_DECORATION_UNDERLINE |
NS_STYLE_TEXT_DECORATION_OVERLINE |
NS_STYLE_TEXT_DECORATION_LINE_THROUGH)) {
const nsStyleFont* font;
::GetStyleData(this, &font);
const nsStyleFont* font = GetStyleFont();
NS_ASSERTION(font->mFont.decorations == NS_FONT_DECORATION_NONE,
"fonts on style structs shouldn't have decorations");
@ -170,14 +169,10 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext,
NS_STYLE_TEXT_DECORATION_OVERLINE |
NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
const nsStyleTextReset* styleText;
::GetStyleData(mStyleContext, &styleText);
if (!aIsBlock) {
aDecorations = styleText->mTextDecoration & decorMask;
aDecorations = GetStyleTextReset()->mTextDecoration & decorMask;
if (aDecorations) {
const nsStyleColor* styleColor;
::GetStyleData(mStyleContext, &styleColor);
const nsStyleColor* styleColor = GetStyleColor();
aUnderColor = styleColor->mColor;
aOverColor = styleColor->mColor;
aStrikeColor = styleColor->mColor;
@ -189,8 +184,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext,
// find text-decorations. "Inherit" from parent *block* frames
nsStyleContext* styleContext = frame->GetStyleContext();
const nsStyleDisplay* styleDisplay;
::GetStyleData(styleContext, &styleDisplay);
const nsStyleDisplay* styleDisplay = styleContext->GetStyleDisplay();
if (!styleDisplay->IsBlockLevel() &&
styleDisplay->mDisplay != NS_STYLE_DISPLAY_TABLE_CELL) {
// If an inline frame is discovered while walking up the tree,
@ -199,25 +193,24 @@ nsHTMLContainerFrame::GetTextDecorations(nsIPresContext* aPresContext,
break;
}
::GetStyleData(styleContext, &styleText);
const nsStyleTextReset* styleText = styleContext->GetStyleTextReset();
PRUint8 decors = decorMask & styleText->mTextDecoration;
if (decors) {
// A *new* text-decoration is found.
const nsStyleColor* styleColor;
::GetStyleData(styleContext, &styleColor);
nscolor color = styleContext->GetStyleColor()->mColor;
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decors) {
aUnderColor = styleColor->mColor;
aUnderColor = color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
aDecorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
}
if (NS_STYLE_TEXT_DECORATION_OVERLINE & decors) {
aOverColor = styleColor->mColor;
aOverColor = color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
aDecorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
}
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & decors) {
aStrikeColor = styleColor->mColor;
aStrikeColor = color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
aDecorations |= NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
}
@ -249,8 +242,7 @@ HasTextFrameDescendant(nsIPresContext* aPresContext, nsIFrame* aParent)
// See bug 20163.
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
const nsStyleText* styleText;
::GetStyleData(kid, &styleText);
const nsStyleText* styleText = kid->GetStyleText();
// XXXldb This is the wrong way to set |isPre|.
PRBool isPre = NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace ||
NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace;
@ -676,8 +668,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext* aPresContext,
// XXX If it's fixed positioned, then create a widget so it floats
// above the scrolling area
const nsStyleDisplay* display;
::GetStyleData(aStyleContext, &display);
const nsStyleDisplay* display = aStyleContext->GetStyleDisplay();
if (NS_STYLE_POSITION_FIXED == display->mPosition) {
view->CreateWidget(kCChildCID);
}
@ -716,8 +707,7 @@ nsHTMLContainerFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
// Currently we actually paint 'outline' inside the element so this code
// isn't strictly necessary. But we're trying to get ready to switch to
// CSS2 compliance.
const nsStyleOutline* outline;
::GetStyleData(this, &outline);
const nsStyleOutline* outline = GetStyleOutline();
PRUint8 outlineStyle = outline->GetOutlineStyle();
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE
&& outlineStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
@ -733,8 +723,7 @@ nsHTMLContainerFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
// Invalidate the old frame if the frame has borders. Those borders
// may be moving.
const nsStyleBorder* border;
::GetStyleData(this, &border);
const nsStyleBorder* border = GetStyleBorder();
if (border->IsBorderSideVisible(NS_SIDE_LEFT)
|| border->IsBorderSideVisible(NS_SIDE_RIGHT)
|| border->IsBorderSideVisible(NS_SIDE_TOP)
@ -745,8 +734,7 @@ nsHTMLContainerFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
// Invalidate the old frame if the frame has a background
// whose position depends on the size of the frame
const nsStyleBackground* background;
::GetStyleData(this, &background);
const nsStyleBackground* background = GetStyleBackground();
if (background->mBackgroundFlags &
(NS_STYLE_BG_X_POSITION_PERCENT | NS_STYLE_BG_Y_POSITION_PERCENT)) {
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));

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

@ -324,13 +324,13 @@ nsHTMLReflowState::Init(nsIPresContext* aPresContext,
mDebugHook = nsnull;
#endif
GetStyleData(frame, &mStylePosition);
GetStyleData(frame, &mStyleDisplay);
GetStyleData(frame, &mStyleVisibility);
GetStyleData(frame, &mStyleBorder);
GetStyleData(frame, &mStyleMargin);
GetStyleData(frame, &mStylePadding);
GetStyleData(frame, &mStyleText);
mStylePosition = frame->GetStylePosition();
mStyleDisplay = frame->GetStyleDisplay();
mStyleVisibility = frame->GetStyleVisibility();
mStyleBorder = frame->GetStyleBorder();
mStyleMargin = frame->GetStyleMargin();
mStylePadding = frame->GetStylePadding();
mStyleText = frame->GetStyleText();
mFrameType = DetermineFrameType(frame, mStyleDisplay);
InitCBReflowState();
@ -379,9 +379,7 @@ nsHTMLReflowState::GetContainingBlockContentWidth(const nsHTMLReflowState* aPare
nsCSSFrameType
nsHTMLReflowState::DetermineFrameType(nsIFrame* aFrame)
{
const nsStyleDisplay* styleDisplay;
aFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&)styleDisplay);
const nsStyleDisplay* styleDisplay = aFrame->GetStyleDisplay();
return DetermineFrameType(aFrame, styleDisplay);
}
@ -484,8 +482,7 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
// If neither 'left' not 'right' are auto, then we're over-constrained and
// we ignore one of them
if (!leftIsAuto && !rightIsAuto) {
const nsStyleVisibility* vis;
frame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
const nsStyleVisibility* vis = frame->GetStyleVisibility();
if (NS_STYLE_DIRECTION_LTR == vis->mDirection) {
rightIsAuto = PR_TRUE;
@ -845,8 +842,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext,
}
// Get the 'direction' of the block
const nsStyleVisibility* blockVis;
aBlockFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)blockVis);
const nsStyleVisibility* blockVis = aBlockFrame->GetStyleVisibility();
// Get the placeholder x-offset and y-offset in the coordinate
// space of the block frame that contains it
@ -946,10 +942,9 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext,
// The specified offsets are relative to the absolute containing block's padding
// edge, and our current values are relative to the border edge so translate
nsMargin border;
const nsStyleBorder* borderStyle;
aAbsoluteContainingBlockFrame->GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderStyle);
const nsStyleBorder* borderStyle =
aAbsoluteContainingBlockFrame->GetStyleBorder();
nsMargin border;
if (!borderStyle->GetBorder(border)) {
NS_NOTYETIMPLEMENTED("percentage border");
}
@ -2003,9 +1998,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
// Check for blinking text and permission to display it
mFlags.mBlinks = (parentReflowState && parentReflowState->mFlags.mBlinks);
if (!mFlags.mBlinks && BlinkIsAllowed()) {
const nsStyleTextReset* st;
frame->GetStyleData(eStyleStruct_TextReset,
(const nsStyleStruct*&)st);
const nsStyleTextReset* st = frame->GetStyleTextReset();
mFlags.mBlinks =
((st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK) != 0);
}
@ -2322,12 +2315,9 @@ ComputeLineHeight(nsIPresContext* aPresContext,
nscoord lineHeight = -1;
const nsStyleText* text;
GetStyleData(aStyleContext, &text);
const nsStyleFont* font;
GetStyleData(aStyleContext, &font);
const nsStyleVisibility* vis;
GetStyleData(aStyleContext, &vis);
const nsStyleText* text = aStyleContext->GetStyleText();
const nsStyleFont* font = aStyleContext->GetStyleFont();
const nsStyleVisibility* vis = aStyleContext->GetStyleVisibility();
nsStyleUnit unit = text->mLineHeight.GetUnit();
@ -2383,8 +2373,7 @@ nsHTMLReflowState::CalcLineHeight(nsIPresContext* aPresContext,
if (lineHeight < 0) {
// Negative line-heights are not allowed by the spec. Translate
// them into "normal" when found.
const nsStyleFont* font = (const nsStyleFont*)
sc->GetStyleData(eStyleStruct_Font);
const nsStyleFont* font = sc->GetStyleFont();
if (UseComputedHeight()) {
lineHeight = font->mFont.size;
}

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

@ -126,13 +126,13 @@
nsImageFrame::IconLoad* nsImageFrame::mIconLoad = nsnull;
// test if the width and height are fixed, looking at the style data
static PRBool HaveFixedSize(const struct nsStylePosition& aStylePosition)
static PRBool HaveFixedSize(const nsStylePosition* aStylePosition)
{
// check the width and height values in the reflow state's style struct
// - if width and height are specified as either coord or percentage, then
// the size of the image frame is constrained
nsStyleUnit widthUnit = aStylePosition.mWidth.GetUnit();
nsStyleUnit heightUnit = aStylePosition.mHeight.GetUnit();
nsStyleUnit widthUnit = aStylePosition->mWidth.GetUnit();
nsStyleUnit heightUnit = aStylePosition->mHeight.GetUnit();
return ((widthUnit == eStyleUnit_Coord ||
widthUnit == eStyleUnit_Percent) &&
@ -158,7 +158,7 @@ inline PRBool HaveFixedSize(const nsHTMLReflowState& aReflowState)
(eStyleUnit_Percent == widthUnit && (NS_UNCONSTRAINEDSIZE == aReflowState.mComputedWidth ||
0 == aReflowState.mComputedWidth)))
? PR_FALSE
: HaveFixedSize(*(aReflowState.mStylePosition));
: HaveFixedSize(aReflowState.mStylePosition);
}
nsresult
@ -477,9 +477,7 @@ nsImageFrame::HandleLoadError(nsresult aStatus, nsIPresShell* aPresShell)
PRBool useSizedBox;
const nsStyleUIReset* uiResetData;
::GetStyleData(this, &uiResetData);
NS_ASSERTION(uiResetData, "null style position: frame is corrupted");
const nsStyleUIReset* uiResetData = GetStyleUIReset();
if (uiResetData->mForceBrokenImageIcon) {
useSizedBox = PR_TRUE;
}
@ -508,11 +506,7 @@ nsImageFrame::HandleLoadError(nsresult aStatus, nsIPresShell* aPresShell)
}
else {
// check whether we have fixed size
const nsStylePosition* stylePosition;
::GetStyleData(this, &stylePosition);
NS_ASSERTION(stylePosition, "null style position: frame is corrupted");
useSizedBox = HaveFixedSize(*stylePosition);
useSizedBox = HaveFixedSize(GetStylePosition());
}
}
}
@ -707,10 +701,7 @@ nsImageFrame::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *aNewFrame,
nsRect *aDirtyRect)
{
const nsStyleVisibility* vis;
::GetStyleData(this, &vis);
if (!vis->IsVisible()) {
if (!GetStyleVisibility()->IsVisible()) {
return NS_OK;
}
@ -1053,10 +1044,8 @@ nsImageFrame::DisplayAltText(nsIPresContext* aPresContext,
const nsString& aAltText,
const nsRect& aRect)
{
const nsStyleColor* color =
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
// Set font and color
aRenderingContext.SetColor(color->mColor);
aRenderingContext.SetColor(GetStyleColor()->mColor);
SetFontFromStyle(&aRenderingContext, mStyleContext);
// Format the text to display within the formatting rect
@ -1260,8 +1249,7 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
// FOREGROUND or BACKGROUND paint layer if the element is
// inline-level or block-level, respectively (bug 36710). (See
// CSS2 9.5, which is the rationale for paint layers.)
const nsStyleDisplay *display;
::GetStyleData(mStyleContext, &display);
const nsStyleDisplay* display = GetStyleDisplay();
nsFramePaintLayer backgroundLayer = display->IsBlockLevel()
? NS_FRAME_PAINT_LAYER_BACKGROUND
: NS_FRAME_PAINT_LAYER_FOREGROUND;
@ -1384,10 +1372,8 @@ nsImageFrame::Paint(nsIPresContext* aPresContext,
// paint the outline in the overlay layer (or if there is an image map) until the
// general problem of painting it outside the border box is solved.
if (paintOutline) {
const nsStyleBorder* myBorder = (const nsStyleBorder*)
mStyleContext->GetStyleData(eStyleStruct_Border);
const nsStyleOutline* myOutline = (const nsStyleOutline*)
mStyleContext->GetStyleData(eStyleStruct_Outline);
const nsStyleBorder* myBorder = GetStyleBorder();
const nsStyleOutline* myOutline = GetStyleOutline();
nsRect rect(0, 0, mRect.width, mRect.height);
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *myBorder,
@ -1778,9 +1764,7 @@ nsImageFrame::GetCursor(nsIPresContext* aPresContext,
if (map->IsInside(p.x, p.y)) {
// Use style defined cursor if one is provided, otherwise when
// the cursor style is "auto" we use the pointer cursor.
const nsStyleUserInterface* styleUserInterface;
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)styleUserInterface);
aCursor = styleUserInterface->mCursor;
aCursor = GetStyleUserInterface()->mCursor;
if (NS_STYLE_CURSOR_AUTO == aCursor) {
aCursor = NS_STYLE_CURSOR_POINTER;
}

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

@ -151,12 +151,9 @@ nsInlineFrame::IsEmpty(nsCompatibility aCompatMode, PRBool aIsPre,
return NS_OK;
}
#endif
const nsStyleMargin* margin = NS_STATIC_CAST(const nsStyleMargin*,
mStyleContext->GetStyleData(eStyleStruct_Margin));
const nsStyleBorder* border = NS_STATIC_CAST(const nsStyleBorder*,
mStyleContext->GetStyleData(eStyleStruct_Border));
const nsStylePadding* padding = NS_STATIC_CAST(const nsStylePadding*,
mStyleContext->GetStyleData(eStyleStruct_Padding));
const nsStyleMargin* margin = GetStyleMargin();
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsStyleCoord coord;
// XXX Top and bottom removed, since they shouldn't affect things, but this
// doesn't really match with nsLineLayout.cpp's setting of
@ -660,8 +657,7 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext,
// little hack lets us override that behavior to allow for more
// precise layout in the face of imprecise fonts.
if (nsHTMLReflowState::UseComputedHeight()) {
const nsStyleFont* font;
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font);
const nsStyleFont* font = GetStyleFont();
aMetrics.height = font->mFont.size +
aReflowState.mComputedBorderPadding.top +
aReflowState.mComputedBorderPadding.bottom;

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

@ -165,8 +165,7 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
MOZ_COUNT_CTOR(nsLineLayout);
// Stash away some style data that we need
aOuterReflowState->frame->GetStyleData(eStyleStruct_Text,
(const nsStyleStruct*&) mStyleText);
mStyleText = aOuterReflowState->frame->GetStyleText();
mTextAlign = mStyleText->mTextAlign;
mLineNumber = 0;
mColumn = 0;
@ -546,9 +545,7 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame,
psd->mX = aLeftEdge;
psd->mRightEdge = aRightEdge;
const nsStyleText* styleText;
aSpanReflowState->frame->GetStyleData(eStyleStruct_Text,
(const nsStyleStruct*&) styleText);
const nsStyleText* styleText = aSpanReflowState->frame->GetStyleText();
switch (styleText->mWhiteSpace) {
case NS_STYLE_WHITESPACE_PRE:
case NS_STYLE_WHITESPACE_NOWRAP:
@ -1087,10 +1084,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
if (nsLayoutAtoms::placeholderFrame == frameType.get()) {
nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)aFrame)->GetOutOfFlowFrame();
if (outOfFlowFrame) {
const nsStyleDisplay* display;
// Make sure it's floated and not absolutely positioned
outOfFlowFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
if (!display->IsAbsolutelyPositioned()) {
if (eReflowReason_Incremental == reason) {
InitFloater((nsPlaceholderFrame*)aFrame, aReflowStatus);
@ -1705,40 +1700,22 @@ nsLineLayout::IsPercentageAwareReplacedElement(nsIPresContext *aPresContext,
if (nsLayoutAtoms::brFrame != frameType.get() &&
nsLayoutAtoms::textFrame != frameType.get())
{
nsresult rv;
const nsStyleMargin* margin;
rv = aFrame->GetStyleData(eStyleStruct_Margin,(const nsStyleStruct*&) margin);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStyleMargin* margin = aFrame->GetStyleMargin();
if (IsPercentageUnitSides(&margin->mMargin)) {
return PR_TRUE;
}
const nsStylePadding* padding;
rv = aFrame->GetStyleData(eStyleStruct_Padding,(const nsStyleStruct*&) padding);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStylePadding* padding = aFrame->GetStylePadding();
if (IsPercentageUnitSides(&padding->mPadding)) {
return PR_TRUE;
}
const nsStyleBorder* border;
rv = aFrame->GetStyleData(eStyleStruct_Border,(const nsStyleStruct*&) border);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStyleBorder* border = aFrame->GetStyleBorder();
if (IsPercentageUnitSides(&border->mBorder)) {
return PR_TRUE;
}
const nsStylePosition* pos;
rv = aFrame->GetStyleData(eStyleStruct_Position,(const nsStyleStruct*&) pos);
if (NS_FAILED(rv)) {
return PR_TRUE; // just to be on the safe side
}
const nsStylePosition* pos = aFrame->GetStylePosition();
if (eStyleUnit_Percent == pos->mWidth.GetUnit()
|| eStyleUnit_Percent == pos->mMaxWidth.GetUnit()
|| eStyleUnit_Percent == pos->mMinWidth.GetUnit()
@ -2289,8 +2266,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
}
// Get vertical-align property
const nsStyleTextReset* textStyle;
frame->GetStyleData(eStyleStruct_TextReset, (const nsStyleStruct*&)textStyle);
const nsStyleTextReset* textStyle = frame->GetStyleTextReset();
nsStyleUnit verticalAlignUnit = textStyle->mVerticalAlign.GetUnit();
#ifdef DEBUG
if (eStyleUnit_Inherit == verticalAlignUnit) {
@ -2496,8 +2472,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// Only consider non empty text frames when line-height=normal
PRBool canUpdate = !pfd->GetFlag(PFD_ISTEXTFRAME);
if (!canUpdate && pfd->GetFlag(PFD_ISNONWHITESPACETEXTFRAME)) {
const nsStyleText* textStyle;
frame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textStyle);
const nsStyleText* textStyle = frame->GetStyleText();
canUpdate = textStyle->mLineHeight.GetUnit() == eStyleUnit_Normal ||
textStyle->mLineHeight.GetUnit() == eStyleUnit_Null;
}
@ -2602,9 +2577,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
nscoord fontAscent, fontHeight;
fm->GetMaxAscent(fontAscent);
if (nsHTMLReflowState::UseComputedHeight()) {
const nsStyleFont* parentFont;
spanFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)parentFont);
fontHeight = parentFont->mFont.size;
fontHeight = spanFrame->GetStyleFont()->mFont.size;
}
else
{
@ -3004,8 +2977,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
}
}
const nsStyleMargin* margin;
::GetStyleData(hrFrame, &margin);
const nsStyleMargin* margin = hrFrame->GetStyleMargin();
textAlign = NS_STYLE_TEXT_ALIGN_CENTER;
nsStyleCoord zero(nscoord(0));
nsStyleCoord temp;
@ -3326,9 +3298,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
if (! aFrame)
break;
const nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, NS_REINTERPRET_CAST(const nsStyleStruct*&, display));
if (NS_STYLE_DISPLAY_INLINE != display->mDisplay)
if (NS_STYLE_DISPLAY_INLINE != aFrame->GetStyleDisplay()->mDisplay)
break;
}
@ -3401,8 +3371,7 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
PRBool
nsLineLayout::TreatFrameAsBlock(nsIFrame* aFrame)
{
const nsStyleDisplay* display;
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
const nsStyleDisplay* display = aFrame->GetStyleDisplay();
if (NS_STYLE_POSITION_ABSOLUTE == display->mPosition) {
return PR_FALSE;
}

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

@ -859,8 +859,7 @@ nsObjectFrame::CreateWidget(nsIPresContext* aPresContext,
// Sometimes, a frame doesn't have a background color or is transparent. In this
// case, walk up the frame tree until we do find a frame with a background color
for (nsIFrame* frame = this; frame; frame->GetParent(&frame)) {
const nsStyleBackground* background;
::GetStyleData(frame, &background);
const nsStyleBackground* background = frame->GetStyleBackground();
if (!background->IsTransparent()) { // make sure we got an actual color
nsCOMPtr<nsIWidget> win;
view->GetWidget(*getter_AddRefs(win));
@ -1428,8 +1427,7 @@ PRBool
nsObjectFrame::IsHidden(PRBool aCheckVisibilityStyle) const
{
if (aCheckVisibilityStyle) {
const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if (vis && !vis->IsVisibleOrCollapsed())
if (!GetStyleVisibility()->IsVisibleOrCollapsed())
return PR_TRUE;
}
@ -1596,8 +1594,7 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
nsFramePaintLayer aWhichLayer,
PRUint32 aFlags)
{
const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
if ((vis != nsnull) && !vis->IsVisibleOrCollapsed())
if (!GetStyleVisibility()->IsVisibleOrCollapsed())
return NS_OK;
nsIFrame * child = mFrames.FirstChild();

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

@ -749,12 +749,8 @@ nsPageFrame::DrawBackground(nsIPresContext* aPresContext,
nsRect rect;
pageContentFrame->GetRect(rect);
const nsStyleBorder* border =
NS_STATIC_CAST(const nsStyleBorder*,
mStyleContext->GetStyleData(eStyleStruct_Border));
const nsStylePadding* padding =
NS_STATIC_CAST(const nsStylePadding*,
mStyleContext->GetStyleData(eStyleStruct_Padding));
const nsStyleBorder* border = GetStyleBorder();
const nsStylePadding* padding = GetStylePadding();
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
aDirtyRect, rect, *border, *padding,

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