2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef NS_SVGTEXTFRAME_H
|
|
|
|
#define NS_SVGTEXTFRAME_H
|
|
|
|
|
2009-04-28 21:31:34 -07:00
|
|
|
#include "gfxMatrix.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "gfxRect.h"
|
|
|
|
#include "nsSVGTextContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-02 00:28:59 -08:00
|
|
|
class nsRenderingContext;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
typedef nsSVGTextContainerFrame nsSVGTextFrameBase;
|
|
|
|
|
2013-03-26 08:53:13 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class SVGIRect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsSVGTextFrame : public nsSVGTextFrameBase
|
|
|
|
{
|
|
|
|
friend nsIFrame*
|
2009-01-19 10:31:34 -08:00
|
|
|
NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2007-08-03 01:39:12 -07:00
|
|
|
nsSVGTextFrame(nsStyleContext* aContext)
|
|
|
|
: nsSVGTextFrameBase(aContext),
|
2011-10-17 07:59:28 -07:00
|
|
|
mPositioningDirty(true) {}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public:
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIFrame:
|
2009-01-19 10:31:34 -08:00
|
|
|
#ifdef DEBUG
|
2013-03-19 18:47:48 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
2009-01-19 10:31:34 -08:00
|
|
|
#endif
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aModType);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::svgTextFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGText"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2012-07-20 11:12:29 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsISVGChildFrame interface:
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags);
|
2008-03-18 12:50:29 -07:00
|
|
|
// Override these four to ensure that UpdateGlyphPositioning is called
|
|
|
|
// to bring glyph positions up to date
|
2012-03-02 00:28:59 -08:00
|
|
|
NS_IMETHOD PaintSVG(nsRenderingContext* aContext,
|
2008-10-20 01:42:03 -07:00
|
|
|
const nsIntRect *aDirtyRect);
|
2008-08-25 02:23:54 -07:00
|
|
|
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint & aPoint);
|
2012-07-21 17:01:44 -07:00
|
|
|
virtual void ReflowSVG();
|
2012-04-16 01:23:48 -07:00
|
|
|
virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsSVGContainerFrame methods:
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual gfxMatrix GetCanvasTM(uint32_t aFor);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-05-29 03:15:40 -07:00
|
|
|
// nsSVGTextContainerFrame methods:
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual uint32_t GetNumberOfChars();
|
2009-05-29 03:15:40 -07:00
|
|
|
virtual float GetComputedTextLength();
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual float GetSubStringLength(uint32_t charnum, uint32_t nchars);
|
2013-01-06 06:14:43 -08:00
|
|
|
virtual int32_t GetCharNumAtPosition(mozilla::nsISVGPoint *point);
|
2009-05-29 03:15:40 -07:00
|
|
|
|
2012-12-22 20:54:25 -08:00
|
|
|
NS_IMETHOD GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval);
|
|
|
|
NS_IMETHOD GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval);
|
2013-03-26 08:53:13 -07:00
|
|
|
NS_IMETHOD GetExtentOfChar(uint32_t charnum, mozilla::dom::SVGIRect **_retval);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetRotationOfChar(uint32_t charnum, float *_retval);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsSVGTextFrame
|
|
|
|
void NotifyGlyphMetricsChange();
|
|
|
|
|
|
|
|
private:
|
2008-03-18 12:50:29 -07:00
|
|
|
/**
|
|
|
|
* @param aForceGlobalTransform passed down to nsSVGGlyphFrames to
|
|
|
|
* control whether they should use the global transform even when
|
|
|
|
* NS_STATE_NONDISPLAY_CHILD
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
void UpdateGlyphPositioning(bool aForceGlobalTransform);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-05-07 10:08:41 -07:00
|
|
|
void SetWhitespaceHandling(nsSVGGlyphFrame *aFrame);
|
2011-05-03 00:45:30 -07:00
|
|
|
|
2011-09-25 14:04:32 -07:00
|
|
|
nsAutoPtr<gfxMatrix> mCanvasTM;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mPositioningDirty;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|