mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-03 04:52:54 +00:00
Bug 889736, part 1 - Remove nsSVGTextFrame and nsSVGGlyphFrame. r=heycam
This commit is contained in:
parent
d13b49a882
commit
a2e2acfb91
@ -1848,7 +1848,6 @@ GK_ATOM(svgFilterFrame, "SVGFilterFrame")
|
||||
GK_ATOM(svgForeignObjectFrame, "SVGForeignObjectFrame")
|
||||
GK_ATOM(svgGenericContainerFrame, "SVGGenericContainerFrame")
|
||||
GK_ATOM(svgGFrame, "SVGGFrame")
|
||||
GK_ATOM(svgGlyphFrame, "SVGGlyphFrame")
|
||||
GK_ATOM(svgGradientFrame, "SVGGradientFrame")
|
||||
GK_ATOM(svgImageFrame, "SVGImageFrame")
|
||||
GK_ATOM(svgInnerSVGFrame, "SVGInnerSVGFrame")
|
||||
@ -1863,7 +1862,6 @@ GK_ATOM(svgPatternFrame, "SVGPatternFrame")
|
||||
GK_ATOM(svgRadialGradientFrame, "SVGRadialGradientFrame")
|
||||
GK_ATOM(svgStopFrame, "SVGStopFrame")
|
||||
GK_ATOM(svgSwitchFrame, "SVGSwitchFrame")
|
||||
GK_ATOM(svgTextFrame, "SVGTextFrame")
|
||||
GK_ATOM(svgTextFrame2, "SVGTextFrame2")
|
||||
GK_ATOM(svgTextPathFrame, "SVGTextPathFrame")
|
||||
GK_ATOM(svgTSpanFrame, "SVGTSpanFrame")
|
||||
|
@ -204,10 +204,7 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
|
||||
}
|
||||
}
|
||||
if (aChange & nsChangeHint_UpdateTextPath) {
|
||||
if (aFrame->GetType() == nsGkAtoms::svgTextPathFrame) {
|
||||
// Invalidate and reflow the entire nsSVGTextFrame:
|
||||
static_cast<nsSVGTextPathFrame*>(aFrame)->NotifyGlyphMetricsChange();
|
||||
} else if (aFrame->IsSVGText()) {
|
||||
if (aFrame->IsSVGText()) {
|
||||
// Invalidate and reflow the entire nsSVGTextFrame2:
|
||||
NS_ASSERTION(aFrame->GetContent()->IsSVG(nsGkAtoms::textPath),
|
||||
"expected frame for a <textPath> element");
|
||||
|
@ -122,12 +122,8 @@ NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGAFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGSwitchFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGTextFrame2(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGTSpanFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
@ -3160,13 +3156,6 @@ nsCSSFrameConstructor::FindTextData(nsIFrame* aParentFrame)
|
||||
if (ancestorFrame->IsSVGText()) {
|
||||
return &sSVGTextData;
|
||||
}
|
||||
} else {
|
||||
static const FrameConstructionData sSVGGlyphData =
|
||||
SIMPLE_FCDATA(NS_NewSVGGlyphFrame);
|
||||
nsSVGTextContainerFrame* metrics = do_QueryFrame(ancestorFrame);
|
||||
if (metrics) {
|
||||
return &sSVGGlyphData;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@ -4984,10 +4973,7 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
|
||||
}
|
||||
} else if (aTag == nsGkAtoms::textPath) {
|
||||
// textPath must be a child of text.
|
||||
nsIAtom* ancestorFrameType = ancestorFrame->GetType();
|
||||
if (ancestorFrameType != nsGkAtoms::svgTextFrame) {
|
||||
return &sSuppressData;
|
||||
}
|
||||
return &sSuppressData; // XXXsvgtext - nsSVGTextPathFrame not used in new SVG text world
|
||||
} else if (aTag != nsGkAtoms::a) {
|
||||
// Every other element except 'a' must not be a child of a text content
|
||||
// element.
|
||||
@ -5018,7 +5004,6 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
|
||||
nsCSSAnonBoxes::mozSVGForeignContent) },
|
||||
SIMPLE_SVG_CREATE(a, NS_NewSVGAFrame),
|
||||
SIMPLE_SVG_CREATE(altGlyph, NS_NewSVGTSpanFrame),
|
||||
SIMPLE_SVG_CREATE(text, NS_NewSVGTextFrame),
|
||||
SIMPLE_SVG_CREATE(tspan, NS_NewSVGTSpanFrame),
|
||||
SIMPLE_SVG_CREATE(linearGradient, NS_NewSVGLinearGradientFrame),
|
||||
SIMPLE_SVG_CREATE(radialGradient, NS_NewSVGRadialGradientFrame),
|
||||
|
@ -7347,7 +7347,7 @@ nsIFrame::VerticalAlignEnum() const
|
||||
for (const nsIFrame* frame = this; frame; frame = frame->GetParent()) {
|
||||
dominantBaseline = frame->StyleSVGReset()->mDominantBaseline;
|
||||
if (dominantBaseline != NS_STYLE_DOMINANT_BASELINE_AUTO ||
|
||||
frame->GetType() == nsGkAtoms::svgTextFrame) {
|
||||
frame->GetType() == nsGkAtoms::svgTextFrame2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,6 @@ FRAME_ID(nsSVGForeignObjectFrame)
|
||||
FRAME_ID(nsSVGGenericContainerFrame)
|
||||
FRAME_ID(nsSVGGeometryFrame)
|
||||
FRAME_ID(nsSVGGFrame)
|
||||
FRAME_ID(nsSVGGlyphFrame)
|
||||
FRAME_ID(nsSVGGradientFrame)
|
||||
FRAME_ID(nsSVGImageFrame)
|
||||
FRAME_ID(nsSVGInnerSVGFrame)
|
||||
@ -154,7 +153,6 @@ FRAME_ID(nsSVGRadialGradientFrame)
|
||||
FRAME_ID(nsSVGStopFrame)
|
||||
FRAME_ID(nsSVGSwitchFrame)
|
||||
FRAME_ID(nsSVGTextContainerFrame)
|
||||
FRAME_ID(nsSVGTextFrame)
|
||||
FRAME_ID(nsSVGTextFrame2)
|
||||
FRAME_ID(nsSVGTextPathFrame)
|
||||
FRAME_ID(nsSVGTSpanFrame)
|
||||
|
@ -26,7 +26,6 @@ UNIFIED_SOURCES += [
|
||||
'nsSVGGenericContainerFrame.cpp',
|
||||
'nsSVGGeometryFrame.cpp',
|
||||
'nsSVGGFrame.cpp',
|
||||
'nsSVGGlyphFrame.cpp',
|
||||
'nsSVGGradientFrame.cpp',
|
||||
'nsSVGImageFrame.cpp',
|
||||
'nsSVGInnerSVGFrame.cpp',
|
||||
@ -40,7 +39,6 @@ UNIFIED_SOURCES += [
|
||||
'nsSVGStopFrame.cpp',
|
||||
'nsSVGSwitchFrame.cpp',
|
||||
'nsSVGTextContainerFrame.cpp',
|
||||
'nsSVGTextFrame.cpp',
|
||||
'nsSVGTextFrame2.cpp',
|
||||
'nsSVGTextPathFrame.cpp',
|
||||
'nsSVGTSpanFrame.cpp',
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
#include "nsQueryFrame.h"
|
||||
|
||||
class nsSVGGlyphFrame;
|
||||
|
||||
namespace mozilla {
|
||||
class nsISVGPoint;
|
||||
}
|
||||
@ -24,8 +22,6 @@ public:
|
||||
virtual float GetComputedTextLength()=0;
|
||||
virtual float GetSubStringLength(uint32_t charnum, uint32_t fragmentChars)=0;
|
||||
virtual int32_t GetCharNumAtPosition(mozilla::nsISVGPoint *point)=0;
|
||||
NS_IMETHOD_(nsSVGGlyphFrame *) GetFirstGlyphFrame()=0;
|
||||
NS_IMETHOD_(nsSVGGlyphFrame *) GetNextGlyphFrame()=0;
|
||||
NS_IMETHOD_(void) SetWhitespaceCompression(bool aCompressWhitespace)=0;
|
||||
};
|
||||
|
||||
|
@ -260,7 +260,6 @@ nsSVGClipPathFrame::IsValid()
|
||||
nsIAtom *type = grandKid->GetType();
|
||||
|
||||
if (type != nsGkAtoms::svgPathGeometryFrame &&
|
||||
type != nsGkAtoms::svgTextFrame &&
|
||||
type != nsGkAtoms::svgTextFrame2) {
|
||||
return false;
|
||||
}
|
||||
@ -268,7 +267,6 @@ nsSVGClipPathFrame::IsValid()
|
||||
continue;
|
||||
}
|
||||
if (type != nsGkAtoms::svgPathGeometryFrame &&
|
||||
type != nsGkAtoms::svgTextFrame &&
|
||||
type != nsGkAtoms::svgTextFrame2) {
|
||||
return false;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,324 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __NS_SVGGLYPHFRAME_H__
|
||||
#define __NS_SVGGLYPHFRAME_H__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "gfxSVGGlyphs.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "nsISVGGlyphFragmentNode.h"
|
||||
#include "nsSVGGeometryFrame.h"
|
||||
#include "nsSVGTextFrame2.h" // for SVGTextContextPaint
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsIContent.h"
|
||||
#include "DrawMode.h"
|
||||
|
||||
class CharacterIterator;
|
||||
class gfxContext;
|
||||
class nsDisplaySVGGlyphs;
|
||||
class nsRenderingContext;
|
||||
class nsSVGGlyphFrame;
|
||||
class nsSVGTextFrame;
|
||||
class nsSVGTextPathFrame;
|
||||
class gfxTextContextPaint;
|
||||
|
||||
struct CharacterPosition;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class SVGIRect;
|
||||
}
|
||||
}
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
typedef nsSVGGeometryFrame nsSVGGlyphFrameBase;
|
||||
|
||||
class nsSVGGlyphFrame : public nsSVGGlyphFrameBase,
|
||||
public nsISVGGlyphFragmentNode,
|
||||
public nsISVGChildFrame
|
||||
{
|
||||
class AutoCanvasTMForMarker;
|
||||
friend class AutoCanvasTMForMarker;
|
||||
friend class CharacterIterator;
|
||||
friend nsIFrame*
|
||||
NS_NewSVGGlyphFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
protected:
|
||||
nsSVGGlyphFrame(nsStyleContext* aContext)
|
||||
: nsSVGGlyphFrameBase(aContext),
|
||||
mTextRun(nullptr),
|
||||
mStartIndex(0),
|
||||
mGetCanvasTMForFlag(nsISVGChildFrame::FOR_OUTERSVG_TM),
|
||||
mCompressWhitespace(true),
|
||||
mTrimLeadingWhitespace(false),
|
||||
mTrimTrailingWhitespace(false)
|
||||
{}
|
||||
~nsSVGGlyphFrame()
|
||||
{
|
||||
ClearTextRun();
|
||||
}
|
||||
|
||||
public:
|
||||
NS_DECL_QUERYFRAME
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
// These do not use the global transform if NS_STATE_NONDISPLAY_CHILD
|
||||
nsresult GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval);
|
||||
nsresult GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval);
|
||||
nsresult GetExtentOfChar(uint32_t charnum, dom::SVGIRect **_retval);
|
||||
nsresult GetRotationOfChar(uint32_t charnum, float *_retval);
|
||||
/**
|
||||
* @param aForceGlobalTransform controls whether to use the
|
||||
* global transform even when NS_STATE_NONDISPLAY_CHILD
|
||||
*/
|
||||
float GetAdvance(bool aForceGlobalTransform);
|
||||
|
||||
void SetGlyphPosition(gfxPoint *aPosition, bool aForceGlobalTransform);
|
||||
nsSVGTextPathFrame* FindTextPathParent();
|
||||
bool IsStartOfChunk(); // == is new absolutely positioned chunk.
|
||||
|
||||
void GetXY(mozilla::SVGUserUnitList *aX, mozilla::SVGUserUnitList *aY);
|
||||
void SetStartIndex(uint32_t aStartIndex);
|
||||
/*
|
||||
* Returns inherited x and y values instead of parent element's attribute
|
||||
* values.
|
||||
*/
|
||||
void GetEffectiveXY(int32_t strLength,
|
||||
nsTArray<float> &aX, nsTArray<float> &aY);
|
||||
/*
|
||||
* Returns inherited dx and dy values instead of parent element's attribute
|
||||
* values.
|
||||
*/
|
||||
void GetEffectiveDxDy(int32_t strLength,
|
||||
nsTArray<float> &aDx,
|
||||
nsTArray<float> &aDy);
|
||||
/*
|
||||
* Returns inherited rotate values instead of parent element's attribute
|
||||
* values.
|
||||
*/
|
||||
void GetEffectiveRotate(int32_t strLength,
|
||||
nsTArray<float> &aRotate);
|
||||
uint16_t GetTextAnchor();
|
||||
bool IsAbsolutelyPositioned();
|
||||
bool IsTextEmpty() const {
|
||||
return mContent->GetText()->GetLength() == 0;
|
||||
}
|
||||
void SetTrimLeadingWhitespace(bool aTrimLeadingWhitespace) {
|
||||
if (mTrimLeadingWhitespace != aTrimLeadingWhitespace) {
|
||||
mTrimLeadingWhitespace = aTrimLeadingWhitespace;
|
||||
ClearTextRun();
|
||||
}
|
||||
}
|
||||
void SetTrimTrailingWhitespace(bool aTrimTrailingWhitespace) {
|
||||
if (mTrimTrailingWhitespace != aTrimTrailingWhitespace) {
|
||||
mTrimTrailingWhitespace = aTrimTrailingWhitespace;
|
||||
ClearTextRun();
|
||||
}
|
||||
}
|
||||
bool EndsWithWhitespace() const;
|
||||
bool IsAllWhitespace() const;
|
||||
|
||||
// nsIFrame interface:
|
||||
NS_IMETHOD CharacterDataChanged(CharacterDataChangeInfo* aInfo) MOZ_OVERRIDE;
|
||||
|
||||
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
|
||||
|
||||
virtual void Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
*
|
||||
* @see nsGkAtoms::svgGlyphFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
||||
|
||||
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
||||
{
|
||||
// Set the frame state bit for text frames to mark them as replaced.
|
||||
// XXX kipp: temporary
|
||||
|
||||
return nsSVGGlyphFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
|
||||
{
|
||||
return MakeFrameName(NS_LITERAL_STRING("SVGGlyph"), aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
||||
|
||||
// nsISVGChildFrame interface:
|
||||
// These four always use the global transform, even if NS_STATE_NONDISPLAY_CHILD
|
||||
NS_IMETHOD PaintSVG(nsRenderingContext *aContext,
|
||||
const nsIntRect *aDirtyRect,
|
||||
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE;
|
||||
virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
||||
uint32_t aFlags) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD_(nsRect) GetCoveredRegion() MOZ_OVERRIDE;
|
||||
virtual void ReflowSVG() MOZ_OVERRIDE;
|
||||
virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(bool) IsDisplayContainer() MOZ_OVERRIDE { return false; }
|
||||
|
||||
// nsSVGGeometryFrame methods
|
||||
gfxMatrix GetCanvasTM(uint32_t aFor,
|
||||
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
|
||||
|
||||
// nsISVGGlyphFragmentNode interface:
|
||||
// These do not use the global transform if NS_STATE_NONDISPLAY_CHILD
|
||||
virtual uint32_t GetNumberOfChars() MOZ_OVERRIDE;
|
||||
virtual float GetComputedTextLength() MOZ_OVERRIDE;
|
||||
virtual float GetSubStringLength(uint32_t charnum, uint32_t fragmentChars) MOZ_OVERRIDE;
|
||||
virtual int32_t GetCharNumAtPosition(mozilla::nsISVGPoint *point) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(nsSVGGlyphFrame *) GetFirstGlyphFrame() MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(nsSVGGlyphFrame *) GetNextGlyphFrame() MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(void) SetWhitespaceCompression(bool aCompressWhitespace) MOZ_OVERRIDE {
|
||||
if (mCompressWhitespace != aCompressWhitespace) {
|
||||
mCompressWhitespace = aCompressWhitespace;
|
||||
ClearTextRun();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* This class exists purely because it would be too messy to pass the "for"
|
||||
* flag for GetCanvasTM through the call chains to the GetCanvasTM() call in
|
||||
* EnsureTextRun.
|
||||
*/
|
||||
class AutoCanvasTMForMarker {
|
||||
public:
|
||||
AutoCanvasTMForMarker(nsSVGGlyphFrame *aFrame, uint32_t aFor)
|
||||
: mFrame(aFrame)
|
||||
{
|
||||
mOldFor = mFrame->mGetCanvasTMForFlag;
|
||||
mFrame->mGetCanvasTMForFlag = aFor;
|
||||
}
|
||||
~AutoCanvasTMForMarker()
|
||||
{
|
||||
// Default
|
||||
mFrame->mGetCanvasTMForFlag = mOldFor;
|
||||
}
|
||||
private:
|
||||
nsSVGGlyphFrame *mFrame;
|
||||
uint32_t mOldFor;
|
||||
};
|
||||
|
||||
// Use a power of 2 here. It's not so important to match
|
||||
// nsDeviceContext::AppUnitsPerDevPixel, but since we do a lot of
|
||||
// multiplying by 1/GetTextRunUnitsFactor, it's good for it to be a
|
||||
// power of 2 to avoid accuracy loss.
|
||||
static int32_t GetTextRunUnitsFactor() { return 64; }
|
||||
|
||||
/**
|
||||
* @aParam aDrawScale font drawing must be scaled into user units
|
||||
* by this factor
|
||||
* @param aMetricsScale font metrics must be scaled into user units
|
||||
* by this factor
|
||||
* @param aForceGlobalTransform set to true if we should force use of
|
||||
* the global transform; otherwise we won't use the global transform
|
||||
* if we're a NONDISPLAY_CHILD
|
||||
*/
|
||||
bool EnsureTextRun(float *aDrawScale, float *aMetricsScale,
|
||||
bool aForceGlobalTransform);
|
||||
void ClearTextRun();
|
||||
|
||||
bool GetCharacterData(nsAString & aCharacterData);
|
||||
bool GetCharacterPositions(nsTArray<CharacterPosition>* aCharacterPositions,
|
||||
float aMetricsScale);
|
||||
uint32_t GetTextRunFlags(uint32_t strLength);
|
||||
|
||||
void AddCharactersToPath(CharacterIterator *aIter,
|
||||
gfxContext *aContext);
|
||||
void AddBoundingBoxesToPath(CharacterIterator *aIter,
|
||||
gfxContext *aContext);
|
||||
void DrawCharacters(CharacterIterator *aIter,
|
||||
gfxContext *aContext,
|
||||
DrawMode aDrawMode,
|
||||
gfxTextContextPaint *aContextPaint = nullptr);
|
||||
|
||||
void NotifyGlyphMetricsChange();
|
||||
void SetupGlobalTransform(gfxContext *aContext, uint32_t aFor,
|
||||
nsIFrame* aTransformRoot = nullptr);
|
||||
float GetSubStringAdvance(uint32_t charnum, uint32_t fragmentChars,
|
||||
float aMetricsScale);
|
||||
gfxFloat GetBaselineOffset(float aMetricsScale);
|
||||
|
||||
virtual void GetDxDy(SVGUserUnitList *aDx, SVGUserUnitList *aDy);
|
||||
virtual const SVGNumberList *GetRotate();
|
||||
|
||||
// Used to support GetBBoxContribution by making GetConvasTM use this as the
|
||||
// parent transform instead of the real CanvasTM.
|
||||
nsAutoPtr<gfxMatrix> mOverrideCanvasTM;
|
||||
|
||||
// Owning pointer, must call gfxTextRunWordCache::RemoveTextRun before deleting
|
||||
gfxTextRun *mTextRun;
|
||||
gfxPoint mPosition;
|
||||
// The start index into the position and rotation data
|
||||
uint32_t mStartIndex;
|
||||
uint32_t mGetCanvasTMForFlag;
|
||||
bool mCompressWhitespace;
|
||||
bool mTrimLeadingWhitespace;
|
||||
bool mTrimTrailingWhitespace;
|
||||
|
||||
private:
|
||||
DrawMode SetupCairoState(gfxContext *aContext,
|
||||
gfxTextContextPaint *aOuterContextPaint,
|
||||
gfxTextContextPaint **aThisContextPaint);
|
||||
|
||||
/**
|
||||
* Sets up the stroke style in |aContext| and stores stroke pattern
|
||||
* information in |aThisContextPaint|.
|
||||
*/
|
||||
bool SetupCairoStroke(gfxContext *aContext,
|
||||
gfxTextContextPaint *aOuterContextPaint,
|
||||
SVGTextContextPaint *aThisContextPaint);
|
||||
|
||||
/**
|
||||
* Sets up the fill style in |aContext| and stores fill pattern information
|
||||
* in |aThisContextPaint|.
|
||||
*/
|
||||
bool SetupCairoFill(gfxContext *aContext,
|
||||
gfxTextContextPaint *aOuterContextPaint,
|
||||
SVGTextContextPaint *aThisContextPaint);
|
||||
|
||||
/**
|
||||
* Sets the current pattern to the fill or stroke style of the outer text
|
||||
* context. Will also set the paint opacity to transparent if the paint is set
|
||||
* to "none".
|
||||
*/
|
||||
bool SetupContextPaint(gfxContext *aContext,
|
||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||
float& aOpacity,
|
||||
gfxTextContextPaint *aContextPaint);
|
||||
|
||||
/**
|
||||
* Stores in |aTargetPaint| information on how to reconstruct the current
|
||||
* fill or stroke pattern. Will also set the paint opacity to transparent if
|
||||
* the paint is set to "none".
|
||||
* @param aOuterContextPaint pattern information from the outer text context
|
||||
* @param aTargetPaint where to store the current pattern information
|
||||
* @param aFillOrStroke member pointer to the paint we are setting up
|
||||
* @param aProperty the frame property descriptor of the fill or stroke paint
|
||||
* server frame
|
||||
*/
|
||||
void SetupInheritablePaint(gfxContext *aContext,
|
||||
float& aOpacity,
|
||||
gfxTextContextPaint *aOuterContextPaint,
|
||||
SVGTextContextPaint::Paint& aTargetPaint,
|
||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||
const FramePropertyDescriptor *aProperty);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -17,8 +17,8 @@
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "nsSVGForeignObjectFrame.h"
|
||||
#include "nsSVGTextContainerFrame.h"
|
||||
#include "mozilla/dom/SVGSVGElement.h"
|
||||
#include "nsSVGTextFrame.h"
|
||||
#include "mozilla/dom/SVGViewElement.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
|
||||
@ -113,12 +113,7 @@ nsSVGMutationObserver::UpdateTextFragmentTrees(nsIFrame *aFrame)
|
||||
{
|
||||
nsIFrame* kid = aFrame->GetFirstPrincipalChild();
|
||||
while (kid) {
|
||||
if (kid->GetType() == nsGkAtoms::svgTextFrame) {
|
||||
nsSVGTextFrame* textFrame = static_cast<nsSVGTextFrame*>(kid);
|
||||
textFrame->NotifyGlyphMetricsChange();
|
||||
} else {
|
||||
UpdateTextFragmentTrees(kid);
|
||||
}
|
||||
UpdateTextFragmentTrees(kid);
|
||||
kid = kid->GetNextSibling();
|
||||
}
|
||||
}
|
||||
|
@ -131,41 +131,6 @@ nsSVGTSpanFrame::GetCharNumAtPosition(mozilla::nsISVGPoint *point)
|
||||
return nsSVGTSpanFrameBase::GetCharNumAtPosition(point);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsSVGGlyphFrame *)
|
||||
nsSVGTSpanFrame::GetFirstGlyphFrame()
|
||||
{
|
||||
// try children first:
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
while (kid) {
|
||||
nsISVGGlyphFragmentNode *node = do_QueryFrame(kid);
|
||||
if (node)
|
||||
return node->GetFirstGlyphFrame();
|
||||
kid = kid->GetNextSibling();
|
||||
}
|
||||
|
||||
// nope. try siblings:
|
||||
return GetNextGlyphFrame();
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsSVGGlyphFrame *)
|
||||
nsSVGTSpanFrame::GetNextGlyphFrame()
|
||||
{
|
||||
nsIFrame* sibling = GetNextSibling();
|
||||
while (sibling) {
|
||||
nsISVGGlyphFragmentNode *node = do_QueryFrame(sibling);
|
||||
if (node)
|
||||
return node->GetFirstGlyphFrame();
|
||||
sibling = sibling->GetNextSibling();
|
||||
}
|
||||
|
||||
// no more siblings. go back up the tree.
|
||||
|
||||
NS_ASSERTION(GetParent(), "null parent");
|
||||
nsISVGGlyphFragmentNode *node = do_QueryFrame(GetParent());
|
||||
return node ? node->GetNextGlyphFrame() : nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
nsSVGTSpanFrame::SetWhitespaceCompression(bool)
|
||||
{
|
||||
|
@ -19,7 +19,6 @@ class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsStyleContext;
|
||||
class nsSVGGlyphFrame;
|
||||
|
||||
namespace mozilla {
|
||||
class nsISVGPoint;
|
||||
@ -73,8 +72,6 @@ public:
|
||||
virtual float GetComputedTextLength() MOZ_OVERRIDE;
|
||||
virtual float GetSubStringLength(uint32_t charnum, uint32_t fragmentChars) MOZ_OVERRIDE;
|
||||
virtual int32_t GetCharNumAtPosition(mozilla::nsISVGPoint *point) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(nsSVGGlyphFrame *) GetFirstGlyphFrame() MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(nsSVGGlyphFrame *) GetNextGlyphFrame() MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(void) SetWhitespaceCompression(bool aCompressWhitespace) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Main header first:
|
||||
#include "nsSVGContainerFrame.h"
|
||||
#include "nsSVGTextContainerFrame.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// Keep others in (case-insensitive) order:
|
||||
#include "nsError.h"
|
||||
#include "nsSVGGlyphFrame.h"
|
||||
#include "nsSVGTextFrame.h"
|
||||
#include "nsISVGGlyphFragmentNode.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "SVGAnimatedNumberList.h"
|
||||
#include "SVGLengthList.h"
|
||||
@ -27,14 +27,6 @@ NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame)
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsSVGTextContainerFrame)
|
||||
|
||||
void
|
||||
nsSVGTextContainerFrame::NotifyGlyphMetricsChange()
|
||||
{
|
||||
nsSVGTextFrame *textFrame = GetTextFrame();
|
||||
if (textFrame)
|
||||
textFrame->NotifyGlyphMetricsChange();
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextContainerFrame::GetXY(SVGUserUnitList *aX, SVGUserUnitList *aY)
|
||||
{
|
||||
@ -77,109 +69,36 @@ nsSVGTextContainerFrame::InsertFrames(ChildListID aListID,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextContainerFrame::RemoveFrame(ChildListID aListID, nsIFrame *aOldFrame)
|
||||
{
|
||||
nsSVGTextFrame *textFrame = GetTextFrame();
|
||||
|
||||
nsresult rv = nsSVGDisplayContainerFrame::RemoveFrame(aListID, aOldFrame);
|
||||
|
||||
if (textFrame)
|
||||
textFrame->NotifyGlyphMetricsChange();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextContainerFrame::GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval)
|
||||
{
|
||||
NS_NOTREACHED("Shouldn't get here now that the old SVG text paths are disabled");
|
||||
*_retval = nullptr;
|
||||
|
||||
if (charnum >= GetNumberOfChars()) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
nsISVGGlyphFragmentNode *node = GetFirstGlyphFragmentChildNode();
|
||||
if (!node) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t offset;
|
||||
nsSVGGlyphFrame *frame = GetGlyphFrameAtCharNum(node, charnum, &offset);
|
||||
if (!frame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return frame->GetStartPositionOfChar(charnum - offset, _retval);
|
||||
return NS_ERROR_FAILURE; // XXXsvgtext
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextContainerFrame::GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval)
|
||||
{
|
||||
NS_NOTREACHED("Shouldn't get here now that the old SVG text paths are disabled");
|
||||
*_retval = nullptr;
|
||||
|
||||
if (charnum >= GetNumberOfChars()) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
nsISVGGlyphFragmentNode *node = GetFirstGlyphFragmentChildNode();
|
||||
if (!node) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t offset;
|
||||
nsSVGGlyphFrame *frame = GetGlyphFrameAtCharNum(node, charnum, &offset);
|
||||
if (!frame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return frame->GetEndPositionOfChar(charnum - offset, _retval);
|
||||
return NS_ERROR_FAILURE; // XXXsvgtext
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextContainerFrame::GetExtentOfChar(uint32_t charnum, dom::SVGIRect **_retval)
|
||||
{
|
||||
NS_NOTREACHED("Shouldn't get here now that the old SVG text paths are disabled");
|
||||
*_retval = nullptr;
|
||||
|
||||
if (charnum >= GetNumberOfChars()) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
nsISVGGlyphFragmentNode *node = GetFirstGlyphFragmentChildNode();
|
||||
if (!node) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t offset;
|
||||
nsSVGGlyphFrame *frame = GetGlyphFrameAtCharNum(node, charnum, &offset);
|
||||
if (!frame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return frame->GetExtentOfChar(charnum - offset, _retval);
|
||||
return NS_ERROR_FAILURE; // XXXsvgtext
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextContainerFrame::GetRotationOfChar(uint32_t charnum, float *_retval)
|
||||
{
|
||||
NS_NOTREACHED("Shouldn't get here now that the old SVG text paths are disabled");
|
||||
*_retval = 0.0f;
|
||||
|
||||
if (charnum >= GetNumberOfChars()) {
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
nsISVGGlyphFragmentNode *node = GetFirstGlyphFragmentChildNode();
|
||||
if (!node) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t offset;
|
||||
nsSVGGlyphFrame *frame = GetGlyphFrameAtCharNum(node, charnum, &offset);
|
||||
if (!frame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return frame->GetRotationOfChar(charnum - offset, _retval);
|
||||
return NS_ERROR_FAILURE; // XXXsvgtext
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@ -292,38 +211,6 @@ nsSVGTextContainerFrame::GetNextGlyphFragmentChildNode(nsISVGGlyphFragmentNode *
|
||||
// Private functions
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
nsSVGGlyphFrame *
|
||||
nsSVGTextContainerFrame::GetGlyphFrameAtCharNum(nsISVGGlyphFragmentNode* node,
|
||||
uint32_t charnum,
|
||||
uint32_t *offset)
|
||||
{
|
||||
nsSVGGlyphFrame *frame = node->GetFirstGlyphFrame();
|
||||
*offset = 0;
|
||||
|
||||
while (frame) {
|
||||
uint32_t count = frame->GetNumberOfChars();
|
||||
if (count > charnum)
|
||||
return frame;
|
||||
charnum -= count;
|
||||
*offset += count;
|
||||
frame = frame->GetNextGlyphFrame();
|
||||
}
|
||||
|
||||
// not found
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsSVGTextFrame *
|
||||
nsSVGTextContainerFrame::GetTextFrame()
|
||||
{
|
||||
for (nsIFrame *frame = this; frame != nullptr; frame = frame->GetParent()) {
|
||||
if (frame->GetType() == nsGkAtoms::svgTextFrame) {
|
||||
return static_cast<nsSVGTextFrame*>(frame);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextContainerFrame::CopyPositionList(nsTArray<float> *parentList,
|
||||
SVGUserUnitList *selfList,
|
||||
@ -390,6 +277,8 @@ uint32_t
|
||||
nsSVGTextContainerFrame::BuildPositionList(uint32_t aOffset,
|
||||
uint32_t aDepth)
|
||||
{
|
||||
NS_NOTREACHED("Shouldn't get here now that the old SVG text paths are disabled");
|
||||
|
||||
nsSVGTextContainerFrame *parent = do_QueryFrame(mParent);
|
||||
nsTArray<float> *parentX = nullptr, *parentY = nullptr;
|
||||
nsTArray<float> *parentDx = nullptr, *parentDy = nullptr;
|
||||
@ -421,10 +310,6 @@ nsSVGTextContainerFrame::BuildPositionList(uint32_t aOffset,
|
||||
nsSVGTextContainerFrame *text = do_QueryFrame(kid);
|
||||
if (text) {
|
||||
startIndex += text->BuildPositionList(startIndex, aDepth + 1);
|
||||
} else if (kid->GetType() == nsGkAtoms::svgGlyphFrame) {
|
||||
nsSVGGlyphFrame *leaf = static_cast<nsSVGGlyphFrame*>(kid);
|
||||
leaf->SetStartIndex(startIndex);
|
||||
startIndex += leaf->GetNumberOfChars();
|
||||
}
|
||||
kid = kid->GetNextSibling();
|
||||
}
|
||||
|
@ -17,8 +17,6 @@
|
||||
class nsFrameList;
|
||||
class nsISVGGlyphFragmentNode;
|
||||
class nsStyleContext;
|
||||
class nsSVGGlyphFrame;
|
||||
class nsSVGTextFrame;
|
||||
|
||||
namespace mozilla {
|
||||
class nsISVGPoint;
|
||||
@ -35,7 +33,7 @@ protected:
|
||||
nsSVGDisplayContainerFrame(aContext) {}
|
||||
|
||||
public:
|
||||
void NotifyGlyphMetricsChange();
|
||||
void NotifyGlyphMetricsChange() {} // XXXsvgtext
|
||||
virtual void GetXY(SVGUserUnitList *aX, SVGUserUnitList *aY);
|
||||
virtual void GetDxDy(SVGUserUnitList *aDx, SVGUserUnitList *aDy);
|
||||
virtual const SVGNumberList *GetRotate();
|
||||
@ -48,7 +46,6 @@ public:
|
||||
NS_IMETHOD InsertFrames(ChildListID aListID,
|
||||
nsIFrame* aPrevFrame,
|
||||
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
||||
NS_IMETHOD RemoveFrame(ChildListID aListID, nsIFrame *aOldFrame) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval);
|
||||
NS_IMETHOD GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval);
|
||||
@ -103,19 +100,6 @@ protected:
|
||||
|
||||
void SetWhitespaceCompression();
|
||||
private:
|
||||
/*
|
||||
* Returns the glyph frame containing a particular character
|
||||
*/
|
||||
static nsSVGGlyphFrame *
|
||||
GetGlyphFrameAtCharNum(nsISVGGlyphFragmentNode* node,
|
||||
uint32_t charnum,
|
||||
uint32_t *offset);
|
||||
|
||||
/*
|
||||
* Returns the text frame ancestor of this frame (or the frame itself
|
||||
* if this is a text frame)
|
||||
*/
|
||||
nsSVGTextFrame * GetTextFrame();
|
||||
nsTArray<float> mX;
|
||||
nsTArray<float> mY;
|
||||
nsTArray<float> mDx;
|
||||
|
@ -1,486 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
// Main header first:
|
||||
#include "nsSVGTextFrame.h"
|
||||
|
||||
// Keep others in (case-insensitive) order:
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/SVGIRect.h"
|
||||
#include "nsISVGGlyphFragmentNode.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsSVGGlyphFrame.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "nsSVGTextPathFrame.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "SVGGraphicsElement.h"
|
||||
#include "SVGLengthList.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsIFrame*
|
||||
NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
return new (aPresShell) nsSVGTextFrame(aContext);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsSVGTextFrame)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIFrame methods
|
||||
#ifdef DEBUG
|
||||
void
|
||||
nsSVGTextFrame::Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
NS_ASSERTION(aContent->IsSVG(nsGkAtoms::text),
|
||||
"Content is not an SVG text");
|
||||
|
||||
nsSVGTextFrameBase::Init(aContent, aParent, aPrevInFlow);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
int32_t aModType)
|
||||
{
|
||||
if (aNameSpaceID != kNameSpaceID_None)
|
||||
return NS_OK;
|
||||
|
||||
if (aAttribute == nsGkAtoms::transform) {
|
||||
// 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.
|
||||
NotifySVGChanged(TRANSFORM_CHANGED);
|
||||
} else if (aAttribute == nsGkAtoms::x ||
|
||||
aAttribute == nsGkAtoms::y ||
|
||||
aAttribute == nsGkAtoms::dx ||
|
||||
aAttribute == nsGkAtoms::dy ||
|
||||
aAttribute == nsGkAtoms::rotate) {
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
nsSVGUtils::ScheduleReflowSVG(this);
|
||||
NotifyGlyphMetricsChange();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsSVGTextFrame::GetType() const
|
||||
{
|
||||
return nsGkAtoms::svgTextFrame;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists)
|
||||
{
|
||||
UpdateGlyphPositioning(true);
|
||||
nsSVGTextFrameBase::BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGTextContainerFrame
|
||||
uint32_t
|
||||
nsSVGTextFrame::GetNumberOfChars()
|
||||
{
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
return nsSVGTextFrameBase::GetNumberOfChars();
|
||||
}
|
||||
|
||||
float
|
||||
nsSVGTextFrame::GetComputedTextLength()
|
||||
{
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
return nsSVGTextFrameBase::GetComputedTextLength();
|
||||
}
|
||||
|
||||
float
|
||||
nsSVGTextFrame::GetSubStringLength(uint32_t charnum, uint32_t nchars)
|
||||
{
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
return nsSVGTextFrameBase::GetSubStringLength(charnum, nchars);
|
||||
}
|
||||
|
||||
int32_t
|
||||
nsSVGTextFrame::GetCharNumAtPosition(nsISVGPoint *point)
|
||||
{
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
return nsSVGTextFrameBase::GetCharNumAtPosition(point);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextFrame::GetStartPositionOfChar(uint32_t charnum, nsISupports **_retval)
|
||||
{
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
return nsSVGTextFrameBase::GetStartPositionOfChar(charnum, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextFrame::GetEndPositionOfChar(uint32_t charnum, nsISupports **_retval)
|
||||
{
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
return nsSVGTextFrameBase::GetEndPositionOfChar(charnum, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextFrame::GetExtentOfChar(uint32_t charnum, dom::SVGIRect **_retval)
|
||||
{
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
return nsSVGTextFrameBase::GetExtentOfChar(charnum, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextFrame::GetRotationOfChar(uint32_t charnum, float *_retval)
|
||||
{
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
return nsSVGTextFrameBase::GetRotationOfChar(charnum, _retval);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGChildFrame methods
|
||||
|
||||
void
|
||||
nsSVGTextFrame::NotifySVGChanged(uint32_t aFlags)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
||||
"Invalidation logic may need adjusting");
|
||||
|
||||
bool updateGlyphMetrics = false;
|
||||
|
||||
if (aFlags & COORD_CONTEXT_CHANGED) {
|
||||
updateGlyphMetrics = true;
|
||||
}
|
||||
|
||||
if (aFlags & TRANSFORM_CHANGED) {
|
||||
if (mCanvasTM && mCanvasTM->IsSingular()) {
|
||||
// We won't have calculated the glyph positions correctly
|
||||
updateGlyphMetrics = true;
|
||||
}
|
||||
// make sure our cached transform matrix gets (lazily) updated
|
||||
mCanvasTM = nullptr;
|
||||
}
|
||||
|
||||
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.
|
||||
nsSVGUtils::ScheduleReflowSVG(this);
|
||||
}
|
||||
|
||||
nsSVGTextFrameBase::NotifySVGChanged(aFlags);
|
||||
|
||||
if (updateGlyphMetrics) {
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGTextFrame::PaintSVG(nsRenderingContext* aContext,
|
||||
const nsIntRect *aDirtyRect,
|
||||
nsIFrame* aTransformRoot)
|
||||
{
|
||||
NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
|
||||
(mState & NS_FRAME_IS_NONDISPLAY),
|
||||
"If display lists are enabled, only painting of non-display "
|
||||
"SVG should take this code path");
|
||||
|
||||
UpdateGlyphPositioning(true);
|
||||
|
||||
return nsSVGTextFrameBase::PaintSVG(aContext, aDirtyRect, aTransformRoot);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsIFrame*)
|
||||
nsSVGTextFrame::GetFrameForPoint(const nsPoint &aPoint)
|
||||
{
|
||||
NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() ||
|
||||
(mState & NS_FRAME_IS_NONDISPLAY),
|
||||
"If display lists are enabled, only hit-testing of non-display "
|
||||
"SVG should take this code path");
|
||||
|
||||
UpdateGlyphPositioning(true);
|
||||
|
||||
return nsSVGTextFrameBase::GetFrameForPoint(aPoint);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame::ReflowSVG()
|
||||
{
|
||||
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
|
||||
"This call is probably a wasteful mistake");
|
||||
|
||||
NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY),
|
||||
"ReflowSVG mechanism not designed for this");
|
||||
|
||||
if (!nsSVGUtils::NeedsReflowSVG(this)) {
|
||||
NS_ASSERTION(!(mState & NS_STATE_SVG_POSITIONING_DIRTY), "How did this happen?");
|
||||
return;
|
||||
}
|
||||
|
||||
// UpdateGlyphPositioning may have been called under DOM calls and cleared
|
||||
// NS_STATE_SVG_POSITIONING_DIRTY. We may now have better positioning, though, so
|
||||
// set it to true so that UpdateGlyphPositioning will do its work.
|
||||
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
|
||||
|
||||
UpdateGlyphPositioning(false);
|
||||
|
||||
// We leave it up to nsSVGTextFrameBase::ReflowSVG to invalidate. XXXSDL
|
||||
// With glyph positions updated, our descendants can invalidate their new
|
||||
// areas correctly:
|
||||
nsSVGTextFrameBase::ReflowSVG();
|
||||
}
|
||||
|
||||
SVGBBox
|
||||
nsSVGTextFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
UpdateGlyphPositioning(true);
|
||||
|
||||
return nsSVGTextFrameBase::GetBBoxContribution(aToBBoxUserspace, aFlags);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGContainerFrame methods:
|
||||
|
||||
gfxMatrix
|
||||
nsSVGTextFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
|
||||
{
|
||||
if (!(GetStateBits() & NS_FRAME_IS_NONDISPLAY) && !aTransformRoot) {
|
||||
if ((aFor == FOR_PAINTING && NS_SVGDisplayListPaintingEnabled()) ||
|
||||
(aFor == FOR_HIT_TESTING && NS_SVGDisplayListHitTestingEnabled())) {
|
||||
return nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(this);
|
||||
}
|
||||
}
|
||||
if (!mCanvasTM) {
|
||||
NS_ASSERTION(mParent, "null parent");
|
||||
|
||||
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
|
||||
dom::SVGGraphicsElement *content = static_cast<dom::SVGGraphicsElement*>(mContent);
|
||||
|
||||
gfxMatrix tm = content->PrependLocalTransformsTo(
|
||||
this == aTransformRoot ? gfxMatrix() :
|
||||
parent->GetCanvasTM(aFor, aTransformRoot));
|
||||
|
||||
mCanvasTM = new gfxMatrix(tm);
|
||||
}
|
||||
|
||||
return *mCanvasTM;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
|
||||
static void
|
||||
MarkDirtyBitsOnDescendants(nsIFrame *aFrame)
|
||||
{
|
||||
// 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.
|
||||
return;
|
||||
}
|
||||
nsIFrame* kid = aFrame->GetFirstPrincipalChild();
|
||||
while (kid) {
|
||||
nsISVGChildFrame* svgkid = do_QueryFrame(kid);
|
||||
if (svgkid) {
|
||||
MarkDirtyBitsOnDescendants(kid);
|
||||
kid->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
kid = kid->GetNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame::NotifyGlyphMetricsChange()
|
||||
{
|
||||
// NotifySVGChanged isn't appropriate here, so we just mark our descendants
|
||||
// as fully dirty to get ReflowSVG() called on them:
|
||||
MarkDirtyBitsOnDescendants(this);
|
||||
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
nsSVGUtils::ScheduleReflowSVG(this);
|
||||
|
||||
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame::SetWhitespaceHandling(nsSVGGlyphFrame *aFrame)
|
||||
{
|
||||
SetWhitespaceCompression();
|
||||
|
||||
nsSVGGlyphFrame* firstFrame = aFrame;
|
||||
bool trimLeadingWhitespace = true;
|
||||
nsSVGGlyphFrame* lastNonWhitespaceFrame = aFrame;
|
||||
|
||||
// If the previous frame ended with whitespace
|
||||
// then display of leading whitespace should be suppressed
|
||||
// when we are compressing whitespace.
|
||||
while (aFrame) {
|
||||
if (!aFrame->IsAllWhitespace()) {
|
||||
lastNonWhitespaceFrame = aFrame;
|
||||
}
|
||||
|
||||
aFrame->SetTrimLeadingWhitespace(trimLeadingWhitespace);
|
||||
trimLeadingWhitespace = aFrame->EndsWithWhitespace();
|
||||
|
||||
aFrame = aFrame->GetNextGlyphFrame();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame::UpdateGlyphPositioning(bool aForceGlobalTransform)
|
||||
{
|
||||
if (!(mState & NS_STATE_SVG_POSITIONING_DIRTY))
|
||||
return;
|
||||
|
||||
RemoveStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
|
||||
|
||||
nsISVGGlyphFragmentNode* node = GetFirstGlyphFragmentChildNode();
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
nsSVGGlyphFrame *frame, *firstFrame;
|
||||
|
||||
firstFrame = node->GetFirstGlyphFrame();
|
||||
if (!firstFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
SetWhitespaceHandling(firstFrame);
|
||||
|
||||
BuildPositionList(0, 0);
|
||||
|
||||
gfxPoint ctp(0.0, 0.0);
|
||||
|
||||
// loop over chunks
|
||||
while (firstFrame) {
|
||||
nsSVGTextPathFrame *textPath = firstFrame->FindTextPathParent();
|
||||
|
||||
nsTArray<float> effectiveXList, effectiveYList;
|
||||
firstFrame->GetEffectiveXY(firstFrame->GetNumberOfChars(),
|
||||
effectiveXList, effectiveYList);
|
||||
if (!effectiveXList.IsEmpty()) ctp.x = effectiveXList[0];
|
||||
if (!textPath && !effectiveYList.IsEmpty()) ctp.y = effectiveYList[0];
|
||||
|
||||
// check for startOffset on textPath
|
||||
if (textPath) {
|
||||
if (!textPath->GetPathFrame()) {
|
||||
// invalid text path, give up
|
||||
return;
|
||||
}
|
||||
ctp.x = textPath->GetStartOffset();
|
||||
}
|
||||
|
||||
// determine x offset based on text_anchor:
|
||||
|
||||
uint8_t anchor = firstFrame->GetTextAnchor();
|
||||
|
||||
/**
|
||||
* 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
|
||||
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
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
|
||||
|
||||
float chunkLength = 0.0f;
|
||||
if (anchor != NS_STYLE_TEXT_ANCHOR_START) {
|
||||
// need to get the total chunk length
|
||||
|
||||
frame = firstFrame;
|
||||
while (frame) {
|
||||
chunkLength += frame->GetAdvance(aForceGlobalTransform);
|
||||
frame = frame->GetNextGlyphFrame();
|
||||
if (frame && frame->IsAbsolutelyPositioned())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (anchor == NS_STYLE_TEXT_ANCHOR_MIDDLE)
|
||||
ctp.x -= chunkLength/2.0f;
|
||||
else if (anchor == NS_STYLE_TEXT_ANCHOR_END)
|
||||
ctp.x -= chunkLength;
|
||||
|
||||
// set position of each frame in this chunk:
|
||||
|
||||
frame = firstFrame;
|
||||
while (frame) {
|
||||
|
||||
frame->SetGlyphPosition(&ctp, aForceGlobalTransform);
|
||||
frame = frame->GetNextGlyphFrame();
|
||||
if (frame && frame->IsAbsolutelyPositioned())
|
||||
break;
|
||||
}
|
||||
firstFrame = frame;
|
||||
}
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef NS_SVGTEXTFRAME_H
|
||||
#define NS_SVGTEXTFRAME_H
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "gfxRect.h"
|
||||
#include "nsSVGTextContainerFrame.h"
|
||||
|
||||
class nsRenderingContext;
|
||||
|
||||
typedef nsSVGTextContainerFrame nsSVGTextFrameBase;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class SVGIRect;
|
||||
}
|
||||
}
|
||||
|
||||
class nsSVGTextFrame : public nsSVGTextFrameBase
|
||||
{
|
||||
friend nsIFrame*
|
||||
NS_NewSVGTextFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
protected:
|
||||
nsSVGTextFrame(nsStyleContext* aContext) : nsSVGTextFrameBase(aContext)
|
||||
{
|
||||
AddStateBits(NS_STATE_SVG_POSITIONING_DIRTY);
|
||||
}
|
||||
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
// nsIFrame:
|
||||
#ifdef DEBUG
|
||||
virtual void Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
||||
#endif
|
||||
|
||||
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
int32_t aModType) MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
*
|
||||
* @see nsGkAtoms::svgTextFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
|
||||
{
|
||||
return MakeFrameName(NS_LITERAL_STRING("SVGText"), aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
||||
|
||||
// nsISVGChildFrame interface:
|
||||
virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
|
||||
// Override these four to ensure that UpdateGlyphPositioning is called
|
||||
// to bring glyph positions up to date
|
||||
NS_IMETHOD PaintSVG(nsRenderingContext* aContext,
|
||||
const nsIntRect *aDirtyRect,
|
||||
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint & aPoint) MOZ_OVERRIDE;
|
||||
virtual void ReflowSVG() MOZ_OVERRIDE;
|
||||
virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
|
||||
uint32_t aFlags) MOZ_OVERRIDE;
|
||||
|
||||
// nsSVGContainerFrame methods:
|
||||
virtual gfxMatrix GetCanvasTM(uint32_t aFor,
|
||||
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
|
||||
|
||||
// nsSVGTextContainerFrame methods:
|
||||
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;
|
||||
|
||||
// nsSVGTextFrame
|
||||
void NotifyGlyphMetricsChange();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @param aForceGlobalTransform passed down to nsSVGGlyphFrames to
|
||||
* control whether they should use the global transform even when
|
||||
* NS_STATE_NONDISPLAY_CHILD
|
||||
*/
|
||||
void UpdateGlyphPositioning(bool aForceGlobalTransform);
|
||||
|
||||
void SetWhitespaceHandling(nsSVGGlyphFrame *aFrame);
|
||||
|
||||
nsAutoPtr<gfxMatrix> mCanvasTM;
|
||||
};
|
||||
|
||||
#endif
|
@ -25,12 +25,10 @@
|
||||
#include "nsQuickSort.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsSVGGlyphFrame.h"
|
||||
#include "nsSVGOuterSVGFrame.h"
|
||||
#include "nsSVGPaintServerFrame.h"
|
||||
#include "mozilla/dom/SVGRect.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "nsSVGTextFrame.h"
|
||||
#include "nsSVGTextPathFrame.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsTArray.h"
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "nsSVGPaintServerFrame.h"
|
||||
#include "nsSVGTextContainerFrame.h"
|
||||
|
||||
class nsDisplaySVGText;
|
||||
class nsRenderingContext;
|
||||
@ -27,6 +26,7 @@ typedef nsSVGDisplayContainerFrame nsSVGTextFrame2Base;
|
||||
namespace mozilla {
|
||||
|
||||
class CharIterator;
|
||||
class nsISVGPoint;
|
||||
class TextFrameIterator;
|
||||
class TextNodeCorrespondenceRecorder;
|
||||
struct TextRenderedRun;
|
||||
|
@ -42,10 +42,6 @@ nsSVGTextPathFrame::Init(nsIContent* aContent,
|
||||
nsIFrame* ancestorFrame = nsSVGUtils::GetFirstNonAAncestorFrame(aParent);
|
||||
NS_ASSERTION(ancestorFrame, "Must have ancestor");
|
||||
|
||||
NS_ASSERTION(ancestorFrame->GetType() == nsGkAtoms::svgTextFrame,
|
||||
"trying to construct an SVGTextPathFrame for an invalid "
|
||||
"container");
|
||||
|
||||
NS_ASSERTION(aContent->IsSVG(nsGkAtoms::textPath),
|
||||
"Content is not an SVG textPath");
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
// Keep others in (case-insensitive) order:
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxMatrix.h"
|
||||
@ -38,7 +39,7 @@
|
||||
#include "nsSVGFilterPaintCallback.h"
|
||||
#include "nsSVGForeignObjectFrame.h"
|
||||
#include "nsSVGGeometryFrame.h"
|
||||
#include "nsSVGGlyphFrame.h"
|
||||
#include "gfxSVGGlyphs.h"
|
||||
#include "nsSVGInnerSVGFrame.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "nsSVGLength2.h"
|
||||
@ -53,7 +54,6 @@
|
||||
#include "nsTextFrame.h"
|
||||
#include "SVGContentUtils.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -135,7 +135,6 @@ static const uint8_t gsRGBToLinearRGBMap[256] = {
|
||||
|
||||
static bool sSVGDisplayListHitTestingEnabled;
|
||||
static bool sSVGDisplayListPaintingEnabled;
|
||||
static bool sSVGTextCSSFramesEnabled;
|
||||
|
||||
bool
|
||||
NS_SVGDisplayListHitTestingEnabled()
|
||||
@ -152,7 +151,7 @@ NS_SVGDisplayListPaintingEnabled()
|
||||
bool
|
||||
NS_SVGTextCSSFramesEnabled()
|
||||
{
|
||||
return sSVGTextCSSFramesEnabled;
|
||||
return true;
|
||||
}
|
||||
|
||||
// we only take the address of this:
|
||||
@ -213,9 +212,6 @@ nsSVGUtils::Init()
|
||||
|
||||
Preferences::AddBoolVarCache(&sSVGDisplayListPaintingEnabled,
|
||||
"svg.display-lists.painting.enabled");
|
||||
|
||||
Preferences::AddBoolVarCache(&sSVGTextCSSFramesEnabled,
|
||||
"svg.text.css-frames.enabled");
|
||||
}
|
||||
|
||||
void
|
||||
@ -1194,15 +1190,6 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
|
||||
}
|
||||
}
|
||||
svg = do_QueryFrame(ancestor);
|
||||
} else {
|
||||
nsSVGTextContainerFrame* metrics = do_QueryFrame(
|
||||
GetFirstNonAAncestorFrame(aFrame));
|
||||
if (metrics) {
|
||||
while (aFrame->GetType() != nsGkAtoms::svgTextFrame) {
|
||||
aFrame = aFrame->GetParent();
|
||||
}
|
||||
svg = do_QueryFrame(aFrame);
|
||||
}
|
||||
}
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
if (content->IsSVG() &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user