Bug 1700051: part 46) Const-qualify `mozInlineSpellStatus::mAnchorRange`. r=smaug
[gecko.git] / dom / svg / SVGFEFloodElement.cpp
bloba7a11f6d1fcb4b121123a43ef5cd28c784086d47
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"
11 #include "nsColor.h"
12 #include "nsIFrame.h"
14 NS_IMPL_NS_NEW_SVG_ELEMENT(FEFlood)
16 using namespace mozilla::gfx;
18 namespace mozilla {
19 namespace dom {
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 //----------------------------------------------------------------------
30 // nsINode methods
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) {
38 FloodAttributes atts;
39 nsIFrame* frame = GetPrimaryFrame();
40 if (frame) {
41 const nsStyleSVGReset* styleSVGReset = frame->Style()->StyleSVGReset();
42 sRGBColor color(
43 sRGBColor::FromABGR(styleSVGReset->mFloodColor.CalcColor(frame)));
44 color.a *= styleSVGReset->mFloodOpacity;
45 atts.mColor = color;
46 } else {
47 atts.mColor = sRGBColor();
49 return FilterPrimitiveDescription(AsVariant(std::move(atts)));
52 //----------------------------------------------------------------------
53 // nsIContent methods
55 NS_IMETHODIMP_(bool)
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 //----------------------------------------------------------------------
64 // SVGElement methods
66 SVGElement::StringAttributesInfo SVGFEFloodElement::GetStringInfo() {
67 return StringAttributesInfo(mStringAttributes, sStringInfo,
68 ArrayLength(sStringInfo));
71 } // namespace dom
72 } // namespace mozilla