mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 798843 - Rename -moz-objectFill, -moz-objectStroke, -moz-objectValue to context-fill, context-stroke, context-value r=dbaron
This commit is contained in:
parent
9e3a28f874
commit
8a4ca2262b
@ -208,8 +208,8 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
||||
#define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -5
|
||||
#define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -6
|
||||
// Only valid as paints in SVG glyphs
|
||||
#define NS_COLOR_OBJECTFILL -7
|
||||
#define NS_COLOR_OBJECTSTROKE -8
|
||||
#define NS_COLOR_CONTEXT_FILL -7
|
||||
#define NS_COLOR_CONTEXT_STROKE -8
|
||||
|
||||
// See nsStyleDisplay
|
||||
#define NS_STYLE_ANIMATION_DIRECTION_NORMAL 0
|
||||
@ -885,7 +885,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
||||
#define NS_STYLE_STROKE_LINEJOIN_BEVEL 2
|
||||
|
||||
// stroke-dasharray, stroke-dashoffset, stroke-width
|
||||
#define NS_STYLE_STROKE_PROP_OBJECTVALUE 0
|
||||
#define NS_STYLE_STROKE_PROP_CONTEXT_VALUE 0
|
||||
|
||||
// text-anchor
|
||||
#define NS_STYLE_TEXT_ANCHOR_START 0
|
||||
@ -915,8 +915,8 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
||||
#define NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D 1
|
||||
|
||||
// object {fill,stroke}-opacity for SVG glyphs
|
||||
#define NS_STYLE_OBJECT_FILL_OPACITY 0
|
||||
#define NS_STYLE_OBJECT_STROKE_OPACITY 1
|
||||
#define NS_STYLE_CONTEXT_FILL_OPACITY 0
|
||||
#define NS_STYLE_CONTEXT_STROKE_OPACITY 1
|
||||
|
||||
/*****************************************************************************
|
||||
* Constants for media features. *
|
||||
|
@ -1,5 +1,5 @@
|
||||
pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-basic.svg svg-glyph-basic-ref.svg
|
||||
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-basic.svg svg-glyph-basic-ref.svg
|
||||
pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-basic.svg svg-glyph-basic-ref.svg
|
||||
pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-positioning.svg svg-glyph-positioning-ref.svg
|
||||
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-positioning.svg svg-glyph-positioning-ref.svg
|
||||
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-html.html svg-glyph-html-ref.svg
|
||||
|
@ -6,19 +6,19 @@
|
||||
<!-- -moz-objectfill, no stroke -->
|
||||
<!-- N -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||
stroke="none" fill="-moz-objectFill" glyphchar="N"/>
|
||||
stroke="none" fill="context-fill" glyphchar="N"/>
|
||||
|
||||
<!-- O -->
|
||||
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
|
||||
fill="-moz-objectFill" stroke="none" glyphchar="O"/>
|
||||
fill="context-fill" stroke="none" glyphchar="O"/>
|
||||
|
||||
<!-- -moz-objectstroke -->
|
||||
<!-- P -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||
stroke="-moz-objectStroke" fill="burlywood" glyphchar="P"/>
|
||||
stroke="context-stroke" fill="burlywood" glyphchar="P"/>
|
||||
|
||||
<!-- both -moz-objectstroke and -moz-objectfill -->
|
||||
<!-- Q -->
|
||||
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
|
||||
fill="-moz-objectStroke" stroke="-moz-objectFill" glyphchar="Q"/>
|
||||
fill="context-stroke" stroke="context-fill" glyphchar="Q"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 846 B After Width: | Height: | Size: 831 B |
@ -5,47 +5,47 @@
|
||||
-->
|
||||
<!-- R -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||
fill="-moz-objectFill" stroke="-moz-objectStroke"
|
||||
fill-opacity="-moz-objectFillOpacity"
|
||||
stroke-opacity="-moz-objectStrokeOpacity" glyphchar="R"/>
|
||||
fill="context-fill" stroke="context-stroke"
|
||||
fill-opacity="context-fill-opacity"
|
||||
stroke-opacity="context-stroke-opacity" glyphchar="R"/>
|
||||
|
||||
<!-- S -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||
fill="-moz-objectFill" stroke="-moz-objectStroke"
|
||||
fill-opacity="-moz-objectStrokeOpacity"
|
||||
stroke-opacity="-moz-objectFillOpacity" glyphchar="S"/>
|
||||
fill="context-fill" stroke="context-stroke"
|
||||
fill-opacity="context-stroke-opacity"
|
||||
stroke-opacity="context-fill-opacity" glyphchar="S"/>
|
||||
|
||||
<!-- T -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||
fill="-moz-objectStroke" stroke="-moz-objectFill"
|
||||
fill-opacity="-moz-objectFillOpacity"
|
||||
stroke-opacity="-moz-objectStrokeOpacity" glyphchar="T"/>
|
||||
fill="context-stroke" stroke="context-fill"
|
||||
fill-opacity="context-fill-opacity"
|
||||
stroke-opacity="context-stroke-opacity" glyphchar="T"/>
|
||||
|
||||
<!-- U -->
|
||||
<!-- Test for bug where explicit `inherit' would fail for
|
||||
*-opacity="objectStrokeOpacity" or "objectFillOpacity" -->
|
||||
<g style="fill-opacity : -moz-objectStrokeOpacity; stroke-opacity : -moz-objectFillOpacity">
|
||||
<g style="fill-opacity : context-stroke-opacity; stroke-opacity : context-fill-opacity">
|
||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||
fill="-moz-objectStroke" stroke="-moz-objectFill"
|
||||
fill="context-stroke" stroke="context-fill"
|
||||
fill-opacity="inherit" stroke-opacity="inherit" glyphchar="U"/>
|
||||
</g>
|
||||
|
||||
<!-- W -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||
fill="darkorchid" stroke="goldenrod"
|
||||
fill-opacity="-moz-objectFillOpacity"
|
||||
stroke-opacity="-moz-objectStrokeOpacity" glyphchar="W"/>
|
||||
fill-opacity="context-fill-opacity"
|
||||
stroke-opacity="context-stroke-opacity" glyphchar="W"/>
|
||||
|
||||
<!-- X -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||
fill="darkorchid" stroke="goldenrod"
|
||||
fill-opacity="-moz-objectStrokeOpacity"
|
||||
stroke-opacity="-moz-objectFillOpacity" glyphchar="X"/>
|
||||
fill-opacity="context-stroke-opacity"
|
||||
stroke-opacity="context-fill-opacity" glyphchar="X"/>
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
#yparent {
|
||||
fill-opacity : -moz-objectFillOpacity;
|
||||
stroke-opacity : -moz-objectStrokeOpacity;
|
||||
fill-opacity : context-fill-opacity;
|
||||
stroke-opacity : context-stroke-opacity;
|
||||
}
|
||||
#ychild {
|
||||
color-interpolation : sRGB;
|
||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.1 KiB |
@ -11,15 +11,15 @@
|
||||
<!-- b -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke="chartreuse"
|
||||
stroke-width="50" stroke-dashoffset="35"
|
||||
stroke-dasharray="-moz-objectValue" glyphchar="b" />
|
||||
stroke-dasharray="context-value" glyphchar="b" />
|
||||
|
||||
<!-- c -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke="sienna"
|
||||
stroke-width="50" stroke-dasharray="50 50"
|
||||
stroke-dashoffset="-moz-objectValue" glyphchar="c" />
|
||||
stroke-dashoffset="context-value" glyphchar="c" />
|
||||
|
||||
<!-- d -->
|
||||
<rect x="100" y="-900" width="800" height="800" stroke="olivedrab"
|
||||
stroke-width="-moz-objectValue" stroke-dasharray="-moz-objectValue"
|
||||
stroke-dashoffset="-moz-objectValue" glyphchar="d" />
|
||||
stroke-width="context-value" stroke-dasharray="context-value"
|
||||
stroke-dashoffset="context-value" glyphchar="d" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 919 B After Width: | Height: | Size: 904 B |
Binary file not shown.
@ -124,11 +124,6 @@ CSS_KEY(-moz-min-content, _moz_min_content)
|
||||
CSS_KEY(-moz-myanmar, _moz_myanmar)
|
||||
CSS_KEY(-moz-nativehyperlinktext, _moz_nativehyperlinktext)
|
||||
CSS_KEY(-moz-none, _moz_none)
|
||||
CSS_KEY(-moz-objectfill, _moz_objectfill)
|
||||
CSS_KEY(-moz-objectfillopacity, _moz_objectfillopacity)
|
||||
CSS_KEY(-moz-objectstroke, _moz_objectstroke)
|
||||
CSS_KEY(-moz-objectstrokeopacity, _moz_objectstrokeopacity)
|
||||
CSS_KEY(-moz-objectvalue, _moz_objectvalue)
|
||||
CSS_KEY(-moz-oddtreerow, _moz_oddtreerow)
|
||||
CSS_KEY(-moz-oriya, _moz_oriya)
|
||||
CSS_KEY(-moz-persian, _moz_persian)
|
||||
@ -219,7 +214,12 @@ CSS_KEY(column-reverse, column_reverse)
|
||||
CSS_KEY(condensed, condensed)
|
||||
CSS_KEY(contain, contain)
|
||||
CSS_KEY(content-box, content_box)
|
||||
CSS_KEY(context-fill, context_fill)
|
||||
CSS_KEY(context-fill-opacity, context_fill_opacity)
|
||||
CSS_KEY(context-menu, context_menu)
|
||||
CSS_KEY(context-stroke, context_stroke)
|
||||
CSS_KEY(context-stroke-opacity, context_stroke_opacity)
|
||||
CSS_KEY(context-value, context_value)
|
||||
CSS_KEY(continuous, continuous)
|
||||
CSS_KEY(copy, copy)
|
||||
CSS_KEY(contextual, contextual)
|
||||
|
@ -77,6 +77,8 @@ using namespace mozilla;
|
||||
#define VARIANT_ELEMENT 0x08000000 // eCSSUnit_Element
|
||||
#define VARIANT_POSITIVE_DIMENSION 0x10000000 // Only lengths greater than 0.0
|
||||
#define VARIANT_NONNEGATIVE_DIMENSION 0x20000000 // Only lengths greater than or equal to 0.0
|
||||
// Keyword used iff gfx.font_rendering.opentype_svg.enabled is true:
|
||||
#define VARIANT_OPENTYPE_SVG_KEYWORD 0x40000000
|
||||
|
||||
// Common combinations of variants
|
||||
#define VARIANT_AL (VARIANT_AUTO | VARIANT_LENGTH)
|
||||
@ -5003,7 +5005,8 @@ CSSParserImpl::TranslateDimension(nsCSSValue& aValue,
|
||||
VARIANT_GRADIENT | \
|
||||
VARIANT_TIMING_FUNCTION | \
|
||||
VARIANT_ALL | \
|
||||
VARIANT_CALC
|
||||
VARIANT_CALC | \
|
||||
VARIANT_OPENTYPE_SVG_KEYWORD
|
||||
|
||||
// Note that callers passing VARIANT_CALC in aVariantMask will get
|
||||
// full-range parsing inside the calc() expression, and the code that
|
||||
@ -5153,6 +5156,18 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ((aVariantMask & VARIANT_OPENTYPE_SVG_KEYWORD) != 0) {
|
||||
static bool sOpentypeSVGEnabled;
|
||||
static bool sOpentypeSVGEnabledCached = false;
|
||||
if (!sOpentypeSVGEnabledCached) {
|
||||
sOpentypeSVGEnabledCached = true;
|
||||
Preferences::AddBoolVarCache(&sOpentypeSVGEnabled,
|
||||
"gfx.font_rendering.opentype_svg.enabled");
|
||||
}
|
||||
if (sOpentypeSVGEnabled) {
|
||||
aVariantMask |= VARIANT_KEYWORD;
|
||||
}
|
||||
}
|
||||
if ((aVariantMask & VARIANT_KEYWORD) != 0) {
|
||||
int32_t value;
|
||||
if (nsCSSProps::FindKeyword(keyword, aKeywordTable, value)) {
|
||||
@ -10651,8 +10666,10 @@ bool
|
||||
CSSParserImpl::ParsePaint(nsCSSProperty aPropID)
|
||||
{
|
||||
nsCSSValue x, y;
|
||||
if (!ParseVariant(x, VARIANT_HCK | VARIANT_NONE | VARIANT_URL,
|
||||
nsCSSProps::kObjectPatternKTable)) {
|
||||
|
||||
if (!ParseVariant(x, VARIANT_HC | VARIANT_NONE | VARIANT_URL |
|
||||
VARIANT_OPENTYPE_SVG_KEYWORD,
|
||||
nsCSSProps::kContextPatternKTable)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -10679,8 +10696,10 @@ bool
|
||||
CSSParserImpl::ParseDasharray()
|
||||
{
|
||||
nsCSSValue value;
|
||||
if (ParseVariant(value, VARIANT_HK | VARIANT_NONE,
|
||||
nsCSSProps::kStrokeObjectValueKTable)) {
|
||||
|
||||
if (ParseVariant(value, VARIANT_INHERIT | VARIANT_NONE |
|
||||
VARIANT_OPENTYPE_SVG_KEYWORD,
|
||||
nsCSSProps::kStrokeContextValueKTable)) {
|
||||
// 'inherit', 'initial', and 'none' are only allowed on their own
|
||||
if (!ExpectEndProperty()) {
|
||||
return false;
|
||||
|
@ -3292,7 +3292,7 @@ CSS_PROP_SVG(
|
||||
CSS_PROPERTY_PARSE_FUNCTION,
|
||||
"",
|
||||
0,
|
||||
kObjectPatternKTable,
|
||||
kContextPatternKTable,
|
||||
offsetof(nsStyleSVG, mFill),
|
||||
eStyleAnimType_PaintServer)
|
||||
CSS_PROP_SVG(
|
||||
@ -3301,8 +3301,8 @@ CSS_PROP_SVG(
|
||||
FillOpacity,
|
||||
CSS_PROPERTY_PARSE_VALUE,
|
||||
"",
|
||||
VARIANT_HN | VARIANT_KEYWORD,
|
||||
kObjectOpacityKTable,
|
||||
VARIANT_HN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
||||
kContextOpacityKTable,
|
||||
offsetof(nsStyleSVG, mFillOpacity),
|
||||
eStyleAnimType_float)
|
||||
CSS_PROP_SVG(
|
||||
@ -3458,7 +3458,7 @@ CSS_PROP_SVG(
|
||||
CSS_PROPERTY_PARSE_FUNCTION,
|
||||
"",
|
||||
0,
|
||||
kObjectPatternKTable,
|
||||
kContextPatternKTable,
|
||||
offsetof(nsStyleSVG, mStroke),
|
||||
eStyleAnimType_PaintServer)
|
||||
CSS_PROP_SVG(
|
||||
@ -3470,7 +3470,7 @@ CSS_PROP_SVG(
|
||||
// NOTE: Internal values have range restrictions.
|
||||
"",
|
||||
0,
|
||||
kStrokeObjectValueKTable,
|
||||
kStrokeContextValueKTable,
|
||||
CSS_PROP_NO_OFFSET, /* property stored in 2 separate members */
|
||||
eStyleAnimType_Custom)
|
||||
CSS_PROP_SVG(
|
||||
@ -3479,8 +3479,8 @@ CSS_PROP_SVG(
|
||||
StrokeDashoffset,
|
||||
CSS_PROPERTY_PARSE_VALUE,
|
||||
"",
|
||||
VARIANT_HLPN | VARIANT_KEYWORD,
|
||||
kStrokeObjectValueKTable,
|
||||
VARIANT_HLPN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
||||
kStrokeContextValueKTable,
|
||||
offsetof(nsStyleSVG, mStrokeDashoffset),
|
||||
eStyleAnimType_Coord)
|
||||
CSS_PROP_SVG(
|
||||
@ -3520,8 +3520,8 @@ CSS_PROP_SVG(
|
||||
StrokeOpacity,
|
||||
CSS_PROPERTY_PARSE_VALUE,
|
||||
"",
|
||||
VARIANT_HN | VARIANT_KEYWORD,
|
||||
kObjectOpacityKTable,
|
||||
VARIANT_HN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
||||
kContextOpacityKTable,
|
||||
offsetof(nsStyleSVG, mStrokeOpacity),
|
||||
eStyleAnimType_float)
|
||||
CSS_PROP_SVG(
|
||||
@ -3531,8 +3531,8 @@ CSS_PROP_SVG(
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_NONNEGATIVE,
|
||||
"",
|
||||
VARIANT_HLPN | VARIANT_KEYWORD,
|
||||
kStrokeObjectValueKTable,
|
||||
VARIANT_HLPN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
||||
kStrokeContextValueKTable,
|
||||
offsetof(nsStyleSVG, mStrokeWidth),
|
||||
eStyleAnimType_Coord)
|
||||
CSS_PROP_SVG(
|
||||
|
@ -769,7 +769,7 @@ const int32_t nsCSSProps::kClearKTable[] = {
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
// See also kObjectPatternKTable for SVG paint-specific values
|
||||
// See also kContextPatternKTable for SVG paint-specific values
|
||||
const int32_t nsCSSProps::kColorKTable[] = {
|
||||
eCSSKeyword_activeborder, LookAndFeel::eColorID_activeborder,
|
||||
eCSSKeyword_activecaption, LookAndFeel::eColorID_activecaption,
|
||||
@ -1229,15 +1229,15 @@ const int32_t nsCSSProps::kListStyleKTable[] = {
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
const int32_t nsCSSProps::kObjectOpacityKTable[] = {
|
||||
eCSSKeyword__moz_objectfillopacity, NS_STYLE_OBJECT_FILL_OPACITY,
|
||||
eCSSKeyword__moz_objectstrokeopacity, NS_STYLE_OBJECT_STROKE_OPACITY,
|
||||
const int32_t nsCSSProps::kContextOpacityKTable[] = {
|
||||
eCSSKeyword_context_fill_opacity, NS_STYLE_CONTEXT_FILL_OPACITY,
|
||||
eCSSKeyword_context_stroke_opacity, NS_STYLE_CONTEXT_STROKE_OPACITY,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
const int32_t nsCSSProps::kObjectPatternKTable[] = {
|
||||
eCSSKeyword__moz_objectfill, NS_COLOR_OBJECTFILL,
|
||||
eCSSKeyword__moz_objectstroke, NS_COLOR_OBJECTSTROKE,
|
||||
const int32_t nsCSSProps::kContextPatternKTable[] = {
|
||||
eCSSKeyword_context_fill, NS_COLOR_CONTEXT_FILL,
|
||||
eCSSKeyword_context_stroke, NS_COLOR_CONTEXT_STROKE,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
@ -1673,8 +1673,8 @@ const int32_t nsCSSProps::kStrokeLinejoinKTable[] = {
|
||||
|
||||
// Lookup table to store the sole objectValue keyword to let SVG glyphs inherit
|
||||
// certain stroke-* properties from the outer text object
|
||||
const int32_t nsCSSProps::kStrokeObjectValueKTable[] = {
|
||||
eCSSKeyword__moz_objectvalue, NS_STYLE_STROKE_PROP_OBJECTVALUE,
|
||||
const int32_t nsCSSProps::kStrokeContextValueKTable[] = {
|
||||
eCSSKeyword_context_value, NS_STYLE_STROKE_PROP_CONTEXT_VALUE,
|
||||
eCSSKeyword_UNKNOWN, -1
|
||||
};
|
||||
|
||||
|
@ -374,7 +374,7 @@ public:
|
||||
static const int32_t kShapeRenderingKTable[];
|
||||
static const int32_t kStrokeLinecapKTable[];
|
||||
static const int32_t kStrokeLinejoinKTable[];
|
||||
static const int32_t kStrokeObjectValueKTable[];
|
||||
static const int32_t kStrokeContextValueKTable[];
|
||||
static const int32_t kVectorEffectKTable[];
|
||||
static const int32_t kTextAnchorKTable[];
|
||||
static const int32_t kTextRenderingKTable[];
|
||||
@ -421,8 +421,8 @@ public:
|
||||
static const int32_t kListStylePositionKTable[];
|
||||
static const int32_t kListStyleKTable[];
|
||||
static const int32_t kMaskTypeKTable[];
|
||||
static const int32_t kObjectOpacityKTable[];
|
||||
static const int32_t kObjectPatternKTable[];
|
||||
static const int32_t kContextOpacityKTable[];
|
||||
static const int32_t kContextPatternKTable[];
|
||||
static const int32_t kOrientKTable[];
|
||||
static const int32_t kOutlineStyleKTable[];
|
||||
static const int32_t kOutlineColorKTable[];
|
||||
|
@ -4155,14 +4155,14 @@ nsComputedDOMStyle::GetSVGPaintFor(bool aFill)
|
||||
SetToRGBAColor(fallback, paint->mFallbackColor);
|
||||
return valueList;
|
||||
}
|
||||
case eStyleSVGPaintType_ObjectFill:
|
||||
case eStyleSVGPaintType_ContextFill:
|
||||
{
|
||||
val->SetIdent(eCSSKeyword__moz_objectfill);
|
||||
val->SetIdent(eCSSKeyword_context_fill);
|
||||
break;
|
||||
}
|
||||
case eStyleSVGPaintType_ObjectStroke:
|
||||
case eStyleSVGPaintType_ContextStroke:
|
||||
{
|
||||
val->SetIdent(eCSSKeyword__moz_objectstroke);
|
||||
val->SetIdent(eCSSKeyword_context_stroke);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -7327,11 +7327,11 @@ SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint,
|
||||
} else if (pair.mXValue.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
||||
switch (pair.mXValue.GetIntValue()) {
|
||||
case NS_COLOR_OBJECTFILL:
|
||||
aResult.SetType(eStyleSVGPaintType_ObjectFill);
|
||||
case NS_COLOR_CONTEXT_FILL:
|
||||
aResult.SetType(eStyleSVGPaintType_ContextFill);
|
||||
break;
|
||||
case NS_COLOR_OBJECTSTROKE:
|
||||
aResult.SetType(eStyleSVGPaintType_ObjectStroke);
|
||||
case NS_COLOR_CONTEXT_STROKE:
|
||||
aResult.SetType(eStyleSVGPaintType_ContextStroke);
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("unknown keyword as paint server value");
|
||||
@ -7363,11 +7363,11 @@ SetSVGOpacity(const nsCSSValue& aValue,
|
||||
{
|
||||
if (eCSSUnit_Enumerated == aValue.GetUnit()) {
|
||||
switch (aValue.GetIntValue()) {
|
||||
case NS_STYLE_OBJECT_FILL_OPACITY:
|
||||
aOpacityTypeField = eStyleSVGOpacitySource_ObjectFillOpacity;
|
||||
case NS_STYLE_CONTEXT_FILL_OPACITY:
|
||||
aOpacityTypeField = eStyleSVGOpacitySource_ContextFillOpacity;
|
||||
break;
|
||||
case NS_STYLE_OBJECT_STROKE_OPACITY:
|
||||
aOpacityTypeField = eStyleSVGOpacitySource_ObjectStrokeOpacity;
|
||||
case NS_STYLE_CONTEXT_STROKE_OPACITY:
|
||||
aOpacityTypeField = eStyleSVGOpacitySource_ContextStrokeOpacity;
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("SetSVGOpacity: Unknown keyword");
|
||||
@ -7387,10 +7387,10 @@ SetSVGOpacity(const nsCSSValue& aValue,
|
||||
|
||||
template <typename FieldT, typename T>
|
||||
static bool
|
||||
SetTextObjectValue(const nsCSSValue& aValue, FieldT& aField, T aFallbackValue)
|
||||
SetTextContextValue(const nsCSSValue& aValue, FieldT& aField, T aFallbackValue)
|
||||
{
|
||||
if (aValue.GetUnit() != eCSSUnit_Enumerated ||
|
||||
aValue.GetIntValue() != NS_STYLE_STROKE_PROP_OBJECTVALUE) {
|
||||
aValue.GetIntValue() != NS_STYLE_STROKE_PROP_CONTEXT_VALUE) {
|
||||
return false;
|
||||
}
|
||||
aField = aFallbackValue;
|
||||
@ -7430,12 +7430,13 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
parentSVG->mFill, mPresContext, aContext,
|
||||
svg->mFill, eStyleSVGPaintType_Color, canStoreInRuleTree);
|
||||
|
||||
// fill-opacity: factor, inherit, initial, objectFillOpacity, objectStrokeOpacity
|
||||
nsStyleSVGOpacitySource objectFillOpacity = svg->mFillOpacitySource;
|
||||
// fill-opacity: factor, inherit, initial,
|
||||
// context-fill-opacity, context-stroke-opacity
|
||||
nsStyleSVGOpacitySource contextFillOpacity = svg->mFillOpacitySource;
|
||||
SetSVGOpacity(*aRuleData->ValueForFillOpacity(),
|
||||
svg->mFillOpacity, objectFillOpacity, canStoreInRuleTree,
|
||||
svg->mFillOpacity, contextFillOpacity, canStoreInRuleTree,
|
||||
parentSVG->mFillOpacity, parentSVG->mFillOpacitySource);
|
||||
svg->mFillOpacitySource = objectFillOpacity;
|
||||
svg->mFillOpacitySource = contextFillOpacity;
|
||||
|
||||
// fill-rule: enum, inherit, initial
|
||||
SetDiscrete(*aRuleData->ValueForFillRule(),
|
||||
@ -7522,7 +7523,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
parentSVG->mStroke, mPresContext, aContext,
|
||||
svg->mStroke, eStyleSVGPaintType_None, canStoreInRuleTree);
|
||||
|
||||
// stroke-dasharray: <dasharray>, none, inherit, -moz-objectValue
|
||||
// stroke-dasharray: <dasharray>, none, inherit, context-value
|
||||
const nsCSSValue* strokeDasharrayValue = aRuleData->ValueForStrokeDasharray();
|
||||
switch (strokeDasharrayValue->GetUnit()) {
|
||||
case eCSSUnit_Null:
|
||||
@ -7549,7 +7550,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
|
||||
case eCSSUnit_Enumerated:
|
||||
NS_ABORT_IF_FALSE(strokeDasharrayValue->GetIntValue() ==
|
||||
NS_STYLE_STROKE_PROP_OBJECTVALUE,
|
||||
NS_STYLE_STROKE_PROP_CONTEXT_VALUE,
|
||||
"Unknown keyword for stroke-dasharray");
|
||||
svg->mStrokeDasharrayFromObject = true;
|
||||
delete [] svg->mStrokeDasharray;
|
||||
@ -7604,7 +7605,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
aRuleData->ValueForStrokeDashoffset();
|
||||
svg->mStrokeDashoffsetFromObject =
|
||||
strokeDashoffsetValue->GetUnit() == eCSSUnit_Enumerated &&
|
||||
strokeDashoffsetValue->GetIntValue() == NS_STYLE_STROKE_PROP_OBJECTVALUE;
|
||||
strokeDashoffsetValue->GetIntValue() == NS_STYLE_STROKE_PROP_CONTEXT_VALUE;
|
||||
if (svg->mStrokeDashoffsetFromObject) {
|
||||
svg->mStrokeDashoffset.SetIntValue(0, eStyleUnit_Integer);
|
||||
} else {
|
||||
@ -7633,18 +7634,18 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
parentSVG->mStrokeMiterlimit, 4.0f);
|
||||
|
||||
// stroke-opacity:
|
||||
nsStyleSVGOpacitySource objectStrokeOpacity = svg->mStrokeOpacitySource;
|
||||
nsStyleSVGOpacitySource contextStrokeOpacity = svg->mStrokeOpacitySource;
|
||||
SetSVGOpacity(*aRuleData->ValueForStrokeOpacity(),
|
||||
svg->mStrokeOpacity, objectStrokeOpacity, canStoreInRuleTree,
|
||||
svg->mStrokeOpacity, contextStrokeOpacity, canStoreInRuleTree,
|
||||
parentSVG->mStrokeOpacity, parentSVG->mStrokeOpacitySource);
|
||||
svg->mStrokeOpacitySource = objectStrokeOpacity;
|
||||
svg->mStrokeOpacitySource = contextStrokeOpacity;
|
||||
|
||||
// stroke-width:
|
||||
const nsCSSValue* strokeWidthValue = aRuleData->ValueForStrokeWidth();
|
||||
switch (strokeWidthValue->GetUnit()) {
|
||||
case eCSSUnit_Enumerated:
|
||||
NS_ABORT_IF_FALSE(strokeWidthValue->GetIntValue() ==
|
||||
NS_STYLE_STROKE_PROP_OBJECTVALUE,
|
||||
NS_STYLE_STROKE_PROP_CONTEXT_VALUE,
|
||||
"Unrecognized keyword for stroke-width");
|
||||
svg->mStrokeWidthFromObject = true;
|
||||
svg->mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1));
|
||||
|
@ -3139,11 +3139,11 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty,
|
||||
eUnit_CSSValuePair);
|
||||
return true;
|
||||
}
|
||||
if (paint.mType == eStyleSVGPaintType_ObjectFill ||
|
||||
paint.mType == eStyleSVGPaintType_ObjectStroke) {
|
||||
if (paint.mType == eStyleSVGPaintType_ContextFill ||
|
||||
paint.mType == eStyleSVGPaintType_ContextStroke) {
|
||||
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
|
||||
pair->mXValue.SetIntValue(paint.mType == eStyleSVGPaintType_ObjectFill ?
|
||||
NS_COLOR_OBJECTFILL : NS_COLOR_OBJECTSTROKE,
|
||||
pair->mXValue.SetIntValue(paint.mType == eStyleSVGPaintType_ContextFill ?
|
||||
NS_COLOR_CONTEXT_FILL : NS_COLOR_CONTEXT_STROKE,
|
||||
eCSSUnit_Enumerated);
|
||||
pair->mYValue.SetColorValue(paint.mFallbackColor);
|
||||
aComputedValue.SetAndAdoptCSSValuePairValue(pair.forget(),
|
||||
|
@ -2157,14 +2157,14 @@ enum nsStyleSVGPaintType {
|
||||
eStyleSVGPaintType_None = 1,
|
||||
eStyleSVGPaintType_Color,
|
||||
eStyleSVGPaintType_Server,
|
||||
eStyleSVGPaintType_ObjectFill,
|
||||
eStyleSVGPaintType_ObjectStroke
|
||||
eStyleSVGPaintType_ContextFill,
|
||||
eStyleSVGPaintType_ContextStroke
|
||||
};
|
||||
|
||||
enum nsStyleSVGOpacitySource {
|
||||
eStyleSVGOpacitySource_Normal,
|
||||
eStyleSVGOpacitySource_ObjectFillOpacity,
|
||||
eStyleSVGOpacitySource_ObjectStrokeOpacity
|
||||
eStyleSVGOpacitySource_ContextFillOpacity,
|
||||
eStyleSVGOpacitySource_ContextStrokeOpacity
|
||||
};
|
||||
|
||||
struct nsStyleSVGPaint
|
||||
|
@ -1059,14 +1059,14 @@ nsSVGGlyphFrame::SetupContextPaint(gfxContext *aContext,
|
||||
const nsStyleSVG *style = StyleSVG();
|
||||
const nsStyleSVGPaint &paint = style->*aFillOrStroke;
|
||||
|
||||
if (paint.mType != eStyleSVGPaintType_ObjectFill &&
|
||||
paint.mType != eStyleSVGPaintType_ObjectStroke) {
|
||||
if (paint.mType != eStyleSVGPaintType_ContextFill &&
|
||||
paint.mType != eStyleSVGPaintType_ContextStroke) {
|
||||
return false;
|
||||
}
|
||||
|
||||
gfxMatrix current = aContext->CurrentMatrix();
|
||||
nsRefPtr<gfxPattern> pattern =
|
||||
paint.mType == eStyleSVGPaintType_ObjectFill ?
|
||||
paint.mType == eStyleSVGPaintType_ContextFill ?
|
||||
aOuterContextPaint->GetFillPattern(aOpacity, current) :
|
||||
aOuterContextPaint->GetStrokePattern(aOpacity, current);
|
||||
if (!pattern) {
|
||||
@ -1135,12 +1135,12 @@ mozilla::SVGTextContextPaint::Paint::GetPattern(float aOpacity,
|
||||
}
|
||||
pattern->SetMatrix(aCTM * mPatternMatrix);
|
||||
break;
|
||||
case eStyleSVGPaintType_ObjectFill:
|
||||
case eStyleSVGPaintType_ContextFill:
|
||||
pattern = mPaintDefinition.mContextPaint->GetFillPattern(aOpacity, aCTM);
|
||||
// Don't cache this. mContextPaint will have cached it anyway. If we
|
||||
// cache it, we'll have to compute mPatternMatrix, which is annoying.
|
||||
return pattern.forget();
|
||||
case eStyleSVGPaintType_ObjectStroke:
|
||||
case eStyleSVGPaintType_ContextStroke:
|
||||
pattern = mPaintDefinition.mContextPaint->GetStrokePattern(aOpacity, aCTM);
|
||||
// Don't cache this. mContextPaint will have cached it anyway. If we
|
||||
// cache it, we'll have to compute mPatternMatrix, which is annoying.
|
||||
|
@ -65,8 +65,8 @@ struct SVGTextContextPaint : public gfxTextContextPaint {
|
||||
|
||||
void SetContextPaint(gfxTextContextPaint *aContextPaint,
|
||||
nsStyleSVGPaintType aPaintType) {
|
||||
NS_ASSERTION(aPaintType == eStyleSVGPaintType_ObjectFill ||
|
||||
aPaintType == eStyleSVGPaintType_ObjectStroke,
|
||||
NS_ASSERTION(aPaintType == eStyleSVGPaintType_ContextFill ||
|
||||
aPaintType == eStyleSVGPaintType_ContextStroke,
|
||||
"Invalid context paint type");
|
||||
mPaintType = aPaintType;
|
||||
mPaintDefinition.mContextPaint = aContextPaint;
|
||||
|
@ -3349,7 +3349,7 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext,
|
||||
SVGCharClipDisplayItem item(run);
|
||||
|
||||
// Set up the fill and stroke so that SVG glyphs can get painted correctly
|
||||
// when they use -moz-objectFill values etc.
|
||||
// when they use context-fill etc.
|
||||
gfx->SetMatrix(initialMatrix);
|
||||
gfxTextContextPaint *outerContextPaint =
|
||||
(gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey);
|
||||
@ -5276,14 +5276,14 @@ nsSVGTextFrame2::SetupContextPaint(gfxContext* aContext,
|
||||
const nsStyleSVG *style = aFrame->StyleSVG();
|
||||
const nsStyleSVGPaint &paint = style->*aFillOrStroke;
|
||||
|
||||
if (paint.mType != eStyleSVGPaintType_ObjectFill &&
|
||||
paint.mType != eStyleSVGPaintType_ObjectStroke) {
|
||||
if (paint.mType != eStyleSVGPaintType_ContextFill &&
|
||||
paint.mType != eStyleSVGPaintType_ContextStroke) {
|
||||
return false;
|
||||
}
|
||||
|
||||
gfxMatrix current = aContext->CurrentMatrix();
|
||||
nsRefPtr<gfxPattern> pattern =
|
||||
paint.mType == eStyleSVGPaintType_ObjectFill ?
|
||||
paint.mType == eStyleSVGPaintType_ContextFill ?
|
||||
aOuterContextPaint->GetFillPattern(aOpacity, current) :
|
||||
aOuterContextPaint->GetStrokePattern(aOpacity, current);
|
||||
if (!pattern) {
|
||||
|
@ -1532,8 +1532,8 @@ nsSVGUtils::GetFallbackOrPaintColor(gfxContext *aContext, nsStyleContext *aStyle
|
||||
const nsStyleSVGPaint &paint = aStyleContext->StyleSVG()->*aFillOrStroke;
|
||||
nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
|
||||
bool isServer = paint.mType == eStyleSVGPaintType_Server ||
|
||||
paint.mType == eStyleSVGPaintType_ObjectFill ||
|
||||
paint.mType == eStyleSVGPaintType_ObjectStroke;
|
||||
paint.mType == eStyleSVGPaintType_ContextFill ||
|
||||
paint.mType == eStyleSVGPaintType_ContextStroke;
|
||||
nscolor color = isServer ? paint.mFallbackColor : paint.mPaint.mColor;
|
||||
if (styleIfVisited) {
|
||||
const nsStyleSVGPaint &paintIfVisited =
|
||||
@ -1592,10 +1592,10 @@ nsSVGUtils::SetupContextPaint(gfxContext *aContext,
|
||||
}
|
||||
|
||||
switch (aPaint.mType) {
|
||||
case eStyleSVGPaintType_ObjectFill:
|
||||
case eStyleSVGPaintType_ContextFill:
|
||||
pattern = aContextPaint->GetFillPattern(aOpacity, aContext->CurrentMatrix());
|
||||
break;
|
||||
case eStyleSVGPaintType_ObjectStroke:
|
||||
case eStyleSVGPaintType_ContextStroke:
|
||||
pattern = aContextPaint->GetStrokePattern(aOpacity, aContext->CurrentMatrix());
|
||||
break;
|
||||
default:
|
||||
@ -1687,18 +1687,18 @@ nsSVGUtils::GetOpacity(nsStyleSVGOpacitySource aOpacityType,
|
||||
case eStyleSVGOpacitySource_Normal:
|
||||
opacity = aOpacity;
|
||||
break;
|
||||
case eStyleSVGOpacitySource_ObjectFillOpacity:
|
||||
case eStyleSVGOpacitySource_ContextFillOpacity:
|
||||
if (aOuterContextPaint) {
|
||||
opacity = aOuterContextPaint->GetFillOpacity();
|
||||
} else {
|
||||
NS_WARNING("objectFillOpacity used outside of an SVG glyph");
|
||||
NS_WARNING("context-fill-opacity used outside of an SVG glyph");
|
||||
}
|
||||
break;
|
||||
case eStyleSVGOpacitySource_ObjectStrokeOpacity:
|
||||
case eStyleSVGOpacitySource_ContextStrokeOpacity:
|
||||
if (aOuterContextPaint) {
|
||||
opacity = aOuterContextPaint->GetStrokeOpacity();
|
||||
} else {
|
||||
NS_WARNING("objectStrokeOpacity used outside of an SVG glyph");
|
||||
NS_WARNING("context-stroke-opacity used outside of an SVG glyph");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user