2006-06-28 19:23:40 +04: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-06-28 19:23:40 +04:00
|
|
|
|
|
|
|
#ifndef NS_SVGTEXTFRAME_H
|
|
|
|
#define NS_SVGTEXTFRAME_H
|
|
|
|
|
2013-05-29 23:37:49 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2009-04-29 08:31:34 +04:00
|
|
|
#include "gfxMatrix.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "gfxRect.h"
|
|
|
|
#include "nsSVGTextContainerFrame.h"
|
2006-06-28 19:23:40 +04:00
|
|
|
|
2012-03-02 12:28:59 +04:00
|
|
|
class nsRenderingContext;
|
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
typedef nsSVGTextContainerFrame nsSVGTextFrameBase;
|
|
|
|
|
2013-03-26 19:53:13 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class SVGIRect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-05 23:04:17 +03:00
|
|
|
class nsSVGTextFrame : public nsSVGTextFrameBase
|
2006-06-28 19:23:40 +04:00
|
|
|
{
|
|
|
|
friend nsIFrame*
|
2009-01-19 21:31:34 +03:00
|
|
|
NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2006-06-28 19:23:40 +04:00
|
|
|
protected:
|
2013-06-24 15:20:38 +04:00
|
|
|
nsSVGTextFrame(nsStyleContext* aContext) : nsSVGTextFrameBase(aContext)
|
|
|
|
{
|
|
|
|
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
|
|
|
|
}
|
2006-06-28 19:23:40 +04:00
|
|
|
|
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
// nsIFrame:
|
2009-01-19 21:31:34 +03:00
|
|
|
#ifdef DEBUG
|
2013-03-20 05:47:48 +04:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
2009-01-19 21:31:34 +03:00
|
|
|
#endif
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2006-06-28 19:23:40 +04:00
|
|
|
nsIAtom* aAttribute,
|
2013-05-29 23:37:49 +04:00
|
|
|
int32_t aModType) MOZ_OVERRIDE;
|
2006-06-28 19:23:40 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::svgTextFrame
|
2006-06-28 19:23:40 +04:00
|
|
|
*/
|
2013-05-29 23:37:49 +04:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2006-06-28 19:23:40 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2013-05-29 23:37:49 +04:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
|
2006-06-28 19:23:40 +04:00
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGText"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2012-07-20 22:12:29 +04:00
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
// nsISVGChildFrame interface:
|
2013-05-29 23:37:49 +04:00
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
|
2008-03-18 22:50:29 +03:00
|
|
|
// Override these four to ensure that UpdateGlyphPositioning is called
|
|
|
|
// to bring glyph positions up to date
|
2012-03-02 12:28:59 +04:00
|
|
|
NS_IMETHOD PaintSVG(nsRenderingContext* aContext,
|
2013-09-11 11:27:45 +04:00
|
|
|
const nsIntRect *aDirtyRect,
|
|
|
|
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
|
2013-05-29 23:37:49 +04:00
|
|
|
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint & aPoint) MOZ_OVERRIDE;
|
|
|
|
virtual void ReflowSVG() MOZ_OVERRIDE;
|
2012-04-16 12:23:48 +04:00
|
|
|
virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
2013-05-29 23:37:49 +04:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
2006-06-28 19:23:40 +04:00
|
|
|
|
|
|
|
// nsSVGContainerFrame methods:
|
2013-09-11 11:27:45 +04:00
|
|
|
virtual gfxMatrix GetCanvasTM(uint32_t aFor,
|
|
|
|
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
|
2006-06-28 19:23:40 +04:00
|
|
|
|
2009-05-29 14:15:40 +04:00
|
|
|
// nsSVGTextContainerFrame methods:
|
2013-05-29 23:37:49 +04: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;
|
2006-06-28 19:23:40 +04:00
|
|
|
|
2006-11-14 03:48:33 +03:00
|
|
|
// nsSVGTextFrame
|
|
|
|
void NotifyGlyphMetricsChange();
|
2006-06-28 19:23:40 +04:00
|
|
|
|
|
|
|
private:
|
2008-03-18 22:50:29 +03: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 10:19:26 +04:00
|
|
|
void UpdateGlyphPositioning(bool aForceGlobalTransform);
|
2006-06-28 19:23:40 +04:00
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
void SetWhitespaceHandling(nsSVGGlyphFrame *aFrame);
|
2011-05-03 11:45:30 +04:00
|
|
|
|
2011-09-26 01:04:32 +04:00
|
|
|
nsAutoPtr<gfxMatrix> mCanvasTM;
|
2006-06-28 19:23:40 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|