no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / layout / svg / SVGFEUnstyledLeafFrame.cpp
blob63cb20bfd8d2186322891df0dec359124ddbb525
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/dom/SVGFilters.h"
9 #include "mozilla/PresShell.h"
10 #include "mozilla/SVGObserverUtils.h"
11 #include "nsContainerFrame.h"
12 #include "nsIFrame.h"
13 #include "nsGkAtoms.h"
15 nsIFrame* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell* aPresShell,
16 mozilla::ComputedStyle* aStyle);
18 namespace mozilla {
20 class SVGFEUnstyledLeafFrame final : public nsIFrame {
21 friend nsIFrame* ::NS_NewSVGFEUnstyledLeafFrame(
22 mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
24 protected:
25 explicit SVGFEUnstyledLeafFrame(ComputedStyle* aStyle,
26 nsPresContext* aPresContext)
27 : nsIFrame(aStyle, aPresContext, kClassID) {
28 AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
31 public:
32 NS_DECL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
34 void BuildDisplayList(nsDisplayListBuilder* aBuilder,
35 const nsDisplayListSet& aLists) override {}
37 #ifdef DEBUG_FRAME_DUMP
38 nsresult GetFrameName(nsAString& aResult) const override {
39 return MakeFrameName(u"SVGFEUnstyledLeaf"_ns, aResult);
41 #endif
43 nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
44 int32_t aModType) override;
46 bool ComputeCustomOverflow(OverflowAreas& aOverflowAreas) override {
47 // We don't maintain a ink overflow rect
48 return false;
52 } // namespace mozilla
54 nsIFrame* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell* aPresShell,
55 mozilla::ComputedStyle* aStyle) {
56 return new (aPresShell)
57 mozilla::SVGFEUnstyledLeafFrame(aStyle, aPresShell->GetPresContext());
60 namespace mozilla {
62 NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
64 nsresult SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
65 nsAtom* aAttribute,
66 int32_t aModType) {
67 auto* element =
68 static_cast<mozilla::dom::SVGFilterPrimitiveChildElement*>(GetContent());
69 if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
70 MOZ_ASSERT(
71 GetParent()->GetParent()->IsSVGFilterFrame(),
72 "Observers observe the filter, so that's what we must invalidate");
73 SVGObserverUtils::InvalidateRenderingObservers(GetParent()->GetParent());
76 return nsIFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
79 } // namespace mozilla