2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is the Mozilla SVG project.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is IBM Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2006
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef NS_SVGTEXTCONTAINERFRAME_H
|
|
|
|
#define NS_SVGTEXTCONTAINERFRAME_H
|
|
|
|
|
|
|
|
#include "nsSVGContainerFrame.h"
|
2010-03-30 03:21:19 -07:00
|
|
|
#include "nsIDOMSVGNumberList.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsISVGGlyphFragmentNode;
|
|
|
|
class nsISVGGlyphFragmentLeaf;
|
|
|
|
class nsSVGTextFrame;
|
2010-07-16 14:42:12 -07:00
|
|
|
namespace mozilla {
|
|
|
|
class SVGUserUnitList;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-05-29 03:15:40 -07:00
|
|
|
class nsSVGTextContainerFrame : public nsSVGDisplayContainerFrame
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsSVGTextContainerFrame(nsStyleContext* aContext) :
|
|
|
|
nsSVGDisplayContainerFrame(aContext) {}
|
|
|
|
|
2008-04-08 05:51:19 -07:00
|
|
|
void NotifyGlyphMetricsChange();
|
2010-07-16 14:42:12 -07:00
|
|
|
virtual void GetXY(mozilla::SVGUserUnitList *aX, mozilla::SVGUserUnitList *aY);
|
|
|
|
virtual void GetDxDy(mozilla::SVGUserUnitList *aDx, mozilla::SVGUserUnitList *aDy);
|
2010-03-30 03:21:19 -07:00
|
|
|
virtual already_AddRefed<nsIDOMSVGNumberList> GetRotate();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-01-09 08:35:24 -08:00
|
|
|
public:
|
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
|
2007-08-03 01:39:12 -07:00
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom *aListName, nsIFrame *aOldFrame);
|
|
|
|
|
|
|
|
NS_IMETHOD GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval);
|
|
|
|
NS_IMETHOD GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval);
|
|
|
|
NS_IMETHOD GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval);
|
|
|
|
NS_IMETHOD GetRotationOfChar(PRUint32 charnum, float *_retval);
|
|
|
|
|
|
|
|
/*
|
2009-05-29 03:15:40 -07:00
|
|
|
* Returns the number of characters in a string
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-05-29 03:15:40 -07:00
|
|
|
virtual PRUint32 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
|
|
|
*/
|
2009-05-29 03:15:40 -07:00
|
|
|
virtual float GetSubStringLength(PRUint32 charnum, PRUint32 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
|
|
|
*/
|
2009-05-29 03:15:40 -07:00
|
|
|
virtual PRInt32 GetCharNumAtPosition(nsIDOMSVGPoint *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
|
|
|
|
|
|
|
/*
|
2009-05-29 03:15:40 -07:00
|
|
|
* Set Whitespace handling
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-05-29 03:15:40 -07:00
|
|
|
void SetWhitespaceHandling();
|
2010-09-17 20:46:48 -07:00
|
|
|
void CopyPositionList(nsTArray<float> *parentList,
|
|
|
|
mozilla::SVGUserUnitList *selfList,
|
|
|
|
nsTArray<float> &dstList,
|
|
|
|
PRUint32 aOffset);
|
|
|
|
void CopyRotateList(nsTArray<float> *parentList,
|
|
|
|
nsCOMPtr<nsIDOMSVGNumberList> selfList,
|
|
|
|
nsTArray<float> &dstList,
|
|
|
|
PRUint32 aOffset);
|
|
|
|
PRUint32 BuildPositionList(PRUint32 aOffset, PRUint32 aDepth);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
/*
|
|
|
|
* Returns the glyph fragment containing a particular character
|
|
|
|
*/
|
|
|
|
static nsISVGGlyphFragmentLeaf *
|
|
|
|
GetGlyphFragmentAtCharNum(nsISVGGlyphFragmentNode* node,
|
|
|
|
PRUint32 charnum,
|
|
|
|
PRUint32 *offset);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|