Bug 1691109 [wpt PR 27513] - Increase timeout duration for wpt/fetch/api/basic/keepal...
[gecko.git] / dom / svg / SVGFEDistantLightElement.cpp
blob7fb5ec672b019ac3d69164c1d61a5f6edf523f6d
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/. */
7 #include "mozilla/dom/SVGFEDistantLightElement.h"
8 #include "mozilla/dom/SVGFEDistantLightElementBinding.h"
9 #include "mozilla/SVGFilterInstance.h"
11 NS_IMPL_NS_NEW_SVG_ELEMENT(FEDistantLight)
13 using namespace mozilla::gfx;
15 namespace mozilla {
16 namespace dom {
18 JSObject* SVGFEDistantLightElement::WrapNode(
19 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
20 return SVGFEDistantLightElement_Binding::Wrap(aCx, this, aGivenProto);
23 SVGElement::NumberInfo SVGFEDistantLightElement::sNumberInfo[2] = {
24 {nsGkAtoms::azimuth, 0, false}, {nsGkAtoms::elevation, 0, false}};
26 //----------------------------------------------------------------------
27 //----------------------------------------------------------------------
28 // nsINode methods
30 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDistantLightElement)
32 // nsFEUnstyledElement methods
34 bool SVGFEDistantLightElement::AttributeAffectsRendering(
35 int32_t aNameSpaceID, nsAtom* aAttribute) const {
36 return aNameSpaceID == kNameSpaceID_None &&
37 (aAttribute == nsGkAtoms::azimuth ||
38 aAttribute == nsGkAtoms::elevation);
41 LightType SVGFEDistantLightElement::ComputeLightAttributes(
42 SVGFilterInstance* aInstance, nsTArray<float>& aFloatAttributes) {
43 float azimuth, elevation;
44 GetAnimatedNumberValues(&azimuth, &elevation, nullptr);
46 aFloatAttributes.SetLength(kDistantLightNumAttributes);
47 aFloatAttributes[kDistantLightAzimuthIndex] = azimuth;
48 aFloatAttributes[kDistantLightElevationIndex] = elevation;
49 return LightType::Distant;
52 already_AddRefed<DOMSVGAnimatedNumber> SVGFEDistantLightElement::Azimuth() {
53 return mNumberAttributes[AZIMUTH].ToDOMAnimatedNumber(this);
56 already_AddRefed<DOMSVGAnimatedNumber> SVGFEDistantLightElement::Elevation() {
57 return mNumberAttributes[ELEVATION].ToDOMAnimatedNumber(this);
60 //----------------------------------------------------------------------
61 // SVGElement methods
63 SVGElement::NumberAttributesInfo SVGFEDistantLightElement::GetNumberInfo() {
64 return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
65 ArrayLength(sNumberInfo));
68 } // namespace dom
69 } // namespace mozilla