Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03: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/. */
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2012-03-26 15:58:59 +04:00
|
|
|
// Main header first:
|
2006-06-28 19:23:40 +04:00
|
|
|
#include "nsSVGTextFrame.h"
|
2012-03-26 15:58:59 +04:00
|
|
|
|
|
|
|
// Keep others in (case-insensitive) order:
|
|
|
|
#include "nsGkAtoms.h"
|
2013-03-26 19:53:13 +04:00
|
|
|
#include "mozilla/dom/SVGIRect.h"
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
#include "nsISVGGlyphFragmentNode.h"
|
2013-04-25 13:18:42 +04:00
|
|
|
#include "nsSVGEffects.h"
|
2011-05-07 21:08:41 +04:00
|
|
|
#include "nsSVGGlyphFrame.h"
|
2012-06-30 15:20:46 +04:00
|
|
|
#include "nsSVGIntegrationUtils.h"
|
2012-03-26 15:58:59 +04:00
|
|
|
#include "nsSVGTextPathFrame.h"
|
2005-08-26 06:49:52 +04:00
|
|
|
#include "nsSVGUtils.h"
|
2013-01-03 10:17:03 +04:00
|
|
|
#include "SVGGraphicsElement.h"
|
2012-03-26 15:58:59 +04:00
|
|
|
#include "SVGLengthList.h"
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2010-07-17 01:42:12 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2005-11-11 05:36:29 +03:00
|
|
|
nsIFrame*
|
2009-01-19 21:31:34 +03:00
|
|
|
NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) nsSVGTextFrame(aContext);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
}
|
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsSVGTextFrame)
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIFrame methods
|
2009-01-19 21:31:34 +03:00
|
|
|
#ifdef DEBUG
|
2013-03-20 05:47:48 +04:00
|
|
|
void
|
2009-01-19 21:31:34 +03:00
|
|
|
nsSVGTextFrame::Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
2013-01-08 07:22:41 +04:00
|
|
|
NS_ASSERTION(aContent->IsSVG(nsGkAtoms::text),
|
|
|
|
"Content is not an SVG text");
|
2009-01-19 21:31:34 +03:00
|
|
|
|
2013-03-20 05:47:48 +04:00
|
|
|
nsSVGTextFrameBase::Init(aContent, aParent, aPrevInFlow);
|
2009-01-19 21:31:34 +03:00
|
|
|
}
|
|
|
|
#endif /* DEBUG */
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsSVGTextFrame::AttributeChanged(int32_t aNameSpaceID,
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aModType)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
{
|
2006-03-02 23:22:19 +03:00
|
|
|
if (aNameSpaceID != kNameSpaceID_None)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
if (aAttribute == nsGkAtoms::transform) {
|
2013-05-23 11:04:21 +04:00
|
|
|
// We don't invalidate for transform changes (the layers code does that).
|
|
|
|
// Also note that SVGTransformableElement::GetAttributeChangeHint will
|
|
|
|
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
|
|
|
|
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
|
2012-01-28 17:58:17 +04:00
|
|
|
NotifySVGChanged(TRANSFORM_CHANGED);
|
2006-03-02 23:22:19 +03:00
|
|
|
} else if (aAttribute == nsGkAtoms::x ||
|
|
|
|
aAttribute == nsGkAtoms::y ||
|
|
|
|
aAttribute == nsGkAtoms::dx ||
|
2010-10-17 20:27:49 +04:00
|
|
|
aAttribute == nsGkAtoms::dy ||
|
|
|
|
aAttribute == nsGkAtoms::rotate) {
|
2013-04-25 13:18:42 +04:00
|
|
|
nsSVGEffects::InvalidateRenderingObservers(this);
|
2012-11-28 13:42:13 +04:00
|
|
|
nsSVGUtils::ScheduleReflowSVG(this);
|
2006-12-06 12:34:14 +03:00
|
|
|
NotifyGlyphMetricsChange();
|
2006-03-02 23:22:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
}
|
|
|
|
|
2005-04-01 23:56:08 +04:00
|
|
|
nsIAtom *
|
|
|
|
nsSVGTextFrame::GetType() const
|
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
return nsGkAtoms::svgTextFrame;
|
2005-04-01 23:56:08 +04:00
|
|
|
}
|
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
void
|
2012-07-20 22:12:29 +04:00
|
|
|
nsSVGTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
|
|
|
UpdateGlyphPositioning(true);
|
2013-02-14 15:12:27 +04:00
|
|
|
nsSVGTextFrameBase::BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
2012-07-20 22:12:29 +04:00
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
//----------------------------------------------------------------------
|
2009-05-29 14:15:40 +04:00
|
|
|
// nsSVGTextContainerFrame
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t
|
2009-05-29 14:15:40 +04:00
|
|
|
nsSVGTextFrame::GetNumberOfChars()
|
2006-02-18 00:24:30 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
2006-02-18 00:24:30 +03:00
|
|
|
|
2009-05-29 14:15:40 +04:00
|
|
|
return nsSVGTextFrameBase::GetNumberOfChars();
|
2006-02-18 00:24:30 +03:00
|
|
|
}
|
|
|
|
|
2009-05-29 14:15:40 +04:00
|
|
|
float
|
|
|
|
nsSVGTextFrame::GetComputedTextLength()
|
2006-02-18 00:24:30 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
2006-02-18 00:24:30 +03:00
|
|
|
|
2009-05-29 14:15:40 +04:00
|
|
|
return nsSVGTextFrameBase::GetComputedTextLength();
|
2006-02-18 00:24:30 +03:00
|
|
|
}
|
|
|
|
|
2009-05-29 14:15:40 +04:00
|
|
|
float
|
2012-08-22 19:56:38 +04:00
|
|
|
nsSVGTextFrame::GetSubStringLength(uint32_t charnum, uint32_t nchars)
|
2009-05-29 14:15:40 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
2009-05-29 14:15:40 +04:00
|
|
|
|
|
|
|
return nsSVGTextFrameBase::GetSubStringLength(charnum, nchars);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t
|
2013-01-06 18:14:43 +04:00
|
|
|
nsSVGTextFrame::GetCharNumAtPosition(nsISVGPoint *point)
|
2006-02-18 00:24:30 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
2006-02-18 00:24:30 +03:00
|
|
|
|
2009-05-29 14:15:40 +04:00
|
|
|
return nsSVGTextFrameBase::GetCharNumAtPosition(point);
|
2006-02-18 00:24:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-12-23 08:54:25 +04:00
|
|
|
nsSVGTextFrame::GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval)
|
2006-02-18 00:24:30 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
2006-02-18 00:24:30 +03:00
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
return nsSVGTextFrameBase::GetStartPositionOfChar(charnum, _retval);
|
2006-02-18 00:24:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-12-23 08:54:25 +04:00
|
|
|
nsSVGTextFrame::GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval)
|
2006-02-18 00:24:30 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
2006-02-18 00:24:30 +03:00
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
return nsSVGTextFrameBase::GetEndPositionOfChar(charnum, _retval);
|
2006-02-18 00:24:30 +03:00
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
NS_IMETHODIMP
|
2013-03-26 19:53:13 +04:00
|
|
|
nsSVGTextFrame::GetExtentOfChar(uint32_t charnum, dom::SVGIRect **_retval)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
return nsSVGTextFrameBase::GetExtentOfChar(charnum, _retval);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
}
|
|
|
|
|
2006-02-18 00:24:30 +03:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsSVGTextFrame::GetRotationOfChar(uint32_t charnum, float *_retval)
|
2006-02-18 00:24:30 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
2006-02-18 00:24:30 +03:00
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
return nsSVGTextFrameBase::GetRotationOfChar(charnum, _retval);
|
2006-02-18 00:24:30 +03:00
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGChildFrame methods
|
|
|
|
|
2008-01-25 12:27:03 +03:00
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
nsSVGTextFrame::NotifySVGChanged(uint32_t aFlags)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
{
|
2012-03-11 19:53:36 +04:00
|
|
|
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
|
|
|
"Invalidation logic may need adjusting");
|
|
|
|
|
2012-01-28 17:58:17 +04:00
|
|
|
bool updateGlyphMetrics = false;
|
|
|
|
|
|
|
|
if (aFlags & COORD_CONTEXT_CHANGED) {
|
|
|
|
updateGlyphMetrics = true;
|
|
|
|
}
|
|
|
|
|
2008-01-25 12:27:03 +03:00
|
|
|
if (aFlags & TRANSFORM_CHANGED) {
|
2012-01-28 17:58:17 +04:00
|
|
|
if (mCanvasTM && mCanvasTM->IsSingular()) {
|
|
|
|
// We won't have calculated the glyph positions correctly
|
|
|
|
updateGlyphMetrics = true;
|
|
|
|
}
|
2008-01-25 12:27:03 +03:00
|
|
|
// make sure our cached transform matrix gets (lazily) updated
|
2012-07-30 18:20:58 +04:00
|
|
|
mCanvasTM = nullptr;
|
2008-01-25 12:27:03 +03:00
|
|
|
}
|
2006-06-01 19:31:15 +04:00
|
|
|
|
2012-06-23 20:36:46 +04:00
|
|
|
if (updateGlyphMetrics) {
|
|
|
|
// Ancestor changes can't affect how we render from the perspective of
|
|
|
|
// any rendering observers that we may have, so we don't need to
|
|
|
|
// invalidate them. We also don't need to invalidate ourself, since our
|
|
|
|
// changed ancestor will have invalidated its entire area, which includes
|
|
|
|
// our area.
|
|
|
|
// For perf reasons we call this before calling NotifySVGChanged() below.
|
2012-07-22 04:01:44 +04:00
|
|
|
nsSVGUtils::ScheduleReflowSVG(this);
|
2012-06-23 20:36:46 +04:00
|
|
|
}
|
|
|
|
|
2009-12-12 17:37:20 +03:00
|
|
|
nsSVGTextFrameBase::NotifySVGChanged(aFlags);
|
|
|
|
|
2012-01-28 17:58:17 +04:00
|
|
|
if (updateGlyphMetrics) {
|
2008-01-25 12:27:03 +03:00
|
|
|
// If we are positioned using percentage values we need to update our
|
|
|
|
// position whenever our viewport's dimensions change.
|
|
|
|
|
|
|
|
// XXX We could check here whether the text frame or any of its children
|
|
|
|
// have any percentage co-ordinates and only update if they don't. This
|
|
|
|
// may not be worth it as we might need to check each glyph
|
|
|
|
NotifyGlyphMetricsChange();
|
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
}
|
|
|
|
|
2008-03-18 22:50:29 +03:00
|
|
|
NS_IMETHODIMP
|
2012-03-02 12:28:59 +04:00
|
|
|
nsSVGTextFrame::PaintSVG(nsRenderingContext* aContext,
|
2008-10-20 12:42:03 +04:00
|
|
|
const nsIntRect *aDirtyRect)
|
2008-03-18 22:50:29 +03:00
|
|
|
{
|
2012-07-20 22:12:29 +04:00
|
|
|
NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
|
|
|
|
(mState & NS_STATE_SVG_NONDISPLAY_CHILD),
|
|
|
|
"If display lists are enabled, only painting of non-display "
|
|
|
|
"SVG should take this code path");
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(true);
|
2008-03-18 22:50:29 +03:00
|
|
|
|
|
|
|
return nsSVGTextFrameBase::PaintSVG(aContext, aDirtyRect);
|
|
|
|
}
|
|
|
|
|
2008-08-25 13:23:54 +04:00
|
|
|
NS_IMETHODIMP_(nsIFrame*)
|
|
|
|
nsSVGTextFrame::GetFrameForPoint(const nsPoint &aPoint)
|
2008-03-18 22:50:29 +03:00
|
|
|
{
|
2012-07-20 22:12:29 +04:00
|
|
|
NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() ||
|
|
|
|
(mState & NS_STATE_SVG_NONDISPLAY_CHILD),
|
|
|
|
"If display lists are enabled, only hit-testing of non-display "
|
|
|
|
"SVG should take this code path");
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(true);
|
2008-03-18 22:50:29 +03:00
|
|
|
|
2008-08-25 13:23:54 +04:00
|
|
|
return nsSVGTextFrameBase::GetFrameForPoint(aPoint);
|
2008-03-18 22:50:29 +03:00
|
|
|
}
|
|
|
|
|
2012-03-20 16:15:53 +04:00
|
|
|
void
|
2012-07-22 04:01:44 +04:00
|
|
|
nsSVGTextFrame::ReflowSVG()
|
2008-03-18 22:50:29 +03:00
|
|
|
{
|
2012-07-22 04:01:44 +04:00
|
|
|
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
|
|
|
|
"This call is probably a wasteful mistake");
|
2008-03-18 22:50:29 +03:00
|
|
|
|
2012-03-20 16:15:53 +04:00
|
|
|
NS_ABORT_IF_FALSE(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
2012-07-22 04:01:44 +04:00
|
|
|
"ReflowSVG mechanism not designed for this");
|
2012-03-20 16:15:53 +04:00
|
|
|
|
2012-07-22 04:01:44 +04:00
|
|
|
if (!nsSVGUtils::NeedsReflowSVG(this)) {
|
2012-03-20 16:15:53 +04:00
|
|
|
NS_ASSERTION(!mPositioningDirty, "How did this happen?");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// UpdateGlyphPositioning may have been called under DOM calls and set
|
|
|
|
// mPositioningDirty to false. We may now have better positioning, though, so
|
|
|
|
// set it to true so that UpdateGlyphPositioning will do its work.
|
|
|
|
mPositioningDirty = true;
|
2012-03-20 16:15:53 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(false);
|
2008-07-30 23:28:12 +04:00
|
|
|
|
2012-11-06 21:00:11 +04:00
|
|
|
// We leave it up to nsSVGTextFrameBase::ReflowSVG to invalidate. XXXSDL
|
2012-03-20 16:15:53 +04:00
|
|
|
// With glyph positions updated, our descendants can invalidate their new
|
|
|
|
// areas correctly:
|
2012-07-22 04:01:44 +04:00
|
|
|
nsSVGTextFrameBase::ReflowSVG();
|
2012-03-20 16:15:53 +04:00
|
|
|
}
|
2008-07-30 23:28:12 +04:00
|
|
|
|
2012-04-16 12:23:48 +04:00
|
|
|
SVGBBox
|
2011-09-30 13:25:37 +04:00
|
|
|
nsSVGTextFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aFlags)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
UpdateGlyphPositioning(true);
|
2006-06-28 19:23:40 +04:00
|
|
|
|
2011-09-30 13:25:37 +04:00
|
|
|
return nsSVGTextFrameBase::GetBBoxContribution(aToBBoxUserspace, aFlags);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2006-06-01 19:31:15 +04:00
|
|
|
// nsSVGContainerFrame methods:
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2009-04-29 08:31:34 +04:00
|
|
|
gfxMatrix
|
2012-08-22 19:56:38 +04:00
|
|
|
nsSVGTextFrame::GetCanvasTM(uint32_t aFor)
|
2004-08-05 13:01:13 +04:00
|
|
|
{
|
2012-06-30 15:20:46 +04:00
|
|
|
if (!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
|
|
|
|
if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) ||
|
|
|
|
(aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) {
|
|
|
|
return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-07 02:30:40 +04:00
|
|
|
if (!mCanvasTM) {
|
2004-08-05 13:01:13 +04:00
|
|
|
NS_ASSERTION(mParent, "null parent");
|
2009-04-29 08:31:34 +04:00
|
|
|
|
|
|
|
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
|
2013-01-03 10:17:03 +04:00
|
|
|
dom::SVGGraphicsElement *content = static_cast<dom::SVGGraphicsElement*>(mContent);
|
2009-04-29 08:31:34 +04:00
|
|
|
|
2012-06-30 15:20:46 +04:00
|
|
|
gfxMatrix tm =
|
|
|
|
content->PrependLocalTransformsTo(parent->GetCanvasTM(aFor));
|
2009-04-29 08:31:34 +04:00
|
|
|
|
2011-09-26 01:04:32 +04:00
|
|
|
mCanvasTM = new gfxMatrix(tm);
|
2004-08-05 13:01:13 +04:00
|
|
|
}
|
|
|
|
|
2011-09-26 01:04:32 +04:00
|
|
|
return *mCanvasTM;
|
2004-08-05 13:01:13 +04:00
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
//----------------------------------------------------------------------
|
2006-06-28 19:23:40 +04:00
|
|
|
//
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2012-06-23 20:36:46 +04:00
|
|
|
static void
|
|
|
|
MarkDirtyBitsOnDescendants(nsIFrame *aFrame)
|
|
|
|
{
|
2012-06-24 21:02:23 +04:00
|
|
|
// Do not skip marking of aFrame or any of its descendants if they have
|
|
|
|
// the NS_FRAME_IS_DIRTY set, because some of their descendants may not
|
|
|
|
// have it set, and we need all descendants to be dirty.
|
|
|
|
if (aFrame->GetStateBits() & (NS_FRAME_FIRST_REFLOW)) {
|
|
|
|
// Nothing to do if our outer-<svg> hasn't yet had its initial reflow.
|
2012-06-23 20:36:46 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsIFrame* kid = aFrame->GetFirstPrincipalChild();
|
|
|
|
while (kid) {
|
|
|
|
nsISVGChildFrame* svgkid = do_QueryFrame(kid);
|
2012-06-24 21:02:23 +04:00
|
|
|
if (svgkid) {
|
2012-06-23 20:36:46 +04:00
|
|
|
MarkDirtyBitsOnDescendants(kid);
|
|
|
|
kid->AddStateBits(NS_FRAME_IS_DIRTY);
|
|
|
|
}
|
|
|
|
kid = kid->GetNextSibling();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
void
|
2006-11-14 03:48:33 +03:00
|
|
|
nsSVGTextFrame::NotifyGlyphMetricsChange()
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
{
|
2012-06-23 20:36:46 +04:00
|
|
|
// NotifySVGChanged isn't appropriate here, so we just mark our descendants
|
2012-07-22 04:01:44 +04:00
|
|
|
// as fully dirty to get ReflowSVG() called on them:
|
2012-06-23 20:36:46 +04:00
|
|
|
MarkDirtyBitsOnDescendants(this);
|
|
|
|
|
2013-04-25 13:18:42 +04:00
|
|
|
nsSVGEffects::InvalidateRenderingObservers(this);
|
2012-11-28 13:42:13 +04:00
|
|
|
nsSVGUtils::ScheduleReflowSVG(this);
|
2012-03-20 16:15:53 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
mPositioningDirty = true;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
}
|
|
|
|
|
2011-05-03 11:45:30 +04:00
|
|
|
void
|
2011-05-07 21:08:41 +04:00
|
|
|
nsSVGTextFrame::SetWhitespaceHandling(nsSVGGlyphFrame *aFrame)
|
2011-05-03 11:45:30 +04:00
|
|
|
{
|
|
|
|
SetWhitespaceCompression();
|
|
|
|
|
2012-01-14 14:07:26 +04:00
|
|
|
nsSVGGlyphFrame* firstFrame = aFrame;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool trimLeadingWhitespace = true;
|
2011-05-07 21:08:41 +04:00
|
|
|
nsSVGGlyphFrame* lastNonWhitespaceFrame = aFrame;
|
2011-05-03 11:45:30 +04:00
|
|
|
|
2012-01-14 14:07:26 +04:00
|
|
|
// If the previous frame ended with whitespace
|
|
|
|
// then display of leading whitespace should be suppressed
|
|
|
|
// when we are compressing whitespace.
|
2011-05-07 21:08:41 +04:00
|
|
|
while (aFrame) {
|
|
|
|
if (!aFrame->IsAllWhitespace()) {
|
|
|
|
lastNonWhitespaceFrame = aFrame;
|
2011-05-03 11:45:30 +04:00
|
|
|
}
|
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
aFrame->SetTrimLeadingWhitespace(trimLeadingWhitespace);
|
|
|
|
trimLeadingWhitespace = aFrame->EndsWithWhitespace();
|
2011-05-03 11:45:30 +04:00
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
aFrame = aFrame->GetNextGlyphFrame();
|
2011-05-03 11:45:30 +04:00
|
|
|
}
|
|
|
|
|
2012-01-14 14:07:26 +04:00
|
|
|
// When there is only whitespace left we need to trim off
|
|
|
|
// the end of the last frame that isn't entirely whitespace.
|
|
|
|
// Making sure that we reset earlier frames as they may once
|
|
|
|
// have been the last non-whitespace frame.
|
|
|
|
aFrame = firstFrame;
|
|
|
|
while (aFrame != lastNonWhitespaceFrame) {
|
|
|
|
aFrame->SetTrimTrailingWhitespace(false);
|
|
|
|
aFrame = aFrame->GetNextGlyphFrame();
|
|
|
|
}
|
|
|
|
|
2012-02-24 14:20:53 +04:00
|
|
|
// We're at the last non-whitespace frame so trim off the end
|
|
|
|
// and make sure we set one of the trim bits so that any
|
|
|
|
// further whitespace is compressed to nothing
|
|
|
|
while (aFrame) {
|
|
|
|
aFrame->SetTrimTrailingWhitespace(true);
|
|
|
|
aFrame = aFrame->GetNextGlyphFrame();
|
|
|
|
}
|
2011-05-03 11:45:30 +04:00
|
|
|
}
|
|
|
|
|
2005-03-07 07:02:02 +03:00
|
|
|
void
|
2011-09-29 10:19:26 +04:00
|
|
|
nsSVGTextFrame::UpdateGlyphPositioning(bool aForceGlobalTransform)
|
2005-03-07 07:02:02 +03:00
|
|
|
{
|
2012-03-20 16:15:53 +04:00
|
|
|
if (!mPositioningDirty)
|
2006-11-14 03:48:33 +03:00
|
|
|
return;
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
mPositioningDirty = false;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2006-06-28 19:23:40 +04:00
|
|
|
nsISVGGlyphFragmentNode* node = GetFirstGlyphFragmentChildNode();
|
2011-05-03 11:45:30 +04:00
|
|
|
if (!node)
|
|
|
|
return;
|
2008-04-08 16:51:19 +04:00
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
nsSVGGlyphFrame *frame, *firstFrame;
|
2005-03-07 07:02:02 +03:00
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
firstFrame = node->GetFirstGlyphFrame();
|
|
|
|
if (!firstFrame) {
|
2006-07-19 16:33:35 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-03-07 07:02:02 +03:00
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
SetWhitespaceHandling(firstFrame);
|
2011-05-03 11:45:30 +04:00
|
|
|
|
2010-09-18 07:46:48 +04:00
|
|
|
BuildPositionList(0, 0);
|
2005-10-03 05:21:00 +04:00
|
|
|
|
2010-09-18 07:46:48 +04:00
|
|
|
gfxPoint ctp(0.0, 0.0);
|
2005-10-03 05:21:00 +04:00
|
|
|
|
2005-03-07 07:02:02 +03:00
|
|
|
// loop over chunks
|
2011-05-07 21:08:41 +04:00
|
|
|
while (firstFrame) {
|
|
|
|
nsSVGTextPathFrame *textPath = firstFrame->FindTextPathParent();
|
2010-09-18 07:46:48 +04:00
|
|
|
|
|
|
|
nsTArray<float> effectiveXList, effectiveYList;
|
2011-05-07 21:08:41 +04:00
|
|
|
firstFrame->GetEffectiveXY(firstFrame->GetNumberOfChars(),
|
|
|
|
effectiveXList, effectiveYList);
|
2010-09-18 07:46:48 +04:00
|
|
|
if (!effectiveXList.IsEmpty()) ctp.x = effectiveXList[0];
|
|
|
|
if (!textPath && !effectiveYList.IsEmpty()) ctp.y = effectiveYList[0];
|
2005-03-07 07:02:02 +03:00
|
|
|
|
2007-12-04 09:51:36 +03:00
|
|
|
// check for startOffset on textPath
|
|
|
|
if (textPath) {
|
2009-01-28 12:44:39 +03:00
|
|
|
if (!textPath->GetPathFrame()) {
|
|
|
|
// invalid text path, give up
|
|
|
|
return;
|
|
|
|
}
|
2010-03-30 14:21:19 +04:00
|
|
|
ctp.x = textPath->GetStartOffset();
|
2007-12-04 09:51:36 +03:00
|
|
|
}
|
|
|
|
|
2005-03-07 07:02:02 +03:00
|
|
|
// determine x offset based on text_anchor:
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t anchor = firstFrame->GetTextAnchor();
|
2005-03-07 07:02:02 +03:00
|
|
|
|
2011-01-04 11:52:17 +03:00
|
|
|
/**
|
|
|
|
* XXXsmontagu: The SVG spec is very vague as to how 'text-anchor'
|
|
|
|
* interacts with bidirectional text. It says:
|
|
|
|
*
|
|
|
|
* "For scripts that are inherently right to left such as Hebrew and
|
|
|
|
* Arabic [text-anchor: start] is equivalent to right alignment."
|
|
|
|
* and
|
|
|
|
* "For scripts that are inherently right to left such as Hebrew and
|
|
|
|
* Arabic, [text-anchor: end] is equivalent to left alignment.
|
|
|
|
*
|
|
|
|
* It's not clear how this should be implemented in terms of defined
|
|
|
|
* properties, i.e. how one should determine that a particular element
|
|
|
|
* contains a script that is inherently right to left.
|
|
|
|
*
|
|
|
|
* The code below follows http://www.w3.org/TR/SVGTiny12/text.html#TextAnchorProperty
|
|
|
|
* and swaps the values of text-anchor: end and text-anchor: start
|
|
|
|
* whenever the 'direction' property is rtl.
|
|
|
|
*
|
|
|
|
* This is probably the "right" thing to do, but other browsers don't do it,
|
|
|
|
* so I am leaving it inside #if 0 for now for interoperability.
|
|
|
|
*
|
|
|
|
* See also XXXsmontagu comments in nsSVGGlyphFrame::EnsureTextRun
|
|
|
|
*/
|
|
|
|
#if 0
|
2013-02-17 01:51:02 +04:00
|
|
|
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
2011-01-04 11:52:17 +03:00
|
|
|
if (anchor == NS_STYLE_TEXT_ANCHOR_END) {
|
|
|
|
anchor = NS_STYLE_TEXT_ANCHOR_START;
|
|
|
|
} else if (anchor == NS_STYLE_TEXT_ANCHOR_START) {
|
|
|
|
anchor = NS_STYLE_TEXT_ANCHOR_END;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-03-07 07:02:02 +03:00
|
|
|
float chunkLength = 0.0f;
|
|
|
|
if (anchor != NS_STYLE_TEXT_ANCHOR_START) {
|
|
|
|
// need to get the total chunk length
|
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
frame = firstFrame;
|
|
|
|
while (frame) {
|
|
|
|
chunkLength += frame->GetAdvance(aForceGlobalTransform);
|
|
|
|
frame = frame->GetNextGlyphFrame();
|
|
|
|
if (frame && frame->IsAbsolutelyPositioned())
|
2005-03-07 07:02:02 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (anchor == NS_STYLE_TEXT_ANCHOR_MIDDLE)
|
2010-03-30 14:21:19 +04:00
|
|
|
ctp.x -= chunkLength/2.0f;
|
2005-03-07 07:02:02 +03:00
|
|
|
else if (anchor == NS_STYLE_TEXT_ANCHOR_END)
|
2010-03-30 14:21:19 +04:00
|
|
|
ctp.x -= chunkLength;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
// set position of each frame in this chunk:
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
frame = firstFrame;
|
|
|
|
while (frame) {
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
|
2011-05-07 21:08:41 +04:00
|
|
|
frame->SetGlyphPosition(&ctp, aForceGlobalTransform);
|
|
|
|
frame = frame->GetNextGlyphFrame();
|
|
|
|
if (frame && frame->IsAbsolutelyPositioned())
|
2005-03-07 07:02:02 +03:00
|
|
|
break;
|
|
|
|
}
|
2011-05-07 21:08:41 +04:00
|
|
|
firstFrame = frame;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 15:39:26 +03:00
|
|
|
}
|
|
|
|
}
|