2006-02-21 03:33:27 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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
|
|
|
|
|
|
|
#ifndef NSSVGFOREIGNOBJECTFRAME_H__
|
|
|
|
#define NSSVGFOREIGNOBJECTFRAME_H__
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-06-07 23:10:18 +03:00
|
|
|
#include "nsAutoPtr.h"
|
2007-06-22 03:01:10 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsIPresShell.h"
|
2017-02-09 21:24:31 +03:00
|
|
|
#include "nsSVGDisplayableFrame.h"
|
2006-06-15 07:23:56 +04:00
|
|
|
#include "nsRegion.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsSVGUtils.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
|
|
|
|
2016-04-18 10:05:48 +03:00
|
|
|
class nsSVGForeignObjectFrame : public nsContainerFrame
|
2017-02-09 21:24:31 +03:00
|
|
|
, public nsSVGDisplayableFrame
|
2006-02-21 03:33:27 +03:00
|
|
|
{
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsContainerFrame*
|
2009-01-19 21:31:34 +03:00
|
|
|
NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2006-02-21 03:33:27 +03:00
|
|
|
protected:
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsSVGForeignObjectFrame(nsStyleContext* aContext);
|
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
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
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;
|
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 12:36:33 +04:00
|
|
|
nsIAtom* 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,
|
2016-07-21 13:36:38 +03:00
|
|
|
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,
|
|
|
|
const nsRect& aDirtyRect,
|
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
|
2007-02-24 21:33:33 +03:00
|
|
|
{
|
2016-04-18 10:05:48 +03:00
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
2007-02-24 21:33:33 +03:00
|
|
|
~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
|
|
|
|
}
|
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(NS_LITERAL_STRING("SVGForeignObject"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-02-09 21:24:31 +03:00
|
|
|
// nsSVGDisplayableFrame interface:
|
2017-05-18 22:15:35 +03:00
|
|
|
virtual DrawResult PaintSVG(gfxContext& aContext,
|
|
|
|
const gfxMatrix& aTransform,
|
|
|
|
const nsIntRect* aDirtyRect = nullptr,
|
|
|
|
uint32_t aFlags = 0) 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-03-15 21:00:43 +03:00
|
|
|
/**
|
|
|
|
* Update the style of our ::-moz-svg-foreign-content anonymous box.
|
|
|
|
*/
|
|
|
|
void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
|
|
|
|
nsStyleChangeList& aChangeList,
|
|
|
|
nsChangeHint aHintForThisFrame) override;
|
|
|
|
|
2006-02-21 03:33:27 +03:00
|
|
|
protected:
|
|
|
|
// implementation helpers:
|
2006-06-09 22:08:33 +04:00
|
|
|
void DoReflow();
|
2007-05-05 15:11:07 +04:00
|
|
|
void RequestReflow(nsIPresShell::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
|
|
|
|
2011-09-26 01:04:32 +04:00
|
|
|
nsAutoPtr<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
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|