--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -4177,23 +4177,22 @@ inline uint32_t ListLength(const T* aLis
uint32_t len = 0;
while (aList) {
len++;
aList = aList->mNext;
}
return len;
}
-
-
-already_AddRefed<nsCSSShadowArray>
-nsRuleNode::GetShadowData(const nsCSSValueList* aList,
- nsStyleContext* aContext,
- bool aIsBoxShadow,
- RuleNodeCacheConditions& aConditions)
+static already_AddRefed<nsCSSShadowArray>
+GetShadowData(const nsCSSValueList* aList,
+ nsStyleContext* aContext,
+ bool aIsBoxShadow,
+ nsPresContext* aPresContext,
+ RuleNodeCacheConditions& aConditions)
{
uint32_t arrayLength = ListLength(aList);
MOZ_ASSERT(arrayLength > 0,
"Non-null text-shadow list, yet we counted 0 items.");
RefPtr<nsCSSShadowArray> shadowList =
new(arrayLength) nsCSSShadowArray(arrayLength);
@@ -4206,53 +4205,53 @@ nsRuleNode::GetShadowData(const nsCSSVal
aList;
aList = aList->mNext, ++item) {
MOZ_ASSERT(aList->mValue.GetUnit() == eCSSUnit_Array,
"expecting a plain array value");
nsCSSValue::Array *arr = aList->mValue.GetArrayValue();
// OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
unitOK = SetCoord(arr->Item(0), tempCoord, nsStyleCoord(),
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
- aContext, mPresContext, aConditions);
+ aContext, aPresContext, aConditions);
NS_ASSERTION(unitOK, "unexpected unit");
item->mXOffset = tempCoord.GetCoordValue();
unitOK = SetCoord(arr->Item(1), tempCoord, nsStyleCoord(),
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
- aContext, mPresContext, aConditions);
+ aContext, aPresContext, aConditions);
NS_ASSERTION(unitOK, "unexpected unit");
item->mYOffset = tempCoord.GetCoordValue();
// Blur radius is optional in the current box-shadow spec
if (arr->Item(2).GetUnit() != eCSSUnit_Null) {
unitOK = SetCoord(arr->Item(2), tempCoord, nsStyleCoord(),
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY |
SETCOORD_CALC_CLAMP_NONNEGATIVE,
- aContext, mPresContext, aConditions);
+ aContext, aPresContext, aConditions);
NS_ASSERTION(unitOK, "unexpected unit");
item->mRadius = tempCoord.GetCoordValue();
} else {
item->mRadius = 0;
}
// Find the spread radius
if (aIsBoxShadow && arr->Item(3).GetUnit() != eCSSUnit_Null) {
unitOK = SetCoord(arr->Item(3), tempCoord, nsStyleCoord(),
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
- aContext, mPresContext, aConditions);
+ aContext, aPresContext, aConditions);
NS_ASSERTION(unitOK, "unexpected unit");
item->mSpread = tempCoord.GetCoordValue();
} else {
item->mSpread = 0;
}
if (arr->Item(4).GetUnit() != eCSSUnit_Null) {
item->mHasColor = true;
// 2nd argument can be bogus since inherit is not a valid color
- unitOK = SetColor(arr->Item(4), 0, mPresContext, aContext, item->mColor,
+ unitOK = SetColor(arr->Item(4), 0, aPresContext, aContext, item->mColor,
aConditions);
NS_ASSERTION(unitOK, "unexpected unit");
}
if (aIsBoxShadow && arr->Item(5).GetUnit() == eCSSUnit_Enumerated) {
NS_ASSERTION(arr->Item(5).GetIntValue() == NS_STYLE_BOX_SHADOW_INSET,
"invalid keyword type for box shadow");
item->mInset = true;
@@ -4444,17 +4443,17 @@ nsRuleNode::ComputeTextData(void* aStart
if (textShadowValue->GetUnit() == eCSSUnit_Inherit ||
textShadowValue->GetUnit() == eCSSUnit_Unset) {
conditions.SetUncacheable();
text->mTextShadow = parentText->mTextShadow;
} else if (textShadowValue->GetUnit() == eCSSUnit_List ||
textShadowValue->GetUnit() == eCSSUnit_ListDep) {
// List of arrays
text->mTextShadow = GetShadowData(textShadowValue->GetListValue(),
- aContext, false, conditions);
+ aContext, false, mPresContext, conditions);
}
}
// line-height: normal, number, length, percent, calc, inherit
const nsCSSValue* lineHeightValue = aRuleData->ValueForLineHeight();
if (eCSSUnit_Percent == lineHeightValue->GetUnit()) {
conditions.SetUncacheable();
// Use |mFont.size| to pick up minimum font size.
@@ -9541,21 +9540,21 @@ nsRuleNode::ComputeSVGData(void* aStartS
svg->mTextAnchor, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
parentSVG->mTextAnchor,
NS_STYLE_TEXT_ANCHOR_START);
COMPUTE_END_INHERITED(SVG, svg)
}
-already_AddRefed<nsStyleBasicShape>
-nsRuleNode::GetStyleBasicShapeFromCSSValue(const nsCSSValue& aValue,
- nsStyleContext* aStyleContext,
- nsPresContext* aPresContext,
- RuleNodeCacheConditions& aConditions)
+static already_AddRefed<nsStyleBasicShape>
+GetStyleBasicShapeFromCSSValue(const nsCSSValue& aValue,
+ nsStyleContext* aStyleContext,
+ nsPresContext* aPresContext,
+ RuleNodeCacheConditions& aConditions)
{
RefPtr<nsStyleBasicShape> basicShape;
nsCSSValue::Array* shapeFunction = aValue.GetArrayValue();
nsCSSKeyword functionName =
(nsCSSKeyword)shapeFunction->Item(0).GetIntValue();
if (functionName == eCSSKeyword_polygon) {
@@ -9690,22 +9689,22 @@ nsRuleNode::GetStyleBasicShapeFromCSSVal
}
} else {
NS_NOTREACHED("unexpected basic shape function");
}
return basicShape.forget();
}
-void
-nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath,
- const nsCSSValue* aValue,
- nsStyleContext* aStyleContext,
- nsPresContext* aPresContext,
- RuleNodeCacheConditions& aConditions)
+static void
+SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath,
+ const nsCSSValue* aValue,
+ nsStyleContext* aStyleContext,
+ nsPresContext* aPresContext,
+ RuleNodeCacheConditions& aConditions)
{
MOZ_ASSERT(aValue->GetUnit() == eCSSUnit_Array,
"expected a basic shape or reference box");
const nsCSSValue::Array* array = aValue->GetArrayValue();
MOZ_ASSERT(array->Count() == 1 || array->Count() == 2,
"Expect one or both of a shape function and geometry-box");
@@ -9732,22 +9731,22 @@ nsRuleNode::SetStyleClipPathToCSSValue(n
if (basicShape) {
aStyleClipPath->SetBasicShape(basicShape, sizingBox);
} else {
aStyleClipPath->SetSizingBox(sizingBox);
}
}
// Returns true if the nsStyleFilter was successfully set using the nsCSSValue.
-bool
-nsRuleNode::SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter,
- const nsCSSValue& aValue,
- nsStyleContext* aStyleContext,
- nsPresContext* aPresContext,
- RuleNodeCacheConditions& aConditions)
+static bool
+SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter,
+ const nsCSSValue& aValue,
+ nsStyleContext* aStyleContext,
+ nsPresContext* aPresContext,
+ RuleNodeCacheConditions& aConditions)
{
nsCSSUnit unit = aValue.GetUnit();
if (unit == eCSSUnit_URL) {
nsIURI* url = aValue.GetURLValue();
if (!url)
return false;
aStyleFilter->SetURL(url);
return true;
@@ -9765,16 +9764,17 @@ nsRuleNode::SetStyleFilterToCSSValue(nsS
nsCSSProps::kFilterFunctionKTable,
type);
MOZ_ASSERT(foundKeyword, "unknown filter type");
if (type == NS_STYLE_FILTER_DROP_SHADOW) {
RefPtr<nsCSSShadowArray> shadowArray = GetShadowData(
filterFunction->Item(1).GetListValue(),
aStyleContext,
false,
+ aPresContext,
aConditions);
aStyleFilter->SetDropShadow(shadowArray);
return true;
}
int32_t mask = SETCOORD_PERCENT | SETCOORD_FACTOR;
if (type == NS_STYLE_FILTER_BLUR) {
mask = SETCOORD_LENGTH |
@@ -10153,17 +10153,17 @@ nsRuleNode::ComputeEffectsData(void* aSt
case eCSSUnit_Inherit:
effects->mBoxShadow = parentEffects->mBoxShadow;
conditions.SetUncacheable();
break;
case eCSSUnit_List:
case eCSSUnit_ListDep:
effects->mBoxShadow = GetShadowData(boxShadowValue->GetListValue(),
- aContext, true, conditions);
+ aContext, true, mPresContext, conditions);
break;
default:
MOZ_ASSERT(false, "unrecognized shadow unit");
}
// clip property: length, auto, inherit
const nsCSSValue* clipValue = aRuleData->ValueForClip();
--- a/layout/style/nsRuleNode.h
+++ b/layout/style/nsRuleNode.h
@@ -778,37 +778,16 @@ protected:
static void SetGenericFont(nsPresContext* aPresContext,
nsStyleContext* aContext,
uint8_t aGenericFontID,
nsStyleFont* aFont);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID,
const nsRuleData* aRuleData);
- already_AddRefed<nsCSSShadowArray>
- GetShadowData(const nsCSSValueList* aList,
- nsStyleContext* aContext,
- bool aIsBoxShadow,
- mozilla::RuleNodeCacheConditions& aConditions);
- already_AddRefed<nsStyleBasicShape>
- GetStyleBasicShapeFromCSSValue(const nsCSSValue& aValue,
- nsStyleContext* aStyleContext,
- nsPresContext* aPresContext,
- mozilla::RuleNodeCacheConditions& aConditions);
- bool SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter,
- const nsCSSValue& aValue,
- nsStyleContext* aStyleContext,
- nsPresContext* aPresContext,
- mozilla::RuleNodeCacheConditions& aConditions);
- void SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath,
- const nsCSSValue* aValue,
- nsStyleContext* aStyleContext,
- nsPresContext* aPresContext,
- mozilla::RuleNodeCacheConditions& aConditions);
-
private:
nsRuleNode(nsPresContext* aPresContext, nsRuleNode* aParent,
nsIStyleRule* aRule, mozilla::SheetType aLevel, bool aIsImportant);
~nsRuleNode();
public:
// This is infallible; it will never return nullptr.
static already_AddRefed<nsRuleNode> CreateRootNode(nsPresContext* aPresContext);