/src/mozilla-central/dom/svg/SVGFEFloodElement.cpp
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #include "mozilla/dom/SVGFEFloodElement.h" |
8 | | |
9 | | #include "FilterSupport.h" |
10 | | #include "mozilla/dom/SVGFEFloodElementBinding.h" |
11 | | #include "nsColor.h" |
12 | | #include "nsIFrame.h" |
13 | | |
14 | | NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEFlood) |
15 | | |
16 | | using namespace mozilla::gfx; |
17 | | |
18 | | namespace mozilla { |
19 | | namespace dom { |
20 | | |
21 | | JSObject* |
22 | | SVGFEFloodElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) |
23 | 0 | { |
24 | 0 | return SVGFEFloodElement_Binding::Wrap(aCx, this, aGivenProto); |
25 | 0 | } |
26 | | |
27 | | nsSVGElement::StringInfo SVGFEFloodElement::sStringInfo[1] = |
28 | | { |
29 | | { &nsGkAtoms::result, kNameSpaceID_None, true } |
30 | | }; |
31 | | |
32 | | //---------------------------------------------------------------------- |
33 | | // nsINode methods |
34 | | |
35 | | NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFloodElement) |
36 | | |
37 | | FilterPrimitiveDescription |
38 | | SVGFEFloodElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, |
39 | | const IntRect& aFilterSubregion, |
40 | | const nsTArray<bool>& aInputsAreTainted, |
41 | | nsTArray<RefPtr<SourceSurface>>& aInputImages) |
42 | 0 | { |
43 | 0 | FloodAttributes atts; |
44 | 0 | nsIFrame* frame = GetPrimaryFrame(); |
45 | 0 | if (frame) { |
46 | 0 | const nsStyleSVGReset* styleSVGReset = frame->Style()->StyleSVGReset(); |
47 | 0 | Color color(Color::FromABGR(styleSVGReset->mFloodColor.CalcColor(frame))); |
48 | 0 | color.a *= styleSVGReset->mFloodOpacity; |
49 | 0 | atts.mColor = color; |
50 | 0 | } else { |
51 | 0 | atts.mColor = Color(); |
52 | 0 | } |
53 | 0 | return FilterPrimitiveDescription(AsVariant(std::move(atts))); |
54 | 0 | } |
55 | | |
56 | | //---------------------------------------------------------------------- |
57 | | // nsIContent methods |
58 | | |
59 | | NS_IMETHODIMP_(bool) |
60 | | SVGFEFloodElement::IsAttributeMapped(const nsAtom* name) const |
61 | 0 | { |
62 | 0 | static const MappedAttributeEntry* const map[] = { |
63 | 0 | sColorMap, |
64 | 0 | sFEFloodMap |
65 | 0 | }; |
66 | 0 |
|
67 | 0 | return FindAttributeDependence(name, map) || |
68 | 0 | SVGFEFloodElementBase::IsAttributeMapped(name); |
69 | 0 | } |
70 | | |
71 | | //---------------------------------------------------------------------- |
72 | | // nsSVGElement methods |
73 | | |
74 | | nsSVGElement::StringAttributesInfo |
75 | | SVGFEFloodElement::GetStringInfo() |
76 | 0 | { |
77 | 0 | return StringAttributesInfo(mStringAttributes, sStringInfo, |
78 | 0 | ArrayLength(sStringInfo)); |
79 | 0 | } |
80 | | |
81 | | } // namespace dom |
82 | | } // namespace mozilla |