mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-10 13:54:27 +00:00
Backed out changeset e27bd873b413 (bug 898361) for crashes on a CLOSED TREE
This commit is contained in:
parent
0a304aba4a
commit
5d03ad2e85
@ -242,7 +242,6 @@ CSS_KEY(disc, disc)
|
|||||||
CSS_KEY(discretionary-ligatures, discretionary_ligatures)
|
CSS_KEY(discretionary-ligatures, discretionary_ligatures)
|
||||||
CSS_KEY(dotted, dotted)
|
CSS_KEY(dotted, dotted)
|
||||||
CSS_KEY(double, double)
|
CSS_KEY(double, double)
|
||||||
CSS_KEY(drop-shadow, drop_shadow)
|
|
||||||
CSS_KEY(e-resize, e_resize)
|
CSS_KEY(e-resize, e_resize)
|
||||||
CSS_KEY(each-box, each_box)
|
CSS_KEY(each-box, each_box)
|
||||||
CSS_KEY(ease, ease)
|
CSS_KEY(ease, ease)
|
||||||
|
@ -607,7 +607,6 @@ protected:
|
|||||||
/* Functions for filter parsing */
|
/* Functions for filter parsing */
|
||||||
bool ParseFilter();
|
bool ParseFilter();
|
||||||
bool ParseSingleFilter(nsCSSValue* aValue);
|
bool ParseSingleFilter(nsCSSValue* aValue);
|
||||||
bool ParseDropShadow(nsCSSValue* aValue);
|
|
||||||
|
|
||||||
/* Find and return the namespace ID associated with aPrefix.
|
/* Find and return the namespace ID associated with aPrefix.
|
||||||
If aPrefix has not been declared in an @namespace rule, returns
|
If aPrefix has not been declared in an @namespace rule, returns
|
||||||
@ -10052,32 +10051,6 @@ bool CSSParserImpl::ParseTransformOrigin(bool aPerspective)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a drop-shadow value. At the moment the Filter Effects specification
|
|
||||||
* just expects one shadow item. Should this ever change to a list of shadow
|
|
||||||
* items, use ParseShadowList instead.
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
CSSParserImpl::ParseDropShadow(nsCSSValue* aValue)
|
|
||||||
{
|
|
||||||
// Use nsCSSValueList to reuse the shadow resolving code in
|
|
||||||
// nsRuleNode and nsComputedDOMStyle.
|
|
||||||
nsCSSValue shadow;
|
|
||||||
nsCSSValueList* cur = shadow.SetListValue();
|
|
||||||
if (!ParseShadowItem(cur->mValue, false))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!ExpectSymbol(')', true))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nsCSSValue::Array* dropShadow = aValue->InitFunction(eCSSKeyword_drop_shadow, 1);
|
|
||||||
|
|
||||||
// Copy things over.
|
|
||||||
dropShadow->Item(1) = shadow;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a single url or filter function from the tokenizer stream, reporting an
|
* Reads a single url or filter function from the tokenizer stream, reporting an
|
||||||
* error if something goes wrong.
|
* error if something goes wrong.
|
||||||
@ -10105,24 +10078,11 @@ CSSParserImpl::ParseSingleFilter(nsCSSValue* aValue)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCSSKeyword functionName = nsCSSKeywords::LookupKeyword(mToken.mIdent);
|
|
||||||
// Parse drop-shadow independently of the other filter functions
|
|
||||||
// because of its more complex characteristics.
|
|
||||||
if (functionName == eCSSKeyword_drop_shadow) {
|
|
||||||
if (ParseDropShadow(aValue)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
// Unrecognized filter function.
|
|
||||||
REPORT_UNEXPECTED_TOKEN(PEExpectedNoneOrURLOrFilterFunction);
|
|
||||||
SkipUntil(')');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the parsing rules based on the filter function.
|
// Set up the parsing rules based on the filter function.
|
||||||
int32_t variantMask = VARIANT_PN;
|
int32_t variantMask = VARIANT_PN;
|
||||||
bool rejectNegativeArgument = true;
|
bool rejectNegativeArgument = true;
|
||||||
bool clampArgumentToOne = false;
|
bool clampArgumentToOne = false;
|
||||||
|
nsCSSKeyword functionName = nsCSSKeywords::LookupKeyword(mToken.mIdent);
|
||||||
switch (functionName) {
|
switch (functionName) {
|
||||||
case eCSSKeyword_blur:
|
case eCSSKeyword_blur:
|
||||||
variantMask = VARIANT_LCALC | VARIANT_NONNEGATIVE_DIMENSION;
|
variantMask = VARIANT_LCALC | VARIANT_NONNEGATIVE_DIMENSION;
|
||||||
|
@ -4498,9 +4498,9 @@ nsComputedDOMStyle::SetCssTextToCoord(nsAString& aCssText,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
GetFilterFunctionName(nsAString& aString, nsStyleFilter::Type aType)
|
GetFilterFunctionName(nsAString& aString, nsStyleFilter::Type mType)
|
||||||
{
|
{
|
||||||
switch (aType) {
|
switch (mType) {
|
||||||
case nsStyleFilter::Type::eBlur:
|
case nsStyleFilter::Type::eBlur:
|
||||||
aString.AssignLiteral("blur(");
|
aString.AssignLiteral("blur(");
|
||||||
break;
|
break;
|
||||||
@ -4510,9 +4510,6 @@ GetFilterFunctionName(nsAString& aString, nsStyleFilter::Type aType)
|
|||||||
case nsStyleFilter::Type::eContrast:
|
case nsStyleFilter::Type::eContrast:
|
||||||
aString.AssignLiteral("contrast(");
|
aString.AssignLiteral("contrast(");
|
||||||
break;
|
break;
|
||||||
case nsStyleFilter::Type::eDropShadow:
|
|
||||||
aString.AssignLiteral("drop-shadow(");
|
|
||||||
break;
|
|
||||||
case nsStyleFilter::Type::eGrayscale:
|
case nsStyleFilter::Type::eGrayscale:
|
||||||
aString.AssignLiteral("grayscale(");
|
aString.AssignLiteral("grayscale(");
|
||||||
break;
|
break;
|
||||||
@ -4536,34 +4533,25 @@ GetFilterFunctionName(nsAString& aString, nsStyleFilter::Type aType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSSValue*
|
nsROCSSPrimitiveValue*
|
||||||
nsComputedDOMStyle::CreatePrimitiveValueForStyleFilter(
|
nsComputedDOMStyle::CreatePrimitiveValueForStyleFilter(
|
||||||
const nsStyleFilter& aStyleFilter)
|
const nsStyleFilter& aStyleFilter)
|
||||||
{
|
{
|
||||||
nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue;
|
nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue;
|
||||||
|
|
||||||
// Handle url().
|
// Handle url().
|
||||||
if (nsStyleFilter::Type::eURL == aStyleFilter.GetType()) {
|
if (nsStyleFilter::Type::eURL == aStyleFilter.mType) {
|
||||||
value->SetURI(aStyleFilter.GetURL());
|
value->SetURI(aStyleFilter.mURL);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter function name and opening parenthesis.
|
// Filter function name and opening parenthesis.
|
||||||
nsAutoString filterFunctionString;
|
nsAutoString filterFunctionString;
|
||||||
GetFilterFunctionName(filterFunctionString, aStyleFilter.GetType());
|
GetFilterFunctionName(filterFunctionString, aStyleFilter.mType);
|
||||||
|
|
||||||
|
// Filter function argument.
|
||||||
nsAutoString argumentString;
|
nsAutoString argumentString;
|
||||||
if (nsStyleFilter::Type::eDropShadow == aStyleFilter.GetType()) {
|
SetCssTextToCoord(argumentString, aStyleFilter.mFilterParameter);
|
||||||
// Handle drop-shadow()
|
|
||||||
nsRefPtr<CSSValue> shadowValue =
|
|
||||||
GetCSSShadowArray(aStyleFilter.GetDropShadow(),
|
|
||||||
StyleColor()->mColor,
|
|
||||||
false);
|
|
||||||
ErrorResult dummy;
|
|
||||||
shadowValue->GetCssText(argumentString, dummy);
|
|
||||||
} else {
|
|
||||||
// Filter function argument.
|
|
||||||
SetCssTextToCoord(argumentString, aStyleFilter.GetFilterParameter());
|
|
||||||
}
|
|
||||||
filterFunctionString.Append(argumentString);
|
filterFunctionString.Append(argumentString);
|
||||||
|
|
||||||
// Filter function closing parenthesis.
|
// Filter function closing parenthesis.
|
||||||
@ -4586,7 +4574,8 @@ nsComputedDOMStyle::DoGetFilter()
|
|||||||
|
|
||||||
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
||||||
for(uint32_t i = 0; i < filters.Length(); i++) {
|
for(uint32_t i = 0; i < filters.Length(); i++) {
|
||||||
CSSValue* value = CreatePrimitiveValueForStyleFilter(filters[i]);
|
nsROCSSPrimitiveValue* value =
|
||||||
|
CreatePrimitiveValueForStyleFilter(filters[i]);
|
||||||
valueList->AppendCSSValue(value);
|
valueList->AppendCSSValue(value);
|
||||||
}
|
}
|
||||||
return valueList;
|
return valueList;
|
||||||
|
@ -494,7 +494,7 @@ private:
|
|||||||
|
|
||||||
/* Helper functions for computing the filter property style. */
|
/* Helper functions for computing the filter property style. */
|
||||||
void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord);
|
void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord);
|
||||||
mozilla::dom::CSSValue* CreatePrimitiveValueForStyleFilter(
|
nsROCSSPrimitiveValue* CreatePrimitiveValueForStyleFilter(
|
||||||
const nsStyleFilter& aStyleFilter);
|
const nsStyleFilter& aStyleFilter);
|
||||||
|
|
||||||
struct ComputedStyleMapEntry
|
struct ComputedStyleMapEntry
|
||||||
|
@ -3752,7 +3752,7 @@ already_AddRefed<nsCSSShadowArray>
|
|||||||
nsRuleNode::GetShadowData(const nsCSSValueList* aList,
|
nsRuleNode::GetShadowData(const nsCSSValueList* aList,
|
||||||
nsStyleContext* aContext,
|
nsStyleContext* aContext,
|
||||||
bool aIsBoxShadow,
|
bool aIsBoxShadow,
|
||||||
bool& aCanStoreInRuleTree)
|
bool& canStoreInRuleTree)
|
||||||
{
|
{
|
||||||
uint32_t arrayLength = ListLength(aList);
|
uint32_t arrayLength = ListLength(aList);
|
||||||
|
|
||||||
@ -3775,13 +3775,13 @@ nsRuleNode::GetShadowData(const nsCSSValueList* aList,
|
|||||||
// OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
|
// OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
|
||||||
unitOK = SetCoord(arr->Item(0), tempCoord, nsStyleCoord(),
|
unitOK = SetCoord(arr->Item(0), tempCoord, nsStyleCoord(),
|
||||||
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
|
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
|
||||||
aContext, mPresContext, aCanStoreInRuleTree);
|
aContext, mPresContext, canStoreInRuleTree);
|
||||||
NS_ASSERTION(unitOK, "unexpected unit");
|
NS_ASSERTION(unitOK, "unexpected unit");
|
||||||
item->mXOffset = tempCoord.GetCoordValue();
|
item->mXOffset = tempCoord.GetCoordValue();
|
||||||
|
|
||||||
unitOK = SetCoord(arr->Item(1), tempCoord, nsStyleCoord(),
|
unitOK = SetCoord(arr->Item(1), tempCoord, nsStyleCoord(),
|
||||||
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
|
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
|
||||||
aContext, mPresContext, aCanStoreInRuleTree);
|
aContext, mPresContext, canStoreInRuleTree);
|
||||||
NS_ASSERTION(unitOK, "unexpected unit");
|
NS_ASSERTION(unitOK, "unexpected unit");
|
||||||
item->mYOffset = tempCoord.GetCoordValue();
|
item->mYOffset = tempCoord.GetCoordValue();
|
||||||
|
|
||||||
@ -3790,7 +3790,7 @@ nsRuleNode::GetShadowData(const nsCSSValueList* aList,
|
|||||||
unitOK = SetCoord(arr->Item(2), tempCoord, nsStyleCoord(),
|
unitOK = SetCoord(arr->Item(2), tempCoord, nsStyleCoord(),
|
||||||
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY |
|
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY |
|
||||||
SETCOORD_CALC_CLAMP_NONNEGATIVE,
|
SETCOORD_CALC_CLAMP_NONNEGATIVE,
|
||||||
aContext, mPresContext, aCanStoreInRuleTree);
|
aContext, mPresContext, canStoreInRuleTree);
|
||||||
NS_ASSERTION(unitOK, "unexpected unit");
|
NS_ASSERTION(unitOK, "unexpected unit");
|
||||||
item->mRadius = tempCoord.GetCoordValue();
|
item->mRadius = tempCoord.GetCoordValue();
|
||||||
} else {
|
} else {
|
||||||
@ -3801,7 +3801,7 @@ nsRuleNode::GetShadowData(const nsCSSValueList* aList,
|
|||||||
if (aIsBoxShadow && arr->Item(3).GetUnit() != eCSSUnit_Null) {
|
if (aIsBoxShadow && arr->Item(3).GetUnit() != eCSSUnit_Null) {
|
||||||
unitOK = SetCoord(arr->Item(3), tempCoord, nsStyleCoord(),
|
unitOK = SetCoord(arr->Item(3), tempCoord, nsStyleCoord(),
|
||||||
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
|
SETCOORD_LENGTH | SETCOORD_CALC_LENGTH_ONLY,
|
||||||
aContext, mPresContext, aCanStoreInRuleTree);
|
aContext, mPresContext, canStoreInRuleTree);
|
||||||
NS_ASSERTION(unitOK, "unexpected unit");
|
NS_ASSERTION(unitOK, "unexpected unit");
|
||||||
item->mSpread = tempCoord.GetCoordValue();
|
item->mSpread = tempCoord.GetCoordValue();
|
||||||
} else {
|
} else {
|
||||||
@ -3812,7 +3812,7 @@ nsRuleNode::GetShadowData(const nsCSSValueList* aList,
|
|||||||
item->mHasColor = true;
|
item->mHasColor = true;
|
||||||
// 2nd argument can be bogus since inherit is not a valid color
|
// 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, mPresContext, aContext, item->mColor,
|
||||||
aCanStoreInRuleTree);
|
canStoreInRuleTree);
|
||||||
NS_ASSERTION(unitOK, "unexpected unit");
|
NS_ASSERTION(unitOK, "unexpected unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7722,17 +7722,15 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static nsStyleFilter::Type
|
static nsStyleFilter::Type
|
||||||
StyleFilterTypeForFunctionName(nsCSSKeyword aFunctionName)
|
StyleFilterTypeForFunctionName(nsCSSKeyword functionName)
|
||||||
{
|
{
|
||||||
switch (aFunctionName) {
|
switch (functionName) {
|
||||||
case eCSSKeyword_blur:
|
case eCSSKeyword_blur:
|
||||||
return nsStyleFilter::Type::eBlur;
|
return nsStyleFilter::Type::eBlur;
|
||||||
case eCSSKeyword_brightness:
|
case eCSSKeyword_brightness:
|
||||||
return nsStyleFilter::Type::eBrightness;
|
return nsStyleFilter::Type::eBrightness;
|
||||||
case eCSSKeyword_contrast:
|
case eCSSKeyword_contrast:
|
||||||
return nsStyleFilter::Type::eContrast;
|
return nsStyleFilter::Type::eContrast;
|
||||||
case eCSSKeyword_drop_shadow:
|
|
||||||
return nsStyleFilter::Type::eDropShadow;
|
|
||||||
case eCSSKeyword_grayscale:
|
case eCSSKeyword_grayscale:
|
||||||
return nsStyleFilter::Type::eGrayscale;
|
return nsStyleFilter::Type::eGrayscale;
|
||||||
case eCSSKeyword_hue_rotate:
|
case eCSSKeyword_hue_rotate:
|
||||||
@ -7751,16 +7749,17 @@ StyleFilterTypeForFunctionName(nsCSSKeyword aFunctionName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
nsRuleNode::SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter,
|
SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter,
|
||||||
const nsCSSValue& aValue,
|
const nsCSSValue& aValue,
|
||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
bool& aCanStoreInRuleTree)
|
bool& aCanStoreInRuleTree)
|
||||||
{
|
{
|
||||||
nsCSSUnit unit = aValue.GetUnit();
|
nsCSSUnit unit = aValue.GetUnit();
|
||||||
if (unit == eCSSUnit_URL) {
|
if (unit == eCSSUnit_URL) {
|
||||||
aStyleFilter->SetURL(aValue.GetURLValue());
|
aStyleFilter->mType = nsStyleFilter::Type::eURL;
|
||||||
|
aStyleFilter->mURL = aValue.GetURLValue();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7769,36 +7768,24 @@ nsRuleNode::SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter,
|
|||||||
nsCSSValue::Array* filterFunction = aValue.GetArrayValue();
|
nsCSSValue::Array* filterFunction = aValue.GetArrayValue();
|
||||||
nsCSSKeyword functionName =
|
nsCSSKeyword functionName =
|
||||||
(nsCSSKeyword)filterFunction->Item(0).GetIntValue();
|
(nsCSSKeyword)filterFunction->Item(0).GetIntValue();
|
||||||
|
aStyleFilter->mType = StyleFilterTypeForFunctionName(functionName);
|
||||||
nsStyleFilter::Type type = StyleFilterTypeForFunctionName(functionName);
|
|
||||||
if (type == nsStyleFilter::Type::eDropShadow) {
|
|
||||||
nsRefPtr<nsCSSShadowArray> shadowArray = GetShadowData(
|
|
||||||
filterFunction->Item(1).GetListValue(),
|
|
||||||
aStyleContext,
|
|
||||||
false,
|
|
||||||
aCanStoreInRuleTree);
|
|
||||||
aStyleFilter->SetDropShadow(shadowArray);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t mask = SETCOORD_PERCENT | SETCOORD_FACTOR;
|
int32_t mask = SETCOORD_PERCENT | SETCOORD_FACTOR;
|
||||||
if (type == nsStyleFilter::Type::eBlur) {
|
if (aStyleFilter->mType == nsStyleFilter::Type::eBlur) {
|
||||||
mask = SETCOORD_LENGTH | SETCOORD_STORE_CALC;
|
mask = SETCOORD_LENGTH | SETCOORD_STORE_CALC;
|
||||||
} else if (type == nsStyleFilter::Type::eHueRotate) {
|
} else if (aStyleFilter->mType == nsStyleFilter::Type::eHueRotate) {
|
||||||
mask = SETCOORD_ANGLE;
|
mask = SETCOORD_ANGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ABORT_IF_FALSE(filterFunction->Count() == 2,
|
NS_ABORT_IF_FALSE(filterFunction->Count() == 2,
|
||||||
"all filter functions should have "
|
"all filter functions except drop-shadow should have "
|
||||||
"exactly one argument");
|
"exactly one argument");
|
||||||
|
|
||||||
nsCSSValue& arg = filterFunction->Item(1);
|
nsCSSValue& arg = filterFunction->Item(1);
|
||||||
nsStyleCoord filterParameter;
|
DebugOnly<bool> success = SetCoord(arg, aStyleFilter->mFilterParameter,
|
||||||
DebugOnly<bool> success = SetCoord(arg, filterParameter,
|
|
||||||
nsStyleCoord(), mask,
|
nsStyleCoord(), mask,
|
||||||
aStyleContext, aPresContext,
|
aStyleContext, aPresContext,
|
||||||
aCanStoreInRuleTree);
|
aCanStoreInRuleTree);
|
||||||
aStyleFilter->SetFilterParameter(filterParameter, type);
|
|
||||||
NS_ABORT_IF_FALSE(success, "unexpected unit");
|
NS_ABORT_IF_FALSE(success, "unexpected unit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7897,7 +7884,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
|
|||||||
nsStyleFilter styleFilter;
|
nsStyleFilter styleFilter;
|
||||||
SetStyleFilterToCSSValue(&styleFilter, cur->mValue, aContext,
|
SetStyleFilterToCSSValue(&styleFilter, cur->mValue, aContext,
|
||||||
mPresContext, canStoreInRuleTree);
|
mPresContext, canStoreInRuleTree);
|
||||||
NS_ABORT_IF_FALSE(styleFilter.GetType() != nsStyleFilter::Type::eNull,
|
NS_ABORT_IF_FALSE(styleFilter.mType != nsStyleFilter::Type::eNull,
|
||||||
"filter should be set");
|
"filter should be set");
|
||||||
svgReset->mFilters.AppendElement(styleFilter);
|
svgReset->mFilters.AppendElement(styleFilter);
|
||||||
cur = cur->mNext;
|
cur = cur->mNext;
|
||||||
|
@ -627,12 +627,7 @@ protected:
|
|||||||
GetShadowData(const nsCSSValueList* aList,
|
GetShadowData(const nsCSSValueList* aList,
|
||||||
nsStyleContext* aContext,
|
nsStyleContext* aContext,
|
||||||
bool aIsBoxShadow,
|
bool aIsBoxShadow,
|
||||||
bool& aCanStoreInRuleTree);
|
bool& inherited);
|
||||||
void SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter,
|
|
||||||
const nsCSSValue& aValue,
|
|
||||||
nsStyleContext* aStyleContext,
|
|
||||||
nsPresContext* aPresContext,
|
|
||||||
bool& aCanStoreInRuleTree);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsRuleNode(nsPresContext* aPresContext, nsRuleNode* aParent,
|
nsRuleNode(nsPresContext* aPresContext, nsRuleNode* aParent,
|
||||||
|
@ -1011,20 +1011,19 @@ nsStyleFilter::nsStyleFilter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsStyleFilter::nsStyleFilter(const nsStyleFilter& aSource)
|
nsStyleFilter::nsStyleFilter(const nsStyleFilter& aSource)
|
||||||
|
: mType(aSource.mType)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsStyleFilter);
|
MOZ_COUNT_CTOR(nsStyleFilter);
|
||||||
if (aSource.mType == eURL) {
|
|
||||||
SetURL(aSource.mURL);
|
if (mType == eURL) {
|
||||||
} else if (aSource.mType == eDropShadow) {
|
mURL = aSource.mURL;
|
||||||
SetDropShadow(aSource.mDropShadow);
|
} else if (mType != eNull) {
|
||||||
} else if (aSource.mType != eNull) {
|
mFilterParameter = aSource.mFilterParameter;
|
||||||
SetFilterParameter(aSource.mFilterParameter, aSource.mType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsStyleFilter::~nsStyleFilter()
|
nsStyleFilter::~nsStyleFilter()
|
||||||
{
|
{
|
||||||
ReleaseRef();
|
|
||||||
MOZ_COUNT_DTOR(nsStyleFilter);
|
MOZ_COUNT_DTOR(nsStyleFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1037,8 +1036,6 @@ nsStyleFilter::operator==(const nsStyleFilter& aOther) const
|
|||||||
|
|
||||||
if (mType == eURL) {
|
if (mType == eURL) {
|
||||||
return EqualURIs(mURL, aOther.mURL);
|
return EqualURIs(mURL, aOther.mURL);
|
||||||
} else if (mType == eDropShadow) {
|
|
||||||
return *mDropShadow == *aOther.mDropShadow;
|
|
||||||
} else if (mType != eNull) {
|
} else if (mType != eNull) {
|
||||||
return mFilterParameter == aOther.mFilterParameter;
|
return mFilterParameter == aOther.mFilterParameter;
|
||||||
}
|
}
|
||||||
@ -1046,47 +1043,6 @@ nsStyleFilter::operator==(const nsStyleFilter& aOther) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
nsStyleFilter::ReleaseRef()
|
|
||||||
{
|
|
||||||
if (mType == eDropShadow) {
|
|
||||||
NS_ASSERTION(mDropShadow, "expected pointer");
|
|
||||||
mDropShadow->Release();
|
|
||||||
} else if (mType == eURL) {
|
|
||||||
NS_ASSERTION(mURL, "expected pointer");
|
|
||||||
mURL->Release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsStyleFilter::SetFilterParameter(const nsStyleCoord& aFilterParameter,
|
|
||||||
Type aType)
|
|
||||||
{
|
|
||||||
ReleaseRef();
|
|
||||||
mFilterParameter = aFilterParameter;
|
|
||||||
mType = aType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsStyleFilter::SetURL(nsIURI* aURL)
|
|
||||||
{
|
|
||||||
NS_ASSERTION(aURL, "expected pointer");
|
|
||||||
ReleaseRef();
|
|
||||||
mURL = aURL;
|
|
||||||
mURL->AddRef();
|
|
||||||
mType = eURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsStyleFilter::SetDropShadow(nsCSSShadowArray* aDropShadow)
|
|
||||||
{
|
|
||||||
NS_ASSERTION(aDropShadow, "expected pointer");
|
|
||||||
ReleaseRef();
|
|
||||||
mDropShadow = aDropShadow;
|
|
||||||
mDropShadow->AddRef();
|
|
||||||
mType = eDropShadow;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
// nsStyleSVGReset
|
// nsStyleSVGReset
|
||||||
//
|
//
|
||||||
|
@ -655,7 +655,7 @@ struct nsCSSShadowItem {
|
|||||||
MOZ_COUNT_DTOR(nsCSSShadowItem);
|
MOZ_COUNT_DTOR(nsCSSShadowItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const nsCSSShadowItem& aOther) const {
|
bool operator==(const nsCSSShadowItem& aOther) {
|
||||||
return (mXOffset == aOther.mXOffset &&
|
return (mXOffset == aOther.mXOffset &&
|
||||||
mYOffset == aOther.mYOffset &&
|
mYOffset == aOther.mYOffset &&
|
||||||
mRadius == aOther.mRadius &&
|
mRadius == aOther.mRadius &&
|
||||||
@ -664,7 +664,7 @@ struct nsCSSShadowItem {
|
|||||||
mInset == aOther.mInset &&
|
mInset == aOther.mInset &&
|
||||||
(!mHasColor || mColor == aOther.mColor));
|
(!mHasColor || mColor == aOther.mColor));
|
||||||
}
|
}
|
||||||
bool operator!=(const nsCSSShadowItem& aOther) const {
|
bool operator!=(const nsCSSShadowItem& aOther) {
|
||||||
return !(*this == aOther);
|
return !(*this == aOther);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -716,18 +716,6 @@ class nsCSSShadowArray {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const nsCSSShadowArray& aOther) const {
|
|
||||||
if (mLength != aOther.Length())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < mLength; ++i) {
|
|
||||||
if (ShadowAt(i) != aOther.ShadowAt(i))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_INLINE_DECL_REFCOUNTING(nsCSSShadowArray)
|
NS_INLINE_DECL_REFCOUNTING(nsCSSShadowArray)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -2293,49 +2281,18 @@ struct nsStyleFilter {
|
|||||||
eBlur,
|
eBlur,
|
||||||
eBrightness,
|
eBrightness,
|
||||||
eContrast,
|
eContrast,
|
||||||
eDropShadow,
|
|
||||||
eGrayscale,
|
|
||||||
eHueRotate,
|
eHueRotate,
|
||||||
eInvert,
|
eInvert,
|
||||||
eOpacity,
|
eOpacity,
|
||||||
|
eGrayscale,
|
||||||
eSaturate,
|
eSaturate,
|
||||||
eSepia,
|
eSepia,
|
||||||
};
|
};
|
||||||
|
|
||||||
Type GetType() const {
|
|
||||||
return mType;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsStyleCoord& GetFilterParameter() const {
|
|
||||||
NS_ASSERTION(mType != eDropShadow &&
|
|
||||||
mType != eURL &&
|
|
||||||
mType != eNull, "wrong filter type");
|
|
||||||
return mFilterParameter;
|
|
||||||
}
|
|
||||||
void SetFilterParameter(const nsStyleCoord& aFilterParameter,
|
|
||||||
Type aType);
|
|
||||||
|
|
||||||
nsIURI* GetURL() const {
|
|
||||||
NS_ASSERTION(mType == eURL, "wrong filter type");
|
|
||||||
return mURL;
|
|
||||||
}
|
|
||||||
void SetURL(nsIURI* aURL);
|
|
||||||
|
|
||||||
nsCSSShadowArray* GetDropShadow() const {
|
|
||||||
NS_ASSERTION(mType == eDropShadow, "wrong filter type");
|
|
||||||
return mDropShadow;
|
|
||||||
}
|
|
||||||
void SetDropShadow(nsCSSShadowArray* aDropShadow);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void ReleaseRef();
|
|
||||||
|
|
||||||
Type mType;
|
Type mType;
|
||||||
|
nsIURI* mURL;
|
||||||
nsStyleCoord mFilterParameter; // coord, percent, factor, angle
|
nsStyleCoord mFilterParameter; // coord, percent, factor, angle
|
||||||
union {
|
// FIXME: Add a nsCSSShadowItem when we implement drop shadow.
|
||||||
nsIURI* mURL;
|
|
||||||
nsCSSShadowArray* mDropShadow;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nsStyleSVGReset {
|
struct nsStyleSVGReset {
|
||||||
@ -2361,8 +2318,8 @@ struct nsStyleSVGReset {
|
|||||||
// filter functions.
|
// filter functions.
|
||||||
nsIURI* SingleFilter() const {
|
nsIURI* SingleFilter() const {
|
||||||
return (mFilters.Length() == 1 &&
|
return (mFilters.Length() == 1 &&
|
||||||
mFilters[0].GetType() == nsStyleFilter::Type::eURL) ?
|
mFilters[0].mType == nsStyleFilter::Type::eURL) ?
|
||||||
mFilters[0].GetURL() : nullptr;
|
mFilters[0].mURL : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> mClipPath; // [reset]
|
nsCOMPtr<nsIURI> mClipPath; // [reset]
|
||||||
|
@ -4458,24 +4458,6 @@ if (SpecialPowers.getBoolPref("layout.css.filters.enabled")) {
|
|||||||
"contrast(350%)",
|
"contrast(350%)",
|
||||||
"contrast(4.567)",
|
"contrast(4.567)",
|
||||||
|
|
||||||
"drop-shadow(2px 2px)",
|
|
||||||
"drop-shadow(2px 2px 1px)",
|
|
||||||
"drop-shadow(2px 2px green))",
|
|
||||||
"drop-shadow(2px 2px 1px green)",
|
|
||||||
"drop-shadow(green 2px 2px)",
|
|
||||||
"drop-shadow(green 2px 2px 1px)",
|
|
||||||
"drop-shadow(currentColor 3px 3px)",
|
|
||||||
"drop-shadow(2px 2px calc(-5px))", /* clamped */
|
|
||||||
"drop-shadow(calc(3em - 2px) 2px green)",
|
|
||||||
"drop-shadow(green calc(3em - 2px) 2px)",
|
|
||||||
"drop-shadow(2px calc(2px + 0.2em))",
|
|
||||||
"drop-shadow(blue 2px calc(2px + 0.2em))",
|
|
||||||
"drop-shadow(2px calc(2px + 0.2em) blue)",
|
|
||||||
"drop-shadow(calc(-2px) calc(-2px))",
|
|
||||||
"drop-shadow(-2px -2px)",
|
|
||||||
"drop-shadow(calc(2px) calc(2px))",
|
|
||||||
"drop-shadow(calc(2px) calc(2px) calc(2px))",
|
|
||||||
|
|
||||||
"grayscale(0)",
|
"grayscale(0)",
|
||||||
"grayscale(50%)",
|
"grayscale(50%)",
|
||||||
"grayscale(1)",
|
"grayscale(1)",
|
||||||
@ -4574,22 +4556,6 @@ if (SpecialPowers.getBoolPref("layout.css.filters.enabled")) {
|
|||||||
"contrast(10px)",
|
"contrast(10px)",
|
||||||
"contrast(-1)",
|
"contrast(-1)",
|
||||||
|
|
||||||
"drop-shadow()",
|
|
||||||
"drop-shadow(3% 3%)",
|
|
||||||
"drop-shadow(2px 2px -5px)",
|
|
||||||
"drop-shadow(2px 2px 2px 2px)",
|
|
||||||
"drop-shadow(2px 2px, none)",
|
|
||||||
"drop-shadow(none, 2px 2px)",
|
|
||||||
"drop-shadow(inherit, 2px 2px)",
|
|
||||||
"drop-shadow(2px 2px, inherit)",
|
|
||||||
"drop-shadow(2 2px)",
|
|
||||||
"drop-shadow(2px 2)",
|
|
||||||
"drop-shadow(2px 2px 2)",
|
|
||||||
"drop-shadow(2px 2px 2px 2)",
|
|
||||||
"drop-shadow(calc(2px) calc(2px) calc(2px) calc(2px))",
|
|
||||||
"drop-shadow(green 2px 2px, blue 1px 3px 4px)",
|
|
||||||
"drop-shadow(blue 2px 2px, currentColor 1px 2px)",
|
|
||||||
|
|
||||||
"grayscale()",
|
"grayscale()",
|
||||||
"grayscale(0.5 0.5)",
|
"grayscale(0.5 0.5)",
|
||||||
"grayscale(0.5,)",
|
"grayscale(0.5,)",
|
||||||
|
Loading…
Reference in New Issue
Block a user