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
|
|
|
|
|
2013-05-29 12:37:49 -07:00
|
|
|
#include "mozilla/Attributes.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:
|
2013-06-24 04:20:38 -07:00
|
|
|
nsSVGTextFrame(nsStyleContext* aContext) : nsSVGTextFrameBase(aContext)
|
|
|
|
{
|
|
|
|
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
|
|
|
|
}
|
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,
|
2013-05-29 12:37:49 -07:00
|
|
|
int32_t aModType) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::svgTextFrame
|
|
|
|
*/
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2013-05-29 12:37:49 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
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:
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
|
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,
|
2013-05-29 12:37:49 -07:00
|
|
|
const nsIntRect *aDirtyRect) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint & aPoint) MOZ_OVERRIDE;
|
|
|
|
virtual void ReflowSVG() MOZ_OVERRIDE;
|
2012-04-16 01:23:48 -07:00
|
|
|
virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
2013-05-29 12:37:49 -07:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsSVGContainerFrame methods:
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual gfxMatrix GetCanvasTM(uint32_t aFor) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-05-29 03:15:40 -07:00
|
|
|
// nsSVGTextContainerFrame methods:
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual uint32_t GetNumberOfChars() MOZ_OVERRIDE;
|
|
|
|
virtual float GetComputedTextLength() MOZ_OVERRIDE;
|
|
|
|
virtual float GetSubStringLength(uint32_t charnum, uint32_t nchars) MOZ_OVERRIDE;
|
|
|
|
virtual int32_t GetCharNumAtPosition(mozilla::nsISVGPoint *point) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
NS_IMETHOD GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD GetExtentOfChar(uint32_t charnum, mozilla::dom::SVGIRect **_retval) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD GetRotationOfChar(uint32_t charnum, float *_retval) MOZ_OVERRIDE;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|