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 // Keep in (case-insensitive) order:
8 #include "mozilla/PresShell.h"
9 #include "mozilla/SVGObserverUtils.h"
10 #include "nsContainerFrame.h"
12 #include "nsGkAtoms.h"
14 nsIFrame
* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell
* aPresShell
,
15 mozilla::ComputedStyle
* aStyle
);
19 class SVGFEUnstyledLeafFrame final
: public nsIFrame
{
20 friend nsIFrame
* ::NS_NewSVGFEUnstyledLeafFrame(
21 mozilla::PresShell
* aPresShell
, ComputedStyle
* aStyle
);
24 explicit SVGFEUnstyledLeafFrame(ComputedStyle
* aStyle
,
25 nsPresContext
* aPresContext
)
26 : nsIFrame(aStyle
, aPresContext
, kClassID
) {
27 AddStateBits(NS_FRAME_SVG_LAYOUT
| NS_FRAME_IS_NONDISPLAY
);
31 NS_DECL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame
)
33 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
34 const nsDisplayListSet
& aLists
) override
{}
36 virtual bool IsFrameOfType(uint32_t aFlags
) const override
{
37 if (aFlags
& eSupportsContainLayoutAndPaint
) {
41 return nsIFrame::IsFrameOfType(aFlags
& ~(nsIFrame::eSVG
));
44 #ifdef DEBUG_FRAME_DUMP
45 virtual nsresult
GetFrameName(nsAString
& aResult
) const override
{
46 return MakeFrameName(u
"SVGFEUnstyledLeaf"_ns
, aResult
);
50 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
51 int32_t aModType
) override
;
53 virtual bool ComputeCustomOverflow(OverflowAreas
& aOverflowAreas
) override
{
54 // We don't maintain a ink overflow rect
59 } // namespace mozilla
61 nsIFrame
* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell
* aPresShell
,
62 mozilla::ComputedStyle
* aStyle
) {
63 return new (aPresShell
)
64 mozilla::SVGFEUnstyledLeafFrame(aStyle
, aPresShell
->GetPresContext());
69 NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame
)
71 nsresult
SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID
,
75 static_cast<mozilla::dom::SVGFEUnstyledElement
*>(GetContent());
76 if (element
->AttributeAffectsRendering(aNameSpaceID
, aAttribute
)) {
78 GetParent()->GetParent()->IsSVGFilterFrame(),
79 "Observers observe the filter, so that's what we must invalidate");
80 SVGObserverUtils::InvalidateDirectRenderingObservers(
81 GetParent()->GetParent());
84 return nsIFrame::AttributeChanged(aNameSpaceID
, aAttribute
, aModType
);
87 } // namespace mozilla