Attachment #8709153: with more tests for bug #1240275

View | Details | Raw Unified | Return to bug 1240275
Collapse All | Expand All

(-)a/dom/base/nsGkAtomList.h (+1 lines)
Line     Link Here 
 Lines 1410-1425   GK_ATOM(font_face_uri, "font-face-uri") Link Here 
1410
GK_ATOM(font_family, "font-family")
1410
GK_ATOM(font_family, "font-family")
1411
GK_ATOM(font_size, "font-size")
1411
GK_ATOM(font_size, "font-size")
1412
GK_ATOM(font_size_adjust, "font-size-adjust")
1412
GK_ATOM(font_size_adjust, "font-size-adjust")
1413
GK_ATOM(font_stretch, "font-stretch")
1413
GK_ATOM(font_stretch, "font-stretch")
1414
GK_ATOM(font_style, "font-style")
1414
GK_ATOM(font_style, "font-style")
1415
GK_ATOM(font_variant, "font-variant")
1415
GK_ATOM(font_variant, "font-variant")
1416
GK_ATOM(foreignObject, "foreignObject")
1416
GK_ATOM(foreignObject, "foreignObject")
1417
GK_ATOM(fractalNoise, "fractalNoise")
1417
GK_ATOM(fractalNoise, "fractalNoise")
1418
GK_ATOM(fr, "fr")
1418
GK_ATOM(fx, "fx")
1419
GK_ATOM(fx, "fx")
1419
GK_ATOM(fy, "fy")
1420
GK_ATOM(fy, "fy")
1420
GK_ATOM(G, "G")
1421
GK_ATOM(G, "G")
1421
GK_ATOM(g, "g")
1422
GK_ATOM(g, "g")
1422
GK_ATOM(gamma, "gamma")
1423
GK_ATOM(gamma, "gamma")
1423
// 'generic' conflicts with msvc11 winrt compiler extensions
1424
// 'generic' conflicts with msvc11 winrt compiler extensions
1424
GK_ATOM(generic_, "generic")
1425
GK_ATOM(generic_, "generic")
1425
GK_ATOM(glyph, "glyph")
1426
GK_ATOM(glyph, "glyph")
(-)a/dom/svg/SVGGradientElement.cpp (-1 / +8 lines)
Line     Link Here 
 Lines 190-212   SVGLinearGradientElement::GetLengthInfo( Link Here 
190
//-------------------------- Radial Gradients ----------------------------
190
//-------------------------- Radial Gradients ----------------------------
191
191
192
JSObject*
192
JSObject*
193
SVGRadialGradientElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
193
SVGRadialGradientElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
194
{
194
{
195
  return SVGRadialGradientElementBinding::Wrap(aCx, this, aGivenProto);
195
  return SVGRadialGradientElementBinding::Wrap(aCx, this, aGivenProto);
196
}
196
}
197
197
198
nsSVGElement::LengthInfo SVGRadialGradientElement::sLengthInfo[5] =
198
nsSVGElement::LengthInfo SVGRadialGradientElement::sLengthInfo[6] =
199
{
199
{
200
  { &nsGkAtoms::cx, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
200
  { &nsGkAtoms::cx, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
201
  { &nsGkAtoms::cy, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
201
  { &nsGkAtoms::cy, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
202
  { &nsGkAtoms::r, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY },
202
  { &nsGkAtoms::r, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY },
203
  { &nsGkAtoms::fx, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
203
  { &nsGkAtoms::fx, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
204
  { &nsGkAtoms::fy, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
204
  { &nsGkAtoms::fy, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
205
  { &nsGkAtoms::fr, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY },
205
};
206
};
206
207
207
//----------------------------------------------------------------------
208
//----------------------------------------------------------------------
208
// Implementation
209
// Implementation
209
210
210
SVGRadialGradientElement::SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
211
SVGRadialGradientElement::SVGRadialGradientElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
211
  : SVGRadialGradientElementBase(aNodeInfo)
212
  : SVGRadialGradientElementBase(aNodeInfo)
212
{
213
{
 Lines 244-259   SVGRadialGradientElement::Fx() Link Here 
244
}
245
}
245
246
246
already_AddRefed<SVGAnimatedLength>
247
already_AddRefed<SVGAnimatedLength>
247
SVGRadialGradientElement::Fy()
248
SVGRadialGradientElement::Fy()
248
{
249
{
249
  return mLengthAttributes[ATTR_FY].ToDOMAnimatedLength(this);
250
  return mLengthAttributes[ATTR_FY].ToDOMAnimatedLength(this);
250
}
251
}
251
252
253
already_AddRefed<SVGAnimatedLength>
254
SVGRadialGradientElement::Fr()
255
{
256
  return mLengthAttributes[ATTR_FR].ToDOMAnimatedLength(this);
257
}
258
252
//----------------------------------------------------------------------
259
//----------------------------------------------------------------------
253
// nsSVGElement methods
260
// nsSVGElement methods
254
261
255
nsSVGElement::LengthAttributesInfo
262
nsSVGElement::LengthAttributesInfo
256
SVGRadialGradientElement::GetLengthInfo()
263
SVGRadialGradientElement::GetLengthInfo()
257
{
264
{
258
  return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
265
  return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
259
                              ArrayLength(sLengthInfo));
266
                              ArrayLength(sLengthInfo));
(-)a/dom/svg/SVGGradientElement.h (-3 / +4 lines)
Line     Link Here 
 Lines 133-153   public: Link Here 
133
  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
133
  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
134
134
135
  // WebIDL
135
  // WebIDL
136
  already_AddRefed<SVGAnimatedLength> Cx();
136
  already_AddRefed<SVGAnimatedLength> Cx();
137
  already_AddRefed<SVGAnimatedLength> Cy();
137
  already_AddRefed<SVGAnimatedLength> Cy();
138
  already_AddRefed<SVGAnimatedLength> R();
138
  already_AddRefed<SVGAnimatedLength> R();
139
  already_AddRefed<SVGAnimatedLength> Fx();
139
  already_AddRefed<SVGAnimatedLength> Fx();
140
  already_AddRefed<SVGAnimatedLength> Fy();
140
  already_AddRefed<SVGAnimatedLength> Fy();
141
  already_AddRefed<SVGAnimatedLength> Fr();
141
protected:
142
protected:
142
143
143
  virtual LengthAttributesInfo GetLengthInfo() override;
144
  virtual LengthAttributesInfo GetLengthInfo() override;
144
145
145
  enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY };
146
  enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY, ATTR_FR };
146
  nsSVGLength2 mLengthAttributes[5];
147
  nsSVGLength2 mLengthAttributes[6];
147
  static LengthInfo sLengthInfo[5];
148
  static LengthInfo sLengthInfo[6];
148
};
149
};
149
150
150
} // namespace dom
151
} // namespace dom
151
} // namespace mozilla
152
} // namespace mozilla
152
153
153
#endif
154
#endif
(-)a/dom/webidl/SVGRadialGradientElement.webidl (-1 / +2 lines)
Line     Link Here 
 Lines 16-25   interface SVGRadialGradientElement : SVG Link Here 
16
  [Constant]
16
  [Constant]
17
  readonly attribute SVGAnimatedLength cy;
17
  readonly attribute SVGAnimatedLength cy;
18
  [Constant]
18
  [Constant]
19
  readonly attribute SVGAnimatedLength r;
19
  readonly attribute SVGAnimatedLength r;
20
  [Constant]
20
  [Constant]
21
  readonly attribute SVGAnimatedLength fx;
21
  readonly attribute SVGAnimatedLength fx;
22
  [Constant]
22
  [Constant]
23
  readonly attribute SVGAnimatedLength fy;
23
  readonly attribute SVGAnimatedLength fy;
24
  // readonly attribute SVGAnimatedLength fr;
24
  [Constant]
25
  readonly attribute SVGAnimatedLength fr;
25
};
26
};
(-)a/layout/reftests/svg/gradient-fr-01.svg (+21 lines)
Line     Link Here 
Line 0    Link Here 
1
<!--
2
     Any copyright is dedicated to the Public Domain.
3
     http://creativecommons.org/publicdomain/zero/1.0/
4
-->
5
<svg xmlns="http://www.w3.org/2000/svg"
6
     xmlns:xlink="http://www.w3.org/1999/xlink">
7
  <title>Test gradient fr attribute</title>
8
  <defs>
9
    <radialGradient id="grad1" fr="100%">
10
      <stop offset="0%" stop-color="red" />
11
      <stop offset="100%" stop-color="lime" />
12
    </radialGradient>
13
    <radialGradient id="grad2" xlink:href="#grad1"/>
14
  </defs>
15
  <rect width="100%" height="100%" fill="lime"/>
16
17
  <circle cx="100" cy="100" r="50" fill="url(#grad1)" />
18
19
  <circle cx="300" cy="100" r="50" fill="url(#grad2)" />
20
</svg>
21
(-)a/layout/reftests/svg/gradient-fr-02-ref.svg (+19 lines)
Line     Link Here 
Line 0    Link Here 
1
<!--
2
     Any copyright is dedicated to the Public Domain.
3
     http://creativecommons.org/publicdomain/zero/1.0/
4
-->
5
<svg xmlns="http://www.w3.org/2000/svg"
6
     xmlns:xlink="http://www.w3.org/1999/xlink">
7
  <title>Test gradient fr attribute</title>
8
  <defs>
9
    <radialGradient id="grad1">
10
      <stop offset="0%" stop-color="red" />
11
      <stop offset="20%" stop-color="red" />
12
      <stop offset="100%" stop-color="lime" />
13
    </radialGradient>
14
  </defs>
15
  <rect width="100%" height="100%" fill="lime"/>
16
17
  <circle cx="100" cy="100" r="50" fill="url(#grad1)" />
18
</svg>
19
(-)a/layout/reftests/svg/gradient-fr-02.svg (+18 lines)
Line     Link Here 
Line 0    Link Here 
1
<!--
2
     Any copyright is dedicated to the Public Domain.
3
     http://creativecommons.org/publicdomain/zero/1.0/
4
-->
5
<svg xmlns="http://www.w3.org/2000/svg"
6
     xmlns:xlink="http://www.w3.org/1999/xlink">
7
  <title>Test gradient fr attribute</title>
8
  <defs>
9
    <radialGradient id="grad1" fr="10%">
10
      <stop offset="0%" stop-color="red" />
11
      <stop offset="100%" stop-color="lime" />
12
    </radialGradient>
13
  </defs>
14
  <rect width="100%" height="100%" fill="lime"/>
15
16
  <circle cx="100" cy="100" r="50" fill="url(#grad1)" />
17
</svg>
18
(-)a/layout/reftests/svg/reftest.list (+2 lines)
Line     Link Here 
 Lines 179-194   fails-if(Android||B2G) pref(security.fil Link Here 
179
== foreignObject-style-change-01.svg pass.svg
179
== foreignObject-style-change-01.svg pass.svg
180
== foreignObject-dynamic-abspos-01.html foreignObject-dynamic-abspos-01-ref.html
180
== foreignObject-dynamic-abspos-01.html foreignObject-dynamic-abspos-01-ref.html
181
fuzzy-if(Android,18,600) == foreignObject-fixedpos-01.html foreignObject-dynamic-abspos-01-ref.html
181
fuzzy-if(Android,18,600) == foreignObject-fixedpos-01.html foreignObject-dynamic-abspos-01-ref.html
182
== foreignObject-fixedpos-02.html foreignObject-fixedpos-ref.html
182
== foreignObject-fixedpos-02.html foreignObject-fixedpos-ref.html
183
== foreignObject-dynamic-fixedpos-01.html foreignObject-dynamic-abspos-01-ref.html
183
== foreignObject-dynamic-fixedpos-01.html foreignObject-dynamic-abspos-01-ref.html
184
== foreignObject-vertical-01.svg foreignObject-vertical-01-ref.svg
184
== foreignObject-vertical-01.svg foreignObject-vertical-01-ref.svg
185
== g-transform-01.svg pass.svg
185
== g-transform-01.svg pass.svg
186
== getElementById-a-element-01.svg pass.svg
186
== getElementById-a-element-01.svg pass.svg
187
== gradient-fr-01.svg pass.svg
188
== gradient-fr-02.svg gradient-fr-02-ref.svg
187
fuzzy-if(Android||B2G,9,980||Mulet,9,980) skip-if(Mulet) == gradient-live-01a.svg gradient-live-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
189
fuzzy-if(Android||B2G,9,980||Mulet,9,980) skip-if(Mulet) == gradient-live-01a.svg gradient-live-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
188
fuzzy-if(Android||B2G,9,980||Mulet,9,980) skip-if(Mulet) == gradient-live-01b.svg gradient-live-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
190
fuzzy-if(Android||B2G,9,980||Mulet,9,980) skip-if(Mulet) == gradient-live-01b.svg gradient-live-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
189
fuzzy-if(Android||B2G,9,980||Mulet,9,980) skip-if(Mulet) == gradient-live-01c.svg gradient-live-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
191
fuzzy-if(Android||B2G,9,980||Mulet,9,980) skip-if(Mulet) == gradient-live-01c.svg gradient-live-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
190
fuzzy-if(Android||B2G,9,980||Mulet,9,980) skip-if(Mulet) == gradient-live-01d.svg gradient-live-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
192
fuzzy-if(Android||B2G,9,980||Mulet,9,980) skip-if(Mulet) == gradient-live-01d.svg gradient-live-01-ref.svg # Initial mulet triage: parity with B2G/B2G Desktop # MULET: Bug 1144079: Re-enable Mulet mochitests and reftests taskcluster-specific disables
191
== gradient-transform-01.svg pass.svg
193
== gradient-transform-01.svg pass.svg
192
== import-svg-01.html pass.svg
194
== import-svg-01.html pass.svg
193
== invalid-text-01.svg pass.svg
195
== invalid-text-01.svg pass.svg
194
== lang-attribute-01.svg pass.svg
196
== lang-attribute-01.svg pass.svg
(-)a/layout/svg/nsSVGGradientFrame.cpp (-2 / +3 lines)
Line     Link Here 
 Lines 609-632   bool Link Here 
609
nsSVGRadialGradientFrame::GradientVectorLengthIsZero()
609
nsSVGRadialGradientFrame::GradientVectorLengthIsZero()
610
{
610
{
611
  return GetLengthValue(dom::SVGRadialGradientElement::ATTR_R) == 0;
611
  return GetLengthValue(dom::SVGRadialGradientElement::ATTR_R) == 0;
612
}
612
}
613
613
614
already_AddRefed<gfxPattern>
614
already_AddRefed<gfxPattern>
615
nsSVGRadialGradientFrame::CreateGradient()
615
nsSVGRadialGradientFrame::CreateGradient()
616
{
616
{
617
  float cx, cy, r, fx, fy;
617
  float cx, cy, r, fx, fy, fr;
618
618
619
  cx = GetLengthValue(dom::SVGRadialGradientElement::ATTR_CX);
619
  cx = GetLengthValue(dom::SVGRadialGradientElement::ATTR_CX);
620
  cy = GetLengthValue(dom::SVGRadialGradientElement::ATTR_CY);
620
  cy = GetLengthValue(dom::SVGRadialGradientElement::ATTR_CY);
621
  r  = GetLengthValue(dom::SVGRadialGradientElement::ATTR_R);
621
  r  = GetLengthValue(dom::SVGRadialGradientElement::ATTR_R);
622
  // If fx or fy are not set, use cx/cy instead
622
  // If fx or fy are not set, use cx/cy instead
623
  fx = GetLengthValue(dom::SVGRadialGradientElement::ATTR_FX, cx);
623
  fx = GetLengthValue(dom::SVGRadialGradientElement::ATTR_FX, cx);
624
  fy = GetLengthValue(dom::SVGRadialGradientElement::ATTR_FY, cy);
624
  fy = GetLengthValue(dom::SVGRadialGradientElement::ATTR_FY, cy);
625
  fr = GetLengthValue(dom::SVGRadialGradientElement::ATTR_FR);
625
626
626
  if (fx != cx || fy != cy) {
627
  if (fx != cx || fy != cy) {
627
    // The focal point (fFx and fFy) must be clamped to be *inside* - not on -
628
    // The focal point (fFx and fFy) must be clamped to be *inside* - not on -
628
    // the circumference of the gradient or we'll get rendering anomalies. We
629
    // the circumference of the gradient or we'll get rendering anomalies. We
629
    // calculate the distance from the focal point to the gradient center and
630
    // calculate the distance from the focal point to the gradient center and
630
    // make sure it is *less* than the gradient radius.
631
    // make sure it is *less* than the gradient radius.
631
    // 1/128 is the limit of the fractional part of cairo's 24.8 fixed point
632
    // 1/128 is the limit of the fractional part of cairo's 24.8 fixed point
632
    // representation divided by 2 to ensure that we get different cairo
633
    // representation divided by 2 to ensure that we get different cairo
 Lines 637-653   nsSVGRadialGradientFrame::CreateGradient Link Here 
637
    double d = sqrt((dx * dx) + (dy * dy));
638
    double d = sqrt((dx * dx) + (dy * dy));
638
    if (d > dMax) {
639
    if (d > dMax) {
639
      double angle = atan2(dy, dx);
640
      double angle = atan2(dy, dx);
640
      fx = (float)(dMax * cos(angle)) + cx;
641
      fx = (float)(dMax * cos(angle)) + cx;
641
      fy = (float)(dMax * sin(angle)) + cy;
642
      fy = (float)(dMax * sin(angle)) + cy;
642
    }
643
    }
643
  }
644
  }
644
645
645
  RefPtr<gfxPattern> pattern = new gfxPattern(fx, fy, 0, cx, cy, r);
646
  RefPtr<gfxPattern> pattern = new gfxPattern(fx, fy, fr, cx, cy, r);
646
  return pattern.forget();
647
  return pattern.forget();
647
}
648
}
648
649
649
// -------------------------------------------------------------------------
650
// -------------------------------------------------------------------------
650
// Public functions
651
// Public functions
651
// -------------------------------------------------------------------------
652
// -------------------------------------------------------------------------
652
653
653
nsIFrame*
654
nsIFrame*
(-)a/testing/web-platform/meta/svg/interfaces.html.ini (-6 lines)
Line     Link Here 
 Lines 1201-1222    Link Here 
1201
    expected: FAIL
1201
    expected: FAIL
1202
1202
1203
  [SVGElement interface: linearGradient must inherit property "onsort" with the proper type (61)]
1203
  [SVGElement interface: linearGradient must inherit property "onsort" with the proper type (61)]
1204
    expected: FAIL
1204
    expected: FAIL
1205
1205
1206
  [SVGElement interface: linearGradient must inherit property "ontoggle" with the proper type (66)]
1206
  [SVGElement interface: linearGradient must inherit property "ontoggle" with the proper type (66)]
1207
    expected: FAIL
1207
    expected: FAIL
1208
1208
1209
  [SVGRadialGradientElement interface: attribute fr]
1210
    expected: FAIL
1211
1212
  [SVGRadialGradientElement interface: radialGradient must inherit property "fr" with the proper type (5)]
1213
    expected: FAIL
1214
1215
  [SVGElement interface: radialGradient must inherit property "tabIndex" with the proper type (3)]
1209
  [SVGElement interface: radialGradient must inherit property "tabIndex" with the proper type (3)]
1216
    expected: FAIL
1210
    expected: FAIL
1217
1211
1218
  [SVGElement interface: radialGradient must inherit property "focus" with the proper type (4)]
1212
  [SVGElement interface: radialGradient must inherit property "focus" with the proper type (4)]
1219
    expected: FAIL
1213
    expected: FAIL
1220
1214
1221
  [SVGElement interface: radialGradient must inherit property "blur" with the proper type (5)]
1215
  [SVGElement interface: radialGradient must inherit property "blur" with the proper type (5)]
1222
    expected: FAIL
1216
    expected: FAIL

Return to bug 1240275