2013-03-24 23:26:04 -07: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-24 23:26:05 -07:00
|
|
|
#include "mozilla/dom/SVGFESpecularLightingElement.h"
|
|
|
|
#include "mozilla/dom/SVGFESpecularLightingElementBinding.h"
|
|
|
|
#include "nsSVGUtils.h"
|
2013-11-27 03:25:29 -08:00
|
|
|
#include "nsSVGFilterInstance.h"
|
2013-03-24 23:26:04 -07:00
|
|
|
|
2013-03-24 23:26:05 -07:00
|
|
|
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FESpecularLighting)
|
2013-03-24 23:26:04 -07:00
|
|
|
|
2013-11-27 03:25:29 -08:00
|
|
|
using namespace mozilla::gfx;
|
|
|
|
|
2013-03-24 23:26:04 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-03-24 23:26:05 -07:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
SVGFESpecularLightingElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-03-24 23:26:05 -07:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
return SVGFESpecularLightingElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-03-24 23:26:05 -07:00
|
|
|
}
|
|
|
|
|
2013-03-24 23:26:04 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIDOMNode methods
|
|
|
|
|
2013-03-24 23:26:05 -07:00
|
|
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFESpecularLightingElement)
|
2013-03-24 23:26:04 -07:00
|
|
|
|
2013-06-14 15:37:27 -07:00
|
|
|
already_AddRefed<SVGAnimatedString>
|
2013-03-24 23:26:05 -07:00
|
|
|
SVGFESpecularLightingElement::In1()
|
2013-03-24 23:26:04 -07:00
|
|
|
{
|
2013-03-24 23:26:05 -07:00
|
|
|
return mStringAttributes[IN1].ToDOMAnimatedString(this);
|
2013-03-24 23:26:04 -07:00
|
|
|
}
|
|
|
|
|
2013-07-01 00:03:04 -07:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-24 23:26:05 -07:00
|
|
|
SVGFESpecularLightingElement::SurfaceScale()
|
2013-03-24 23:26:04 -07:00
|
|
|
{
|
2013-03-24 23:26:05 -07:00
|
|
|
return mNumberAttributes[SURFACE_SCALE].ToDOMAnimatedNumber(this);
|
2013-03-24 23:26:04 -07:00
|
|
|
}
|
|
|
|
|
2013-07-01 00:03:04 -07:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-24 23:26:05 -07:00
|
|
|
SVGFESpecularLightingElement::SpecularConstant()
|
2013-03-24 23:26:04 -07:00
|
|
|
{
|
2013-03-24 23:26:05 -07:00
|
|
|
return mNumberAttributes[SPECULAR_CONSTANT].ToDOMAnimatedNumber(this);
|
2013-03-24 23:26:04 -07:00
|
|
|
}
|
|
|
|
|
2013-07-01 00:03:04 -07:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-24 23:26:05 -07:00
|
|
|
SVGFESpecularLightingElement::SpecularExponent()
|
2013-03-24 23:26:04 -07:00
|
|
|
{
|
2013-03-24 23:26:05 -07:00
|
|
|
return mNumberAttributes[SPECULAR_EXPONENT].ToDOMAnimatedNumber(this);
|
2013-03-24 23:26:04 -07:00
|
|
|
}
|
|
|
|
|
2013-07-01 00:03:04 -07:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-24 23:26:05 -07:00
|
|
|
SVGFESpecularLightingElement::KernelUnitLengthX()
|
2013-03-24 23:26:04 -07:00
|
|
|
{
|
2013-03-24 23:26:05 -07:00
|
|
|
return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber(
|
|
|
|
nsSVGNumberPair::eFirst, this);
|
2013-03-24 23:26:04 -07:00
|
|
|
}
|
|
|
|
|
2013-07-01 00:03:04 -07:00
|
|
|
already_AddRefed<SVGAnimatedNumber>
|
2013-03-24 23:26:05 -07:00
|
|
|
SVGFESpecularLightingElement::KernelUnitLengthY()
|
2013-03-24 23:26:04 -07:00
|
|
|
{
|
2013-03-24 23:26:05 -07:00
|
|
|
return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber(
|
|
|
|
nsSVGNumberPair::eSecond, this);
|
2013-03-24 23:26:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSVGElement methods
|
|
|
|
|
2013-11-27 03:25:29 -08:00
|
|
|
FilterPrimitiveDescription
|
|
|
|
SVGFESpecularLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
|
|
|
const IntRect& aFilterSubregion,
|
2014-01-08 01:30:03 -08:00
|
|
|
const nsTArray<bool>& aInputsAreTainted,
|
2013-11-28 06:38:43 -08:00
|
|
|
nsTArray<RefPtr<SourceSurface>>& aInputImages)
|
2013-03-24 23:26:04 -07:00
|
|
|
{
|
|
|
|
float specularExponent = mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue();
|
2013-11-27 03:25:29 -08:00
|
|
|
float specularConstant = mNumberAttributes[SPECULAR_CONSTANT].GetAnimValue();
|
2013-03-24 23:26:04 -07:00
|
|
|
|
|
|
|
// specification defined range (15.22)
|
2013-11-27 03:25:29 -08:00
|
|
|
if (specularExponent < 1 || specularExponent > 128) {
|
2014-03-19 19:12:43 -07:00
|
|
|
return FilterPrimitiveDescription(PrimitiveType::Empty);
|
2013-11-27 03:25:29 -08:00
|
|
|
}
|
|
|
|
|
2014-03-19 19:12:43 -07:00
|
|
|
FilterPrimitiveDescription descr(PrimitiveType::SpecularLighting);
|
2013-11-27 03:25:29 -08:00
|
|
|
descr.Attributes().Set(eSpecularLightingSpecularConstant, specularConstant);
|
|
|
|
descr.Attributes().Set(eSpecularLightingSpecularExponent, specularExponent);
|
|
|
|
return AddLightingAttributes(descr, aInstance);
|
2013-03-24 23:26:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-03-24 23:26:05 -07:00
|
|
|
SVGFESpecularLightingElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute) const
|
2013-03-24 23:26:04 -07:00
|
|
|
{
|
2013-03-24 23:26:05 -07:00
|
|
|
return SVGFESpecularLightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
2013-03-24 23:26:04 -07:00
|
|
|
(aNameSpaceID == kNameSpaceID_None &&
|
|
|
|
(aAttribute == nsGkAtoms::specularConstant ||
|
|
|
|
aAttribute == nsGkAtoms::specularExponent));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|