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