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_SVGTEXTCONTAINERFRAME_H
|
|
|
|
#define NS_SVGTEXTCONTAINERFRAME_H
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "nsFrame.h"
|
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsISVGChildFrame.h"
|
|
|
|
#include "nsQueryFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsSVGContainerFrame.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "nsTArray.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-20 05:15:55 -07:00
|
|
|
class nsFrameList;
|
2012-03-18 03:32:02 -07:00
|
|
|
class nsIDOMSVGRect;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsISVGGlyphFragmentNode;
|
2012-03-20 05:15:55 -07:00
|
|
|
class nsStyleContext;
|
2011-05-07 10:08:41 -07:00
|
|
|
class nsSVGGlyphFrame;
|
2012-03-20 05:15:55 -07:00
|
|
|
class nsSVGTextFrame;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-12-22 20:54:25 -08:00
|
|
|
namespace mozilla {
|
2013-01-06 06:14:43 -08:00
|
|
|
class nsISVGPoint;
|
2012-12-22 20:54:25 -08:00
|
|
|
}
|
|
|
|
|
2009-05-29 03:15:40 -07:00
|
|
|
class nsSVGTextContainerFrame : public nsSVGDisplayContainerFrame
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-05-03 00:45:30 -07:00
|
|
|
protected:
|
2007-03-22 10:30:00 -07:00
|
|
|
nsSVGTextContainerFrame(nsStyleContext* aContext) :
|
|
|
|
nsSVGDisplayContainerFrame(aContext) {}
|
|
|
|
|
2011-05-03 00:45:30 -07:00
|
|
|
public:
|
2008-04-08 05:51:19 -07:00
|
|
|
void NotifyGlyphMetricsChange();
|
2010-12-03 08:40:23 -08:00
|
|
|
virtual void GetXY(SVGUserUnitList *aX, SVGUserUnitList *aY);
|
|
|
|
virtual void GetDxDy(SVGUserUnitList *aDx, SVGUserUnitList *aDy);
|
|
|
|
virtual const SVGNumberList *GetRotate();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsSVGTextContainerFrame)
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2009-01-12 11:20:59 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIFrame
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
2007-08-03 01:39:12 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID, nsIFrame *aOldFrame) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -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);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetExtentOfChar(uint32_t charnum, nsIDOMSVGRect **_retval);
|
|
|
|
NS_IMETHOD GetRotationOfChar(uint32_t charnum, float *_retval);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
2009-05-29 03:15:40 -07:00
|
|
|
* Returns the number of characters in a string
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual uint32_t GetNumberOfChars();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
2009-05-29 03:15:40 -07:00
|
|
|
* Determines the length of a string
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-05-29 03:15:40 -07:00
|
|
|
virtual float GetComputedTextLength();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
2009-05-29 03:15:40 -07:00
|
|
|
* Determines the length of a substring
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual float GetSubStringLength(uint32_t charnum, uint32_t nchars);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
2009-05-29 03:15:40 -07:00
|
|
|
* Get the character at the specified position
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2013-01-06 06:14:43 -08:00
|
|
|
virtual int32_t GetCharNumAtPosition(mozilla::nsISVGPoint *point);
|
2010-09-17 20:46:48 -07:00
|
|
|
void GetEffectiveXY(nsTArray<float> &aX, nsTArray<float> &aY);
|
|
|
|
void GetEffectiveDxDy(nsTArray<float> &aDx, nsTArray<float> &aDy);
|
|
|
|
void GetEffectiveRotate(nsTArray<float> &aRotate);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-05-29 03:15:40 -07:00
|
|
|
protected:
|
2007-03-22 10:30:00 -07:00
|
|
|
/*
|
2009-05-29 03:15:40 -07:00
|
|
|
* Returns the first child node for a frame
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-05-29 03:15:40 -07:00
|
|
|
nsISVGGlyphFragmentNode *
|
|
|
|
GetFirstGlyphFragmentChildNode();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
2009-05-29 03:15:40 -07:00
|
|
|
* Returns the next child node for a frame
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-05-29 03:15:40 -07:00
|
|
|
nsISVGGlyphFragmentNode *
|
|
|
|
GetNextGlyphFragmentChildNode(nsISVGGlyphFragmentNode *node);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-09-17 20:46:48 -07:00
|
|
|
void CopyPositionList(nsTArray<float> *parentList,
|
2010-12-03 08:40:23 -08:00
|
|
|
SVGUserUnitList *selfList,
|
2010-09-17 20:46:48 -07:00
|
|
|
nsTArray<float> &dstList,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aOffset);
|
2010-09-17 20:46:48 -07:00
|
|
|
void CopyRotateList(nsTArray<float> *parentList,
|
2010-12-03 08:40:23 -08:00
|
|
|
const SVGNumberList *selfList,
|
2010-09-17 20:46:48 -07:00
|
|
|
nsTArray<float> &dstList,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aOffset);
|
|
|
|
uint32_t BuildPositionList(uint32_t aOffset, uint32_t aDepth);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-05-03 00:45:30 -07:00
|
|
|
void SetWhitespaceCompression();
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
|
|
|
/*
|
2011-05-07 10:08:41 -07:00
|
|
|
* Returns the glyph frame containing a particular character
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2011-05-07 10:08:41 -07:00
|
|
|
static nsSVGGlyphFrame *
|
|
|
|
GetGlyphFrameAtCharNum(nsISVGGlyphFragmentNode* node,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t charnum,
|
|
|
|
uint32_t *offset);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns the text frame ancestor of this frame (or the frame itself
|
|
|
|
* if this is a text frame)
|
|
|
|
*/
|
|
|
|
nsSVGTextFrame * GetTextFrame();
|
2010-09-17 20:46:48 -07:00
|
|
|
nsTArray<float> mX;
|
|
|
|
nsTArray<float> mY;
|
|
|
|
nsTArray<float> mDx;
|
|
|
|
nsTArray<float> mDy;
|
|
|
|
nsTArray<float> mRotate;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|