/src/mozilla-central/dom/svg/SVGFEDistantLightElement.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "mozilla/dom/SVGFEDistantLightElement.h" |
8 | | #include "mozilla/dom/SVGFEDistantLightElementBinding.h" |
9 | | #include "nsSVGFilterInstance.h" |
10 | | |
11 | | NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEDistantLight) |
12 | | |
13 | | using namespace mozilla::gfx; |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | JSObject* |
19 | | SVGFEDistantLightElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) |
20 | 0 | { |
21 | 0 | return SVGFEDistantLightElement_Binding::Wrap(aCx, this, aGivenProto); |
22 | 0 | } |
23 | | |
24 | | nsSVGElement::NumberInfo SVGFEDistantLightElement::sNumberInfo[2] = |
25 | | { |
26 | | { &nsGkAtoms::azimuth, 0, false }, |
27 | | { &nsGkAtoms::elevation, 0, false } |
28 | | }; |
29 | | |
30 | | //---------------------------------------------------------------------- |
31 | | //---------------------------------------------------------------------- |
32 | | // nsINode methods |
33 | | |
34 | | NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDistantLightElement) |
35 | | |
36 | | // nsFEUnstyledElement methods |
37 | | |
38 | | bool |
39 | | SVGFEDistantLightElement::AttributeAffectsRendering(int32_t aNameSpaceID, |
40 | | nsAtom* aAttribute) const |
41 | 0 | { |
42 | 0 | return aNameSpaceID == kNameSpaceID_None && |
43 | 0 | (aAttribute == nsGkAtoms::azimuth || |
44 | 0 | aAttribute == nsGkAtoms::elevation); |
45 | 0 | } |
46 | | |
47 | | LightType |
48 | | SVGFEDistantLightElement::ComputeLightAttributes(nsSVGFilterInstance* aInstance, |
49 | | nsTArray<float>& aFloatAttributes) |
50 | 0 | { |
51 | 0 | float azimuth, elevation; |
52 | 0 | GetAnimatedNumberValues(&azimuth, &elevation, nullptr); |
53 | 0 |
|
54 | 0 | aFloatAttributes.SetLength(kDistantLightNumAttributes); |
55 | 0 | aFloatAttributes[kDistantLightAzimuthIndex] = azimuth; |
56 | 0 | aFloatAttributes[kDistantLightElevationIndex] = elevation; |
57 | 0 | return LightType::Distant; |
58 | 0 | } |
59 | | |
60 | | already_AddRefed<SVGAnimatedNumber> |
61 | | SVGFEDistantLightElement::Azimuth() |
62 | 0 | { |
63 | 0 | return mNumberAttributes[AZIMUTH].ToDOMAnimatedNumber(this); |
64 | 0 | } |
65 | | |
66 | | already_AddRefed<SVGAnimatedNumber> |
67 | | SVGFEDistantLightElement::Elevation() |
68 | 0 | { |
69 | 0 | return mNumberAttributes[ELEVATION].ToDOMAnimatedNumber(this); |
70 | 0 | } |
71 | | |
72 | | //---------------------------------------------------------------------- |
73 | | // nsSVGElement methods |
74 | | |
75 | | nsSVGElement::NumberAttributesInfo |
76 | | SVGFEDistantLightElement::GetNumberInfo() |
77 | 0 | { |
78 | 0 | return NumberAttributesInfo(mNumberAttributes, sNumberInfo, |
79 | 0 | ArrayLength(sNumberInfo)); |
80 | 0 | } |
81 | | |
82 | | } // namespace dom |
83 | | } // namespace mozilla |