Issue #2112 - Part 13: Remove construction context for style structs

Partial reversion of bug 1261552. This keeps the behavior of always passing the presentation context to the style structs, unlike pre-stylo where it is conditional.
This commit is contained in:
FranklinDM 2024-03-25 22:40:54 +08:00 • committed by roytam1
commit cb08fdd1f0
4 changed files with 67 additions and 164 deletions

View file

@ -1,80 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_StyleStructContext_h
#define mozilla_StyleStructContext_h
#include "CounterStyleManager.h"
#include "mozilla/LookAndFeel.h"
#include "nsPresContext.h"
class nsDeviceContext;
/**
* Construction context for style structs.
* TODO: marked for removal.
*/
class StyleStructContext {
public:
MOZ_IMPLICIT StyleStructContext(nsPresContext* aPresContext)
: mPresContext(aPresContext) { MOZ_ASSERT(aPresContext); }
static StyleStructContext ServoContext() { return StyleStructContext(); }
float TextZoom()
{
return mPresContext->TextZoom();
}
const nsFont* GetDefaultFont(uint8_t aFontID)
{
return mPresContext->GetDefaultFont(aFontID, GetLanguageFromCharset());
}
uint32_t GetBidi()
{
return mPresContext->GetBidi();
}
int32_t AppUnitsPerDevPixel();
nscoord DevPixelsToAppUnits(int32_t aPixels)
{
return NSIntPixelsToAppUnits(aPixels, AppUnitsPerDevPixel());
}
typedef mozilla::LookAndFeel LookAndFeel;
nscolor DefaultColor()
{
return mPresContext->DefaultColor();
}
mozilla::CounterStyle* BuildCounterStyle(const nsSubstring& aName)
{
return mPresContext->CounterStyleManager()->BuildCounterStyle(aName);
}
nsIAtom* GetLanguageFromCharset() const
{
return mPresContext->GetLanguageFromCharset();
}
already_AddRefed<nsIAtom> GetContentLanguage() const
{
return mPresContext->GetContentLanguage();
}
private:
nsDeviceContext* DeviceContext()
{
return mPresContext->DeviceContext();
}
nsDeviceContext* HackilyFindSomeDeviceContext();
StyleStructContext() : mPresContext(nullptr) {}
nsPresContext* mPresContext;
};
#endif // mozilla_StyleStructContext_h

View file

@ -96,7 +96,6 @@ EXPORTS.mozilla += [
'StyleSheet.h', 'StyleSheet.h',
'StyleSheetInfo.h', 'StyleSheetInfo.h',
'StyleSheetInlines.h', 'StyleSheetInlines.h',
'StyleStructContext.h',
] ]
EXPORTS.mozilla.dom += [ EXPORTS.mozilla.dom += [

View file

@ -116,28 +116,12 @@ safe_strcmp(const char16_t* a, const char16_t* b)
return NS_strcmp(a, b); return NS_strcmp(a, b);
} }
int32_t
StyleStructContext::AppUnitsPerDevPixel()
{
return DeviceContext()->AppUnitsPerDevPixel();
}
nsDeviceContext*
StyleStructContext::HackilyFindSomeDeviceContext()
{
nsCOMPtr<nsIAppShellService> appShell(do_GetService("@mozilla.org/appshell/appShellService;1"));
MOZ_ASSERT(appShell);
nsCOMPtr<mozIDOMWindowProxy> win;
appShell->GetHiddenDOMWindow(getter_AddRefs(win));
return nsLayoutUtils::GetDeviceContextForScreenInfo(static_cast<nsPIDOMWindowOuter*>(win.get()));
}
static bool AreShadowArraysEqual(nsCSSShadowArray* lhs, nsCSSShadowArray* rhs); static bool AreShadowArraysEqual(nsCSSShadowArray* lhs, nsCSSShadowArray* rhs);
// -------------------- // --------------------
// nsStyleFont // nsStyleFont
// //
nsStyleFont::nsStyleFont(const nsFont& aFont, StyleStructContext aContext) nsStyleFont::nsStyleFont(const nsFont& aFont, nsPresContext* aContext)
: mFont(aFont) : mFont(aFont)
, mSize(nsStyleFont::ZoomText(aContext, mFont.size)) , mSize(nsStyleFont::ZoomText(aContext, mFont.size))
, mGenericID(kGenericFont_NONE) , mGenericID(kGenericFont_NONE)
@ -175,9 +159,9 @@ nsStyleFont::nsStyleFont(const nsStyleFont& aSrc)
MOZ_COUNT_CTOR(nsStyleFont); MOZ_COUNT_CTOR(nsStyleFont);
} }
nsStyleFont::nsStyleFont(StyleStructContext aContext) nsStyleFont::nsStyleFont(nsPresContext* aContext)
: nsStyleFont(*aContext.GetDefaultFont(kPresContext_DefaultVariableFont_ID), : nsStyleFont(*(aContext->GetDefaultFont(
aContext) kPresContext_DefaultVariableFont_ID, nullptr)), aContext)
{ {
} }
@ -236,11 +220,11 @@ nsStyleFont::CalcDifference(const nsStyleFont& aNewData) const
} }
/* static */ nscoord /* static */ nscoord
nsStyleFont::ZoomText(StyleStructContext aContext, nscoord aSize) nsStyleFont::ZoomText(nsPresContext* aContext, nscoord aSize)
{ {
// aSize can be negative (e.g.: calc(-1px)) so we can't assert that here. // aSize can be negative (e.g.: calc(-1px)) so we can't assert that here.
// The caller is expected deal with that. // The caller is expected deal with that.
return NSToCoordTruncClamped(float(aSize) * aContext.TextZoom()); return NSToCoordTruncClamped(float(aSize) * aContext->TextZoom());
} }
/* static */ nscoord /* static */ nscoord
@ -252,16 +236,16 @@ nsStyleFont::UnZoomText(nsPresContext *aPresContext, nscoord aSize)
} }
/* static */ already_AddRefed<nsIAtom> /* static */ already_AddRefed<nsIAtom>
nsStyleFont::GetLanguage(StyleStructContext aContext) nsStyleFont::GetLanguage(nsPresContext* aContext)
{ {
RefPtr<nsIAtom> language = aContext.GetContentLanguage(); RefPtr<nsIAtom> language = aContext->GetContentLanguage();
if (!language) { if (!language) {
// we didn't find a (usable) Content-Language, so we fall back // we didn't find a (usable) Content-Language, so we fall back
// to whatever the presContext guessed from the charset // to whatever the presContext guessed from the charset
// NOTE this should not be used elsewhere, because we want websites // NOTE this should not be used elsewhere, because we want websites
// to use UTF-8 with proper language tag, instead of relying on // to use UTF-8 with proper language tag, instead of relying on
// deriving language from charset. See bug 1040668 comment 67. // deriving language from charset. See bug 1040668 comment 67.
language = aContext.GetLanguageFromCharset(); language = aContext->GetLanguageFromCharset();
} }
return language.forget(); return language.forget();
} }
@ -282,7 +266,7 @@ CalcCoord(const nsStyleCoord& aCoord, const nscoord* aEnumTable, int32_t aNumEnu
return nsRuleNode::ComputeCoordPercentCalc(aCoord, 0); return nsRuleNode::ComputeCoordPercentCalc(aCoord, 0);
} }
nsStyleMargin::nsStyleMargin(StyleStructContext aContext) nsStyleMargin::nsStyleMargin(nsPresContext* aContext)
{ {
MOZ_COUNT_CTOR(nsStyleMargin); MOZ_COUNT_CTOR(nsStyleMargin);
nsStyleCoord zero(0, nsStyleCoord::CoordConstructor); nsStyleCoord zero(0, nsStyleCoord::CoordConstructor);
@ -317,7 +301,7 @@ nsStyleMargin::CalcDifference(const nsStyleMargin& aNewData) const
nsChangeHint_ClearAncestorIntrinsics; nsChangeHint_ClearAncestorIntrinsics;
} }
nsStylePadding::nsStylePadding(StyleStructContext aContext) nsStylePadding::nsStylePadding(nsPresContext* aContext)
{ {
MOZ_COUNT_CTOR(nsStylePadding); MOZ_COUNT_CTOR(nsStylePadding);
nsStyleCoord zero(0, nsStyleCoord::CoordConstructor); nsStyleCoord zero(0, nsStyleCoord::CoordConstructor);
@ -356,7 +340,7 @@ nsStylePadding::CalcDifference(const nsStylePadding& aNewData) const
return NS_STYLE_HINT_REFLOW & ~nsChangeHint_ClearDescendantIntrinsics; return NS_STYLE_HINT_REFLOW & ~nsChangeHint_ClearDescendantIntrinsics;
} }
nsStyleBorder::nsStyleBorder(StyleStructContext aContext) nsStyleBorder::nsStyleBorder(nsPresContext* aContext)
: mBorderColors(nullptr) : mBorderColors(nullptr)
, mBorderImageFill(NS_STYLE_BORDER_IMAGE_SLICE_NOFILL) , mBorderImageFill(NS_STYLE_BORDER_IMAGE_SLICE_NOFILL)
, mBorderImageRepeatH(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH) , mBorderImageRepeatH(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
@ -383,7 +367,7 @@ nsStyleBorder::nsStyleBorder(StyleStructContext aContext)
mBorderColor[side] = StyleComplexColor::CurrentColor(); mBorderColor[side] = StyleComplexColor::CurrentColor();
} }
mTwipsPerPixel = aContext.DevPixelsToAppUnits(1); mTwipsPerPixel = aContext->DevPixelsToAppUnits(1);
} }
nsBorderColors::~nsBorderColors() nsBorderColors::~nsBorderColors()
@ -564,13 +548,13 @@ nsStyleBorder::CalcDifference(const nsStyleBorder& aNewData) const
return nsChangeHint(0); return nsChangeHint(0);
} }
nsStyleOutline::nsStyleOutline(StyleStructContext aContext) nsStyleOutline::nsStyleOutline(nsPresContext* aContext)
: mOutlineWidth(NS_STYLE_BORDER_WIDTH_MEDIUM, eStyleUnit_Enumerated) : mOutlineWidth(NS_STYLE_BORDER_WIDTH_MEDIUM, eStyleUnit_Enumerated)
, mOutlineOffset(0) , mOutlineOffset(0)
, mOutlineColor(StyleComplexColor::CurrentColor()) , mOutlineColor(StyleComplexColor::CurrentColor())
, mOutlineStyle(NS_STYLE_BORDER_STYLE_NONE) , mOutlineStyle(NS_STYLE_BORDER_STYLE_NONE)
, mActualOutlineWidth(0) , mActualOutlineWidth(0)
, mTwipsPerPixel(aContext.DevPixelsToAppUnits(1)) , mTwipsPerPixel(aContext->DevPixelsToAppUnits(1))
{ {
MOZ_COUNT_CTOR(nsStyleOutline); MOZ_COUNT_CTOR(nsStyleOutline);
// spacing values not inherited // spacing values not inherited
@ -640,9 +624,10 @@ nsStyleOutline::CalcDifference(const nsStyleOutline& aNewData) const
// -------------------- // --------------------
// nsStyleList // nsStyleList
// //
nsStyleList::nsStyleList(StyleStructContext aContext) nsStyleList::nsStyleList(nsPresContext* aContext)
: mListStylePosition(NS_STYLE_LIST_STYLE_POSITION_OUTSIDE) : mListStylePosition(NS_STYLE_LIST_STYLE_POSITION_OUTSIDE)
, mCounterStyle(aContext.BuildCounterStyle(NS_LITERAL_STRING("disc"))) , mCounterStyle(aContext->CounterStyleManager()->
BuildCounterStyle(NS_LITERAL_STRING("disc")))
{ {
MOZ_COUNT_CTOR(nsStyleList); MOZ_COUNT_CTOR(nsStyleList);
SetQuotesInitial(); SetQuotesInitial();
@ -750,7 +735,7 @@ nsStyleList::sNoneQuotes;
// -------------------- // --------------------
// nsStyleXUL // nsStyleXUL
// //
nsStyleXUL::nsStyleXUL(StyleStructContext aContext) nsStyleXUL::nsStyleXUL(nsPresContext* aContext)
: mBoxFlex(0.0f) : mBoxFlex(0.0f)
, mBoxOrdinal(1) , mBoxOrdinal(1)
, mBoxAlign(StyleBoxAlign::Stretch) , mBoxAlign(StyleBoxAlign::Stretch)
@ -802,7 +787,7 @@ nsStyleXUL::CalcDifference(const nsStyleXUL& aNewData) const
// //
/* static */ const uint32_t nsStyleColumn::kMaxColumnCount; /* static */ const uint32_t nsStyleColumn::kMaxColumnCount;
nsStyleColumn::nsStyleColumn(StyleStructContext aContext) nsStyleColumn::nsStyleColumn(nsPresContext* aContext)
: mColumnCount(NS_STYLE_COLUMN_COUNT_AUTO) : mColumnCount(NS_STYLE_COLUMN_COUNT_AUTO)
, mColumnWidth(eStyleUnit_Auto) , mColumnWidth(eStyleUnit_Auto)
, mColumnRuleColor(StyleComplexColor::CurrentColor()) , mColumnRuleColor(StyleComplexColor::CurrentColor())
@ -810,7 +795,7 @@ nsStyleColumn::nsStyleColumn(StyleStructContext aContext)
, mColumnFill(NS_STYLE_COLUMN_FILL_BALANCE) , mColumnFill(NS_STYLE_COLUMN_FILL_BALANCE)
, mColumnRuleWidth((StaticPresData::Get() , mColumnRuleWidth((StaticPresData::Get()
->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM]) ->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM])
, mTwipsPerPixel(aContext.AppUnitsPerDevPixel()) , mTwipsPerPixel(aContext->AppUnitsPerDevPixel())
{ {
MOZ_COUNT_CTOR(nsStyleColumn); MOZ_COUNT_CTOR(nsStyleColumn);
} }
@ -868,7 +853,7 @@ nsStyleColumn::CalcDifference(const nsStyleColumn& aNewData) const
// -------------------- // --------------------
// nsStyleSVG // nsStyleSVG
// //
nsStyleSVG::nsStyleSVG(StyleStructContext aContext) nsStyleSVG::nsStyleSVG(nsPresContext* aContext)
: mFill(eStyleSVGPaintType_Color) // Will be initialized to NS_RGB(0, 0, 0) : mFill(eStyleSVGPaintType_Color) // Will be initialized to NS_RGB(0, 0, 0)
, mStroke(eStyleSVGPaintType_None) , mStroke(eStyleSVGPaintType_None)
, mStrokeDashoffset(0, nsStyleCoord::CoordConstructor) , mStrokeDashoffset(0, nsStyleCoord::CoordConstructor)
@ -1142,7 +1127,7 @@ nsStyleFilter::SetDropShadow(nsCSSShadowArray* aDropShadow)
// -------------------- // --------------------
// nsStyleSVGReset // nsStyleSVGReset
// //
nsStyleSVGReset::nsStyleSVGReset(StyleStructContext aContext) nsStyleSVGReset::nsStyleSVGReset(nsPresContext* aContext)
: mMask(nsStyleImageLayers::LayerType::Mask) : mMask(nsStyleImageLayers::LayerType::Mask)
, mStopColor(NS_RGB(0, 0, 0)) , mStopColor(NS_RGB(0, 0, 0))
, mFloodColor(NS_RGB(0, 0, 0)) , mFloodColor(NS_RGB(0, 0, 0))
@ -1364,7 +1349,7 @@ bool nsStyleSVGPaint::operator==(const nsStyleSVGPaint& aOther) const
// -------------------- // --------------------
// nsStylePosition // nsStylePosition
// //
nsStylePosition::nsStylePosition(StyleStructContext aContext) nsStylePosition::nsStylePosition(nsPresContext* aContext)
: mWidth(eStyleUnit_Auto) : mWidth(eStyleUnit_Auto)
, mMinWidth(eStyleUnit_Auto) , mMinWidth(eStyleUnit_Auto)
, mMaxWidth(eStyleUnit_None) , mMaxWidth(eStyleUnit_None)
@ -1695,7 +1680,7 @@ nsStylePosition::UsedJustifySelf(nsStyleContext* aParent) const
// nsStyleTable // nsStyleTable
// //
nsStyleTable::nsStyleTable(StyleStructContext aContext) nsStyleTable::nsStyleTable(nsPresContext* aContext)
: mLayoutStrategy(NS_STYLE_TABLE_LAYOUT_AUTO) : mLayoutStrategy(NS_STYLE_TABLE_LAYOUT_AUTO)
, mSpan(1) , mSpan(1)
{ {
@ -1727,7 +1712,7 @@ nsStyleTable::CalcDifference(const nsStyleTable& aNewData) const
// ----------------------- // -----------------------
// nsStyleTableBorder // nsStyleTableBorder
nsStyleTableBorder::nsStyleTableBorder(StyleStructContext aContext) nsStyleTableBorder::nsStyleTableBorder(nsPresContext* aContext)
: mBorderSpacingCol(0) : mBorderSpacingCol(0)
, mBorderSpacingRow(0) , mBorderSpacingRow(0)
, mBorderCollapse(NS_STYLE_BORDER_SEPARATE) , mBorderCollapse(NS_STYLE_BORDER_SEPARATE)
@ -1779,8 +1764,8 @@ nsStyleTableBorder::CalcDifference(const nsStyleTableBorder& aNewData) const
// nsStyleColor // nsStyleColor
// //
nsStyleColor::nsStyleColor(StyleStructContext aContext) nsStyleColor::nsStyleColor(nsPresContext* aContext)
: mColor(aContext.DefaultColor()) : mColor(aContext->DefaultColor())
{ {
MOZ_COUNT_CTOR(nsStyleColor); MOZ_COUNT_CTOR(nsStyleColor);
} }
@ -2839,7 +2824,7 @@ nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aNewL
// nsStyleBackground // nsStyleBackground
// //
nsStyleBackground::nsStyleBackground(StyleStructContext aContext) nsStyleBackground::nsStyleBackground(nsPresContext* aContext)
: mImage(nsStyleImageLayers::LayerType::Background) : mImage(nsStyleImageLayers::LayerType::Background)
, mBackgroundColor(NS_RGBA(0, 0, 0, 0)) , mBackgroundColor(NS_RGBA(0, 0, 0, 0))
{ {
@ -3033,7 +3018,7 @@ StyleAnimation::operator==(const StyleAnimation& aOther) const
// -------------------- // --------------------
// nsStyleDisplay // nsStyleDisplay
// //
nsStyleDisplay::nsStyleDisplay(StyleStructContext aContext) nsStyleDisplay::nsStyleDisplay(nsPresContext* aContext)
: mDisplay(StyleDisplay::Inline) : mDisplay(StyleDisplay::Inline)
, mOriginalDisplay(StyleDisplay::Inline) , mOriginalDisplay(StyleDisplay::Inline)
, mContain(NS_STYLE_CONTAIN_NONE) , mContain(NS_STYLE_CONTAIN_NONE)
@ -3383,8 +3368,8 @@ nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
// nsStyleVisibility // nsStyleVisibility
// //
nsStyleVisibility::nsStyleVisibility(StyleStructContext aContext) nsStyleVisibility::nsStyleVisibility(nsPresContext* aContext)
: mDirection(aContext.GetBidi() == IBMBIDI_TEXTDIRECTION_RTL : mDirection(aContext->GetBidi() == IBMBIDI_TEXTDIRECTION_RTL
? NS_STYLE_DIRECTION_RTL ? NS_STYLE_DIRECTION_RTL
: NS_STYLE_DIRECTION_LTR) : NS_STYLE_DIRECTION_LTR)
, mVisible(NS_STYLE_VISIBILITY_VISIBLE) , mVisible(NS_STYLE_VISIBILITY_VISIBLE)
@ -3560,7 +3545,7 @@ nsStyleContentData::UntrackImage(ImageTracker* aImageTracker)
// nsStyleContent // nsStyleContent
// //
nsStyleContent::nsStyleContent(StyleStructContext aContext) nsStyleContent::nsStyleContent(nsPresContext* aContext)
{ {
MOZ_COUNT_CTOR(nsStyleContent); MOZ_COUNT_CTOR(nsStyleContent);
} }
@ -3623,7 +3608,7 @@ nsStyleContent::CalcDifference(const nsStyleContent& aNewData) const
// nsStyleTextReset // nsStyleTextReset
// //
nsStyleTextReset::nsStyleTextReset(StyleStructContext aContext) nsStyleTextReset::nsStyleTextReset(nsPresContext* aContext)
: mTextDecorationLine(NS_STYLE_TEXT_DECORATION_LINE_NONE) : mTextDecorationLine(NS_STYLE_TEXT_DECORATION_LINE_NONE)
, mTextDecorationStyle(NS_STYLE_TEXT_DECORATION_STYLE_SOLID) , mTextDecorationStyle(NS_STYLE_TEXT_DECORATION_STYLE_SOLID)
, mUnicodeBidi(NS_STYLE_UNICODE_BIDI_NORMAL) , mUnicodeBidi(NS_STYLE_UNICODE_BIDI_NORMAL)
@ -3701,7 +3686,7 @@ AreShadowArraysEqual(nsCSSShadowArray* lhs,
// nsStyleText // nsStyleText
// //
nsStyleText::nsStyleText(StyleStructContext aContext) nsStyleText::nsStyleText(nsPresContext* aContext)
: mTextAlign(NS_STYLE_TEXT_ALIGN_START) : mTextAlign(NS_STYLE_TEXT_ALIGN_START)
, mTextAlignLast(NS_STYLE_TEXT_ALIGN_AUTO) , mTextAlignLast(NS_STYLE_TEXT_ALIGN_AUTO)
, mTextAlignTrue(false) , mTextAlignTrue(false)
@ -3731,7 +3716,7 @@ nsStyleText::nsStyleText(StyleStructContext aContext)
, mTextShadow(nullptr) , mTextShadow(nullptr)
{ {
MOZ_COUNT_CTOR(nsStyleText); MOZ_COUNT_CTOR(nsStyleText);
nsCOMPtr<nsIAtom> language = aContext.GetContentLanguage(); nsCOMPtr<nsIAtom> language = aContext->GetContentLanguage();
mTextEmphasisPosition = language && mTextEmphasisPosition = language &&
nsStyleUtil::MatchesLanguagePrefix(language, u"zh") ? nsStyleUtil::MatchesLanguagePrefix(language, u"zh") ?
NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT_ZH : NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT_ZH :
@ -3930,7 +3915,7 @@ nsCursorImage::operator==(const nsCursorImage& aOther) const
EqualImages(mImage, aOther.mImage); EqualImages(mImage, aOther.mImage);
} }
nsStyleUserInterface::nsStyleUserInterface(StyleStructContext aContext) nsStyleUserInterface::nsStyleUserInterface(nsPresContext* aContext)
: mUserInput(StyleUserInput::Auto) : mUserInput(StyleUserInput::Auto)
, mUserModify(StyleUserModify::ReadOnly) , mUserModify(StyleUserModify::ReadOnly)
, mUserFocus(StyleUserFocus::None) , mUserFocus(StyleUserFocus::None)
@ -4017,7 +4002,7 @@ nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const
// nsStyleUIReset // nsStyleUIReset
// //
nsStyleUIReset::nsStyleUIReset(StyleStructContext aContext) nsStyleUIReset::nsStyleUIReset(nsPresContext* aContext)
: mUserSelect(StyleUserSelect::Auto) : mUserSelect(StyleUserSelect::Auto)
, mForceBrokenImageIcon(0) , mForceBrokenImageIcon(0)
, mIMEMode(NS_STYLE_IME_MODE_AUTO) , mIMEMode(NS_STYLE_IME_MODE_AUTO)
@ -4070,7 +4055,7 @@ nsStyleUIReset::CalcDifference(const nsStyleUIReset& aNewData) const
// nsStyleVariables // nsStyleVariables
// //
nsStyleVariables::nsStyleVariables(StyleStructContext aContext) nsStyleVariables::nsStyleVariables(nsPresContext* aContext)
{ {
MOZ_COUNT_CTOR(nsStyleVariables); MOZ_COUNT_CTOR(nsStyleVariables);
} }
@ -4096,7 +4081,7 @@ nsStyleVariables::CalcDifference(const nsStyleVariables& aNewData) const
// nsStyleEffects // nsStyleEffects
// //
nsStyleEffects::nsStyleEffects(StyleStructContext aContext) nsStyleEffects::nsStyleEffects(nsPresContext* aContext)
: mBoxShadow(nullptr) : mBoxShadow(nullptr)
, mClip(0, 0, 0, 0) , mClip(0, 0, 0, 0)
, mOpacity(1.0f) , mOpacity(1.0f)

View file

@ -18,7 +18,6 @@
#include "mozilla/SheetType.h" #include "mozilla/SheetType.h"
#include "mozilla/StaticPtr.h" #include "mozilla/StaticPtr.h"
#include "mozilla/StyleComplexColor.h" #include "mozilla/StyleComplexColor.h"
#include "mozilla/StyleStructContext.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include "nsColor.h" #include "nsColor.h"
#include "nsCoord.h" #include "nsCoord.h"
@ -154,9 +153,9 @@ struct Position {
// The lifetime of these objects is managed by the presshell's arena. // The lifetime of these objects is managed by the presshell's arena.
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont
{ {
nsStyleFont(const nsFont& aFont, StyleStructContext aContext); nsStyleFont(const nsFont& aFont, nsPresContext* aContext);
nsStyleFont(const nsStyleFont& aStyleFont); nsStyleFont(const nsStyleFont& aStyleFont);
explicit nsStyleFont(StyleStructContext aContext); explicit nsStyleFont(nsPresContext* aContext);
~nsStyleFont() { ~nsStyleFont() {
MOZ_COUNT_DTOR(nsStyleFont); MOZ_COUNT_DTOR(nsStyleFont);
} }
@ -179,14 +178,14 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont
* aSize is allowed to be negative, but the caller is expected to deal with * aSize is allowed to be negative, but the caller is expected to deal with
* negative results. The result is clamped to nscoord_MIN .. nscoord_MAX. * negative results. The result is clamped to nscoord_MIN .. nscoord_MAX.
*/ */
static nscoord ZoomText(StyleStructContext aContext, nscoord aSize); static nscoord ZoomText(nsPresContext* aContext, nscoord aSize);
/** /**
* Return aSize divided by the current text zoom factor (in aPresContext). * Return aSize divided by the current text zoom factor (in aPresContext).
* aSize is allowed to be negative, but the caller is expected to deal with * aSize is allowed to be negative, but the caller is expected to deal with
* negative results. The result is clamped to nscoord_MIN .. nscoord_MAX. * negative results. The result is clamped to nscoord_MIN .. nscoord_MAX.
*/ */
static nscoord UnZoomText(nsPresContext* aPresContext, nscoord aSize); static nscoord UnZoomText(nsPresContext* aPresContext, nscoord aSize);
static already_AddRefed<nsIAtom> GetLanguage(StyleStructContext aPresContext); static already_AddRefed<nsIAtom> GetLanguage(nsPresContext* aPresContext);
void* operator new(size_t sz, nsStyleFont* aSelf) { return aSelf; } void* operator new(size_t sz, nsStyleFont* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) { void* operator new(size_t sz, nsPresContext* aContext) {
@ -523,7 +522,7 @@ private:
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColor struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColor
{ {
explicit nsStyleColor(StyleStructContext aContext); explicit nsStyleColor(nsPresContext* aContext);
nsStyleColor(const nsStyleColor& aOther); nsStyleColor(const nsStyleColor& aOther);
~nsStyleColor() { ~nsStyleColor() {
MOZ_COUNT_DTOR(nsStyleColor); MOZ_COUNT_DTOR(nsStyleColor);
@ -862,7 +861,7 @@ struct nsStyleImageLayers {
}; };
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground { struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
explicit nsStyleBackground(StyleStructContext aContext); explicit nsStyleBackground(nsPresContext* aContext);
nsStyleBackground(const nsStyleBackground& aOther); nsStyleBackground(const nsStyleBackground& aOther);
~nsStyleBackground(); ~nsStyleBackground();
@ -912,7 +911,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin
{ {
explicit nsStyleMargin(StyleStructContext aContext); explicit nsStyleMargin(nsPresContext* aContext);
nsStyleMargin(const nsStyleMargin& aMargin); nsStyleMargin(const nsStyleMargin& aMargin);
~nsStyleMargin() { ~nsStyleMargin() {
MOZ_COUNT_DTOR(nsStyleMargin); MOZ_COUNT_DTOR(nsStyleMargin);
@ -959,7 +958,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePadding struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePadding
{ {
explicit nsStylePadding(StyleStructContext aContext); explicit nsStylePadding(nsPresContext* aContext);
nsStylePadding(const nsStylePadding& aPadding); nsStylePadding(const nsStylePadding& aPadding);
~nsStylePadding() { ~nsStylePadding() {
MOZ_COUNT_DTOR(nsStylePadding); MOZ_COUNT_DTOR(nsStylePadding);
@ -1171,7 +1170,7 @@ static bool IsVisibleBorderStyle(uint8_t aStyle)
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
{ {
explicit nsStyleBorder(StyleStructContext aContext); explicit nsStyleBorder(nsPresContext* aContext);
nsStyleBorder(const nsStyleBorder& aBorder); nsStyleBorder(const nsStyleBorder& aBorder);
~nsStyleBorder(); ~nsStyleBorder();
@ -1385,7 +1384,7 @@ ASSERT_BORDER_COLOR_FIELD(Left);
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline
{ {
explicit nsStyleOutline(StyleStructContext aContext); explicit nsStyleOutline(nsPresContext* aContext);
nsStyleOutline(const nsStyleOutline& aOutline); nsStyleOutline(const nsStyleOutline& aOutline);
~nsStyleOutline() { ~nsStyleOutline() {
MOZ_COUNT_DTOR(nsStyleOutline); MOZ_COUNT_DTOR(nsStyleOutline);
@ -1460,7 +1459,7 @@ private:
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList
{ {
explicit nsStyleList(StyleStructContext aContext); explicit nsStyleList(nsPresContext* aContext);
nsStyleList(const nsStyleList& aStyleList); nsStyleList(const nsStyleList& aStyleList);
~nsStyleList(); ~nsStyleList();
@ -1684,7 +1683,7 @@ struct nsStyleGridTemplate
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition
{ {
explicit nsStylePosition(StyleStructContext aContext); explicit nsStylePosition(nsPresContext* aContext);
nsStylePosition(const nsStylePosition& aOther); nsStylePosition(const nsStylePosition& aOther);
~nsStylePosition(); ~nsStylePosition();
@ -1921,7 +1920,7 @@ struct nsStyleTextOverflow
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset
{ {
explicit nsStyleTextReset(StyleStructContext aContext); explicit nsStyleTextReset(nsPresContext* aContext);
nsStyleTextReset(const nsStyleTextReset& aOther); nsStyleTextReset(const nsStyleTextReset& aOther);
~nsStyleTextReset(); ~nsStyleTextReset();
@ -1969,7 +1968,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
{ {
explicit nsStyleText(StyleStructContext aContext); explicit nsStyleText(nsPresContext* aContext);
nsStyleText(const nsStyleText& aOther); nsStyleText(const nsStyleText& aOther);
~nsStyleText(); ~nsStyleText();
@ -2194,7 +2193,7 @@ protected:
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility
{ {
explicit nsStyleVisibility(StyleStructContext aContext); explicit nsStyleVisibility(nsPresContext* aContext);
nsStyleVisibility(const nsStyleVisibility& aVisibility); nsStyleVisibility(const nsStyleVisibility& aVisibility);
~nsStyleVisibility() { ~nsStyleVisibility() {
MOZ_COUNT_DTOR(nsStyleVisibility); MOZ_COUNT_DTOR(nsStyleVisibility);
@ -2701,7 +2700,7 @@ using StyleShapeOutside = StyleShapeSource<StyleShapeOutsideShapeBox>;
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
{ {
explicit nsStyleDisplay(StyleStructContext aContext); explicit nsStyleDisplay(nsPresContext* aContext);
nsStyleDisplay(const nsStyleDisplay& aOther); nsStyleDisplay(const nsStyleDisplay& aOther);
~nsStyleDisplay() { ~nsStyleDisplay() {
MOZ_COUNT_DTOR(nsStyleDisplay); MOZ_COUNT_DTOR(nsStyleDisplay);
@ -3016,7 +3015,7 @@ public:
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable
{ {
explicit nsStyleTable(StyleStructContext aContext); explicit nsStyleTable(nsPresContext* aContext);
nsStyleTable(const nsStyleTable& aOther); nsStyleTable(const nsStyleTable& aOther);
~nsStyleTable(); ~nsStyleTable();
@ -3047,7 +3046,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTableBorder struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTableBorder
{ {
explicit nsStyleTableBorder(StyleStructContext aContext); explicit nsStyleTableBorder(nsPresContext* aContext);
nsStyleTableBorder(const nsStyleTableBorder& aOther); nsStyleTableBorder(const nsStyleTableBorder& aOther);
~nsStyleTableBorder(); ~nsStyleTableBorder();
@ -3155,7 +3154,7 @@ struct nsStyleCounterData
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleContent struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleContent
{ {
explicit nsStyleContent(StyleStructContext aContext); explicit nsStyleContent(nsPresContext* aContext);
nsStyleContent(const nsStyleContent& aContent); nsStyleContent(const nsStyleContent& aContent);
~nsStyleContent(); ~nsStyleContent();
@ -3235,7 +3234,7 @@ protected:
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
{ {
explicit nsStyleUIReset(StyleStructContext aContext); explicit nsStyleUIReset(nsPresContext* aContext);
nsStyleUIReset(const nsStyleUIReset& aOther); nsStyleUIReset(const nsStyleUIReset& aOther);
~nsStyleUIReset(); ~nsStyleUIReset();
@ -3307,7 +3306,7 @@ private:
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface
{ {
explicit nsStyleUserInterface(StyleStructContext aContext); explicit nsStyleUserInterface(nsPresContext* aContext);
nsStyleUserInterface(const nsStyleUserInterface& aOther); nsStyleUserInterface(const nsStyleUserInterface& aOther);
~nsStyleUserInterface(); ~nsStyleUserInterface();
@ -3352,7 +3351,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL
{ {
explicit nsStyleXUL(StyleStructContext aContext); explicit nsStyleXUL(nsPresContext* aContext);
nsStyleXUL(const nsStyleXUL& aSource); nsStyleXUL(const nsStyleXUL& aSource);
~nsStyleXUL(); ~nsStyleXUL();
@ -3391,7 +3390,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn
{ {
explicit nsStyleColumn(StyleStructContext aContext); explicit nsStyleColumn(nsPresContext* aContext);
nsStyleColumn(const nsStyleColumn& aSource); nsStyleColumn(const nsStyleColumn& aSource);
~nsStyleColumn(); ~nsStyleColumn();
@ -3514,7 +3513,7 @@ private:
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
{ {
explicit nsStyleSVG(StyleStructContext aContext); explicit nsStyleSVG(nsPresContext* aContext);
nsStyleSVG(const nsStyleSVG& aSource); nsStyleSVG(const nsStyleSVG& aSource);
~nsStyleSVG(); ~nsStyleSVG();
@ -3703,7 +3702,7 @@ struct nsTArray_CopyChooser<nsStyleFilter>
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
{ {
explicit nsStyleSVGReset(StyleStructContext aContext); explicit nsStyleSVGReset(nsPresContext* aContext);
nsStyleSVGReset(const nsStyleSVGReset& aSource); nsStyleSVGReset(const nsStyleSVGReset& aSource);
~nsStyleSVGReset(); ~nsStyleSVGReset();
@ -3755,7 +3754,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVariables struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVariables
{ {
explicit nsStyleVariables(StyleStructContext aContext); explicit nsStyleVariables(nsPresContext* aContext);
nsStyleVariables(const nsStyleVariables& aSource); nsStyleVariables(const nsStyleVariables& aSource);
~nsStyleVariables(); ~nsStyleVariables();
@ -3785,7 +3784,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVariables
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
{ {
explicit nsStyleEffects(StyleStructContext aContext); explicit nsStyleEffects(nsPresContext* aContext);
nsStyleEffects(const nsStyleEffects& aSource); nsStyleEffects(const nsStyleEffects& aSource);
~nsStyleEffects(); ~nsStyleEffects();