/src/mozilla-central/layout/svg/SVGFEContainerFrame.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 | | // Keep in (case-insensitive) order: |
8 | | #include "nsContainerFrame.h" |
9 | | #include "nsGkAtoms.h" |
10 | | #include "nsIFrame.h" |
11 | | #include "nsLiteralString.h" |
12 | | #include "SVGObserverUtils.h" |
13 | | #include "nsSVGFilters.h" |
14 | | |
15 | | using namespace mozilla; |
16 | | |
17 | | /* |
18 | | * This frame is used by filter primitive elements that |
19 | | * have special child elements that provide parameters. |
20 | | */ |
21 | | class SVGFEContainerFrame final : public nsContainerFrame |
22 | | { |
23 | | friend nsIFrame* |
24 | | NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle); |
25 | | protected: |
26 | | explicit SVGFEContainerFrame(ComputedStyle* aStyle) |
27 | | : nsContainerFrame(aStyle, kClassID) |
28 | 0 | { |
29 | 0 | AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY); |
30 | 0 | } |
31 | | |
32 | | public: |
33 | | NS_DECL_FRAMEARENA_HELPERS(SVGFEContainerFrame) |
34 | | |
35 | | virtual bool IsFrameOfType(uint32_t aFlags) const override |
36 | 0 | { |
37 | 0 | if (aFlags & eSupportsContainLayoutAndPaint) { |
38 | 0 | return false; |
39 | 0 | } |
40 | 0 | |
41 | 0 | return nsContainerFrame::IsFrameOfType( |
42 | 0 | aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGContainer)); |
43 | 0 | } |
44 | | |
45 | | #ifdef DEBUG_FRAME_DUMP |
46 | | virtual nsresult GetFrameName(nsAString& aResult) const override |
47 | | { |
48 | | return MakeFrameName(NS_LITERAL_STRING("SVGFEContainer"), aResult); |
49 | | } |
50 | | #endif |
51 | | |
52 | | #ifdef DEBUG |
53 | | virtual void Init(nsIContent* aContent, |
54 | | nsContainerFrame* aParent, |
55 | | nsIFrame* aPrevInFlow) override; |
56 | | #endif |
57 | | |
58 | | virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
59 | | nsAtom* aAttribute, |
60 | | int32_t aModType) override; |
61 | | |
62 | 0 | virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override { |
63 | 0 | // We don't maintain a visual overflow rect |
64 | 0 | return false; |
65 | 0 | } |
66 | | }; |
67 | | |
68 | | nsIFrame* |
69 | | NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle) |
70 | 0 | { |
71 | 0 | return new (aPresShell) SVGFEContainerFrame(aStyle); |
72 | 0 | } |
73 | | |
74 | | NS_IMPL_FRAMEARENA_HELPERS(SVGFEContainerFrame) |
75 | | |
76 | | #ifdef DEBUG |
77 | | void |
78 | | SVGFEContainerFrame::Init(nsIContent* aContent, |
79 | | nsContainerFrame* aParent, |
80 | | nsIFrame* aPrevInFlow) |
81 | | { |
82 | | NS_ASSERTION(aContent->IsNodeOfType(nsINode::eFILTER), |
83 | | "Trying to construct an SVGFEContainerFrame for a " |
84 | | "content element that doesn't support the right interfaces"); |
85 | | |
86 | | nsContainerFrame::Init(aContent, aParent, aPrevInFlow); |
87 | | } |
88 | | #endif /* DEBUG */ |
89 | | |
90 | | nsresult |
91 | | SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID, |
92 | | nsAtom* aAttribute, |
93 | | int32_t aModType) |
94 | 0 | { |
95 | 0 | nsSVGFE *element = static_cast<nsSVGFE*>(GetContent()); |
96 | 0 | if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) { |
97 | 0 | MOZ_ASSERT(GetParent()->IsSVGFilterFrame(), |
98 | 0 | "Observers observe the filter, so that's what we must invalidate"); |
99 | 0 | SVGObserverUtils::InvalidateDirectRenderingObservers(GetParent()); |
100 | 0 | } |
101 | 0 |
|
102 | 0 | return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); |
103 | 0 | } |