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/SVGFEFloodElement.h"
9 #include "FilterSupport.h"
10 #include "mozilla/dom/SVGFEFloodElementBinding.h"
14 NS_IMPL_NS_NEW_SVG_ELEMENT(FEFlood
)
16 using namespace mozilla::gfx
;
21 JSObject
* SVGFEFloodElement::WrapNode(JSContext
* aCx
,
22 JS::Handle
<JSObject
*> aGivenProto
) {
23 return SVGFEFloodElement_Binding::Wrap(aCx
, this, aGivenProto
);
26 SVGElement::StringInfo
SVGFEFloodElement::sStringInfo
[1] = {
27 {nsGkAtoms::result
, kNameSpaceID_None
, true}};
29 //----------------------------------------------------------------------
32 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFloodElement
)
34 FilterPrimitiveDescription
SVGFEFloodElement::GetPrimitiveDescription(
35 SVGFilterInstance
* aInstance
, const IntRect
& aFilterSubregion
,
36 const nsTArray
<bool>& aInputsAreTainted
,
37 nsTArray
<RefPtr
<SourceSurface
>>& aInputImages
) {
39 nsIFrame
* frame
= GetPrimaryFrame();
41 const nsStyleSVGReset
* styleSVGReset
= frame
->Style()->StyleSVGReset();
43 sRGBColor::FromABGR(styleSVGReset
->mFloodColor
.CalcColor(frame
)));
44 color
.a
*= styleSVGReset
->mFloodOpacity
;
47 atts
.mColor
= sRGBColor();
49 return FilterPrimitiveDescription(AsVariant(std::move(atts
)));
52 //----------------------------------------------------------------------
56 SVGFEFloodElement::IsAttributeMapped(const nsAtom
* name
) const {
57 static const MappedAttributeEntry
* const map
[] = {sColorMap
, sFEFloodMap
};
59 return FindAttributeDependence(name
, map
) ||
60 SVGFEFloodElementBase::IsAttributeMapped(name
);
63 //----------------------------------------------------------------------
66 SVGElement::StringAttributesInfo
SVGFEFloodElement::GetStringInfo() {
67 return StringAttributesInfo(mStringAttributes
, sStringInfo
,
68 ArrayLength(sStringInfo
));
72 } // namespace mozilla