Bug 956311 - Remove nsSVGGeometryFrame. r=dholbert

This commit is contained in:
Robert Longson 2014-01-04 08:29:02 +00:00
parent a20095acaa
commit 98afe359fa
12 changed files with 44 additions and 136 deletions

View File

@ -134,7 +134,6 @@ FRAME_ID(SVGFEUnstyledLeafFrame)
FRAME_ID(nsSVGFilterFrame) FRAME_ID(nsSVGFilterFrame)
FRAME_ID(nsSVGForeignObjectFrame) FRAME_ID(nsSVGForeignObjectFrame)
FRAME_ID(nsSVGGenericContainerFrame) FRAME_ID(nsSVGGenericContainerFrame)
FRAME_ID(nsSVGGeometryFrame)
FRAME_ID(nsSVGGFrame) FRAME_ID(nsSVGGFrame)
FRAME_ID(nsSVGGradientFrame) FRAME_ID(nsSVGGradientFrame)
FRAME_ID(nsSVGImageFrame) FRAME_ID(nsSVGImageFrame)

View File

@ -22,7 +22,6 @@ UNIFIED_SOURCES += [
'nsSVGFilterInstance.cpp', 'nsSVGFilterInstance.cpp',
'nsSVGForeignObjectFrame.cpp', 'nsSVGForeignObjectFrame.cpp',
'nsSVGGenericContainerFrame.cpp', 'nsSVGGenericContainerFrame.cpp',
'nsSVGGeometryFrame.cpp',
'nsSVGGFrame.cpp', 'nsSVGGFrame.cpp',
'nsSVGGradientFrame.cpp', 'nsSVGGradientFrame.cpp',
'nsSVGImageFrame.cpp', 'nsSVGImageFrame.cpp',

View File

@ -1,43 +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 "nsSVGGeometryFrame.h"
// Keep others in (case-insensitive) order:
#include "gfxContext.h"
#include "gfxSVGGlyphs.h"
#include "nsPresContext.h"
#include "nsSVGEffects.h"
#include "nsSVGPaintServerFrame.h"
#include "nsSVGUtils.h"
NS_IMPL_FRAMEARENA_HELPERS(nsSVGGeometryFrame)
//----------------------------------------------------------------------
// nsIFrame methods
void
nsSVGGeometryFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD);
nsSVGGeometryFrameBase::Init(aContent, aParent, aPrevInFlow);
}
//----------------------------------------------------------------------
uint16_t
nsSVGGeometryFrame::GetClipRule()
{
return StyleSVG()->mClipRule;
}
uint16_t
nsSVGGeometryFrame::GetHitTestFlags()
{
return nsSVGUtils::GetGeometryHitTestFlags(this);
}

View File

@ -1,69 +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_SVGGEOMETRYFRAME_H__
#define __NS_SVGGEOMETRYFRAME_H__
#include "mozilla/Attributes.h"
#include "gfxMatrix.h"
#include "gfxTypes.h"
#include "nsFrame.h"
#include "nsIFrame.h"
#include "nsQueryFrame.h"
class gfxContext;
class nsIContent;
class nsStyleContext;
class nsSVGPaintServerFrame;
struct nsStyleSVGPaint;
typedef nsFrame nsSVGGeometryFrameBase;
/* nsSVGGeometryFrame is a base class for SVG objects that directly
* have geometry (circle, ellipse, line, polyline, polygon, path, and
* glyph frames). It knows how to convert the style information into
* cairo context information and stores the fill/stroke paint
* servers. */
class nsSVGGeometryFrame : public nsSVGGeometryFrameBase
{
protected:
NS_DECL_FRAMEARENA_HELPERS
nsSVGGeometryFrame(nsStyleContext *aContext)
: nsSVGGeometryFrameBase(aContext)
{
AddStateBits(NS_FRAME_SVG_LAYOUT);
}
public:
// nsIFrame interface:
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
{
return nsSVGGeometryFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry));
}
// nsSVGGeometryFrame methods:
virtual gfxMatrix GetCanvasTM(uint32_t aFor,
nsIFrame* aTransformRoot = nullptr) = 0;
uint16_t GetClipRule();
protected:
/**
* This function returns a set of bit flags indicating which parts of the
* element (fill, stroke, bounds) should intercept pointer events. It takes
* into account the type of element and the value of the 'pointer-events'
* property on the element.
*/
virtual uint16_t GetHitTestFlags();
};
#endif // __NS_SVGGEOMETRYFRAME_H__

View File

@ -63,7 +63,7 @@ public:
virtual void ReflowSVG(); virtual void ReflowSVG();
// nsSVGPathGeometryFrame methods: // nsSVGPathGeometryFrame methods:
virtual uint16_t GetHitTestFlags(); virtual uint16_t GetHitTestFlags() MOZ_OVERRIDE;
// nsIFrame interface: // nsIFrame interface:
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,

View File

@ -9,7 +9,6 @@
// Keep others in (case-insensitive) order: // Keep others in (case-insensitive) order:
#include "gfxContext.h" #include "gfxContext.h"
#include "nsSVGElement.h" #include "nsSVGElement.h"
#include "nsSVGGeometryFrame.h"
NS_IMPL_FRAMEARENA_HELPERS(nsSVGPaintServerFrame) NS_IMPL_FRAMEARENA_HELPERS(nsSVGPaintServerFrame)

View File

@ -17,7 +17,6 @@
class gfxContext; class gfxContext;
class gfxPattern; class gfxPattern;
class nsStyleContext; class nsStyleContext;
class nsSVGGeometryFrame;
struct gfxRect; struct gfxRect;

View File

@ -102,6 +102,15 @@ nsDisplaySVGPathGeometry::Paint(nsDisplayListBuilder* aBuilder,
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsIFrame methods // nsIFrame methods
void
nsSVGPathGeometryFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD);
nsSVGPathGeometryFrameBase::Init(aContent, aParent, aPrevInFlow);
}
NS_IMETHODIMP NS_IMETHODIMP
nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID, nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
@ -231,7 +240,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const nsPoint &aPoint)
uint16_t fillRule, hitTestFlags; uint16_t fillRule, hitTestFlags;
if (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) { if (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) {
hitTestFlags = SVG_HIT_TEST_FILL; hitTestFlags = SVG_HIT_TEST_FILL;
fillRule = GetClipRule(); fillRule = StyleSVG()->mClipRule;
} else { } else {
hitTestFlags = GetHitTestFlags(); hitTestFlags = GetHitTestFlags();
// XXX once bug 614732 is fixed, aPoint won't need any conversion in order // XXX once bug 614732 is fixed, aPoint won't need any conversion in order
@ -496,7 +505,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsSVGGeometryFrame methods: // nsSVGPathGeometryFrame methods:
gfxMatrix gfxMatrix
nsSVGPathGeometryFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot) nsSVGPathGeometryFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
@ -518,9 +527,6 @@ nsSVGPathGeometryFrame::GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot)
parent->GetCanvasTM(aFor, aTransformRoot)); parent->GetCanvasTM(aFor, aTransformRoot));
} }
//----------------------------------------------------------------------
// nsSVGPathGeometryFrame methods:
nsSVGPathGeometryFrame::MarkerProperties nsSVGPathGeometryFrame::MarkerProperties
nsSVGPathGeometryFrame::GetMarkerProperties(nsSVGPathGeometryFrame *aFrame) nsSVGPathGeometryFrame::GetMarkerProperties(nsSVGPathGeometryFrame *aFrame)
{ {
@ -620,7 +626,7 @@ nsSVGPathGeometryFrame::Render(nsRenderingContext *aContext,
gfxContext::FillRule oldFillRull = gfx->CurrentFillRule(); gfxContext::FillRule oldFillRull = gfx->CurrentFillRule();
if (GetClipRule() == NS_STYLE_FILL_RULE_EVENODD) if (StyleSVG()->mClipRule == NS_STYLE_FILL_RULE_EVENODD)
gfx->SetFillRule(gfxContext::FILL_RULE_EVEN_ODD); gfx->SetFillRule(gfxContext::FILL_RULE_EVEN_ODD);
else else
gfx->SetFillRule(gfxContext::FILL_RULE_WINDING); gfx->SetFillRule(gfxContext::FILL_RULE_WINDING);
@ -714,3 +720,9 @@ nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* aContext)
} }
} }
} }
uint16_t
nsSVGPathGeometryFrame::GetHitTestFlags()
{
return nsSVGUtils::GetGeometryHitTestFlags(this);
}

View File

@ -13,7 +13,6 @@
#include "nsISVGChildFrame.h" #include "nsISVGChildFrame.h"
#include "nsLiteralString.h" #include "nsLiteralString.h"
#include "nsQueryFrame.h" #include "nsQueryFrame.h"
#include "nsSVGGeometryFrame.h"
#include "nsSVGUtils.h" #include "nsSVGUtils.h"
class gfxContext; class gfxContext;
@ -30,7 +29,7 @@ struct nsPoint;
struct nsRect; struct nsRect;
struct nsIntRect; struct nsIntRect;
typedef nsSVGGeometryFrame nsSVGPathGeometryFrameBase; typedef nsFrame nsSVGPathGeometryFrameBase;
class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase, class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase,
public nsISVGChildFrame public nsISVGChildFrame
@ -44,7 +43,7 @@ protected:
nsSVGPathGeometryFrame(nsStyleContext* aContext) nsSVGPathGeometryFrame(nsStyleContext* aContext)
: nsSVGPathGeometryFrameBase(aContext) : nsSVGPathGeometryFrameBase(aContext)
{ {
AddStateBits(NS_FRAME_MAY_BE_TRANSFORMED); AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED);
} }
public: public:
@ -53,6 +52,15 @@ public:
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
// nsIFrame interface: // nsIFrame interface:
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
{
return nsSVGPathGeometryFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGGeometry));
}
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID, NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
int32_t aModType) MOZ_OVERRIDE; int32_t aModType) MOZ_OVERRIDE;
@ -80,10 +88,9 @@ public:
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE; const nsDisplayListSet& aLists) MOZ_OVERRIDE;
// nsSVGGeometryFrame methods // nsSVGPathGeometryFrame methods
gfxMatrix GetCanvasTM(uint32_t aFor, gfxMatrix GetCanvasTM(uint32_t aFor,
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE; nsIFrame* aTransformRoot = nullptr);
protected: protected:
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsRenderingContext *aContext, NS_IMETHOD PaintSVG(nsRenderingContext *aContext,
@ -97,9 +104,14 @@ protected:
uint32_t aFlags) MOZ_OVERRIDE; uint32_t aFlags) MOZ_OVERRIDE;
NS_IMETHOD_(bool) IsDisplayContainer() MOZ_OVERRIDE { return false; } NS_IMETHOD_(bool) IsDisplayContainer() MOZ_OVERRIDE { return false; }
protected:
void GeneratePath(gfxContext *aContext, const Matrix &aTransform); void GeneratePath(gfxContext *aContext, const Matrix &aTransform);
/**
* This function returns a set of bit flags indicating which parts of the
* element (fill, stroke, bounds) should intercept pointer events. It takes
* into account the type of element and the value of the 'pointer-events'
* property on the element.
*/
virtual uint16_t GetHitTestFlags();
private: private:
enum { eRenderFill = 1, eRenderStroke = 2 }; enum { eRenderFill = 1, eRenderStroke = 2 };
void Render(nsRenderingContext *aContext, uint32_t aRenderComponents, void Render(nsRenderingContext *aContext, uint32_t aRenderComponents,

View File

@ -19,7 +19,7 @@
#include "nsRenderingContext.h" #include "nsRenderingContext.h"
#include "nsStyleContext.h" #include "nsStyleContext.h"
#include "nsSVGEffects.h" #include "nsSVGEffects.h"
#include "nsSVGGeometryFrame.h" #include "nsSVGPathGeometryFrame.h"
#include "mozilla/dom/SVGPatternElement.h" #include "mozilla/dom/SVGPatternElement.h"
#include "nsSVGUtils.h" #include "nsSVGUtils.h"
#include "nsSVGAnimatedTransformList.h" #include "nsSVGAnimatedTransformList.h"
@ -389,7 +389,7 @@ nsSVGPatternFrame::PaintPattern(gfxASurface** surface,
if (aSource->IsFrameOfType(nsIFrame::eSVGGeometry)) { if (aSource->IsFrameOfType(nsIFrame::eSVGGeometry)) {
// Set the geometrical parent of the pattern we are rendering // Set the geometrical parent of the pattern we are rendering
patternFrame->mSource = static_cast<nsSVGGeometryFrame*>(aSource); patternFrame->mSource = static_cast<nsSVGPathGeometryFrame*>(aSource);
} }
// Delay checking NS_FRAME_DRAWING_AS_PAINTSERVER bit until here so we can // Delay checking NS_FRAME_DRAWING_AS_PAINTSERVER bit until here so we can

View File

@ -16,6 +16,7 @@ class gfxContext;
class nsIFrame; class nsIFrame;
class nsSVGElement; class nsSVGElement;
class nsSVGLength2; class nsSVGLength2;
class nsSVGPathGeometryFrame;
class nsSVGViewBox; class nsSVGViewBox;
namespace mozilla { namespace mozilla {
@ -131,7 +132,7 @@ private:
// this is a *temporary* reference to the frame of the element currently // this is a *temporary* reference to the frame of the element currently
// referencing our pattern. This must be temporary because different // referencing our pattern. This must be temporary because different
// referencing frames will all reference this one frame // referencing frames will all reference this one frame
nsSVGGeometryFrame *mSource; nsSVGPathGeometryFrame *mSource;
nsAutoPtr<gfxMatrix> mCTM; nsAutoPtr<gfxMatrix> mCTM;
protected: protected:

View File

@ -38,7 +38,6 @@
#include "nsSVGFilterFrame.h" #include "nsSVGFilterFrame.h"
#include "nsSVGFilterPaintCallback.h" #include "nsSVGFilterPaintCallback.h"
#include "nsSVGForeignObjectFrame.h" #include "nsSVGForeignObjectFrame.h"
#include "nsSVGGeometryFrame.h"
#include "gfxSVGGlyphs.h" #include "gfxSVGGlyphs.h"
#include "nsSVGInnerSVGFrame.h" #include "nsSVGInnerSVGFrame.h"
#include "nsSVGIntegrationUtils.h" #include "nsSVGIntegrationUtils.h"
@ -386,7 +385,7 @@ nsSVGUtils::GetCanvasTM(nsIFrame *aFrame, uint32_t aFor,
return containerFrame->GetCanvasTM(aFor, aTransformRoot); return containerFrame->GetCanvasTM(aFor, aTransformRoot);
} }
return static_cast<nsSVGGeometryFrame*>(aFrame)-> return static_cast<nsSVGPathGeometryFrame*>(aFrame)->
GetCanvasTM(aFor, aTransformRoot); GetCanvasTM(aFor, aTransformRoot);
} }