2013-03-25 06:26:04 +00:00
|
|
|
/* a*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2013-03-25 06:26:05 +00:00
|
|
|
#include "mozilla/dom/SVGFESpecularLightingElement.h"
|
|
|
|
#include "mozilla/dom/SVGFESpecularLightingElementBinding.h"
|
|
|
|
#include "nsSVGUtils.h"
|
2013-11-27 11:25:29 +00:00
|
|
|
#include "nsSVGFilterInstance.h"
|
2013-03-25 06:26:04 +00:00
|
|
|
|
2013-03-25 06:26:05 +00:00
|
|
|
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FESpecularLighting)
|
2013-03-25 06:26:04 +00:00
|
|
|
|
2013-11-27 11:25:29 +00:00
|
|
|
using namespace mozilla::gfx;
|
|
|
|
|
2013-03-25 06:26:04 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-03-25 06:26:05 +00:00
|
|
|
JSObject*
|
2014-04-08 22:27:17 +00:00
|
|
|
SVGFESpecularLightingElement::WrapNode(JSContext* aCx)
|
2013-03-25 06:26:05 +00:00
|
|
|
{
|
Bug 991742 part 6. Remove the "aScope" argument of binding Wrap() methods. r=bholley
This patch was mostly generated with this command:
find . -name "*.h" -o -name "*.cpp" | xargs sed -e 's/Binding::Wrap(aCx, aScope, this/Binding::Wrap(aCx, this/' -e 's/Binding_workers::Wrap(aCx, aScope, this/Binding_workers::Wrap(aCx, this/' -e 's/Binding::Wrap(cx, scope, this/Binding::Wrap(cx, this/' -i ""
plus a few manual fixes to dom/bindings/Codegen.py, js/xpconnect/src/event_impl_gen.py, and a few C++ files that were not caught in the search-and-replace above.
2014-04-08 22:27:17 +00:00
|
|
|
return SVGFESpecularLightingElementBinding::Wrap(aCx, this);
|
2013-03-25 06:26:05 +00:00
|
|
|
}
|
|
|
|
|
2013-03-25 06:26:04 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIDOMNode methods
|
|
|
|
|
2013-03-25 06:26:05 +00:00
|
|
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFESpecularLightingElement)
|
2013-03-25 06:26:04 +00:00
|
|
|
|
2013-06-14 22:37:27 +00:00
|
|
|
already_AddRefed<SVGAnimatedString>
|
2013-03-25 06:26:05 +00:00
|
|
|
SVGFESpecularLightingElement::In1()
|
2013-03-25 06:26:04 +00:00
|
|
|
{
|
2013-03-25 06:26:05 +00:00
|
|
|
return mStringAttributes[IN1].ToDOMAnimatedString(this);
|
2013-03-25 06:26:04 +00:00
|
|
|
}
|
|
|
|
|
2013-07-01 07:03:04 +00:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-25 06:26:05 +00:00
|
|
|
SVGFESpecularLightingElement::SurfaceScale()
|
2013-03-25 06:26:04 +00:00
|
|
|
{
|
2013-03-25 06:26:05 +00:00
|
|
|
return mNumberAttributes[SURFACE_SCALE].ToDOMAnimatedNumber(this);
|
2013-03-25 06:26:04 +00:00
|
|
|
}
|
|
|
|
|
2013-07-01 07:03:04 +00:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-25 06:26:05 +00:00
|
|
|
SVGFESpecularLightingElement::SpecularConstant()
|
2013-03-25 06:26:04 +00:00
|
|
|
{
|
2013-03-25 06:26:05 +00:00
|
|
|
return mNumberAttributes[SPECULAR_CONSTANT].ToDOMAnimatedNumber(this);
|
2013-03-25 06:26:04 +00:00
|
|
|
}
|
|
|
|
|
2013-07-01 07:03:04 +00:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-25 06:26:05 +00:00
|
|
|
SVGFESpecularLightingElement::SpecularExponent()
|
2013-03-25 06:26:04 +00:00
|
|
|
{
|
2013-03-25 06:26:05 +00:00
|
|
|
return mNumberAttributes[SPECULAR_EXPONENT].ToDOMAnimatedNumber(this);
|
2013-03-25 06:26:04 +00:00
|
|
|
}
|
|
|
|
|
2013-07-01 07:03:04 +00:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-25 06:26:05 +00:00
|
|
|
SVGFESpecularLightingElement::KernelUnitLengthX()
|
2013-03-25 06:26:04 +00:00
|
|
|
{
|
2013-03-25 06:26:05 +00:00
|
|
|
return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber(
|
|
|
|
nsSVGNumberPair::eFirst, this);
|
2013-03-25 06:26:04 +00:00
|
|
|
}
|
|
|
|
|
2013-07-01 07:03:04 +00:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-25 06:26:05 +00:00
|
|
|
SVGFESpecularLightingElement::KernelUnitLengthY()
|
2013-03-25 06:26:04 +00:00
|
|
|
{
|
2013-03-25 06:26:05 +00:00
|
|
|
return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber(
|
|
|
|
nsSVGNumberPair::eSecond, this);
|
2013-03-25 06:26:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSVGElement methods
|
|
|
|
|
2013-11-27 11:25:29 +00:00
|
|
|
FilterPrimitiveDescription
|
|
|
|
SVGFESpecularLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
|
|
|
const IntRect& aFilterSubregion,
|
2014-01-08 09:30:03 +00:00
|
|
|
const nsTArray<bool>& aInputsAreTainted,
|
2013-11-28 14:38:43 +00:00
|
|
|
nsTArray<RefPtr<SourceSurface>>& aInputImages)
|
2013-03-25 06:26:04 +00:00
|
|
|
{
|
|
|
|
float specularExponent = mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue();
|
2013-11-27 11:25:29 +00:00
|
|
|
float specularConstant = mNumberAttributes[SPECULAR_CONSTANT].GetAnimValue();
|
2013-03-25 06:26:04 +00:00
|
|
|
|
|
|
|
// specification defined range (15.22)
|
2013-11-27 11:25:29 +00:00
|
|
|
if (specularExponent < 1 || specularExponent > 128) {
|
2014-03-20 02:12:43 +00:00
|
|
|
return FilterPrimitiveDescription(PrimitiveType::Empty);
|
2013-11-27 11:25:29 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 02:12:43 +00:00
|
|
|
FilterPrimitiveDescription descr(PrimitiveType::SpecularLighting);
|
2013-11-27 11:25:29 +00:00
|
|
|
descr.Attributes().Set(eSpecularLightingSpecularConstant, specularConstant);
|
|
|
|
descr.Attributes().Set(eSpecularLightingSpecularExponent, specularExponent);
|
|
|
|
return AddLightingAttributes(descr, aInstance);
|
2013-03-25 06:26:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-03-25 06:26:05 +00:00
|
|
|
SVGFESpecularLightingElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute) const
|
2013-03-25 06:26:04 +00:00
|
|
|
{
|
2013-03-25 06:26:05 +00:00
|
|
|
return SVGFESpecularLightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
2013-03-25 06:26:04 +00:00
|
|
|
(aNameSpaceID == kNameSpaceID_None &&
|
|
|
|
(aAttribute == nsGkAtoms::specularConstant ||
|
|
|
|
aAttribute == nsGkAtoms::specularExponent));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|