2017-10-27 17:33:53 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-11-19 17:53:52 +00:00
|
|
|
|
2012-03-26 11:58:59 +00:00
|
|
|
// Keep in (case-insensitive) order:
|
2019-04-16 07:24:49 +00:00
|
|
|
#include "mozilla/PresShell.h"
|
2014-11-06 09:30:11 +00:00
|
|
|
#include "nsContainerFrame.h"
|
2011-11-19 17:53:52 +00:00
|
|
|
#include "nsFrame.h"
|
2012-03-26 11:58:59 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2017-08-30 13:14:46 +00:00
|
|
|
#include "SVGObserverUtils.h"
|
2018-12-21 16:24:17 +00:00
|
|
|
#include "SVGFilters.h"
|
2011-11-19 17:53:52 +00:00
|
|
|
|
2018-11-12 22:20:52 +00:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2018-09-06 01:23:14 +00:00
|
|
|
class SVGFEUnstyledLeafFrame final : public nsFrame {
|
2019-04-16 07:24:49 +00:00
|
|
|
friend nsIFrame* NS_NewSVGFEUnstyledLeafFrame(mozilla::PresShell* aPresShell,
|
2018-03-22 18:20:41 +00:00
|
|
|
ComputedStyle* aStyle);
|
2018-11-30 10:46:48 +00:00
|
|
|
|
2011-11-19 17:53:52 +00:00
|
|
|
protected:
|
2019-02-05 16:45:54 +00:00
|
|
|
explicit SVGFEUnstyledLeafFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext)
|
|
|
|
: nsFrame(aStyle, aPresContext, kClassID) {
|
2013-07-12 07:13:07 +00:00
|
|
|
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_NONDISPLAY);
|
2012-07-16 00:42:50 +00:00
|
|
|
}
|
2011-11-19 17:53:52 +00:00
|
|
|
|
|
|
|
public:
|
2017-05-26 10:11:11 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
|
2011-11-19 17:53:52 +00:00
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsDisplayListSet& aLists) override {}
|
2012-07-20 16:41:29 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2018-08-07 22:02:07 +00:00
|
|
|
if (aFlags & eSupportsContainLayoutAndPaint) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-04-18 07:52:31 +00:00
|
|
|
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
|
2011-11-19 17:53:52 +00:00
|
|
|
}
|
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
2011-11-19 17:53:52 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGFEUnstyledLeaf"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
2015-03-21 16:28:04 +00:00
|
|
|
int32_t aModType) override;
|
2012-08-14 09:04:24 +00:00
|
|
|
|
2016-05-04 00:27:43 +00:00
|
|
|
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
|
2012-08-14 09:04:24 +00:00
|
|
|
// We don't maintain a visual overflow rect
|
|
|
|
return false;
|
|
|
|
}
|
2011-11-19 17:53:52 +00:00
|
|
|
};
|
|
|
|
|
2019-04-16 07:24:49 +00:00
|
|
|
nsIFrame* NS_NewSVGFEUnstyledLeafFrame(PresShell* aPresShell,
|
2018-03-22 18:20:41 +00:00
|
|
|
ComputedStyle* aStyle) {
|
2019-02-05 16:45:54 +00:00
|
|
|
return new (aPresShell)
|
|
|
|
SVGFEUnstyledLeafFrame(aStyle, aPresShell->GetPresContext());
|
2011-11-19 17:53:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
|
2017-10-02 22:05:19 +00:00
|
|
|
nsAtom* aAttribute,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aModType) {
|
2017-08-26 22:58:38 +00:00
|
|
|
SVGFEUnstyledElement* element =
|
|
|
|
static_cast<SVGFEUnstyledElement*>(GetContent());
|
2011-11-19 17:53:52 +00:00
|
|
|
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
|
2017-04-30 15:30:08 +00:00
|
|
|
MOZ_ASSERT(
|
|
|
|
GetParent()->GetParent()->IsSVGFilterFrame(),
|
2014-11-06 09:30:11 +00:00
|
|
|
"Observers observe the filter, so that's what we must invalidate");
|
2017-08-30 14:58:31 +00:00
|
|
|
SVGObserverUtils::InvalidateDirectRenderingObservers(
|
|
|
|
GetParent()->GetParent());
|
2011-11-19 17:53:52 +00:00
|
|
|
}
|
|
|
|
|
2016-04-18 07:52:31 +00:00
|
|
|
return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
|
2011-11-19 17:53:52 +00:00
|
|
|
}
|