Bug 383184 - Implement SVG lighting filters.

Style portion r+sr=dbaron, rest r=longsonr, sr=roc.
This commit is contained in:
tor@cs.brown.edu 2007-07-25 23:57:42 -07:00
Родитель d09c917fe3
Коммит c9776f2873
29 изменённых файлов: 1462 добавлений и 250 удалений

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

@ -928,6 +928,7 @@ GK_ATOM(animateMotion, "animateMotion")
GK_ATOM(animateTransform, "animateTransform")
GK_ATOM(arithmetic, "arithmetic")
GK_ATOM(atop, "atop")
GK_ATOM(azimuth, "azimuth")
GK_ATOM(baseFrequency, "baseFrequency")
GK_ATOM(baseline_shift, "baseline-shift")
GK_ATOM(bias, "bias")
@ -948,6 +949,7 @@ GK_ATOM(defs, "defs")
GK_ATOM(definition_src, "definition-src")
GK_ATOM(deg, "deg")
GK_ATOM(desc, "desc")
GK_ATOM(diffuseConstant, "diffuseConstant")
GK_ATOM(dilate, "dilate")
GK_ATOM(direction, "direction")
GK_ATOM(disable, "disable")
@ -959,6 +961,7 @@ GK_ATOM(dx, "dx")
GK_ATOM(dy, "dy")
GK_ATOM(edgeMode, "edgeMode")
GK_ATOM(ellipse, "ellipse")
GK_ATOM(elevation, "elevation")
GK_ATOM(erode, "erode")
GK_ATOM(ex, "ex")
GK_ATOM(exact, "exact")
@ -1038,6 +1041,8 @@ GK_ATOM(kernelMatrix, "kernelMatrix")
GK_ATOM(kernelUnitLength, "kernelUnitLength")
GK_ATOM(letter_spacing, "letter-spacing")
GK_ATOM(lighten, "lighten")
GK_ATOM(lighting_color, "lighting-color")
GK_ATOM(limitingConeAngle, "limitingConeAngle")
GK_ATOM(linear, "linear")
GK_ATOM(linearGradient, "linearGradient")
GK_ATOM(linearRGB, "linearRGB")
@ -1085,6 +1090,9 @@ GK_ATOM(patternUnits, "patternUnits")
GK_ATOM(pc, "pc")
GK_ATOM(pointer_events, "pointer-events")
GK_ATOM(points, "points")
GK_ATOM(pointsAtX, "pointsAtX")
GK_ATOM(pointsAtY, "pointsAtY")
GK_ATOM(pointsAtZ, "pointsAtZ")
GK_ATOM(polyline, "polyline")
GK_ATOM(preserveAlpha, "preserveAlpha")
GK_ATOM(preserveAspectRatio, "preserveAspectRatio")
@ -1112,6 +1120,8 @@ GK_ATOM(skewX, "skewX")
GK_ATOM(skewY, "skewY")
GK_ATOM(slope, "slope")
GK_ATOM(spacing, "spacing")
GK_ATOM(specularConstant, "specularConstant")
GK_ATOM(specularExponent, "specularExponent")
GK_ATOM(spreadMethod, "spreadMethod")
GK_ATOM(sRGB, "sRGB")
GK_ATOM(startOffset, "startOffset")
@ -1129,6 +1139,7 @@ GK_ATOM(stroke_miterlimit, "stroke-miterlimit")
GK_ATOM(stroke_opacity, "stroke-opacity")
GK_ATOM(stroke_width, "stroke-width")
GK_ATOM(strokeWidth, "strokeWidth")
GK_ATOM(surfaceScale, "surfaceScale")
GK_ATOM(svg, "svg")
GK_ATOM(svgSwitch, "switch")
GK_ATOM(symbol, "symbol")
@ -1155,6 +1166,7 @@ GK_ATOM(x2, "x2")
GK_ATOM(y, "y")
GK_ATOM(y1, "y1")
GK_ATOM(y2, "y2")
GK_ATOM(z, "z")
GK_ATOM(zoomAndPan, "zoomAndPan")
#endif

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

@ -113,6 +113,7 @@ nsSVGDefsElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -487,6 +487,13 @@ nsSVGElement::sFEFloodMap[] = {
{ nsnull }
};
// PresentationAttributes-LightingEffects
/* static */ const nsGenericElement::MappedAttributeEntry
nsSVGElement::sLightingEffectsMap[] = {
{ &nsGkAtoms::lighting_color },
{ nsnull }
};
//----------------------------------------------------------------------
// nsIDOMNode methods

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

@ -92,7 +92,8 @@ public:
static const MappedAttributeEntry sColorMap[];
static const MappedAttributeEntry sFiltersMap[];
static const MappedAttributeEntry sFEFloodMap[];
static const MappedAttributeEntry sLightingEffectsMap[];
// nsIDOMNode
NS_IMETHOD IsSupported(const nsAString& aFeature, const nsAString& aVersion, PRBool* aReturn);
@ -218,5 +219,4 @@ NS_NewSVG##_elementName##Element(nsIContent **aResult, \
return rv; \
}
#endif // __NS_SVGELEMENT_H__

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

@ -146,6 +146,16 @@ nsresult
NS_NewSVGSwitchElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGFEConvolveMatrixElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGFEDistantLightElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGFEPointLightElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGFESpotLightElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGFEDiffuseLightingElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGFESpecularLightingElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGElement(nsIContent** aResult, nsINodeInfo *aNodeInfo)
@ -254,10 +264,18 @@ NS_NewSVGElement(nsIContent** aResult, nsINodeInfo *aNodeInfo)
return NS_NewSVGFETurbulenceElement(aResult, aNodeInfo);
if (name == nsGkAtoms::feConvolveMatrix)
return NS_NewSVGFEConvolveMatrixElement(aResult, aNodeInfo);
if (name == nsGkAtoms::feDiffuseLighting ||
name == nsGkAtoms::feDisplacementMap ||
if (name == nsGkAtoms::feDistantLight)
return NS_NewSVGFEDistantLightElement(aResult, aNodeInfo);
if (name == nsGkAtoms::fePointLight)
return NS_NewSVGFEPointLightElement(aResult, aNodeInfo);
if (name == nsGkAtoms::feSpotLight)
return NS_NewSVGFESpotLightElement(aResult, aNodeInfo);
if (name == nsGkAtoms::feDiffuseLighting)
return NS_NewSVGFEDiffuseLightingElement(aResult, aNodeInfo);
if (name == nsGkAtoms::feSpecularLighting)
return NS_NewSVGFESpecularLightingElement(aResult, aNodeInfo);
if (name == nsGkAtoms::feDisplacementMap ||
name == nsGkAtoms::feImage ||
name == nsGkAtoms::feSpecularLighting ||
name == nsGkAtoms::feTile)
return NS_NewSVGFEUnimplementedMOZElement(aResult, aNodeInfo);
if (name == nsGkAtoms::pattern)

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

@ -271,6 +271,7 @@ nsSVGFilterElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -40,6 +40,9 @@
#include "nsSVGStylableElement.h"
#include "nsSVGLength2.h"
class nsSVGFilterResource;
class nsIDOMSVGAnimatedString;
typedef nsSVGStylableElement nsSVGFEBase;
class nsSVGFE : public nsSVGFEBase
@ -59,6 +62,25 @@ protected:
nsSVGFilterInstance::ColorModel
GetColorModel(nsSVGFilterInstance::ColorModel::AlphaChannel aAlphaChannel);
struct ScaleInfo {
nsRefPtr<gfxImageSurface> mRealSource;
nsRefPtr<gfxImageSurface> mRealTarget;
nsRefPtr<gfxImageSurface> mSource;
nsRefPtr<gfxImageSurface> mTarget;
nsRect mRect;
PRPackedBool mRescaling;
};
nsresult SetupScalingFilter(nsSVGFilterInstance *aInstance,
nsSVGFilterResource *aResource,
nsIDOMSVGAnimatedString *aIn,
nsSVGNumber2 *aUnitX, nsSVGNumber2 *aUnitY,
ScaleInfo *aScaleInfo);
void FinishScalingFilter(nsSVGFilterResource *aResource,
ScaleInfo *aScaleInfo);
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED

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

@ -115,6 +115,7 @@ nsSVGForeignObjectElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -115,6 +115,7 @@ nsSVGGElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -293,6 +293,7 @@ nsSVGMarkerElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -282,6 +282,7 @@ nsSVGPatternElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -1089,6 +1089,7 @@ nsSVGSVGElement::IsAttributeMapped(const nsIAtom* name) const
sFontSpecificationMap,
sGradientStopMap,
sGraphicsMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -113,6 +113,7 @@ nsSVGSwitchElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -180,6 +180,7 @@ nsSVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
sFontSpecificationMap,
sGradientStopMap,
sGraphicsMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -499,6 +499,7 @@ nsSVGUseElement::IsAttributeMapped(const nsIAtom* name) const
sFiltersMap,
sFontSpecificationMap,
sGradientStopMap,
sLightingEffectsMap,
sMarkersMap,
sTextContentElementsMap,
sViewportsMap

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

@ -249,6 +249,52 @@ interface nsIDOMSVGFEConvolveMatrixElement : nsIDOMSVGFilterPrimitiveStandardAtt
readonly attribute nsIDOMSVGAnimatedBoolean preserveAlpha;
};
[scriptable, uuid(2e9eb422-2398-4be9-a9b8-b1cc7aa9dd6f)]
interface nsIDOMSVGFEDiffuseLightingElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{
readonly attribute nsIDOMSVGAnimatedString in1;
readonly attribute nsIDOMSVGAnimatedNumber surfaceScale;
readonly attribute nsIDOMSVGAnimatedNumber diffuseConstant;
readonly attribute nsIDOMSVGAnimatedNumber kernelUnitLengthX;
readonly attribute nsIDOMSVGAnimatedNumber kernelUnitLengthY;
};
[scriptable, uuid(49c38287-a7c2-4895-a630-86d2b45df23c)]
interface nsIDOMSVGFESpecularLightingElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{
readonly attribute nsIDOMSVGAnimatedString in1;
readonly attribute nsIDOMSVGAnimatedNumber surfaceScale;
readonly attribute nsIDOMSVGAnimatedNumber specularConstant;
readonly attribute nsIDOMSVGAnimatedNumber specularExponent;
readonly attribute nsIDOMSVGAnimatedNumber kernelUnitLengthX;
readonly attribute nsIDOMSVGAnimatedNumber kernelUnitLengthY;
};
[scriptable, uuid(02141672-7f2c-412a-a7d7-4caa194842e9)]
interface nsIDOMSVGFEDistantLightElement : nsIDOMSVGElement {
readonly attribute nsIDOMSVGAnimatedNumber azimuth;
readonly attribute nsIDOMSVGAnimatedNumber elevation;
};
[scriptable, uuid(557f128a-026b-4fa8-a44c-605df7bfd62e)]
interface nsIDOMSVGFEPointLightElement : nsIDOMSVGElement {
readonly attribute nsIDOMSVGAnimatedNumber x;
readonly attribute nsIDOMSVGAnimatedNumber y;
readonly attribute nsIDOMSVGAnimatedNumber z;
};
[scriptable, uuid(5515dd05-3d9d-4d6c-8460-a04aaf5afe15)]
interface nsIDOMSVGFESpotLightElement : nsIDOMSVGElement {
readonly attribute nsIDOMSVGAnimatedNumber x;
readonly attribute nsIDOMSVGAnimatedNumber y;
readonly attribute nsIDOMSVGAnimatedNumber z;
readonly attribute nsIDOMSVGAnimatedNumber pointsAtX;
readonly attribute nsIDOMSVGAnimatedNumber pointsAtY;
readonly attribute nsIDOMSVGAnimatedNumber pointsAtZ;
readonly attribute nsIDOMSVGAnimatedNumber specularExponent;
readonly attribute nsIDOMSVGAnimatedNumber limitingConeAngle;
};
[scriptable, uuid(8698c635-26c7-468b-905e-494e8825d56b)]
interface nsIDOMSVGFEUnimplementedMOZElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{

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

@ -247,6 +247,8 @@ enum nsDOMClassInfoID {
eDOMClassInfo_SVGDescElement_id,
eDOMClassInfo_SVGEllipseElement_id,
eDOMClassInfo_SVGFEBlendElement_id,
eDOMClassInfo_SVGFEDiffuseLightingElement_id,
eDOMClassInfo_SVGFEDistantLightElement_id,
eDOMClassInfo_SVGFEColorMatrixElement_id,
eDOMClassInfo_SVGFEComponentTransferElement_id,
eDOMClassInfo_SVGFECompositeElement_id,
@ -261,6 +263,9 @@ enum nsDOMClassInfoID {
eDOMClassInfo_SVGFEMergeNodeElement_id,
eDOMClassInfo_SVGFEMorphologyElement_id,
eDOMClassInfo_SVGFEOffsetElement_id,
eDOMClassInfo_SVGFEPointLightElement_id,
eDOMClassInfo_SVGFESpecularLightingElement_id,
eDOMClassInfo_SVGFESpotLightElement_id,
eDOMClassInfo_SVGFETurbulenceElement_id,
eDOMClassInfo_SVGFEUnimplementedMOZElement_id,
eDOMClassInfo_SVGFilterElement_id,

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

@ -919,6 +919,10 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEBlendElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEDiffuseLightingElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEDistantLightElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEColorMatrixElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEComponentTransferElement, nsElementSH,
@ -947,6 +951,12 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEOffsetElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEPointLightElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFESpecularLightingElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFESpotLightElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFETurbulenceElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEUnimplementedMOZElement, nsElementSH,
@ -2645,6 +2655,18 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEDiffuseLightingElement, nsIDOMSVGFEDiffuseLightingElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDiffuseLightingElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEDistantLightElement, nsIDOMSVGFEDistantLightElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDistantLightElement)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEColorMatrixElement, nsIDOMSVGFEColorMatrixElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEColorMatrixElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
@ -2733,6 +2755,23 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEPointLightElement, nsIDOMSVGFEPointLightElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEPointLightElement)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFESpecularLightingElement, nsIDOMSVGFESpecularLightingElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFESpecularLightingElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFESpotLightElement, nsIDOMSVGFESpotLightElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFESpotLightElement)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFETurbulenceElement, nsIDOMSVGFETurbulenceElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFETurbulenceElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)

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

@ -4739,6 +4739,8 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
return ParseVariant(aErrorCode, aValue, VARIANT_HC, nsnull);
case eCSSProperty_flood_opacity:
return ParseVariant(aErrorCode, aValue, VARIANT_HN, nsnull);
case eCSSProperty_lighting_color:
return ParseVariant(aErrorCode, aValue, VARIANT_HC, nsnull);
case eCSSProperty_marker_end:
case eCSSProperty_marker_mid:
case eCSSProperty_marker_start:

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

@ -532,6 +532,7 @@ CSS_PROP_SVG(fill-rule, fill_rule, FillRule, SVG, mFillRule, eCSSType_Value, kFi
CSS_PROP_SVGRESET(filter, filter, Filter, SVG, mFilter, eCSSType_Value, nsnull)
CSS_PROP_SVGRESET(flood-color, flood_color, FloodColor, SVG, mFloodColor, eCSSType_Value, nsnull)
CSS_PROP_SVGRESET(flood-opacity, flood_opacity, FloodOpacity, SVG, mFloodOpacity, eCSSType_Value, nsnull)
CSS_PROP_SVGRESET(lighting-color, lighting_color, LightingColor, SVG, mLightingColor, eCSSType_Value, nsnull)
CSS_PROP_SHORTHAND(marker, marker, Marker)
CSS_PROP_SVG(marker-end, marker_end, MarkerEnd, SVG, mMarkerEnd, eCSSType_Value, nsnull)
CSS_PROP_SVG(marker-mid, marker_mid, MarkerMid, SVG, mMarkerMid, eCSSType_Value, nsnull)

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

@ -586,6 +586,7 @@ struct nsCSSSVG : public nsCSSStruct {
nsCSSValue mFilter;
nsCSSValue mFloodColor;
nsCSSValue mFloodOpacity;
nsCSSValue mLightingColor;
nsCSSValue mMarkerEnd;
nsCSSValue mMarkerMid;
nsCSSValue mMarkerStart;

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

@ -3524,12 +3524,12 @@ nsComputedDOMStyle::GetTextRendering(nsIDOMCSSValue** aValue)
}
nsresult
nsComputedDOMStyle::GetStopColor(nsIDOMCSSValue** aValue)
nsComputedDOMStyle::GetFloodColor(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mStopColor);
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor);
if (NS_FAILED(rv)) {
delete val;
return rv;
@ -3539,12 +3539,27 @@ nsComputedDOMStyle::GetStopColor(nsIDOMCSSValue** aValue)
}
nsresult
nsComputedDOMStyle::GetFloodColor(nsIDOMCSSValue** aValue)
nsComputedDOMStyle::GetLightingColor(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor);
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mLightingColor);
if (NS_FAILED(rv)) {
delete val;
return rv;
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetStopColor(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mStopColor);
if (NS_FAILED(rv)) {
delete val;
return rv;
@ -3807,6 +3822,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
COMPUTED_STYLE_MAP_ENTRY(filter, Filter),
COMPUTED_STYLE_MAP_ENTRY(flood_color, FloodColor),
COMPUTED_STYLE_MAP_ENTRY(flood_opacity, FloodOpacity),
COMPUTED_STYLE_MAP_ENTRY(lighting_color, LightingColor),
COMPUTED_STYLE_MAP_ENTRY(mask, Mask),
COMPUTED_STYLE_MAP_ENTRY(marker_end, MarkerEnd),
COMPUTED_STYLE_MAP_ENTRY(marker_mid, MarkerMid),

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

@ -307,8 +307,9 @@ private:
nsresult GetShapeRendering(nsIDOMCSSValue** aValue);
nsresult GetTextRendering(nsIDOMCSSValue** aValue);
nsresult GetStopColor(nsIDOMCSSValue** aValue);
nsresult GetFloodColor(nsIDOMCSSValue** aValue);
nsresult GetLightingColor(nsIDOMCSSValue** aValue);
nsresult GetStopColor(nsIDOMCSSValue** aValue);
nsresult GetClipPath(nsIDOMCSSValue** aValue);
nsresult GetFilter(nsIDOMCSSValue** aValue);

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

@ -4668,6 +4668,14 @@ nsRuleNode::ComputeSVGResetData(nsStyleStruct* aStartStruct,
mPresContext, aContext, svgReset->mFloodColor, inherited);
}
// lighting-color:
if (eCSSUnit_Initial == SVGData.mLightingColor.GetUnit()) {
svgReset->mLightingColor = NS_RGB(255, 255, 255);
} else {
SetColor(SVGData.mLightingColor, parentSVGReset->mLightingColor,
mPresContext, aContext, svgReset->mLightingColor, inherited);
}
// clip-path: url, none, inherit
if (eCSSUnit_URL == SVGData.mClipPath.GetUnit()) {
svgReset->mClipPath = SVGData.mClipPath.GetURLValue();

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

@ -888,6 +888,8 @@ void nsStyleContext::DumpRegressionData(nsPresContext* aPresContext, FILE* out,
fprintf(out, "%ld ", (long)svgReset->mFloodColor);
fprintf(out, "%ld ", (long)svgReset->mLightingColor);
fprintf(out, "%s %s %s %f %f %d\" />\n",
URICString(svgReset->mClipPath).get(),
URICString(svgReset->mFilter).get(),

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

@ -772,6 +772,7 @@ nsStyleSVGReset::nsStyleSVGReset()
{
mStopColor = NS_RGB(0,0,0);
mFloodColor = NS_RGB(0,0,0);
mLightingColor = NS_RGB(255,255,255);
mClipPath = nsnull;
mFilter = nsnull;
mMask = nsnull;
@ -788,6 +789,7 @@ nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource)
{
mStopColor = aSource.mStopColor;
mFloodColor = aSource.mFloodColor;
mLightingColor = aSource.mLightingColor;
mClipPath = aSource.mClipPath;
mFilter = aSource.mFilter;
mMask = aSource.mMask;
@ -798,13 +800,14 @@ nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource)
nsChangeHint nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aOther) const
{
if (mStopColor != aOther.mStopColor ||
mFloodColor != aOther.mFloodColor ||
!EqualURIs(mClipPath, aOther.mClipPath) ||
!EqualURIs(mFilter, aOther.mFilter) ||
!EqualURIs(mMask, aOther.mMask) ||
mStopOpacity != aOther.mStopOpacity ||
mFloodOpacity != aOther.mFloodOpacity ||
if (mStopColor != aOther.mStopColor ||
mFloodColor != aOther.mFloodColor ||
mLightingColor != aOther.mLightingColor ||
!EqualURIs(mClipPath, aOther.mClipPath) ||
!EqualURIs(mFilter, aOther.mFilter) ||
!EqualURIs(mMask, aOther.mMask) ||
mStopOpacity != aOther.mStopOpacity ||
mFloodOpacity != aOther.mFloodOpacity ||
mDominantBaseline != aOther.mDominantBaseline)
return NS_STYLE_HINT_VISUAL;

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

@ -1308,6 +1308,7 @@ struct nsStyleSVGReset : public nsStyleStruct {
nscolor mStopColor; // [reset]
nscolor mFloodColor; // [reset]
nscolor mLightingColor; // [reset]
nsCOMPtr<nsIURI> mClipPath; // [reset]
nsCOMPtr<nsIURI> mFilter; // [reset]
nsCOMPtr<nsIURI> mMask; // [reset]

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

@ -1695,6 +1695,14 @@ var gCSSProperties = {
other_values: [ "0", "0.3", "-7.3" ],
invalid_values: []
},
"lighting-color": {
domProp: null,
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "white", "#fff", "#ffffff", "rgb(255,255,255)", "rgba(255,255,255,1.0)", "rgba(255,255,255,42.0)" ],
other_values: [ "green", "#fc3" ],
invalid_values: [ "url('#myserver')", "url(foo.svg#myserver)", 'url("#myserver") green' ]
},
"marker": {
domProp: null,
inherited: true,