Bug 316908 - Add SVG to nsComputedDOMStyle. r+sr=dbaron

This commit is contained in:
tor%cs.brown.edu 2007-07-21 14:20:28 +00:00
Родитель 10d5299c38
Коммит 1f4a683b99
8 изменённых файлов: 612 добавлений и 138 удалений

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

@ -2870,6 +2870,509 @@ nsComputedDOMStyle::GetFrameBorderRectWidth(nscoord& aWidth)
return PR_TRUE;
}
#ifdef MOZ_SVG
nsresult
nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill,
nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
const nsStyleSVGPaint* paint = nsnull;
if (aFill)
paint = &svg->mFill;
else
paint = &svg->mStroke;
nsAutoString paintString;
switch (paint->mType) {
case eStyleSVGPaintType_None:
{
val->SetIdent(nsGkAtoms::none);
break;
}
case eStyleSVGPaintType_Color:
{
nsresult rv = SetToRGBAColor(val, paint->mPaint.mColor);
if (NS_FAILED(rv)) {
delete val;
return rv;
}
break;
}
case eStyleSVGPaintType_Server:
{
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
if (!valueList->AppendCSSValue(val)) {
delete valueList;
delete val;
return NS_ERROR_OUT_OF_MEMORY;
}
nsROCSSPrimitiveValue* fallback = GetROCSSPrimitiveValue();
if (!fallback || !valueList->AppendCSSValue(fallback)) {
delete valueList;
delete fallback;
return NS_ERROR_OUT_OF_MEMORY;
}
val->SetURI(paint->mPaint.mPaintServer);
nsresult rv = SetToRGBAColor(fallback, paint->mFallbackColor);
if (NS_FAILED(rv)) {
delete valueList;
return rv;
}
return CallQueryInterface(valueList, aValue);
}
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetFill(nsIDOMCSSValue** aValue)
{
return GetSVGPaintFor(PR_TRUE, aValue);
}
nsresult
nsComputedDOMStyle::GetStroke(nsIDOMCSSValue** aValue)
{
return GetSVGPaintFor(PR_FALSE, aValue);
}
nsresult
nsComputedDOMStyle::GetMarkerEnd(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
if (svg->mMarkerEnd)
val->SetURI(svg->mMarkerEnd);
else
val->SetIdent(nsGkAtoms::none);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetMarkerMid(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
if (svg->mMarkerMid)
val->SetURI(svg->mMarkerMid);
else
val->SetIdent(nsGkAtoms::none);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetMarkerStart(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
if (svg->mMarkerStart)
val->SetURI(svg->mMarkerStart);
else
val->SetIdent(nsGkAtoms::none);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetStrokeDasharray(nsIDOMCSSValue** aValue)
{
const nsStyleSVG* svg = GetStyleSVG();
if (!svg->mStrokeDasharrayLength || !svg->mStrokeDasharray) {
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
val->SetIdent(nsGkAtoms::none);
return CallQueryInterface(val, aValue);
}
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
for (PRUint32 i = 0; i < svg->mStrokeDasharrayLength; i++) {
nsROCSSPrimitiveValue* dash = GetROCSSPrimitiveValue();
if (!dash || !valueList->AppendCSSValue(dash)) {
delete valueList;
delete dash;
return NS_ERROR_OUT_OF_MEMORY;
}
SetValueToCoord(dash, svg->mStrokeDasharray[i]);
}
return CallQueryInterface(valueList, aValue);
}
nsresult
nsComputedDOMStyle::GetStrokeDashoffset(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetStrokeWidth(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStyleSVG()->mStrokeWidth);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetFillOpacity(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
val->SetNumber(GetStyleSVG()->mFillOpacity);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetFloodOpacity(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
val->SetNumber(GetStyleSVGReset()->mFloodOpacity);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetStopOpacity(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
val->SetNumber(GetStyleSVGReset()->mStopOpacity);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetStrokeMiterlimit(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
val->SetNumber(GetStyleSVG()->mStrokeMiterlimit);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetStrokeOpacity(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
val->SetNumber(GetStyleSVG()->mStrokeOpacity);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetClipRule(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(GetStyleSVG()->mClipRule,
nsCSSProps::kFillRuleKTable);
val->SetIdent(keyword);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetFillRule(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(GetStyleSVG()->mFillRule,
nsCSSProps::kFillRuleKTable);
val->SetIdent(keyword);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetStrokeLinecap(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(GetStyleSVG()->mStrokeLinecap,
nsCSSProps::kStrokeLinecapKTable);
val->SetIdent(keyword);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetStrokeLinejoin(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(GetStyleSVG()->mStrokeLinejoin,
nsCSSProps::kStrokeLinejoinKTable);
val->SetIdent(keyword);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetTextAnchor(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(GetStyleSVG()->mTextAnchor,
nsCSSProps::kTextAnchorKTable);
val->SetIdent(keyword);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetColorInterpolation(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
if (svg->mColorInterpolation != NS_STYLE_COLOR_INTERPOLATION_AUTO) {
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(svg->mColorInterpolation,
nsCSSProps::kColorInterpolationKTable);
val->SetIdent(keyword);
} else {
val->SetIdent(nsGkAtoms::_auto);
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetColorInterpolationFilters(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
if (svg->mColorInterpolationFilters != NS_STYLE_COLOR_INTERPOLATION_AUTO) {
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(svg->mColorInterpolationFilters,
nsCSSProps::kColorInterpolationKTable);
val->SetIdent(keyword);
} else {
val->SetIdent(nsGkAtoms::_auto);
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetDominantBaseline(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVGReset* svg = GetStyleSVGReset();
if (svg->mDominantBaseline != NS_STYLE_DOMINANT_BASELINE_AUTO) {
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(svg->mDominantBaseline,
nsCSSProps::kDominantBaselineKTable);
val->SetIdent(keyword);
} else {
val->SetIdent(nsGkAtoms::_auto);
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetPointerEvents(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
if (svg->mPointerEvents != NS_STYLE_POINTER_EVENTS_NONE) {
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(svg->mPointerEvents,
nsCSSProps::kPointerEventsKTable);
val->SetIdent(keyword);
} else {
val->SetIdent(nsGkAtoms::none);
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetShapeRendering(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
if (svg->mShapeRendering != NS_STYLE_SHAPE_RENDERING_AUTO) {
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(svg->mShapeRendering,
nsCSSProps::kShapeRenderingKTable);
val->SetIdent(keyword);
} else {
val->SetIdent(nsGkAtoms::_auto);
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetTextRendering(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVG* svg = GetStyleSVG();
if (svg->mTextRendering != NS_STYLE_TEXT_RENDERING_AUTO) {
const nsAFlatCString& keyword =
nsCSSProps::ValueToKeyword(svg->mTextRendering,
nsCSSProps::kTextRenderingKTable);
val->SetIdent(keyword);
} else {
val->SetIdent(nsGkAtoms::_auto);
}
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;
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetFloodColor(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor);
if (NS_FAILED(rv)) {
delete val;
return rv;
}
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetClipPath(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVGReset* svg = GetStyleSVGReset();
if (svg->mClipPath)
val->SetURI(svg->mClipPath);
else
val->SetIdent(nsGkAtoms::none);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetFilter(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVGReset* svg = GetStyleSVGReset();
if (svg->mFilter)
val->SetURI(svg->mFilter);
else
val->SetIdent(nsGkAtoms::none);
return CallQueryInterface(val, aValue);
}
nsresult
nsComputedDOMStyle::GetMask(nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStyleSVGReset* svg = GetStyleSVGReset();
if (svg->mMask)
val->SetURI(svg->mMask);
else
val->SetIdent(nsGkAtoms::none);
return CallQueryInterface(val, aValue);
}
#endif // MOZ_SVG
#define COMPUTED_STYLE_MAP_ENTRY(_prop, _method) \
{ eCSSProperty_##_prop, &nsComputedDOMStyle::Get##_method }
@ -3058,6 +3561,40 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
COMPUTED_STYLE_MAP_ENTRY(user_input, UserInput),
COMPUTED_STYLE_MAP_ENTRY(user_modify, UserModify),
COMPUTED_STYLE_MAP_ENTRY(user_select, UserSelect)
#ifdef MOZ_SVG
,
COMPUTED_STYLE_MAP_ENTRY(clip_path, ClipPath),
COMPUTED_STYLE_MAP_ENTRY(clip_rule, ClipRule),
COMPUTED_STYLE_MAP_ENTRY(color_interpolation, ColorInterpolation),
COMPUTED_STYLE_MAP_ENTRY(color_interpolation_filters, ColorInterpolationFilters),
COMPUTED_STYLE_MAP_ENTRY(dominant_baseline, DominantBaseline),
COMPUTED_STYLE_MAP_ENTRY(fill, Fill),
COMPUTED_STYLE_MAP_ENTRY(fill_opacity, FillOpacity),
COMPUTED_STYLE_MAP_ENTRY(fill_rule, FillRule),
COMPUTED_STYLE_MAP_ENTRY(filter, Filter),
COMPUTED_STYLE_MAP_ENTRY(flood_color, FloodColor),
COMPUTED_STYLE_MAP_ENTRY(flood_opacity, FloodOpacity),
COMPUTED_STYLE_MAP_ENTRY(mask, Mask),
COMPUTED_STYLE_MAP_ENTRY(marker_end, MarkerEnd),
COMPUTED_STYLE_MAP_ENTRY(marker_mid, MarkerMid),
COMPUTED_STYLE_MAP_ENTRY(marker_start, MarkerStart),
COMPUTED_STYLE_MAP_ENTRY(pointer_events, PointerEvents),
COMPUTED_STYLE_MAP_ENTRY(shape_rendering, ShapeRendering),
COMPUTED_STYLE_MAP_ENTRY(stop_color, StopColor),
COMPUTED_STYLE_MAP_ENTRY(stop_opacity, StopOpacity),
COMPUTED_STYLE_MAP_ENTRY(stroke, Stroke),
COMPUTED_STYLE_MAP_ENTRY(stroke_dasharray, StrokeDasharray),
COMPUTED_STYLE_MAP_ENTRY(stroke_dashoffset, StrokeDashoffset),
COMPUTED_STYLE_MAP_ENTRY(stroke_linecap, StrokeLinecap),
COMPUTED_STYLE_MAP_ENTRY(stroke_linejoin, StrokeLinejoin),
COMPUTED_STYLE_MAP_ENTRY(stroke_miterlimit, StrokeMiterlimit),
COMPUTED_STYLE_MAP_ENTRY(stroke_opacity, StrokeOpacity),
COMPUTED_STYLE_MAP_ENTRY(stroke_width, StrokeWidth),
COMPUTED_STYLE_MAP_ENTRY(text_anchor, TextAnchor),
COMPUTED_STYLE_MAP_ENTRY(text_rendering, TextRendering)
#endif
};
*aLength = NS_ARRAY_LENGTH(map);

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

@ -266,6 +266,47 @@ private:
nsresult GetColumnWidth(nsIDOMCSSValue** aValue);
nsresult GetColumnGap(nsIDOMCSSValue** aValue);
#ifdef MOZ_SVG
/* SVG properties */
nsresult GetSVGPaintFor(PRBool aFill, nsIDOMCSSValue** aValue);
nsresult GetFill(nsIDOMCSSValue** aValue);
nsresult GetStroke(nsIDOMCSSValue** aValue);
nsresult GetMarkerEnd(nsIDOMCSSValue** aValue);
nsresult GetMarkerMid(nsIDOMCSSValue** aValue);
nsresult GetMarkerStart(nsIDOMCSSValue** aValue);
nsresult GetStrokeDasharray(nsIDOMCSSValue** aValue);
nsresult GetStrokeDashoffset(nsIDOMCSSValue** aValue);
nsresult GetStrokeWidth(nsIDOMCSSValue** aValue);
nsresult GetFillOpacity(nsIDOMCSSValue** aValue);
nsresult GetFloodOpacity(nsIDOMCSSValue** aValue);
nsresult GetStopOpacity(nsIDOMCSSValue** aValue);
nsresult GetStrokeMiterlimit(nsIDOMCSSValue** aValue);
nsresult GetStrokeOpacity(nsIDOMCSSValue** aValue);
nsresult GetClipRule(nsIDOMCSSValue** aValue);
nsresult GetFillRule(nsIDOMCSSValue** aValue);
nsresult GetStrokeLinecap(nsIDOMCSSValue** aValue);
nsresult GetStrokeLinejoin(nsIDOMCSSValue** aValue);
nsresult GetTextAnchor(nsIDOMCSSValue** aValue);
nsresult GetColorInterpolation(nsIDOMCSSValue** aValue);
nsresult GetColorInterpolationFilters(nsIDOMCSSValue** aValue);
nsresult GetDominantBaseline(nsIDOMCSSValue** aValue);
nsresult GetPointerEvents(nsIDOMCSSValue** aValue);
nsresult GetShapeRendering(nsIDOMCSSValue** aValue);
nsresult GetTextRendering(nsIDOMCSSValue** aValue);
nsresult GetStopColor(nsIDOMCSSValue** aValue);
nsresult GetFloodColor(nsIDOMCSSValue** aValue);
nsresult GetClipPath(nsIDOMCSSValue** aValue);
nsresult GetFilter(nsIDOMCSSValue** aValue);
nsresult GetMask(nsIDOMCSSValue** aValue);
#endif // MOZ_SVG
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
nsDOMCSSValueList* GetROCSSValueList(PRBool aCommaDelimited);
nsresult SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);

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

@ -4248,8 +4248,8 @@ nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct,
inherited = PR_TRUE;
svg->mColorInterpolationFilters = parentSVG->mColorInterpolationFilters;
}
else if (eCSSUnit_Initial == SVGData.mColorInterpolation.GetUnit()) {
svg->mColorInterpolation = NS_STYLE_COLOR_INTERPOLATION_LINEARRGB;
else if (eCSSUnit_Initial == SVGData.mColorInterpolationFilters.GetUnit()) {
svg->mColorInterpolationFilters = NS_STYLE_COLOR_INTERPOLATION_LINEARRGB;
}
// fill:
@ -4347,7 +4347,7 @@ nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct,
if (svg->mStrokeDasharray)
memcpy(svg->mStrokeDasharray,
parentSVG->mStrokeDasharray,
svg->mStrokeDasharrayLength * sizeof(float));
svg->mStrokeDasharrayLength * sizeof(nsStyleCoord));
else
svg->mStrokeDasharrayLength = 0;
}
@ -4387,10 +4387,14 @@ nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct,
}
// stroke-dashoffset: <dashoffset>, inherit
SetCoord(SVGData.mStrokeDashoffset,
svg->mStrokeDashoffset, parentSVG->mStrokeDashoffset,
SETCOORD_LPH | SETCOORD_FACTOR,
aContext, mPresContext, inherited);
if (eCSSUnit_Initial == SVGData.mStrokeDashoffset.GetUnit()) {
svg->mStrokeDashoffset.SetCoordValue(0);
} else {
SetCoord(SVGData.mStrokeDashoffset,
svg->mStrokeDashoffset, parentSVG->mStrokeDashoffset,
SETCOORD_LPH | SETCOORD_FACTOR,
aContext, mPresContext, inherited);
}
// stroke-linecap: enum, inherit
if (eCSSUnit_Enumerated == SVGData.mStrokeLinecap.GetUnit()) {
@ -4433,10 +4437,14 @@ nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct,
svg->mStrokeOpacity, inherited);
// stroke-width:
SetCoord(SVGData.mStrokeWidth,
svg->mStrokeWidth, parentSVG->mStrokeWidth,
SETCOORD_LPH | SETCOORD_FACTOR,
aContext, mPresContext, inherited);
if (eCSSUnit_Initial == SVGData.mStrokeWidth.GetUnit()) {
svg->mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1));
} else {
SetCoord(SVGData.mStrokeWidth,
svg->mStrokeWidth, parentSVG->mStrokeWidth,
SETCOORD_LPH | SETCOORD_FACTOR,
aContext, mPresContext, inherited);
}
// text-anchor: enum, inherit
if (eCSSUnit_Enumerated == SVGData.mTextAnchor.GetUnit()) {
@ -4476,12 +4484,20 @@ nsRuleNode::ComputeSVGResetData(nsStyleStruct* aStartStruct,
COMPUTE_START_RESET(SVGReset, (), svgReset, parentSVGReset, SVG, SVGData)
// stop-color:
SetColor(SVGData.mStopColor, parentSVGReset->mStopColor,
mPresContext, aContext, svgReset->mStopColor, inherited);
if (eCSSUnit_Initial == SVGData.mStopColor.GetUnit()) {
svgReset->mStopColor = NS_RGB(0, 0, 0);
} else {
SetColor(SVGData.mStopColor, parentSVGReset->mStopColor,
mPresContext, aContext, svgReset->mStopColor, inherited);
}
// flood-color:
SetColor(SVGData.mFloodColor, parentSVGReset->mFloodColor,
mPresContext, aContext, svgReset->mFloodColor, inherited);
if (eCSSUnit_Initial == SVGData.mFloodColor.GetUnit()) {
svgReset->mFloodColor = NS_RGB(0, 0, 0);
} else {
SetColor(SVGData.mFloodColor, parentSVGReset->mFloodColor,
mPresContext, aContext, svgReset->mFloodColor, inherited);
}
// clip-path: url, none, inherit
if (eCSSUnit_URL == SVGData.mClipPath.GetUnit()) {

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

@ -652,8 +652,8 @@ nsStyleSVG::nsStyleSVG()
mStroke.mFallbackColor = NS_RGB(0,0,0);
mStrokeDasharray = nsnull;
mStrokeDashoffset.SetFactorValue(0.0f);
mStrokeWidth.SetFactorValue(1.0f);
mStrokeDashoffset.SetCoordValue(0);
mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1));
mFillOpacity = 1.0f;
mStrokeMiterlimit = 4.0f;
@ -686,7 +686,7 @@ nsStyleSVG::nsStyleSVG(const nsStyleSVG& aSource)
mMarkerEnd = aSource.mMarkerEnd;
mMarkerMid = aSource.mMarkerMid;
mMarkerEnd = aSource.mMarkerStart;
mMarkerStart = aSource.mMarkerStart;
mStrokeDasharrayLength = aSource.mStrokeDasharrayLength;
if (aSource.mStrokeDasharray) {

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

@ -39,36 +39,6 @@ var gNoComputedStyle = {
"page-break-after": true,
"page-break-before": true,
"quotes": true,
"clip-path": true,
"clip-rule": true,
"color-interpolation": true,
"color-interpolation-filters": true,
"dominant-baseline": true,
"fill": true,
"fill-opacity": true,
"fill-rule": true,
"filter": true,
"flood-color": true,
"flood-opacity": true,
"marker": true, // NB: shorthand
"marker-end": true,
"marker-mid": true,
"marker-start": true,
"mask": true,
"pointer-events": true,
"shape-rendering": true,
"stop-color": true,
"stop-opacity": true,
"stroke": true,
"stroke-dasharray": true,
"stroke-dashoffset": true,
"stroke-linecap": true,
"stroke-linejoin": true,
"stroke-miterlimit": true,
"stroke-opacity": true,
"stroke-width": true,
"text-anchor": true,
"text-rendering": true,
};
var gXFailComputed = {

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

@ -41,36 +41,6 @@ var gNoComputedStyle = {
"page-break-after": true,
"page-break-before": true,
"quotes": true,
"clip-path": true,
"clip-rule": true,
"color-interpolation": true,
"color-interpolation-filters": true,
"dominant-baseline": true,
"fill": true,
"fill-opacity": true,
"fill-rule": true,
"filter": true,
"flood-color": true,
"flood-opacity": true,
"marker": true, // NB: shorthand
"marker-end": true,
"marker-mid": true,
"marker-start": true,
"mask": true,
"pointer-events": true,
"shape-rendering": true,
"stop-color": true,
"stop-opacity": true,
"stroke": true,
"stroke-dasharray": true,
"stroke-dashoffset": true,
"stroke-linecap": true,
"stroke-linejoin": true,
"stroke-miterlimit": true,
"stroke-opacity": true,
"stroke-width": true,
"text-anchor": true,
"text-rendering": true,
};
function xfail_diffcomputed(property) {

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

@ -54,36 +54,6 @@ var gNoComputedStyle = {
"page-break-after": true,
"page-break-before": true,
"quotes": true,
"clip-path": true,
"clip-rule": true,
"color-interpolation": true,
"color-interpolation-filters": true,
"dominant-baseline": true,
"fill": true,
"fill-opacity": true,
"fill-rule": true,
"filter": true,
"flood-color": true,
"flood-opacity": true,
"marker": true, // NB: shorthand
"marker-end": true,
"marker-mid": true,
"marker-start": true,
"mask": true,
"pointer-events": true,
"shape-rendering": true,
"stop-color": true,
"stop-opacity": true,
"stroke": true,
"stroke-dasharray": true,
"stroke-dashoffset": true,
"stroke-linecap": true,
"stroke-linejoin": true,
"stroke-miterlimit": true,
"stroke-opacity": true,
"stroke-width": true,
"text-anchor": true,
"text-rendering": true,
};
function xfail_diffcomputed(property) {

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

@ -54,36 +54,6 @@ var gNoComputedStyle = {
"page-break-after": true,
"page-break-before": true,
"quotes": true,
"clip-path": true,
"clip-rule": true,
"color-interpolation": true,
"color-interpolation-filters": true,
"dominant-baseline": true,
"fill": true,
"fill-opacity": true,
"fill-rule": true,
"filter": true,
"flood-color": true,
"flood-opacity": true,
"marker": true, // NB: shorthand
"marker-end": true,
"marker-mid": true,
"marker-start": true,
"mask": true,
"pointer-events": true,
"shape-rendering": true,
"stop-color": true,
"stop-opacity": true,
"stroke": true,
"stroke-dasharray": true,
"stroke-dashoffset": true,
"stroke-linecap": true,
"stroke-linejoin": true,
"stroke-miterlimit": true,
"stroke-opacity": true,
"stroke-width": true,
"text-anchor": true,
"text-rendering": true,
};
function xfail_diffcomputed(property) {