2017-10-27 20:33:53 +03: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 15:12:37 +04: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/. */
|
2006-02-21 03:33:27 +03:00
|
|
|
|
2020-07-15 02:40:05 +03:00
|
|
|
#ifndef LAYOUT_SVG_SVGFOREIGNOBJECTFRAME_H_
|
|
|
|
#define LAYOUT_SVG_SVGFOREIGNOBJECTFRAME_H_
|
2006-02-21 03:33:27 +03:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2020-07-09 21:34:54 +03:00
|
|
|
#include "mozilla/ISVGDisplayableFrame.h"
|
2019-04-25 08:04:15 +03:00
|
|
|
#include "mozilla/PresShellForwards.h"
|
2020-02-01 12:40:36 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2007-06-22 03:01:10 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2006-06-15 07:23:56 +04:00
|
|
|
#include "nsRegion.h"
|
2006-02-21 03:33:27 +03:00
|
|
|
|
2014-10-31 23:08:54 +03:00
|
|
|
class gfxContext;
|
2008-09-18 13:47:21 +04:00
|
|
|
|
2020-06-25 23:42:49 +03:00
|
|
|
nsContainerFrame* NS_NewSVGForeignObjectFrame(mozilla::PresShell* aPresShell,
|
|
|
|
mozilla::ComputedStyle* aStyle);
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class SVGForeignObjectFrame final : public nsContainerFrame,
|
2020-07-09 21:34:54 +03:00
|
|
|
public ISVGDisplayableFrame {
|
2020-06-25 23:42:49 +03:00
|
|
|
friend nsContainerFrame* ::NS_NewSVGForeignObjectFrame(
|
2019-04-16 10:24:49 +03:00
|
|
|
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2006-02-21 03:33:27 +03:00
|
|
|
protected:
|
2020-06-25 23:42:49 +03:00
|
|
|
explicit SVGForeignObjectFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext);
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2009-01-09 19:35:24 +03:00
|
|
|
public:
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2020-06-25 23:42:49 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(SVGForeignObjectFrame)
|
2009-01-12 22:20:59 +03:00
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
// nsIFrame:
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2017-11-07 03:20:33 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
2006-03-02 23:22:19 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
2016-01-29 17:42:14 +03:00
|
|
|
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
|
2006-06-07 03:13:15 +04:00
|
|
|
}
|
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2007-01-26 09:58:31 +03:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2012-07-20 22:12:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2018-08-08 01:02:07 +03:00
|
|
|
if (aFlags & eSupportsContainLayoutAndPaint) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-12-18 19:00:47 +03:00
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags & ~nsIFrame::eSVG);
|
2007-02-24 21:33:33 +03:00
|
|
|
}
|
2006-02-21 03:33:27 +03:00
|
|
|
|
2013-12-30 10:50:17 +04:00
|
|
|
virtual bool IsSVGTransformed(Matrix* aOwnTransform,
|
2015-03-21 19:28:04 +03:00
|
|
|
Matrix* aFromParentTransform) const override;
|
2012-07-20 22:12:29 +04:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
2006-02-21 03:33:27 +03:00
|
|
|
return MakeFrameName(u"SVGForeignObject"_ns, aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-07-09 21:34:54 +03:00
|
|
|
// ISVGDisplayableFrame interface:
|
2017-05-18 23:03:41 +03:00
|
|
|
virtual void PaintSVG(gfxContext& aContext, const gfxMatrix& aTransform,
|
|
|
|
imgDrawingParams& aImgParams,
|
|
|
|
const nsIntRect* aDirtyRect = nullptr) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
|
|
|
|
virtual void ReflowSVG() override;
|
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags) override;
|
2013-12-30 10:50:07 +04:00
|
|
|
virtual SVGBBox GetBBoxContribution(const Matrix& aToBBoxUserspace,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aFlags) override;
|
|
|
|
virtual bool IsDisplayContainer() override { return true; }
|
2006-02-21 03:33:27 +03:00
|
|
|
|
2014-09-08 15:28:50 +04:00
|
|
|
gfxMatrix GetCanvasTM();
|
2007-11-20 12:10:18 +03:00
|
|
|
|
2012-08-29 09:39:33 +04:00
|
|
|
nsRect GetInvalidRegion();
|
|
|
|
|
2017-06-16 12:22:33 +03:00
|
|
|
// Return our ::-moz-svg-foreign-content anonymous box.
|
|
|
|
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
|
2017-03-15 21:00:43 +03:00
|
|
|
|
2019-05-25 14:17:49 +03:00
|
|
|
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
|
|
|
|
|
2006-02-21 03:33:27 +03:00
|
|
|
protected:
|
|
|
|
// implementation helpers:
|
2006-06-09 22:08:33 +04:00
|
|
|
void DoReflow();
|
2020-06-25 23:42:49 +03:00
|
|
|
void RequestReflow(IntrinsicDirty aType);
|
2009-06-18 15:31:25 +04:00
|
|
|
|
2007-06-25 12:31:31 +04:00
|
|
|
// If width or height is less than or equal to zero we must disable rendering
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; }
|
2007-06-25 12:31:31 +04:00
|
|
|
|
2020-06-25 23:42:49 +03:00
|
|
|
UniquePtr<gfxMatrix> mCanvasTM;
|
2009-06-11 19:23:43 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mInReflow;
|
2006-02-21 03:33:27 +03:00
|
|
|
};
|
|
|
|
|
2020-06-25 23:42:49 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2020-07-15 02:40:05 +03:00
|
|
|
#endif // LAYOUT_SVG_SVGFOREIGNOBJECTFRAME_H_
|