Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : // Keep in (case-insensitive) order:
7 : #include "nsContainerFrame.h"
8 : #include "nsFrame.h"
9 : #include "nsGkAtoms.h"
10 : #include "nsSVGEffects.h"
11 : #include "nsSVGFilters.h"
12 :
13 0 : class SVGFEUnstyledLeafFrame : public nsFrame
14 : {
15 : friend nsIFrame*
16 : NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
17 : protected:
18 0 : explicit SVGFEUnstyledLeafFrame(nsStyleContext* aContext)
19 0 : : nsFrame(aContext, kClassID)
20 : {
21 0 : AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
22 0 : }
23 :
24 : public:
25 0 : NS_DECL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
26 :
27 0 : virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
28 : const nsRect& aDirtyRect,
29 0 : const nsDisplayListSet& aLists) override {}
30 :
31 0 : virtual bool IsFrameOfType(uint32_t aFlags) const override
32 : {
33 0 : return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
34 : }
35 :
36 : #ifdef DEBUG_FRAME_DUMP
37 0 : virtual nsresult GetFrameName(nsAString& aResult) const override
38 : {
39 0 : return MakeFrameName(NS_LITERAL_STRING("SVGFEUnstyledLeaf"), aResult);
40 : }
41 : #endif
42 :
43 : virtual nsresult AttributeChanged(int32_t aNameSpaceID,
44 : nsIAtom* aAttribute,
45 : int32_t aModType) override;
46 :
47 0 : virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
48 : // We don't maintain a visual overflow rect
49 0 : return false;
50 : }
51 : };
52 :
53 : nsIFrame*
54 0 : NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
55 : {
56 0 : return new (aPresShell) SVGFEUnstyledLeafFrame(aContext);
57 : }
58 :
59 0 : NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
60 :
61 : nsresult
62 0 : SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
63 : nsIAtom* aAttribute,
64 : int32_t aModType)
65 : {
66 0 : SVGFEUnstyledElement *element = static_cast<SVGFEUnstyledElement*>(mContent);
67 0 : if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
68 0 : MOZ_ASSERT(GetParent()->GetParent()->IsSVGFilterFrame(),
69 : "Observers observe the filter, so that's what we must invalidate");
70 0 : nsSVGEffects::InvalidateDirectRenderingObservers(GetParent()->GetParent());
71 : }
72 :
73 0 : return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
74 : }
|