mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-03 22:07:30 +09:00
Issue #2737 - Part 1: Base implementation of SVGGeometryElement.
Mostly mechanical changes to generalize path geometry for all SVG draw elements. No user-exposed changes.
This commit is contained in:
parent
8ae2b45691
commit
fd4a224d1d
45 changed files with 368 additions and 319 deletions
|
|
@ -56,7 +56,7 @@
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "nsPluginFrame.h"
|
#include "nsPluginFrame.h"
|
||||||
#include "nsSVGPathGeometryFrame.h"
|
#include "SVGGeometryFrame.h"
|
||||||
#include "nsTreeBodyFrame.h"
|
#include "nsTreeBodyFrame.h"
|
||||||
#include "nsTreeColumns.h"
|
#include "nsTreeColumns.h"
|
||||||
#include "nsTreeUtils.h"
|
#include "nsTreeUtils.h"
|
||||||
|
|
@ -1161,8 +1161,8 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
|
||||||
|
|
||||||
if (!newAcc) {
|
if (!newAcc) {
|
||||||
if (content->IsSVGElement()) {
|
if (content->IsSVGElement()) {
|
||||||
nsSVGPathGeometryFrame* pathGeometryFrame = do_QueryFrame(frame);
|
SVGGeometryFrame* geometryFrame = do_QueryFrame(frame);
|
||||||
if (pathGeometryFrame) {
|
if (geometryFrame) {
|
||||||
// A graphic elements: rect, circle, ellipse, line, path, polygon,
|
// A graphic elements: rect, circle, ellipse, line, path, polygon,
|
||||||
// polyline and image. A 'use' and 'text' graphic elements require
|
// polyline and image. A 'use' and 'text' graphic elements require
|
||||||
// special support.
|
// special support.
|
||||||
|
|
|
||||||
|
|
@ -2061,6 +2061,7 @@ GK_ATOM(svgFEUnstyledLeafFrame, "SVGFEUnstyledLeafFrame")
|
||||||
GK_ATOM(svgFilterFrame, "SVGFilterFrame")
|
GK_ATOM(svgFilterFrame, "SVGFilterFrame")
|
||||||
GK_ATOM(svgForeignObjectFrame, "SVGForeignObjectFrame")
|
GK_ATOM(svgForeignObjectFrame, "SVGForeignObjectFrame")
|
||||||
GK_ATOM(svgGenericContainerFrame, "SVGGenericContainerFrame")
|
GK_ATOM(svgGenericContainerFrame, "SVGGenericContainerFrame")
|
||||||
|
GK_ATOM(svgGeometryFrame, "SVGGeometryFrame")
|
||||||
GK_ATOM(svgGFrame, "SVGGFrame")
|
GK_ATOM(svgGFrame, "SVGGFrame")
|
||||||
GK_ATOM(svgGradientFrame, "SVGGradientFrame")
|
GK_ATOM(svgGradientFrame, "SVGGradientFrame")
|
||||||
GK_ATOM(svgImageFrame, "SVGImageFrame")
|
GK_ATOM(svgImageFrame, "SVGImageFrame")
|
||||||
|
|
@ -2071,7 +2072,6 @@ GK_ATOM(svgMarkerAnonChildFrame, "SVGMarkerAnonChildFrame")
|
||||||
GK_ATOM(svgMaskFrame, "SVGMaskFrame")
|
GK_ATOM(svgMaskFrame, "SVGMaskFrame")
|
||||||
GK_ATOM(svgOuterSVGFrame, "SVGOuterSVGFrame")
|
GK_ATOM(svgOuterSVGFrame, "SVGOuterSVGFrame")
|
||||||
GK_ATOM(svgOuterSVGAnonChildFrame, "SVGOuterSVGAnonChildFrame")
|
GK_ATOM(svgOuterSVGAnonChildFrame, "SVGOuterSVGAnonChildFrame")
|
||||||
GK_ATOM(svgPathGeometryFrame, "SVGPathGeometryFrame")
|
|
||||||
GK_ATOM(svgPatternFrame, "SVGPatternFrame")
|
GK_ATOM(svgPatternFrame, "SVGPatternFrame")
|
||||||
GK_ATOM(svgRadialGradientFrame, "SVGRadialGradientFrame")
|
GK_ATOM(svgRadialGradientFrame, "SVGRadialGradientFrame")
|
||||||
GK_ATOM(svgStopFrame, "SVGStopFrame")
|
GK_ATOM(svgStopFrame, "SVGStopFrame")
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ SVGCircleElement::GetLengthInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SVGCircleElement::GetGeometryBounds(Rect* aBounds,
|
SVGCircleElement::GetGeometryBounds(Rect* aBounds,
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,17 @@
|
||||||
#ifndef mozilla_dom_SVGCircleElement_h
|
#ifndef mozilla_dom_SVGCircleElement_h
|
||||||
#define mozilla_dom_SVGCircleElement_h
|
#define mozilla_dom_SVGCircleElement_h
|
||||||
|
|
||||||
#include "nsSVGPathGeometryElement.h"
|
#include "SVGGeometryElement.h"
|
||||||
#include "nsSVGLength2.h"
|
#include "nsSVGLength2.h"
|
||||||
|
|
||||||
nsresult NS_NewSVGCircleElement(nsIContent **aResult,
|
nsresult NS_NewSVGCircleElement(nsIContent **aResult,
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||||
|
|
||||||
typedef nsSVGPathGeometryElement SVGCircleElementBase;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
typedef SVGGeometryElement SVGCircleElementBase;
|
||||||
|
|
||||||
class SVGCircleElement final : public SVGCircleElementBase
|
class SVGCircleElement final : public SVGCircleElementBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -29,7 +29,7 @@ public:
|
||||||
// nsSVGSVGElement methods:
|
// nsSVGSVGElement methods:
|
||||||
virtual bool HasValidDimensions() const override;
|
virtual bool HasValidDimensions() const override;
|
||||||
|
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
|
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
|
||||||
const Matrix& aToBoundsSpace,
|
const Matrix& aToBoundsSpace,
|
||||||
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
|
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ SVGEllipseElement::GetLengthInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SVGEllipseElement::GetGeometryBounds(Rect* aBounds,
|
SVGEllipseElement::GetGeometryBounds(Rect* aBounds,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef mozilla_dom_SVGEllipseElement_h
|
#ifndef mozilla_dom_SVGEllipseElement_h
|
||||||
#define mozilla_dom_SVGEllipseElement_h
|
#define mozilla_dom_SVGEllipseElement_h
|
||||||
|
|
||||||
#include "nsSVGPathGeometryElement.h"
|
#include "SVGGeometryElement.h"
|
||||||
#include "nsSVGLength2.h"
|
#include "nsSVGLength2.h"
|
||||||
|
|
||||||
nsresult NS_NewSVGEllipseElement(nsIContent **aResult,
|
nsresult NS_NewSVGEllipseElement(nsIContent **aResult,
|
||||||
|
|
@ -15,7 +15,7 @@ nsresult NS_NewSVGEllipseElement(nsIContent **aResult,
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
typedef nsSVGPathGeometryElement SVGEllipseElementBase;
|
typedef SVGGeometryElement SVGEllipseElementBase;
|
||||||
|
|
||||||
class SVGEllipseElement final : public SVGEllipseElementBase
|
class SVGEllipseElement final : public SVGEllipseElementBase
|
||||||
{
|
{
|
||||||
|
|
@ -29,7 +29,7 @@ public:
|
||||||
// nsSVGSVGElement methods:
|
// nsSVGSVGElement methods:
|
||||||
virtual bool HasValidDimensions() const override;
|
virtual bool HasValidDimensions() const override;
|
||||||
|
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
|
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
|
||||||
const Matrix& aToBoundsSpace,
|
const Matrix& aToBoundsSpace,
|
||||||
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
|
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,9 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsSVGPathGeometryElement.h"
|
#include "SVGGeometryElement.h"
|
||||||
|
|
||||||
|
#include "DOMSVGPoint.h"
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "nsComputedDOMStyle.h"
|
#include "nsComputedDOMStyle.h"
|
||||||
|
|
@ -15,16 +16,25 @@
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
|
||||||
|
nsSVGElement::NumberInfo SVGGeometryElement::sNumberInfo =
|
||||||
|
{ &nsGkAtoms::pathLength, 0, false };
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Implementation
|
// Implementation
|
||||||
|
|
||||||
nsSVGPathGeometryElement::nsSVGPathGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
SVGGeometryElement::SVGGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||||
: nsSVGPathGeometryElementBase(aNodeInfo)
|
: SVGGeometryElementBase(aNodeInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsSVGElement::NumberAttributesInfo
|
||||||
|
SVGGeometryElement::GetNumberInfo()
|
||||||
|
{
|
||||||
|
return NumberAttributesInfo(&mPathLength, &sNumberInfo, 1);
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGPathGeometryElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
SVGGeometryElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||||
const nsAttrValue* aValue,
|
const nsAttrValue* aValue,
|
||||||
const nsAttrValue* aOldValue, bool aNotify)
|
const nsAttrValue* aOldValue, bool aNotify)
|
||||||
{
|
{
|
||||||
|
|
@ -33,13 +43,17 @@ nsSVGPathGeometryElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||||
AttributeDefinesGeometry(aName)) {
|
AttributeDefinesGeometry(aName)) {
|
||||||
mCachedPath = nullptr;
|
mCachedPath = nullptr;
|
||||||
}
|
}
|
||||||
return nsSVGPathGeometryElementBase::AfterSetAttr(aNamespaceID, aName,
|
return SVGGeometryElementBase::AfterSetAttr(aNamespaceID, aName,
|
||||||
aValue, aOldValue, aNotify);
|
aValue, aOldValue, aNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGPathGeometryElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
SVGGeometryElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
||||||
{
|
{
|
||||||
|
if (aName == nsGkAtoms::pathLength) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for nsSVGLength2 attribute
|
// Check for nsSVGLength2 attribute
|
||||||
LengthAttributesInfo info = GetLengthInfo();
|
LengthAttributesInfo info = GetLengthInfo();
|
||||||
for (uint32_t i = 0; i < info.mLengthCount; i++) {
|
for (uint32_t i = 0; i < info.mLengthCount; i++) {
|
||||||
|
|
@ -52,10 +66,10 @@ nsSVGPathGeometryElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGPathGeometryElement::GeometryDependsOnCoordCtx()
|
SVGGeometryElement::GeometryDependsOnCoordCtx()
|
||||||
{
|
{
|
||||||
// Check the nsSVGLength2 attribute
|
// Check the nsSVGLength2 attribute
|
||||||
LengthAttributesInfo info = const_cast<nsSVGPathGeometryElement*>(this)->GetLengthInfo();
|
LengthAttributesInfo info = const_cast<SVGGeometryElement*>(this)->GetLengthInfo();
|
||||||
for (uint32_t i = 0; i < info.mLengthCount; i++) {
|
for (uint32_t i = 0; i < info.mLengthCount; i++) {
|
||||||
if (info.mLengths[i].GetSpecifiedUnitType() == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE) {
|
if (info.mLengths[i].GetSpecifiedUnitType() == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -65,18 +79,18 @@ nsSVGPathGeometryElement::GeometryDependsOnCoordCtx()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGPathGeometryElement::IsMarkable()
|
SVGGeometryElement::IsMarkable()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSVGPathGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
SVGGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<Path>
|
already_AddRefed<Path>
|
||||||
nsSVGPathGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
|
SVGGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
|
||||||
FillRule aFillRule)
|
FillRule aFillRule)
|
||||||
{
|
{
|
||||||
// We only cache the path if it matches the backend used for screen painting:
|
// We only cache the path if it matches the backend used for screen painting:
|
||||||
|
|
@ -102,13 +116,13 @@ nsSVGPathGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<Path>
|
already_AddRefed<Path>
|
||||||
nsSVGPathGeometryElement::GetOrBuildPathForMeasuring()
|
SVGGeometryElement::GetOrBuildPathForMeasuring()
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FillRule
|
FillRule
|
||||||
nsSVGPathGeometryElement::GetFillRule()
|
SVGGeometryElement::GetFillRule()
|
||||||
{
|
{
|
||||||
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to StyleFillRule::Nonzero
|
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to StyleFillRule::Nonzero
|
||||||
|
|
||||||
|
|
@ -130,3 +144,42 @@ nsSVGPathGeometryElement::GetFillRule()
|
||||||
|
|
||||||
return fillRule;
|
return fillRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
SVGGeometryElement::GetTotalLength()
|
||||||
|
{
|
||||||
|
RefPtr<Path> flat = GetOrBuildPathForMeasuring();
|
||||||
|
return flat ? flat->ComputeLength() : 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<nsISVGPoint>
|
||||||
|
SVGGeometryElement::GetPointAtLength(float distance, ErrorResult& rv)
|
||||||
|
{
|
||||||
|
RefPtr<Path> path = GetOrBuildPathForMeasuring();
|
||||||
|
if (!path) {
|
||||||
|
rv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
float totalLength = path->ComputeLength();
|
||||||
|
if (mPathLength.IsExplicitlySet()) {
|
||||||
|
float pathLength = mPathLength.GetAnimValue();
|
||||||
|
if (pathLength <= 0) {
|
||||||
|
rv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
distance *= totalLength / pathLength;
|
||||||
|
}
|
||||||
|
distance = std::max(0.f, distance);
|
||||||
|
distance = std::min(totalLength, distance);
|
||||||
|
|
||||||
|
nsCOMPtr<nsISVGPoint> point =
|
||||||
|
new DOMSVGPoint(path->ComputePointAtLength(distance));
|
||||||
|
return point.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<SVGAnimatedNumber>
|
||||||
|
SVGGeometryElement::PathLength()
|
||||||
|
{
|
||||||
|
return mPathLength.ToDOMAnimatedNumber(this);
|
||||||
|
}
|
||||||
|
|
@ -3,11 +3,13 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef __NS_SVGPATHGEOMETRYELEMENT_H__
|
#ifndef mozilla_dom_SVGGeometryElement_h
|
||||||
#define __NS_SVGPATHGEOMETRYELEMENT_H__
|
#define mozilla_dom_SVGGeometryElement_h
|
||||||
|
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "SVGGraphicsElement.h"
|
#include "SVGGraphicsElement.h"
|
||||||
|
#include "nsISVGPoint.h"
|
||||||
|
#include "nsSVGNumber2.h"
|
||||||
|
|
||||||
struct nsSVGMark {
|
struct nsSVGMark {
|
||||||
enum Type {
|
enum Type {
|
||||||
|
|
@ -24,9 +26,14 @@ struct nsSVGMark {
|
||||||
x(aX), y(aY), angle(aAngle), type(aType) {}
|
x(aX), y(aY), angle(aAngle), type(aType) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef mozilla::dom::SVGGraphicsElement nsSVGPathGeometryElementBase;
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
class nsSVGPathGeometryElement : public nsSVGPathGeometryElementBase
|
class SVGAnimatedNumber;
|
||||||
|
|
||||||
|
typedef mozilla::dom::SVGGraphicsElement SVGGeometryElementBase;
|
||||||
|
|
||||||
|
class SVGGeometryElement : public SVGGeometryElementBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
typedef mozilla::gfx::CapStyle CapStyle;
|
typedef mozilla::gfx::CapStyle CapStyle;
|
||||||
|
|
@ -41,7 +48,7 @@ protected:
|
||||||
typedef mozilla::gfx::StrokeOptions StrokeOptions;
|
typedef mozilla::gfx::StrokeOptions StrokeOptions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit nsSVGPathGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
explicit SVGGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||||
|
|
||||||
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
||||||
const nsAttrValue* aValue,
|
const nsAttrValue* aValue,
|
||||||
|
|
@ -192,8 +199,22 @@ public:
|
||||||
*/
|
*/
|
||||||
FillRule GetFillRule();
|
FillRule GetFillRule();
|
||||||
|
|
||||||
|
// WebIDL
|
||||||
|
already_AddRefed<SVGAnimatedNumber> PathLength();
|
||||||
|
float GetTotalLength();
|
||||||
|
already_AddRefed<nsISVGPoint>
|
||||||
|
GetPointAtLength(float distance, ErrorResult& rv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// nsSVGElement method
|
||||||
|
virtual NumberAttributesInfo GetNumberInfo() override;
|
||||||
|
|
||||||
|
nsSVGNumber2 mPathLength;
|
||||||
|
static NumberInfo sNumberInfo;
|
||||||
mutable RefPtr<Path> mCachedPath;
|
mutable RefPtr<Path> mCachedPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif // mozilla_dom_SVGGeometryElement_h
|
||||||
|
|
@ -235,7 +235,7 @@ SVGImageElement::IsAttributeMapped(const nsIAtom* name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
/* For the purposes of the update/invalidation logic pretend to
|
/* For the purposes of the update/invalidation logic pretend to
|
||||||
be a rectangle. */
|
be a rectangle. */
|
||||||
|
|
|
||||||
|
|
@ -8,21 +8,21 @@
|
||||||
|
|
||||||
#include "nsImageLoadingContent.h"
|
#include "nsImageLoadingContent.h"
|
||||||
#include "nsSVGLength2.h"
|
#include "nsSVGLength2.h"
|
||||||
#include "nsSVGPathGeometryElement.h"
|
|
||||||
#include "nsSVGString.h"
|
#include "nsSVGString.h"
|
||||||
|
#include "SVGGeometryElement.h"
|
||||||
#include "SVGAnimatedPreserveAspectRatio.h"
|
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||||
|
|
||||||
nsresult NS_NewSVGImageElement(nsIContent **aResult,
|
nsresult NS_NewSVGImageElement(nsIContent **aResult,
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||||
|
|
||||||
typedef nsSVGPathGeometryElement SVGImageElementBase;
|
|
||||||
|
|
||||||
class nsSVGImageFrame;
|
class nsSVGImageFrame;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class DOMSVGAnimatedPreserveAspectRatio;
|
class DOMSVGAnimatedPreserveAspectRatio;
|
||||||
|
|
||||||
|
typedef SVGGeometryElement SVGImageElementBase;
|
||||||
|
|
||||||
class SVGImageElement : public SVGImageElementBase,
|
class SVGImageElement : public SVGImageElementBase,
|
||||||
public nsImageLoadingContent
|
public nsImageLoadingContent
|
||||||
{
|
{
|
||||||
|
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const override;
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const override;
|
||||||
|
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
|
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
|
||||||
const Matrix& aToBoundsSpace,
|
const Matrix& aToBoundsSpace,
|
||||||
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
|
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ SVGLineElement::GetLengthInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
void
|
void
|
||||||
SVGLineElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks) {
|
SVGLineElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef mozilla_dom_SVGLineElement_h
|
#ifndef mozilla_dom_SVGLineElement_h
|
||||||
#define mozilla_dom_SVGLineElement_h
|
#define mozilla_dom_SVGLineElement_h
|
||||||
|
|
||||||
#include "nsSVGPathGeometryElement.h"
|
#include "SVGGeometryElement.h"
|
||||||
#include "nsSVGLength2.h"
|
#include "nsSVGLength2.h"
|
||||||
|
|
||||||
nsresult NS_NewSVGLineElement(nsIContent **aResult,
|
nsresult NS_NewSVGLineElement(nsIContent **aResult,
|
||||||
|
|
@ -15,7 +15,7 @@ nsresult NS_NewSVGLineElement(nsIContent **aResult,
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
typedef nsSVGPathGeometryElement SVGLineElementBase;
|
typedef SVGGeometryElement SVGLineElementBase;
|
||||||
|
|
||||||
class SVGLineElement final : public SVGLineElementBase
|
class SVGLineElement final : public SVGLineElementBase
|
||||||
{
|
{
|
||||||
|
|
@ -33,7 +33,7 @@ public:
|
||||||
// nsIContent interface
|
// nsIContent interface
|
||||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const override;
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const override;
|
||||||
|
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual bool IsMarkable() override { return true; }
|
virtual bool IsMarkable() override { return true; }
|
||||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
|
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
|
||||||
virtual void GetAsSimplePath(SimplePath* aSimplePath) override;
|
virtual void GetAsSimplePath(SimplePath* aSimplePath) override;
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsSVGPathDataParser.h"
|
#include "nsSVGPathDataParser.h"
|
||||||
#include "nsSVGPathGeometryElement.h" // for nsSVGMark
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
#include "SVGContentUtils.h"
|
#include "SVGContentUtils.h"
|
||||||
|
#include "SVGGeometryElement.h" // for nsSVGMark
|
||||||
#include "SVGPathSegUtils.h"
|
#include "SVGPathSegUtils.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include "DOMSVGPathSeg.h"
|
#include "DOMSVGPathSeg.h"
|
||||||
#include "DOMSVGPathSegList.h"
|
#include "DOMSVGPathSegList.h"
|
||||||
#include "DOMSVGPoint.h"
|
|
||||||
#include "gfx2DGlue.h"
|
#include "gfx2DGlue.h"
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
#include "mozilla/dom/SVGPathElementBinding.h"
|
#include "mozilla/dom/SVGPathElementBinding.h"
|
||||||
|
|
@ -35,9 +34,6 @@ SVGPathElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
return SVGPathElementBinding::Wrap(aCx, this, aGivenProto);
|
return SVGPathElementBinding::Wrap(aCx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGElement::NumberInfo SVGPathElement::sNumberInfo =
|
|
||||||
{ &nsGkAtoms::pathLength, 0, false };
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Implementation
|
// Implementation
|
||||||
|
|
||||||
|
|
@ -61,45 +57,6 @@ SVGPathElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||||
|
|
||||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPathElement)
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPathElement)
|
||||||
|
|
||||||
already_AddRefed<SVGAnimatedNumber>
|
|
||||||
SVGPathElement::PathLength()
|
|
||||||
{
|
|
||||||
return mPathLength.ToDOMAnimatedNumber(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
float
|
|
||||||
SVGPathElement::GetTotalLength()
|
|
||||||
{
|
|
||||||
RefPtr<Path> flat = GetOrBuildPathForMeasuring();
|
|
||||||
return flat ? flat->ComputeLength() : 0.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsISVGPoint>
|
|
||||||
SVGPathElement::GetPointAtLength(float distance, ErrorResult& rv)
|
|
||||||
{
|
|
||||||
RefPtr<Path> path = GetOrBuildPathForMeasuring();
|
|
||||||
if (!path) {
|
|
||||||
rv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
float totalLength = path->ComputeLength();
|
|
||||||
if (mPathLength.IsExplicitlySet()) {
|
|
||||||
float pathLength = mPathLength.GetAnimValue();
|
|
||||||
if (pathLength <= 0) {
|
|
||||||
rv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
distance *= totalLength / pathLength;
|
|
||||||
}
|
|
||||||
distance = std::max(0.f, distance);
|
|
||||||
distance = std::min(totalLength, distance);
|
|
||||||
|
|
||||||
nsCOMPtr<nsISVGPoint> point =
|
|
||||||
new DOMSVGPoint(path->ComputePointAtLength(distance));
|
|
||||||
return point.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
SVGPathElement::GetPathSegAtLength(float distance)
|
SVGPathElement::GetPathSegAtLength(float distance)
|
||||||
{
|
{
|
||||||
|
|
@ -284,12 +241,6 @@ SVGPathElement::HasValidDimensions() const
|
||||||
return !mD.GetAnimValue().IsEmpty();
|
return !mD.GetAnimValue().IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGElement::NumberAttributesInfo
|
|
||||||
SVGPathElement::GetNumberInfo()
|
|
||||||
{
|
|
||||||
return NumberAttributesInfo(&mPathLength, &sNumberInfo, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsIContent methods
|
// nsIContent methods
|
||||||
|
|
||||||
|
|
@ -311,7 +262,7 @@ SVGPathElement::GetOrBuildPathForMeasuring()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SVGPathElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
SVGPathElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
||||||
|
|
|
||||||
|
|
@ -8,22 +8,21 @@
|
||||||
|
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "mozilla/RefPtr.h"
|
#include "mozilla/RefPtr.h"
|
||||||
#include "nsSVGNumber2.h"
|
|
||||||
#include "nsSVGPathGeometryElement.h"
|
|
||||||
#include "SVGAnimatedPathSegList.h"
|
#include "SVGAnimatedPathSegList.h"
|
||||||
|
#include "SVGGeometryElement.h"
|
||||||
#include "DOMSVGPathSeg.h"
|
#include "DOMSVGPathSeg.h"
|
||||||
|
|
||||||
nsresult NS_NewSVGPathElement(nsIContent **aResult,
|
nsresult NS_NewSVGPathElement(nsIContent **aResult,
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||||
|
|
||||||
typedef nsSVGPathGeometryElement SVGPathElementBase;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class nsISVGPoint;
|
class nsISVGPoint;
|
||||||
|
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
typedef SVGGeometryElement SVGPathElementBase;
|
||||||
|
|
||||||
class SVGPathElement final : public SVGPathElementBase
|
class SVGPathElement final : public SVGPathElementBase
|
||||||
{
|
{
|
||||||
friend class nsSVGPathFrame;
|
friend class nsSVGPathFrame;
|
||||||
|
|
@ -46,7 +45,7 @@ public:
|
||||||
// nsSVGSVGElement methods:
|
// nsSVGSVGElement methods:
|
||||||
virtual bool HasValidDimensions() const override;
|
virtual bool HasValidDimensions() const override;
|
||||||
|
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) override;
|
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) override;
|
||||||
virtual bool IsMarkable() override;
|
virtual bool IsMarkable() override;
|
||||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
|
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
|
||||||
|
|
@ -83,9 +82,6 @@ public:
|
||||||
float GetPathLengthScale(PathLengthScaleForType aFor);
|
float GetPathLengthScale(PathLengthScaleForType aFor);
|
||||||
|
|
||||||
// WebIDL
|
// WebIDL
|
||||||
already_AddRefed<SVGAnimatedNumber> PathLength();
|
|
||||||
float GetTotalLength();
|
|
||||||
already_AddRefed<nsISVGPoint> GetPointAtLength(float distance, ErrorResult& rv);
|
|
||||||
uint32_t GetPathSegAtLength(float distance);
|
uint32_t GetPathSegAtLength(float distance);
|
||||||
already_AddRefed<DOMSVGPathSegClosePath> CreateSVGPathSegClosePath();
|
already_AddRefed<DOMSVGPathSegClosePath> CreateSVGPathSegClosePath();
|
||||||
already_AddRefed<DOMSVGPathSegMovetoAbs> CreateSVGPathSegMovetoAbs(float x, float y);
|
already_AddRefed<DOMSVGPathSegMovetoAbs> CreateSVGPathSegMovetoAbs(float x, float y);
|
||||||
|
|
@ -121,12 +117,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// nsSVGElement method
|
|
||||||
virtual NumberAttributesInfo GetNumberInfo() override;
|
|
||||||
|
|
||||||
SVGAnimatedPathSegList mD;
|
SVGAnimatedPathSegList mD;
|
||||||
nsSVGNumber2 mPathLength;
|
|
||||||
static NumberInfo sNumberInfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsSVGPolyElement.h"
|
#include "SVGPolyElement.h"
|
||||||
#include "DOMSVGPointList.h"
|
#include "DOMSVGPointList.h"
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "SVGContentUtils.h"
|
#include "SVGContentUtils.h"
|
||||||
|
|
@ -14,26 +14,26 @@ using namespace mozilla::gfx;
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsISupports methods
|
// nsISupports methods
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsSVGPolyElement,nsSVGPolyElementBase)
|
NS_IMPL_ADDREF_INHERITED(SVGPolyElement,SVGPolyElementBase)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsSVGPolyElement,nsSVGPolyElementBase)
|
NS_IMPL_RELEASE_INHERITED(SVGPolyElement,SVGPolyElementBase)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsSVGPolyElement)
|
NS_INTERFACE_MAP_BEGIN(SVGPolyElement)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGPolyElementBase)
|
NS_INTERFACE_MAP_END_INHERITING(SVGPolyElementBase)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Implementation
|
// Implementation
|
||||||
|
|
||||||
nsSVGPolyElement::nsSVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
SVGPolyElement::SVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
||||||
: nsSVGPolyElementBase(aNodeInfo)
|
: SVGPolyElementBase(aNodeInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGPolyElement::~nsSVGPolyElement()
|
SVGPolyElement::~SVGPolyElement()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMSVGPointList>
|
already_AddRefed<DOMSVGPointList>
|
||||||
nsSVGPolyElement::Points()
|
SVGPolyElement::Points()
|
||||||
{
|
{
|
||||||
void *key = mPoints.GetBaseValKey();
|
void *key = mPoints.GetBaseValKey();
|
||||||
RefPtr<DOMSVGPointList> points = DOMSVGPointList::GetDOMWrapper(key, this, false);
|
RefPtr<DOMSVGPointList> points = DOMSVGPointList::GetDOMWrapper(key, this, false);
|
||||||
|
|
@ -41,7 +41,7 @@ nsSVGPolyElement::Points()
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMSVGPointList>
|
already_AddRefed<DOMSVGPointList>
|
||||||
nsSVGPolyElement::AnimatedPoints()
|
SVGPolyElement::AnimatedPoints()
|
||||||
{
|
{
|
||||||
void *key = mPoints.GetAnimValKey();
|
void *key = mPoints.GetAnimValKey();
|
||||||
RefPtr<DOMSVGPointList> points = DOMSVGPointList::GetDOMWrapper(key, this, true);
|
RefPtr<DOMSVGPointList> points = DOMSVGPointList::GetDOMWrapper(key, this, true);
|
||||||
|
|
@ -53,30 +53,30 @@ nsSVGPolyElement::AnimatedPoints()
|
||||||
// nsIContent methods
|
// nsIContent methods
|
||||||
|
|
||||||
NS_IMETHODIMP_(bool)
|
NS_IMETHODIMP_(bool)
|
||||||
nsSVGPolyElement::IsAttributeMapped(const nsIAtom* name) const
|
SVGPolyElement::IsAttributeMapped(const nsIAtom* name) const
|
||||||
{
|
{
|
||||||
static const MappedAttributeEntry* const map[] = {
|
static const MappedAttributeEntry* const map[] = {
|
||||||
sMarkersMap
|
sMarkersMap
|
||||||
};
|
};
|
||||||
|
|
||||||
return FindAttributeDependence(name, map) ||
|
return FindAttributeDependence(name, map) ||
|
||||||
nsSVGPolyElementBase::IsAttributeMapped(name);
|
SVGPolyElementBase::IsAttributeMapped(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGElement methods
|
// nsSVGElement methods
|
||||||
|
|
||||||
/* virtual */ bool
|
/* virtual */ bool
|
||||||
nsSVGPolyElement::HasValidDimensions() const
|
SVGPolyElement::HasValidDimensions() const
|
||||||
{
|
{
|
||||||
return !mPoints.GetAnimValue().IsEmpty();
|
return !mPoints.GetAnimValue().IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGPolyElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
SVGPolyElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
||||||
{
|
{
|
||||||
if (aName == nsGkAtoms::points)
|
if (aName == nsGkAtoms::points)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -85,7 +85,7 @@ nsSVGPolyElement::AttributeDefinesGeometry(const nsIAtom *aName)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSVGPolyElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
SVGPolyElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
||||||
{
|
{
|
||||||
const SVGPointList &points = mPoints.GetAnimValue();
|
const SVGPointList &points = mPoints.GetAnimValue();
|
||||||
|
|
||||||
|
|
@ -121,7 +121,7 @@ nsSVGPolyElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGPolyElement::GetGeometryBounds(Rect* aBounds,
|
SVGPolyElement::GetGeometryBounds(Rect* aBounds,
|
||||||
const StrokeOptions& aStrokeOptions,
|
const StrokeOptions& aStrokeOptions,
|
||||||
const Matrix& aToBoundsSpace,
|
const Matrix& aToBoundsSpace,
|
||||||
const Matrix* aToNonScalingStrokeSpace)
|
const Matrix* aToNonScalingStrokeSpace)
|
||||||
|
|
@ -3,25 +3,26 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef NS_SVGPOLYELEMENT_H_
|
#ifndef __SVGPOLYELEMENT_H_
|
||||||
#define NS_SVGPOLYELEMENT_H_
|
#define __SVGPOLYELEMENT_H_
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsSVGPathGeometryElement.h"
|
|
||||||
#include "SVGAnimatedPointList.h"
|
#include "SVGAnimatedPointList.h"
|
||||||
|
#include "SVGGeometryElement.h"
|
||||||
typedef nsSVGPathGeometryElement nsSVGPolyElementBase;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class DOMSVGPointList;
|
class DOMSVGPointList;
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
class nsSVGPolyElement : public nsSVGPolyElementBase
|
namespace dom {
|
||||||
|
|
||||||
|
typedef SVGGeometryElement SVGPolyElementBase;
|
||||||
|
|
||||||
|
class SVGPolyElement : public SVGPolyElementBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
explicit nsSVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
explicit SVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
||||||
|
|
||||||
virtual ~nsSVGPolyElement();
|
virtual ~SVGPolyElement();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//interfaces
|
//interfaces
|
||||||
|
|
@ -41,7 +42,7 @@ public:
|
||||||
// nsSVGElement methods:
|
// nsSVGElement methods:
|
||||||
virtual bool HasValidDimensions() const override;
|
virtual bool HasValidDimensions() const override;
|
||||||
|
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) override;
|
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) override;
|
||||||
virtual bool IsMarkable() override { return true; }
|
virtual bool IsMarkable() override { return true; }
|
||||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
|
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
|
||||||
|
|
@ -57,4 +58,7 @@ protected:
|
||||||
SVGAnimatedPointList mPoints;
|
SVGAnimatedPointList mPoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //NS_SVGPOLYELEMENT_H_
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif //__SVGPOLYELEMENT_H_
|
||||||
|
|
@ -36,12 +36,12 @@ SVGPolygonElement::SVGPolygonElement(already_AddRefed<mozilla::dom::NodeInfo>& a
|
||||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolygonElement)
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolygonElement)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
void
|
void
|
||||||
SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
||||||
{
|
{
|
||||||
nsSVGPolyElement::GetMarkPoints(aMarks);
|
SVGPolyElement::GetMarkPoints(aMarks);
|
||||||
|
|
||||||
if (aMarks->IsEmpty() || aMarks->LastElement().type != nsSVGMark::eEnd) {
|
if (aMarks->IsEmpty() || aMarks->LastElement().type != nsSVGMark::eEnd) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -55,7 +55,7 @@ SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
||||||
endMark->angle = SVGContentUtils::AngleBisect(angle, endMark->angle);
|
endMark->angle = SVGContentUtils::AngleBisect(angle, endMark->angle);
|
||||||
startMark->angle = SVGContentUtils::AngleBisect(angle, startMark->angle);
|
startMark->angle = SVGContentUtils::AngleBisect(angle, startMark->angle);
|
||||||
// for a polygon (as opposed to a polyline) there's an implicit extra point
|
// for a polygon (as opposed to a polyline) there's an implicit extra point
|
||||||
// co-located with the start point that nsSVGPolyElement::GetMarkPoints
|
// co-located with the start point that SVGPolyElement::GetMarkPoints
|
||||||
// doesn't return
|
// doesn't return
|
||||||
aMarks->AppendElement(nsSVGMark(startMark->x, startMark->y, startMark->angle,
|
aMarks->AppendElement(nsSVGMark(startMark->x, startMark->y, startMark->angle,
|
||||||
nsSVGMark::eEnd));
|
nsSVGMark::eEnd));
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,16 @@
|
||||||
#define mozilla_dom_SVGPolygonElement_h
|
#define mozilla_dom_SVGPolygonElement_h
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsSVGPolyElement.h"
|
#include "SVGPolyElement.h"
|
||||||
|
|
||||||
nsresult NS_NewSVGPolygonElement(nsIContent **aResult,
|
nsresult NS_NewSVGPolygonElement(nsIContent **aResult,
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||||
|
|
||||||
typedef nsSVGPolyElement SVGPolygonElementBase;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
typedef SVGPolyElement SVGPolygonElementBase;
|
||||||
|
|
||||||
class SVGPolygonElement final : public SVGPolygonElementBase
|
class SVGPolygonElement final : public SVGPolygonElementBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -26,7 +26,7 @@ protected:
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
|
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
|
||||||
virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
|
virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ SVGPolylineElement::SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>&
|
||||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolylineElement)
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolylineElement)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
already_AddRefed<Path>
|
already_AddRefed<Path>
|
||||||
SVGPolylineElement::BuildPath(PathBuilder* aBuilder)
|
SVGPolylineElement::BuildPath(PathBuilder* aBuilder)
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@
|
||||||
#ifndef mozilla_dom_SVGPolylineElement_h
|
#ifndef mozilla_dom_SVGPolylineElement_h
|
||||||
#define mozilla_dom_SVGPolylineElement_h
|
#define mozilla_dom_SVGPolylineElement_h
|
||||||
|
|
||||||
#include "nsSVGPolyElement.h"
|
#include "SVGPolyElement.h"
|
||||||
|
|
||||||
nsresult NS_NewSVGPolylineElement(nsIContent **aResult,
|
nsresult NS_NewSVGPolylineElement(nsIContent **aResult,
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||||
|
|
||||||
typedef nsSVGPolyElement SVGPolylineElementBase;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
typedef SVGPolyElement SVGPolylineElementBase;
|
||||||
|
|
||||||
class SVGPolylineElement final : public SVGPolylineElementBase
|
class SVGPolylineElement final : public SVGPolylineElementBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -24,7 +24,7 @@ protected:
|
||||||
friend nsresult (::NS_NewSVGPolylineElement(nsIContent **aResult,
|
friend nsresult (::NS_NewSVGPolylineElement(nsIContent **aResult,
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
||||||
|
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
|
virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ SVGRectElement::GetLengthInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryElement methods
|
// SVGGeometryElement methods
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SVGRectElement::GetGeometryBounds(Rect* aBounds,
|
SVGRectElement::GetGeometryBounds(Rect* aBounds,
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,17 @@
|
||||||
#ifndef mozilla_dom_SVGRectElement_h
|
#ifndef mozilla_dom_SVGRectElement_h
|
||||||
#define mozilla_dom_SVGRectElement_h
|
#define mozilla_dom_SVGRectElement_h
|
||||||
|
|
||||||
#include "nsSVGPathGeometryElement.h"
|
|
||||||
#include "nsSVGLength2.h"
|
#include "nsSVGLength2.h"
|
||||||
|
#include "SVGGeometryElement.h"
|
||||||
|
|
||||||
nsresult NS_NewSVGRectElement(nsIContent **aResult,
|
nsresult NS_NewSVGRectElement(nsIContent **aResult,
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||||
|
|
||||||
typedef nsSVGPathGeometryElement SVGRectElementBase;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
typedef SVGGeometryElement SVGRectElementBase;
|
||||||
|
|
||||||
class SVGRectElement final : public SVGRectElementBase
|
class SVGRectElement final : public SVGRectElementBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -29,7 +29,7 @@ public:
|
||||||
// nsSVGSVGElement methods:
|
// nsSVGSVGElement methods:
|
||||||
virtual bool HasValidDimensions() const override;
|
virtual bool HasValidDimensions() const override;
|
||||||
|
|
||||||
// nsSVGPathGeometryElement methods:
|
// SVGGeometryElement methods:
|
||||||
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
|
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
|
||||||
const Matrix& aToBoundsSpace,
|
const Matrix& aToBoundsSpace,
|
||||||
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
|
const Matrix* aToNonScalingStrokeSpace = nullptr) override;
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ EXPORTS.mozilla.dom += [
|
||||||
'SVGFilterElement.h',
|
'SVGFilterElement.h',
|
||||||
'SVGForeignObjectElement.h',
|
'SVGForeignObjectElement.h',
|
||||||
'SVGGElement.h',
|
'SVGGElement.h',
|
||||||
|
'SVGGeometryElement.h',
|
||||||
'SVGGradientElement.h',
|
'SVGGradientElement.h',
|
||||||
'SVGGraphicsElement.h',
|
'SVGGraphicsElement.h',
|
||||||
'SVGImageElement.h',
|
'SVGImageElement.h',
|
||||||
|
|
@ -131,8 +132,6 @@ UNIFIED_SOURCES += [
|
||||||
'nsSVGNumber2.cpp',
|
'nsSVGNumber2.cpp',
|
||||||
'nsSVGNumberPair.cpp',
|
'nsSVGNumberPair.cpp',
|
||||||
'nsSVGPathDataParser.cpp',
|
'nsSVGPathDataParser.cpp',
|
||||||
'nsSVGPathGeometryElement.cpp',
|
|
||||||
'nsSVGPolyElement.cpp',
|
|
||||||
'nsSVGString.cpp',
|
'nsSVGString.cpp',
|
||||||
'nsSVGTransform.cpp',
|
'nsSVGTransform.cpp',
|
||||||
'nsSVGViewBox.cpp',
|
'nsSVGViewBox.cpp',
|
||||||
|
|
@ -190,6 +189,7 @@ UNIFIED_SOURCES += [
|
||||||
'SVGForeignObjectElement.cpp',
|
'SVGForeignObjectElement.cpp',
|
||||||
'SVGFragmentIdentifier.cpp',
|
'SVGFragmentIdentifier.cpp',
|
||||||
'SVGGElement.cpp',
|
'SVGGElement.cpp',
|
||||||
|
'SVGGeometryElement.cpp',
|
||||||
'SVGGradientElement.cpp',
|
'SVGGradientElement.cpp',
|
||||||
'SVGGraphicsElement.cpp',
|
'SVGGraphicsElement.cpp',
|
||||||
'SVGImageElement.cpp',
|
'SVGImageElement.cpp',
|
||||||
|
|
@ -218,6 +218,7 @@ UNIFIED_SOURCES += [
|
||||||
'SVGPatternElement.cpp',
|
'SVGPatternElement.cpp',
|
||||||
'SVGPointList.cpp',
|
'SVGPointList.cpp',
|
||||||
'SVGPointListSMILType.cpp',
|
'SVGPointListSMILType.cpp',
|
||||||
|
'SVGPolyElement.cpp',
|
||||||
'SVGPolygonElement.cpp',
|
'SVGPolygonElement.cpp',
|
||||||
'SVGPolylineElement.cpp',
|
'SVGPolylineElement.cpp',
|
||||||
'SVGPreserveAspectRatio.cpp',
|
'SVGPreserveAspectRatio.cpp',
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
#include "nsICSSDeclaration.h"
|
#include "nsICSSDeclaration.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMMutationEvent.h"
|
#include "nsIDOMMutationEvent.h"
|
||||||
#include "nsSVGPathGeometryElement.h"
|
|
||||||
#include "mozilla/InternalMutationEvent.h"
|
#include "mozilla/InternalMutationEvent.h"
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
|
|
@ -45,6 +44,7 @@
|
||||||
#include "SVGAnimatedPointList.h"
|
#include "SVGAnimatedPointList.h"
|
||||||
#include "SVGAnimatedPathSegList.h"
|
#include "SVGAnimatedPathSegList.h"
|
||||||
#include "SVGContentUtils.h"
|
#include "SVGContentUtils.h"
|
||||||
|
#include "SVGGeometryElement.h"
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
#include "nsQueryObject.h"
|
#include "nsQueryObject.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
|
||||||
|
|
@ -992,6 +992,8 @@ var interfaceNamesInGlobalScope =
|
||||||
"SVGForeignObjectElement",
|
"SVGForeignObjectElement",
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
"SVGGElement",
|
"SVGGElement",
|
||||||
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
"SVGGeometryElement",
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
"SVGGradientElement",
|
"SVGGradientElement",
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
|
|
||||||
20
dom/webidl/SVGGeometryElement.webidl
Normal file
20
dom/webidl/SVGGeometryElement.webidl
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* -*- Mode: IDL; 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/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.w3.org/TR/SVG2/
|
||||||
|
*
|
||||||
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||||
|
* liability, trademark and document use rules apply.
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface SVGGeometryElement : SVGGraphicsElement {
|
||||||
|
[SameObject]
|
||||||
|
readonly attribute SVGAnimatedNumber pathLength;
|
||||||
|
|
||||||
|
float getTotalLength();
|
||||||
|
[NewObject, Throws]
|
||||||
|
SVGPoint getPointAtLength(float distance);
|
||||||
|
};
|
||||||
|
|
@ -9,14 +9,8 @@
|
||||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||||
* liability, trademark and document use rules apply.
|
* liability, trademark and document use rules apply.
|
||||||
*/
|
*/
|
||||||
interface SVGPathElement : SVGGraphicsElement {
|
interface SVGPathElement : SVGGeometryElement {
|
||||||
|
|
||||||
[Constant]
|
|
||||||
readonly attribute SVGAnimatedNumber pathLength;
|
|
||||||
|
|
||||||
float getTotalLength();
|
|
||||||
[NewObject, Throws]
|
|
||||||
SVGPoint getPointAtLength(float distance);
|
|
||||||
unsigned long getPathSegAtLength(float distance);
|
unsigned long getPathSegAtLength(float distance);
|
||||||
[NewObject]
|
[NewObject]
|
||||||
SVGPathSegClosePath createSVGPathSegClosePath();
|
SVGPathSegClosePath createSVGPathSegClosePath();
|
||||||
|
|
|
||||||
|
|
@ -470,6 +470,7 @@ WEBIDL_FILES = [
|
||||||
'SVGFitToViewBox.webidl',
|
'SVGFitToViewBox.webidl',
|
||||||
'SVGForeignObjectElement.webidl',
|
'SVGForeignObjectElement.webidl',
|
||||||
'SVGGElement.webidl',
|
'SVGGElement.webidl',
|
||||||
|
'SVGGeometryElement.webidl',
|
||||||
'SVGGradientElement.webidl',
|
'SVGGradientElement.webidl',
|
||||||
'SVGGraphicsElement.webidl',
|
'SVGGraphicsElement.webidl',
|
||||||
'SVGImageElement.webidl',
|
'SVGImageElement.webidl',
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ NS_NewSVGOuterSVGAnonChildFrame(nsIPresShell* aPresShell, nsStyleContext* aConte
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
NS_NewSVGGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
NS_NewSVGGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
NS_NewSVGGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
|
|
@ -5482,13 +5482,13 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
|
||||||
SIMPLE_SVG_CREATE(svg, NS_NewSVGInnerSVGFrame),
|
SIMPLE_SVG_CREATE(svg, NS_NewSVGInnerSVGFrame),
|
||||||
SIMPLE_SVG_CREATE(g, NS_NewSVGGFrame),
|
SIMPLE_SVG_CREATE(g, NS_NewSVGGFrame),
|
||||||
SIMPLE_SVG_CREATE(svgSwitch, NS_NewSVGSwitchFrame),
|
SIMPLE_SVG_CREATE(svgSwitch, NS_NewSVGSwitchFrame),
|
||||||
SIMPLE_SVG_CREATE(polygon, NS_NewSVGPathGeometryFrame),
|
SIMPLE_SVG_CREATE(polygon, NS_NewSVGGeometryFrame),
|
||||||
SIMPLE_SVG_CREATE(polyline, NS_NewSVGPathGeometryFrame),
|
SIMPLE_SVG_CREATE(polyline, NS_NewSVGGeometryFrame),
|
||||||
SIMPLE_SVG_CREATE(circle, NS_NewSVGPathGeometryFrame),
|
SIMPLE_SVG_CREATE(circle, NS_NewSVGGeometryFrame),
|
||||||
SIMPLE_SVG_CREATE(ellipse, NS_NewSVGPathGeometryFrame),
|
SIMPLE_SVG_CREATE(ellipse, NS_NewSVGGeometryFrame),
|
||||||
SIMPLE_SVG_CREATE(line, NS_NewSVGPathGeometryFrame),
|
SIMPLE_SVG_CREATE(line, NS_NewSVGGeometryFrame),
|
||||||
SIMPLE_SVG_CREATE(rect, NS_NewSVGPathGeometryFrame),
|
SIMPLE_SVG_CREATE(rect, NS_NewSVGGeometryFrame),
|
||||||
SIMPLE_SVG_CREATE(path, NS_NewSVGPathGeometryFrame),
|
SIMPLE_SVG_CREATE(path, NS_NewSVGGeometryFrame),
|
||||||
SIMPLE_SVG_CREATE(defs, NS_NewSVGContainerFrame),
|
SIMPLE_SVG_CREATE(defs, NS_NewSVGContainerFrame),
|
||||||
SIMPLE_SVG_CREATE(generic_, NS_NewSVGGenericContainerFrame),
|
SIMPLE_SVG_CREATE(generic_, NS_NewSVGGenericContainerFrame),
|
||||||
{ &nsGkAtoms::foreignObject,
|
{ &nsGkAtoms::foreignObject,
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ DECLARE_DISPLAY_ITEM_TYPE(SUBDOCUMENT)
|
||||||
DECLARE_DISPLAY_ITEM_TYPE(MASK)
|
DECLARE_DISPLAY_ITEM_TYPE(MASK)
|
||||||
DECLARE_DISPLAY_ITEM_TYPE(FILTER)
|
DECLARE_DISPLAY_ITEM_TYPE(FILTER)
|
||||||
DECLARE_DISPLAY_ITEM_TYPE(SVG_OUTER_SVG)
|
DECLARE_DISPLAY_ITEM_TYPE(SVG_OUTER_SVG)
|
||||||
DECLARE_DISPLAY_ITEM_TYPE(SVG_PATH_GEOMETRY)
|
DECLARE_DISPLAY_ITEM_TYPE(SVG_GEOMETRY)
|
||||||
DECLARE_DISPLAY_ITEM_TYPE(SVG_TEXT)
|
DECLARE_DISPLAY_ITEM_TYPE(SVG_TEXT)
|
||||||
DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_BACKGROUND)
|
DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_BACKGROUND)
|
||||||
DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_SELECTION)
|
DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_SELECTION)
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ FRAME_ID(nsSVGMaskFrame)
|
||||||
FRAME_ID(nsSVGOuterSVGFrame)
|
FRAME_ID(nsSVGOuterSVGFrame)
|
||||||
FRAME_ID(nsSVGOuterSVGAnonChildFrame)
|
FRAME_ID(nsSVGOuterSVGAnonChildFrame)
|
||||||
FRAME_ID(nsSVGPaintServerFrame)
|
FRAME_ID(nsSVGPaintServerFrame)
|
||||||
FRAME_ID(nsSVGPathGeometryFrame)
|
FRAME_ID(SVGGeometryFrame)
|
||||||
FRAME_ID(nsSVGPatternFrame)
|
FRAME_ID(nsSVGPatternFrame)
|
||||||
FRAME_ID(nsSVGRadialGradientFrame)
|
FRAME_ID(nsSVGRadialGradientFrame)
|
||||||
FRAME_ID(nsSVGStopFrame)
|
FRAME_ID(nsSVGStopFrame)
|
||||||
|
|
|
||||||
|
|
@ -929,7 +929,7 @@ nsStyleSVG::CalcDifference(const nsStyleSVG& aNewData) const
|
||||||
if (!DefinitelyEqualURIs(mMarkerEnd, aNewData.mMarkerEnd) ||
|
if (!DefinitelyEqualURIs(mMarkerEnd, aNewData.mMarkerEnd) ||
|
||||||
!DefinitelyEqualURIs(mMarkerMid, aNewData.mMarkerMid) ||
|
!DefinitelyEqualURIs(mMarkerMid, aNewData.mMarkerMid) ||
|
||||||
!DefinitelyEqualURIs(mMarkerStart, aNewData.mMarkerStart)) {
|
!DefinitelyEqualURIs(mMarkerStart, aNewData.mMarkerStart)) {
|
||||||
// Markers currently contribute to nsSVGPathGeometryFrame::mRect,
|
// Markers currently contribute to SVGGeometryFrame::mRect,
|
||||||
// so we need a reflow as well as a repaint. No intrinsic sizes need
|
// so we need a reflow as well as a repaint. No intrinsic sizes need
|
||||||
// to change, so nsChangeHint_NeedReflow is sufficient.
|
// to change, so nsChangeHint_NeedReflow is sufficient.
|
||||||
return nsChangeHint_UpdateEffects |
|
return nsChangeHint_UpdateEffects |
|
||||||
|
|
@ -950,7 +950,7 @@ nsStyleSVG::CalcDifference(const nsStyleSVG& aNewData) const
|
||||||
// stroke (in which case whether we have fill or not is significant to frame
|
// stroke (in which case whether we have fill or not is significant to frame
|
||||||
// bounds) and whether we have fill or not just changed. In either case we
|
// bounds) and whether we have fill or not just changed. In either case we
|
||||||
// need to reflow so the frame rect is updated.
|
// need to reflow so the frame rect is updated.
|
||||||
// XXXperf this is a waste on non nsSVGPathGeometryFrames.
|
// XXXperf this is a waste on non SVGGeometryFrames.
|
||||||
hint |= nsChangeHint_NeedReflow |
|
hint |= nsChangeHint_NeedReflow |
|
||||||
nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085
|
nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085
|
||||||
}
|
}
|
||||||
|
|
@ -960,10 +960,10 @@ nsStyleSVG::CalcDifference(const nsStyleSVG& aNewData) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stroke currently contributes to nsSVGPathGeometryFrame::mRect, so
|
// Stroke currently contributes to SVGGeometryFrame::mRect, so
|
||||||
// we need a reflow here. No intrinsic sizes need to change, so
|
// we need a reflow here. No intrinsic sizes need to change, so
|
||||||
// nsChangeHint_NeedReflow is sufficient.
|
// nsChangeHint_NeedReflow is sufficient.
|
||||||
// Note that stroke-dashoffset does not affect nsSVGPathGeometryFrame::mRect.
|
// Note that stroke-dashoffset does not affect SVGGeometryFrame::mRect.
|
||||||
// text-anchor changes also require a reflow since it changes frames' rects.
|
// text-anchor changes also require a reflow since it changes frames' rects.
|
||||||
if (mStrokeWidth != aNewData.mStrokeWidth ||
|
if (mStrokeWidth != aNewData.mStrokeWidth ||
|
||||||
mStrokeMiterlimit != aNewData.mStrokeMiterlimit ||
|
mStrokeMiterlimit != aNewData.mStrokeMiterlimit ||
|
||||||
|
|
@ -1189,9 +1189,9 @@ nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
|
||||||
// XXXjwatt: why NS_STYLE_HINT_REFLOW? Isn't that excessive?
|
// XXXjwatt: why NS_STYLE_HINT_REFLOW? Isn't that excessive?
|
||||||
hint |= NS_STYLE_HINT_REFLOW;
|
hint |= NS_STYLE_HINT_REFLOW;
|
||||||
} else if (mVectorEffect != aNewData.mVectorEffect) {
|
} else if (mVectorEffect != aNewData.mVectorEffect) {
|
||||||
// Stroke currently affects nsSVGPathGeometryFrame::mRect, and
|
// Stroke currently affects SVGGeometryFrame::mRect, and
|
||||||
// vector-effect affect stroke. As a result we need to reflow if
|
// vector-effect affect stroke. As a result we need to reflow if
|
||||||
// vector-effect changes in order to have nsSVGPathGeometryFrame::
|
// vector-effect changes in order to have SVGGeometryFrame::
|
||||||
// ReflowSVG called to update its mRect. No intrinsic sizes need
|
// ReflowSVG called to update its mRect. No intrinsic sizes need
|
||||||
// to change so nsChangeHint_NeedReflow is sufficient.
|
// to change so nsChangeHint_NeedReflow is sufficient.
|
||||||
hint |= nsChangeHint_NeedReflow |
|
hint |= nsChangeHint_NeedReflow |
|
||||||
|
|
@ -3962,8 +3962,8 @@ nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mPointerEvents != aNewData.mPointerEvents) {
|
if (mPointerEvents != aNewData.mPointerEvents) {
|
||||||
// nsSVGPathGeometryFrame's mRect depends on stroke _and_ on the value
|
// SVGGeometryFrame's mRect depends on stroke _and_ on the value
|
||||||
// of pointer-events. See nsSVGPathGeometryFrame::ReflowSVG's use of
|
// of pointer-events. See SVGGeometryFrame::ReflowSVG's use of
|
||||||
// GetHitTestFlags. (Only a reflow, no visual change.)
|
// GetHitTestFlags. (Only a reflow, no visual change.)
|
||||||
hint |= nsChangeHint_NeedReflow |
|
hint |= nsChangeHint_NeedReflow |
|
||||||
nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085
|
nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// Main header first:
|
// Main header first:
|
||||||
#include "nsSVGPathGeometryFrame.h"
|
#include "SVGGeometryFrame.h"
|
||||||
|
|
||||||
// Keep others in (case-insensitive) order:
|
// Keep others in (case-insensitive) order:
|
||||||
#include "gfx2DGlue.h"
|
#include "gfx2DGlue.h"
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "nsSVGEffects.h"
|
#include "nsSVGEffects.h"
|
||||||
#include "nsSVGIntegrationUtils.h"
|
#include "nsSVGIntegrationUtils.h"
|
||||||
#include "nsSVGMarkerFrame.h"
|
#include "nsSVGMarkerFrame.h"
|
||||||
#include "nsSVGPathGeometryElement.h"
|
#include "SVGGeometryElement.h"
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
#include "SVGAnimatedTransformList.h"
|
#include "SVGAnimatedTransformList.h"
|
||||||
|
|
@ -37,41 +37,41 @@ using namespace mozilla::image;
|
||||||
// Implementation
|
// Implementation
|
||||||
|
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell,
|
NS_NewSVGGeometryFrame(nsIPresShell* aPresShell,
|
||||||
nsStyleContext* aContext)
|
nsStyleContext* aContext)
|
||||||
{
|
{
|
||||||
return new (aPresShell) nsSVGPathGeometryFrame(aContext);
|
return new (aPresShell) SVGGeometryFrame(aContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_FRAMEARENA_HELPERS(nsSVGPathGeometryFrame)
|
NS_IMPL_FRAMEARENA_HELPERS(SVGGeometryFrame)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsQueryFrame methods
|
// nsQueryFrame methods
|
||||||
|
|
||||||
NS_QUERYFRAME_HEAD(nsSVGPathGeometryFrame)
|
NS_QUERYFRAME_HEAD(SVGGeometryFrame)
|
||||||
NS_QUERYFRAME_ENTRY(nsISVGChildFrame)
|
NS_QUERYFRAME_ENTRY(nsISVGChildFrame)
|
||||||
NS_QUERYFRAME_ENTRY(nsSVGPathGeometryFrame)
|
NS_QUERYFRAME_ENTRY(SVGGeometryFrame)
|
||||||
NS_QUERYFRAME_TAIL_INHERITING(nsFrame)
|
NS_QUERYFRAME_TAIL_INHERITING(nsFrame)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Display list item:
|
// Display list item:
|
||||||
|
|
||||||
class nsDisplaySVGPathGeometry : public nsDisplayItem {
|
class nsDisplaySVGGeometry : public nsDisplayItem {
|
||||||
public:
|
public:
|
||||||
nsDisplaySVGPathGeometry(nsDisplayListBuilder* aBuilder,
|
nsDisplaySVGGeometry(nsDisplayListBuilder* aBuilder,
|
||||||
nsSVGPathGeometryFrame* aFrame)
|
SVGGeometryFrame* aFrame)
|
||||||
: nsDisplayItem(aBuilder, aFrame)
|
: nsDisplayItem(aBuilder, aFrame)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsDisplaySVGPathGeometry);
|
MOZ_COUNT_CTOR(nsDisplaySVGGeometry);
|
||||||
MOZ_ASSERT(aFrame, "Must have a frame!");
|
MOZ_ASSERT(aFrame, "Must have a frame!");
|
||||||
}
|
}
|
||||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||||
virtual ~nsDisplaySVGPathGeometry() {
|
virtual ~nsDisplaySVGGeometry() {
|
||||||
MOZ_COUNT_DTOR(nsDisplaySVGPathGeometry);
|
MOZ_COUNT_DTOR(nsDisplaySVGGeometry);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_DISPLAY_DECL_NAME("nsDisplaySVGPathGeometry", TYPE_SVG_PATH_GEOMETRY)
|
NS_DISPLAY_DECL_NAME("nsDisplaySVGGeometry", TYPE_SVG_GEOMETRY)
|
||||||
|
|
||||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||||
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) override;
|
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) override;
|
||||||
|
|
@ -89,10 +89,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplaySVGPathGeometry::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
nsDisplaySVGGeometry::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||||
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
|
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
|
||||||
{
|
{
|
||||||
nsSVGPathGeometryFrame *frame = static_cast<nsSVGPathGeometryFrame*>(mFrame);
|
SVGGeometryFrame *frame = static_cast<SVGGeometryFrame*>(mFrame);
|
||||||
nsPoint pointRelativeToReferenceFrame = aRect.Center();
|
nsPoint pointRelativeToReferenceFrame = aRect.Center();
|
||||||
// ToReferenceFrame() includes frame->GetPosition(), our user space position.
|
// ToReferenceFrame() includes frame->GetPosition(), our user space position.
|
||||||
nsPoint userSpacePtInAppUnits = pointRelativeToReferenceFrame -
|
nsPoint userSpacePtInAppUnits = pointRelativeToReferenceFrame -
|
||||||
|
|
@ -106,7 +106,7 @@ nsDisplaySVGPathGeometry::HitTest(nsDisplayListBuilder* aBuilder, const nsRect&
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplaySVGPathGeometry::Paint(nsDisplayListBuilder* aBuilder,
|
nsDisplaySVGGeometry::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx)
|
nsRenderingContext* aCtx)
|
||||||
{
|
{
|
||||||
uint32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
uint32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||||
|
|
@ -122,13 +122,13 @@ nsDisplaySVGPathGeometry::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
|
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
|
||||||
gfxMatrix::Translation(devPixelOffset);
|
gfxMatrix::Translation(devPixelOffset);
|
||||||
DrawResult result =
|
DrawResult result =
|
||||||
static_cast<nsSVGPathGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(), tm);
|
static_cast<SVGGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(), tm);
|
||||||
|
|
||||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplaySVGPathGeometry::ComputeInvalidationRegion(
|
nsDisplaySVGGeometry::ComputeInvalidationRegion(
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayItemGeometry* aGeometry,
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
nsRegion* aInvalidRegion)
|
nsRegion* aInvalidRegion)
|
||||||
|
|
@ -145,11 +145,13 @@ nsDisplaySVGPathGeometry::ComputeInvalidationRegion(
|
||||||
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsIFrame methods
|
// nsIFrame methods
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSVGPathGeometryFrame::Init(nsIContent* aContent,
|
SVGGeometryFrame::Init(nsIContent* aContent,
|
||||||
nsContainerFrame* aParent,
|
nsContainerFrame* aParent,
|
||||||
nsIFrame* aPrevInFlow)
|
nsIFrame* aPrevInFlow)
|
||||||
{
|
{
|
||||||
|
|
@ -158,7 +160,7 @@ nsSVGPathGeometryFrame::Init(nsIContent* aContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
|
SVGGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
int32_t aModType)
|
int32_t aModType)
|
||||||
{
|
{
|
||||||
|
|
@ -168,7 +170,7 @@ nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
|
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
|
||||||
|
|
||||||
if (aNameSpaceID == kNameSpaceID_None &&
|
if (aNameSpaceID == kNameSpaceID_None &&
|
||||||
(static_cast<nsSVGPathGeometryElement*>
|
(static_cast<SVGGeometryElement*>
|
||||||
(mContent)->AttributeDefinesGeometry(aAttribute))) {
|
(mContent)->AttributeDefinesGeometry(aAttribute))) {
|
||||||
nsLayoutUtils::PostRestyleEvent(
|
nsLayoutUtils::PostRestyleEvent(
|
||||||
mContent->AsElement(), nsRestyleHint(0),
|
mContent->AsElement(), nsRestyleHint(0),
|
||||||
|
|
@ -179,7 +181,7 @@ nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ void
|
/* virtual */ void
|
||||||
nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
SVGGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||||
{
|
{
|
||||||
nsFrame::DidSetStyleContext(aOldStyleContext);
|
nsFrame::DidSetStyleContext(aOldStyleContext);
|
||||||
|
|
||||||
|
|
@ -193,8 +195,8 @@ nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||||
InvalidateFrame();
|
InvalidateFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGPathGeometryElement* element =
|
SVGGeometryElement* element =
|
||||||
static_cast<nsSVGPathGeometryElement*>(mContent);
|
static_cast<SVGGeometryElement*>(mContent);
|
||||||
|
|
||||||
auto oldStyleSVG = aOldStyleContext->PeekStyleSVG();
|
auto oldStyleSVG = aOldStyleContext->PeekStyleSVG();
|
||||||
if (oldStyleSVG && !SVGContentUtils::ShapeTypeHasNoCorners(mContent)) {
|
if (oldStyleSVG && !SVGContentUtils::ShapeTypeHasNoCorners(mContent)) {
|
||||||
|
|
@ -222,13 +224,13 @@ nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom *
|
nsIAtom *
|
||||||
nsSVGPathGeometryFrame::GetType() const
|
SVGGeometryFrame::GetType() const
|
||||||
{
|
{
|
||||||
return nsGkAtoms::svgPathGeometryFrame;
|
return nsGkAtoms::svgGeometryFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGPathGeometryFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
|
SVGGeometryFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
|
||||||
gfx::Matrix *aFromParentTransform) const
|
gfx::Matrix *aFromParentTransform) const
|
||||||
{
|
{
|
||||||
bool foundTransform = false;
|
bool foundTransform = false;
|
||||||
|
|
@ -258,7 +260,7 @@ nsSVGPathGeometryFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSVGPathGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
SVGGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayListSet& aLists)
|
const nsDisplayListSet& aLists)
|
||||||
{
|
{
|
||||||
if (!static_cast<const nsSVGElement*>(mContent)->HasValidDimensions() ||
|
if (!static_cast<const nsSVGElement*>(mContent)->HasValidDimensions() ||
|
||||||
|
|
@ -267,14 +269,14 @@ nsSVGPathGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
}
|
}
|
||||||
DisplayOutline(aBuilder, aLists);
|
DisplayOutline(aBuilder, aLists);
|
||||||
aLists.Content()->AppendNewToTop(
|
aLists.Content()->AppendNewToTop(
|
||||||
new (aBuilder) nsDisplaySVGPathGeometry(aBuilder, this));
|
new (aBuilder) nsDisplaySVGGeometry(aBuilder, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsISVGChildFrame methods
|
// nsISVGChildFrame methods
|
||||||
|
|
||||||
DrawResult
|
DrawResult
|
||||||
nsSVGPathGeometryFrame::PaintSVG(gfxContext& aContext,
|
SVGGeometryFrame::PaintSVG(gfxContext& aContext,
|
||||||
const gfxMatrix& aTransform,
|
const gfxMatrix& aTransform,
|
||||||
const nsIntRect* aDirtyRect)
|
const nsIntRect* aDirtyRect)
|
||||||
{
|
{
|
||||||
|
|
@ -322,7 +324,7 @@ nsSVGPathGeometryFrame::PaintSVG(gfxContext& aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
|
SVGGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
|
||||||
{
|
{
|
||||||
FillRule fillRule;
|
FillRule fillRule;
|
||||||
uint16_t hitTestFlags;
|
uint16_t hitTestFlags;
|
||||||
|
|
@ -346,8 +348,8 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
|
||||||
|
|
||||||
bool isHit = false;
|
bool isHit = false;
|
||||||
|
|
||||||
nsSVGPathGeometryElement* content =
|
SVGGeometryElement* content =
|
||||||
static_cast<nsSVGPathGeometryElement*>(mContent);
|
static_cast<SVGGeometryElement*>(mContent);
|
||||||
|
|
||||||
// Using ScreenReferenceDrawTarget() opens us to Moz2D backend specific hit-
|
// Using ScreenReferenceDrawTarget() opens us to Moz2D backend specific hit-
|
||||||
// testing bugs. Maybe we should use a BackendType::CAIRO DT for hit-testing
|
// testing bugs. Maybe we should use a BackendType::CAIRO DT for hit-testing
|
||||||
|
|
@ -387,7 +389,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect
|
nsRect
|
||||||
nsSVGPathGeometryFrame::GetCoveredRegion()
|
SVGGeometryFrame::GetCoveredRegion()
|
||||||
{
|
{
|
||||||
gfxMatrix canvasTM = GetCanvasTM();
|
gfxMatrix canvasTM = GetCanvasTM();
|
||||||
if (canvasTM.PreservesAxisAlignedRectangles()) {
|
if (canvasTM.PreservesAxisAlignedRectangles()) {
|
||||||
|
|
@ -409,7 +411,7 @@ nsSVGPathGeometryFrame::GetCoveredRegion()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSVGPathGeometryFrame::ReflowSVG()
|
SVGGeometryFrame::ReflowSVG()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
|
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
|
||||||
"This call is probably a wasteful mistake");
|
"This call is probably a wasteful mistake");
|
||||||
|
|
@ -463,7 +465,7 @@ nsSVGPathGeometryFrame::ReflowSVG()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSVGPathGeometryFrame::NotifySVGChanged(uint32_t aFlags)
|
SVGGeometryFrame::NotifySVGChanged(uint32_t aFlags)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
|
||||||
"Invalidation logic may need adjusting");
|
"Invalidation logic may need adjusting");
|
||||||
|
|
@ -487,9 +489,9 @@ nsSVGPathGeometryFrame::NotifySVGChanged(uint32_t aFlags)
|
||||||
// of stroke-dashoffset since, although that can have a percentage value
|
// of stroke-dashoffset since, although that can have a percentage value
|
||||||
// that is resolved against our coordinate context, it does not affect our
|
// that is resolved against our coordinate context, it does not affect our
|
||||||
// mRect.
|
// mRect.
|
||||||
if (static_cast<nsSVGPathGeometryElement*>(mContent)->GeometryDependsOnCoordCtx() ||
|
if (static_cast<SVGGeometryElement*>(mContent)->GeometryDependsOnCoordCtx() ||
|
||||||
StyleSVG()->mStrokeWidth.HasPercent()) {
|
StyleSVG()->mStrokeWidth.HasPercent()) {
|
||||||
static_cast<nsSVGPathGeometryElement*>(mContent)->ClearAnyCachedPath();
|
static_cast<SVGGeometryElement*>(mContent)->ClearAnyCachedPath();
|
||||||
nsSVGUtils::ScheduleReflowSVG(this);
|
nsSVGUtils::ScheduleReflowSVG(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -502,7 +504,7 @@ nsSVGPathGeometryFrame::NotifySVGChanged(uint32_t aFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
SVGBBox
|
SVGBBox
|
||||||
nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
SVGGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
uint32_t aFlags)
|
uint32_t aFlags)
|
||||||
{
|
{
|
||||||
SVGBBox bbox;
|
SVGBBox bbox;
|
||||||
|
|
@ -512,8 +514,8 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
return bbox;
|
return bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGPathGeometryElement* element =
|
SVGGeometryElement* element =
|
||||||
static_cast<nsSVGPathGeometryElement*>(mContent);
|
static_cast<SVGGeometryElement*>(mContent);
|
||||||
|
|
||||||
bool getFill = (aFlags & nsSVGUtils::eBBoxIncludeFillGeometry) ||
|
bool getFill = (aFlags & nsSVGUtils::eBBoxIncludeFillGeometry) ||
|
||||||
((aFlags & nsSVGUtils::eBBoxIncludeFill) &&
|
((aFlags & nsSVGUtils::eBBoxIncludeFill) &&
|
||||||
|
|
@ -629,7 +631,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
//
|
//
|
||||||
// Second, the way we account for non-scaling-stroke by transforming the
|
// Second, the way we account for non-scaling-stroke by transforming the
|
||||||
// path using the transform to the outer-<svg> element is not compatible
|
// path using the transform to the outer-<svg> element is not compatible
|
||||||
// with the way that nsSVGPathGeometryFrame::Reflow() inserts a scale
|
// with the way that SVGGeometryFrame::Reflow() inserts a scale
|
||||||
// into aToBBoxUserspace and then scales the bounds that we return.
|
// into aToBBoxUserspace and then scales the bounds that we return.
|
||||||
SVGContentUtils::AutoStrokeOptions strokeOptions;
|
SVGContentUtils::AutoStrokeOptions strokeOptions;
|
||||||
SVGContentUtils::GetStrokeOptions(&strokeOptions, element,
|
SVGContentUtils::GetStrokeOptions(&strokeOptions, element,
|
||||||
|
|
@ -666,14 +668,14 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
|
|
||||||
// Account for markers:
|
// Account for markers:
|
||||||
if ((aFlags & nsSVGUtils::eBBoxIncludeMarkers) != 0 &&
|
if ((aFlags & nsSVGUtils::eBBoxIncludeMarkers) != 0 &&
|
||||||
static_cast<nsSVGPathGeometryElement*>(mContent)->IsMarkable()) {
|
static_cast<SVGGeometryElement*>(mContent)->IsMarkable()) {
|
||||||
|
|
||||||
float strokeWidth = nsSVGUtils::GetStrokeWidth(this);
|
float strokeWidth = nsSVGUtils::GetStrokeWidth(this);
|
||||||
MarkerProperties properties = GetMarkerProperties(this);
|
MarkerProperties properties = GetMarkerProperties(this);
|
||||||
|
|
||||||
if (properties.MarkersExist()) {
|
if (properties.MarkersExist()) {
|
||||||
nsTArray<nsSVGMark> marks;
|
nsTArray<nsSVGMark> marks;
|
||||||
static_cast<nsSVGPathGeometryElement*>(mContent)->GetMarkPoints(&marks);
|
static_cast<SVGGeometryElement*>(mContent)->GetMarkPoints(&marks);
|
||||||
uint32_t num = marks.Length();
|
uint32_t num = marks.Length();
|
||||||
|
|
||||||
// These are in the same order as the nsSVGMark::Type constants.
|
// These are in the same order as the nsSVGMark::Type constants.
|
||||||
|
|
@ -703,10 +705,10 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryFrame methods:
|
// SVGGeometryFrame methods:
|
||||||
|
|
||||||
gfxMatrix
|
gfxMatrix
|
||||||
nsSVGPathGeometryFrame::GetCanvasTM()
|
SVGGeometryFrame::GetCanvasTM()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(GetParent(), "null parent");
|
NS_ASSERTION(GetParent(), "null parent");
|
||||||
|
|
||||||
|
|
@ -716,8 +718,8 @@ nsSVGPathGeometryFrame::GetCanvasTM()
|
||||||
return content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
return content->PrependLocalTransformsTo(parent->GetCanvasTM());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGPathGeometryFrame::MarkerProperties
|
SVGGeometryFrame::MarkerProperties
|
||||||
nsSVGPathGeometryFrame::GetMarkerProperties(nsSVGPathGeometryFrame *aFrame)
|
SVGGeometryFrame::GetMarkerProperties(SVGGeometryFrame *aFrame)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame should be first continuation");
|
NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame should be first continuation");
|
||||||
|
|
||||||
|
|
@ -741,7 +743,7 @@ nsSVGPathGeometryFrame::GetMarkerProperties(nsSVGPathGeometryFrame *aFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGMarkerFrame *
|
nsSVGMarkerFrame *
|
||||||
nsSVGPathGeometryFrame::MarkerProperties::GetMarkerStartFrame()
|
SVGGeometryFrame::MarkerProperties::GetMarkerStartFrame()
|
||||||
{
|
{
|
||||||
if (!mMarkerStart)
|
if (!mMarkerStart)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -750,7 +752,7 @@ nsSVGPathGeometryFrame::MarkerProperties::GetMarkerStartFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGMarkerFrame *
|
nsSVGMarkerFrame *
|
||||||
nsSVGPathGeometryFrame::MarkerProperties::GetMarkerMidFrame()
|
SVGGeometryFrame::MarkerProperties::GetMarkerMidFrame()
|
||||||
{
|
{
|
||||||
if (!mMarkerMid)
|
if (!mMarkerMid)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -759,7 +761,7 @@ nsSVGPathGeometryFrame::MarkerProperties::GetMarkerMidFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGMarkerFrame *
|
nsSVGMarkerFrame *
|
||||||
nsSVGPathGeometryFrame::MarkerProperties::GetMarkerEndFrame()
|
SVGGeometryFrame::MarkerProperties::GetMarkerEndFrame()
|
||||||
{
|
{
|
||||||
if (!mMarkerEnd)
|
if (!mMarkerEnd)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -768,7 +770,7 @@ nsSVGPathGeometryFrame::MarkerProperties::GetMarkerEndFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSVGPathGeometryFrame::Render(gfxContext* aContext,
|
SVGGeometryFrame::Render(gfxContext* aContext,
|
||||||
uint32_t aRenderComponents,
|
uint32_t aRenderComponents,
|
||||||
const gfxMatrix& aNewTransform)
|
const gfxMatrix& aNewTransform)
|
||||||
{
|
{
|
||||||
|
|
@ -780,8 +782,8 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext,
|
||||||
nsSVGUtils::ToFillRule((GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) ?
|
nsSVGUtils::ToFillRule((GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) ?
|
||||||
StyleSVG()->mClipRule : StyleSVG()->mFillRule);
|
StyleSVG()->mClipRule : StyleSVG()->mFillRule);
|
||||||
|
|
||||||
nsSVGPathGeometryElement* element =
|
SVGGeometryElement* element =
|
||||||
static_cast<nsSVGPathGeometryElement*>(mContent);
|
static_cast<SVGGeometryElement*>(mContent);
|
||||||
|
|
||||||
AntialiasMode aaMode =
|
AntialiasMode aaMode =
|
||||||
(StyleSVG()->mShapeRendering == NS_STYLE_SHAPE_RENDERING_OPTIMIZESPEED ||
|
(StyleSVG()->mShapeRendering == NS_STYLE_SHAPE_RENDERING_OPTIMIZESPEED ||
|
||||||
|
|
@ -806,7 +808,7 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGPathGeometryElement::SimplePath simplePath;
|
SVGGeometryElement::SimplePath simplePath;
|
||||||
RefPtr<Path> path;
|
RefPtr<Path> path;
|
||||||
|
|
||||||
element->GetAsSimplePath(&simplePath);
|
element->GetAsSimplePath(&simplePath);
|
||||||
|
|
@ -882,19 +884,19 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSVGPathGeometryFrame::PaintMarkers(gfxContext& aContext,
|
SVGGeometryFrame::PaintMarkers(gfxContext& aContext,
|
||||||
const gfxMatrix& aTransform)
|
const gfxMatrix& aTransform)
|
||||||
{
|
{
|
||||||
SVGContextPaint* contextPaint = SVGContextPaint::GetContextPaint(mContent);
|
SVGContextPaint* contextPaint = SVGContextPaint::GetContextPaint(mContent);
|
||||||
|
|
||||||
if (static_cast<nsSVGPathGeometryElement*>(mContent)->IsMarkable()) {
|
if (static_cast<SVGGeometryElement*>(mContent)->IsMarkable()) {
|
||||||
MarkerProperties properties = GetMarkerProperties(this);
|
MarkerProperties properties = GetMarkerProperties(this);
|
||||||
|
|
||||||
if (properties.MarkersExist()) {
|
if (properties.MarkersExist()) {
|
||||||
float strokeWidth = nsSVGUtils::GetStrokeWidth(this, contextPaint);
|
float strokeWidth = nsSVGUtils::GetStrokeWidth(this, contextPaint);
|
||||||
|
|
||||||
nsTArray<nsSVGMark> marks;
|
nsTArray<nsSVGMark> marks;
|
||||||
static_cast<nsSVGPathGeometryElement*>
|
static_cast<SVGGeometryElement*>
|
||||||
(mContent)->GetMarkPoints(&marks);
|
(mContent)->GetMarkPoints(&marks);
|
||||||
|
|
||||||
uint32_t num = marks.Length();
|
uint32_t num = marks.Length();
|
||||||
|
|
@ -921,7 +923,8 @@ nsSVGPathGeometryFrame::PaintMarkers(gfxContext& aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t
|
uint16_t
|
||||||
nsSVGPathGeometryFrame::GetHitTestFlags()
|
SVGGeometryFrame::GetHitTestFlags()
|
||||||
{
|
{
|
||||||
return nsSVGUtils::GetGeometryHitTestFlags(this);
|
return nsSVGUtils::GetGeometryHitTestFlags(this);
|
||||||
}
|
}
|
||||||
|
} // namespace mozilla
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef __NS_SVGPATHGEOMETRYFRAME_H__
|
#ifndef __SVGGEOMETRYFRAME_H__
|
||||||
#define __NS_SVGPATHGEOMETRYFRAME_H__
|
#define __SVGGEOMETRYFRAME_H__
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "gfxMatrix.h"
|
#include "gfxMatrix.h"
|
||||||
|
|
@ -16,13 +16,14 @@
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
class SVGGeometryFrame;
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
class DrawTarget;
|
class DrawTarget;
|
||||||
} // namespace gfx
|
} // namespace gfx
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
class gfxContext;
|
class gfxContext;
|
||||||
class nsDisplaySVGPathGeometry;
|
class nsDisplaySVGGeometry;
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
class nsIFrame;
|
class nsIFrame;
|
||||||
class nsIPresShell;
|
class nsIPresShell;
|
||||||
|
|
@ -32,25 +33,30 @@ class nsSVGMarkerProperty;
|
||||||
|
|
||||||
struct nsRect;
|
struct nsRect;
|
||||||
|
|
||||||
class nsSVGPathGeometryFrame : public nsFrame
|
nsIFrame*
|
||||||
|
NS_NewSVGGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
class SVGGeometryFrame : public nsFrame
|
||||||
, public nsISVGChildFrame
|
, public nsISVGChildFrame
|
||||||
{
|
{
|
||||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
||||||
|
|
||||||
friend nsIFrame*
|
friend nsIFrame*
|
||||||
NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
::NS_NewSVGGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||||
|
|
||||||
friend class nsDisplaySVGPathGeometry;
|
friend class ::nsDisplaySVGGeometry;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit nsSVGPathGeometryFrame(nsStyleContext* aContext)
|
explicit SVGGeometryFrame(nsStyleContext* aContext)
|
||||||
: nsFrame(aContext)
|
: nsFrame(aContext)
|
||||||
{
|
{
|
||||||
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED);
|
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_QUERYFRAME_TARGET(nsSVGPathGeometryFrame)
|
NS_DECL_QUERYFRAME_TARGET(SVGGeometryFrame)
|
||||||
NS_DECL_QUERYFRAME
|
NS_DECL_QUERYFRAME
|
||||||
NS_DECL_FRAMEARENA_HELPERS
|
NS_DECL_FRAMEARENA_HELPERS
|
||||||
|
|
||||||
|
|
@ -73,7 +79,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the "type" of the frame
|
* Get the "type" of the frame
|
||||||
*
|
*
|
||||||
* @see nsGkAtoms::svgPathGeometryFrame
|
* @see nsGkAtoms::svgGeometryFrame
|
||||||
*/
|
*/
|
||||||
virtual nsIAtom* GetType() const override;
|
virtual nsIAtom* GetType() const override;
|
||||||
|
|
||||||
|
|
@ -83,14 +89,14 @@ public:
|
||||||
#ifdef DEBUG_FRAME_DUMP
|
#ifdef DEBUG_FRAME_DUMP
|
||||||
virtual nsresult GetFrameName(nsAString& aResult) const override
|
virtual nsresult GetFrameName(nsAString& aResult) const override
|
||||||
{
|
{
|
||||||
return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult);
|
return MakeFrameName(NS_LITERAL_STRING("SVGGeometry"), aResult);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayListSet& aLists) override;
|
const nsDisplayListSet& aLists) override;
|
||||||
|
|
||||||
// nsSVGPathGeometryFrame methods
|
// SVGGeometryFrame methods
|
||||||
gfxMatrix GetCanvasTM();
|
gfxMatrix GetCanvasTM();
|
||||||
protected:
|
protected:
|
||||||
// nsISVGChildFrame interface:
|
// nsISVGChildFrame interface:
|
||||||
|
|
@ -140,7 +146,8 @@ private:
|
||||||
/**
|
/**
|
||||||
* @param aFrame should be the first continuation
|
* @param aFrame should be the first continuation
|
||||||
*/
|
*/
|
||||||
static MarkerProperties GetMarkerProperties(nsSVGPathGeometryFrame *aFrame);
|
static MarkerProperties GetMarkerProperties(SVGGeometryFrame *aFrame);
|
||||||
};
|
};
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // __NS_SVGPATHGEOMETRYFRAME_H__
|
#endif // __SVGGEOMETRYFRAME_H__
|
||||||
|
|
@ -40,7 +40,6 @@ UNIFIED_SOURCES += [
|
||||||
'nsSVGMarkerFrame.cpp',
|
'nsSVGMarkerFrame.cpp',
|
||||||
'nsSVGMaskFrame.cpp',
|
'nsSVGMaskFrame.cpp',
|
||||||
'nsSVGOuterSVGFrame.cpp',
|
'nsSVGOuterSVGFrame.cpp',
|
||||||
'nsSVGPathGeometryFrame.cpp',
|
|
||||||
'nsSVGPatternFrame.cpp',
|
'nsSVGPatternFrame.cpp',
|
||||||
'nsSVGStopFrame.cpp',
|
'nsSVGStopFrame.cpp',
|
||||||
'nsSVGSwitchFrame.cpp',
|
'nsSVGSwitchFrame.cpp',
|
||||||
|
|
@ -51,6 +50,7 @@ UNIFIED_SOURCES += [
|
||||||
'SVGFEImageFrame.cpp',
|
'SVGFEImageFrame.cpp',
|
||||||
'SVGFELeafFrame.cpp',
|
'SVGFELeafFrame.cpp',
|
||||||
'SVGFEUnstyledLeafFrame.cpp',
|
'SVGFEUnstyledLeafFrame.cpp',
|
||||||
|
'SVGGeometryFrame.cpp',
|
||||||
'SVGTextFrame.cpp',
|
'SVGTextFrame.cpp',
|
||||||
'SVGViewFrame.cpp',
|
'SVGViewFrame.cpp',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
#include "mozilla/dom/SVGClipPathElement.h"
|
#include "mozilla/dom/SVGClipPathElement.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsSVGEffects.h"
|
#include "nsSVGEffects.h"
|
||||||
#include "nsSVGPathGeometryElement.h"
|
#include "SVGGeometryElement.h"
|
||||||
#include "nsSVGPathGeometryFrame.h"
|
#include "SVGGeometryFrame.h"
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
@ -54,10 +54,10 @@ nsSVGClipPathFrame::ApplyClipPath(gfxContext& aContext,
|
||||||
IsTrivial(&singleClipPathChild);
|
IsTrivial(&singleClipPathChild);
|
||||||
|
|
||||||
if (singleClipPathChild) {
|
if (singleClipPathChild) {
|
||||||
nsSVGPathGeometryFrame* pathFrame = do_QueryFrame(singleClipPathChild);
|
SVGGeometryFrame* pathFrame = do_QueryFrame(singleClipPathChild);
|
||||||
if (pathFrame) {
|
if (pathFrame) {
|
||||||
nsSVGPathGeometryElement* pathElement =
|
SVGGeometryElement* pathElement =
|
||||||
static_cast<nsSVGPathGeometryElement*>(pathFrame->GetContent());
|
static_cast<SVGGeometryElement*>(pathFrame->GetContent());
|
||||||
gfxMatrix toChildsUserSpace = pathElement->
|
gfxMatrix toChildsUserSpace = pathElement->
|
||||||
PrependLocalTransformsTo(GetClipPathTransform(aClippedFrame) * aMatrix,
|
PrependLocalTransformsTo(GetClipPathTransform(aClippedFrame) * aMatrix,
|
||||||
eUserSpaceToParent);
|
eUserSpaceToParent);
|
||||||
|
|
@ -214,7 +214,7 @@ nsSVGClipPathFrame::GetClipMask(gfxContext& aReferenceContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our children have NS_STATE_SVG_CLIPPATH_CHILD set on them, and
|
// Our children have NS_STATE_SVG_CLIPPATH_CHILD set on them, and
|
||||||
// nsSVGPathGeometryFrame::Render checks for that state bit and paints
|
// SVGGeometryFrame::Render checks for that state bit and paints
|
||||||
// only the geometry (opaque black) if set.
|
// only the geometry (opaque black) if set.
|
||||||
DrawResult result = SVGFrame->PaintSVG(*ctx, toChildsUserSpace);
|
DrawResult result = SVGFrame->PaintSVG(*ctx, toChildsUserSpace);
|
||||||
if (aResult) {
|
if (aResult) {
|
||||||
|
|
@ -394,7 +394,7 @@ nsSVGClipPathFrame::IsValid()
|
||||||
|
|
||||||
nsIAtom* grandKidType = grandKid->GetType();
|
nsIAtom* grandKidType = grandKid->GetType();
|
||||||
|
|
||||||
if (grandKidType != nsGkAtoms::svgPathGeometryFrame &&
|
if (grandKidType != nsGkAtoms::svgGeometryFrame &&
|
||||||
grandKidType != nsGkAtoms::svgTextFrame) {
|
grandKidType != nsGkAtoms::svgTextFrame) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -402,7 +402,7 @@ nsSVGClipPathFrame::IsValid()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kidType != nsGkAtoms::svgPathGeometryFrame &&
|
if (kidType != nsGkAtoms::svgGeometryFrame &&
|
||||||
kidType != nsGkAtoms::svgTextFrame) {
|
kidType != nsGkAtoms::svgTextFrame) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@
|
||||||
#include "nsISupportsImpl.h"
|
#include "nsISupportsImpl.h"
|
||||||
#include "nsSVGClipPathFrame.h"
|
#include "nsSVGClipPathFrame.h"
|
||||||
#include "nsSVGPaintServerFrame.h"
|
#include "nsSVGPaintServerFrame.h"
|
||||||
#include "nsSVGPathGeometryElement.h"
|
|
||||||
#include "nsSVGFilterFrame.h"
|
#include "nsSVGFilterFrame.h"
|
||||||
#include "nsSVGMaskFrame.h"
|
#include "nsSVGMaskFrame.h"
|
||||||
#include "nsIReflowCallback.h"
|
#include "nsIReflowCallback.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
|
#include "SVGGeometryElement.h"
|
||||||
#include "SVGUseElement.h"
|
#include "SVGUseElement.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
@ -523,8 +523,8 @@ nsSVGMarkerProperty*
|
||||||
nsSVGEffects::GetMarkerProperty(nsIURI* aURI, nsIFrame* aFrame,
|
nsSVGEffects::GetMarkerProperty(nsIURI* aURI, nsIFrame* aFrame,
|
||||||
const mozilla::FramePropertyDescriptor<nsSVGMarkerProperty>* aProperty)
|
const mozilla::FramePropertyDescriptor<nsSVGMarkerProperty>* aProperty)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame &&
|
MOZ_ASSERT(aFrame->GetType() == nsGkAtoms::svgGeometryFrame &&
|
||||||
static_cast<nsSVGPathGeometryElement*>(aFrame->GetContent())->IsMarkable(),
|
static_cast<SVGGeometryElement*>(aFrame->GetContent())->IsMarkable(),
|
||||||
"Bad frame");
|
"Bad frame");
|
||||||
return GetEffectProperty(aURI, aFrame, aProperty);
|
return GetEffectProperty(aURI, aFrame, aProperty);
|
||||||
}
|
}
|
||||||
|
|
@ -700,8 +700,8 @@ nsSVGEffects::UpdateEffects(nsIFrame* aFrame)
|
||||||
// We can't do that in DoUpdate as the referenced frame may not be valid
|
// We can't do that in DoUpdate as the referenced frame may not be valid
|
||||||
GetOrCreateFilterProperty(aFrame);
|
GetOrCreateFilterProperty(aFrame);
|
||||||
|
|
||||||
if (aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame &&
|
if (aFrame->GetType() == nsGkAtoms::svgGeometryFrame &&
|
||||||
static_cast<nsSVGPathGeometryElement*>(aFrame->GetContent())->IsMarkable()) {
|
static_cast<SVGGeometryElement*>(aFrame->GetContent())->IsMarkable()) {
|
||||||
// Set marker properties here to avoid reference loops
|
// Set marker properties here to avoid reference loops
|
||||||
nsCOMPtr<nsIURI> markerURL =
|
nsCOMPtr<nsIURI> markerURL =
|
||||||
GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);
|
GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "imgINotificationObserver.h"
|
#include "imgINotificationObserver.h"
|
||||||
#include "nsSVGEffects.h"
|
#include "nsSVGEffects.h"
|
||||||
#include "nsSVGPathGeometryFrame.h"
|
|
||||||
#include "mozilla/dom/SVGSVGElement.h"
|
#include "mozilla/dom/SVGSVGElement.h"
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
#include "SVGContentUtils.h"
|
#include "SVGContentUtils.h"
|
||||||
|
#include "SVGGeometryFrame.h"
|
||||||
#include "SVGImageContext.h"
|
#include "SVGImageContext.h"
|
||||||
#include "mozilla/dom/SVGImageElement.h"
|
#include "mozilla/dom/SVGImageElement.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
|
@ -46,7 +46,7 @@ private:
|
||||||
nsSVGImageFrame *mFrame;
|
nsSVGImageFrame *mFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsSVGImageFrame : public nsSVGPathGeometryFrame
|
class nsSVGImageFrame : public SVGGeometryFrame
|
||||||
, public nsIReflowCallback
|
, public nsIReflowCallback
|
||||||
{
|
{
|
||||||
friend nsIFrame*
|
friend nsIFrame*
|
||||||
|
|
@ -54,7 +54,7 @@ class nsSVGImageFrame : public nsSVGPathGeometryFrame
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit nsSVGImageFrame(nsStyleContext* aContext)
|
explicit nsSVGImageFrame(nsStyleContext* aContext)
|
||||||
: nsSVGPathGeometryFrame(aContext)
|
: SVGGeometryFrame(aContext)
|
||||||
, mReflowCallbackPosted(false)
|
, mReflowCallbackPosted(false)
|
||||||
{
|
{
|
||||||
EnableVisibilityTracking();
|
EnableVisibilityTracking();
|
||||||
|
|
@ -72,7 +72,7 @@ public:
|
||||||
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
|
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
|
||||||
virtual void ReflowSVG() override;
|
virtual void ReflowSVG() override;
|
||||||
|
|
||||||
// nsSVGPathGeometryFrame methods:
|
// SVGGeometryFrame methods:
|
||||||
virtual uint16_t GetHitTestFlags() override;
|
virtual uint16_t GetHitTestFlags() override;
|
||||||
|
|
||||||
// nsIFrame interface:
|
// nsIFrame interface:
|
||||||
|
|
@ -154,7 +154,7 @@ nsSVGImageFrame::Init(nsIContent* aContent,
|
||||||
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::image),
|
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::image),
|
||||||
"Content is not an SVG image!");
|
"Content is not an SVG image!");
|
||||||
|
|
||||||
nsSVGPathGeometryFrame::Init(aContent, aParent, aPrevInFlow);
|
SVGGeometryFrame::Init(aContent, aParent, aPrevInFlow);
|
||||||
|
|
||||||
if (GetStateBits() & NS_FRAME_IS_NONDISPLAY) {
|
if (GetStateBits() & NS_FRAME_IS_NONDISPLAY) {
|
||||||
// Non-display frames are likely to be patterns, masks or the like.
|
// Non-display frames are likely to be patterns, masks or the like.
|
||||||
|
|
@ -246,7 +246,7 @@ nsSVGImageFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsSVGPathGeometryFrame::AttributeChanged(aNameSpaceID,
|
return SVGGeometryFrame::AttributeChanged(aNameSpaceID,
|
||||||
aAttribute, aModType);
|
aAttribute, aModType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,13 +256,13 @@ nsSVGImageFrame::OnVisibilityChange(Visibility aNewVisibility,
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
|
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
|
||||||
if (!imageLoader) {
|
if (!imageLoader) {
|
||||||
nsSVGPathGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
|
SVGGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
imageLoader->OnVisibilityChange(aNewVisibility, aNonvisibleAction);
|
imageLoader->OnVisibilityChange(aNewVisibility, aNonvisibleAction);
|
||||||
|
|
||||||
nsSVGPathGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
|
SVGGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Matrix
|
gfx::Matrix
|
||||||
|
|
@ -505,7 +505,7 @@ nsSVGImageFrame::GetType() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsSVGPathGeometryFrame methods:
|
// SVGGeometryFrame methods:
|
||||||
|
|
||||||
// Lie about our fill/stroke so that covered region and hit detection work properly
|
// Lie about our fill/stroke so that covered region and hit detection work properly
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
#include "gfxContext.h"
|
#include "gfxContext.h"
|
||||||
#include "nsSVGEffects.h"
|
#include "nsSVGEffects.h"
|
||||||
#include "mozilla/dom/SVGMarkerElement.h"
|
#include "mozilla/dom/SVGMarkerElement.h"
|
||||||
#include "nsSVGPathGeometryElement.h"
|
#include "SVGGeometryElement.h"
|
||||||
#include "nsSVGPathGeometryFrame.h"
|
#include "SVGGeometryFrame.h"
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
|
@ -73,7 +73,7 @@ nsSVGMarkerFrame::GetType() const
|
||||||
gfxMatrix
|
gfxMatrix
|
||||||
nsSVGMarkerFrame::GetCanvasTM()
|
nsSVGMarkerFrame::GetCanvasTM()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mMarkedFrame, "null nsSVGPathGeometry frame");
|
NS_ASSERTION(mMarkedFrame, "null SVGGeometry frame");
|
||||||
|
|
||||||
if (mInUse2) {
|
if (mInUse2) {
|
||||||
// We're going to be bailing drawing the marker, so return an identity.
|
// We're going to be bailing drawing the marker, so return an identity.
|
||||||
|
|
@ -105,7 +105,7 @@ GetAnonymousChildFrame(nsIFrame* aFrame)
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGMarkerFrame::PaintMark(gfxContext& aContext,
|
nsSVGMarkerFrame::PaintMark(gfxContext& aContext,
|
||||||
const gfxMatrix& aToMarkedFrameUserSpace,
|
const gfxMatrix& aToMarkedFrameUserSpace,
|
||||||
nsSVGPathGeometryFrame *aMarkedFrame,
|
SVGGeometryFrame *aMarkedFrame,
|
||||||
nsSVGMark *aMark, float aStrokeWidth)
|
nsSVGMark *aMark, float aStrokeWidth)
|
||||||
{
|
{
|
||||||
// If the flag is set when we get here, it means this marker frame
|
// If the flag is set when we get here, it means this marker frame
|
||||||
|
|
@ -166,7 +166,7 @@ nsSVGMarkerFrame::PaintMark(gfxContext& aContext,
|
||||||
SVGBBox
|
SVGBBox
|
||||||
nsSVGMarkerFrame::GetMarkBBoxContribution(const Matrix &aToBBoxUserspace,
|
nsSVGMarkerFrame::GetMarkBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
uint32_t aFlags,
|
uint32_t aFlags,
|
||||||
nsSVGPathGeometryFrame *aMarkedFrame,
|
SVGGeometryFrame *aMarkedFrame,
|
||||||
const nsSVGMark *aMark,
|
const nsSVGMark *aMark,
|
||||||
float aStrokeWidth)
|
float aStrokeWidth)
|
||||||
{
|
{
|
||||||
|
|
@ -227,7 +227,7 @@ nsSVGMarkerFrame::SetParentCoordCtxProvider(SVGSVGElement *aContext)
|
||||||
|
|
||||||
nsSVGMarkerFrame::AutoMarkerReferencer::AutoMarkerReferencer(
|
nsSVGMarkerFrame::AutoMarkerReferencer::AutoMarkerReferencer(
|
||||||
nsSVGMarkerFrame *aFrame,
|
nsSVGMarkerFrame *aFrame,
|
||||||
nsSVGPathGeometryFrame *aMarkedFrame
|
SVGGeometryFrame *aMarkedFrame
|
||||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
||||||
: mFrame(aFrame)
|
: mFrame(aFrame)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
|
|
||||||
class gfxContext;
|
class gfxContext;
|
||||||
class nsSVGPathGeometryFrame;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
class SVGGeometryFrame;
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class SVGSVGElement;
|
class SVGSVGElement;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
@ -83,19 +83,19 @@ public:
|
||||||
// nsSVGMarkerFrame methods:
|
// nsSVGMarkerFrame methods:
|
||||||
nsresult PaintMark(gfxContext& aContext,
|
nsresult PaintMark(gfxContext& aContext,
|
||||||
const gfxMatrix& aToMarkedFrameUserSpace,
|
const gfxMatrix& aToMarkedFrameUserSpace,
|
||||||
nsSVGPathGeometryFrame *aMarkedFrame,
|
SVGGeometryFrame *aMarkedFrame,
|
||||||
nsSVGMark *aMark,
|
nsSVGMark *aMark,
|
||||||
float aStrokeWidth);
|
float aStrokeWidth);
|
||||||
|
|
||||||
SVGBBox GetMarkBBoxContribution(const Matrix &aToBBoxUserspace,
|
SVGBBox GetMarkBBoxContribution(const Matrix &aToBBoxUserspace,
|
||||||
uint32_t aFlags,
|
uint32_t aFlags,
|
||||||
nsSVGPathGeometryFrame *aMarkedFrame,
|
SVGGeometryFrame *aMarkedFrame,
|
||||||
const nsSVGMark *aMark,
|
const nsSVGMark *aMark,
|
||||||
float aStrokeWidth);
|
float aStrokeWidth);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// stuff needed for callback
|
// stuff needed for callback
|
||||||
nsSVGPathGeometryFrame *mMarkedFrame;
|
SVGGeometryFrame *mMarkedFrame;
|
||||||
float mStrokeWidth, mX, mY, mAutoAngle;
|
float mStrokeWidth, mX, mY, mAutoAngle;
|
||||||
bool mIsStart; // whether the callback is for a marker-start marker
|
bool mIsStart; // whether the callback is for a marker-start marker
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ private:
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoMarkerReferencer(nsSVGMarkerFrame *aFrame,
|
AutoMarkerReferencer(nsSVGMarkerFrame *aFrame,
|
||||||
nsSVGPathGeometryFrame *aMarkedFrame
|
SVGGeometryFrame *aMarkedFrame
|
||||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
||||||
~AutoMarkerReferencer();
|
~AutoMarkerReferencer();
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#include "nsISVGChildFrame.h"
|
#include "nsISVGChildFrame.h"
|
||||||
#include "nsStyleContext.h"
|
#include "nsStyleContext.h"
|
||||||
#include "nsSVGEffects.h"
|
#include "nsSVGEffects.h"
|
||||||
#include "nsSVGPathGeometryFrame.h"
|
#include "SVGGeometryFrame.h"
|
||||||
#include "mozilla/dom/SVGPatternElement.h"
|
#include "mozilla/dom/SVGPatternElement.h"
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
#include "nsSVGAnimatedTransformList.h"
|
#include "nsSVGAnimatedTransformList.h"
|
||||||
|
|
@ -392,7 +392,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
|
||||||
|
|
||||||
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
|
||||||
patternWithChildren->mSource = static_cast<nsSVGPathGeometryFrame*>(aSource);
|
patternWithChildren->mSource = static_cast<SVGGeometryFrame*>(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
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@
|
||||||
|
|
||||||
class nsIFrame;
|
class nsIFrame;
|
||||||
class nsSVGLength2;
|
class nsSVGLength2;
|
||||||
class nsSVGPathGeometryFrame;
|
|
||||||
class nsSVGViewBox;
|
class nsSVGViewBox;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class SVGAnimatedPreserveAspectRatio;
|
class SVGAnimatedPreserveAspectRatio;
|
||||||
|
class SVGGeometryFrame;
|
||||||
class nsSVGAnimatedTransformList;
|
class nsSVGAnimatedTransformList;
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
|
@ -142,7 +142,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
|
||||||
nsSVGPathGeometryFrame *mSource;
|
SVGGeometryFrame *mSource;
|
||||||
nsAutoPtr<gfxMatrix> mCTM;
|
nsAutoPtr<gfxMatrix> mCTM;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@
|
||||||
#include "nsSVGOuterSVGFrame.h"
|
#include "nsSVGOuterSVGFrame.h"
|
||||||
#include "mozilla/dom/SVGClipPathElement.h"
|
#include "mozilla/dom/SVGClipPathElement.h"
|
||||||
#include "mozilla/dom/SVGPathElement.h"
|
#include "mozilla/dom/SVGPathElement.h"
|
||||||
#include "nsSVGPathGeometryElement.h"
|
#include "SVGGeometryElement.h"
|
||||||
#include "nsSVGPathGeometryFrame.h"
|
#include "SVGGeometryFrame.h"
|
||||||
#include "nsSVGPaintServerFrame.h"
|
#include "nsSVGPaintServerFrame.h"
|
||||||
#include "mozilla/dom/SVGSVGElement.h"
|
#include "mozilla/dom/SVGSVGElement.h"
|
||||||
#include "nsTextFrame.h"
|
#include "nsTextFrame.h"
|
||||||
|
|
@ -415,7 +415,7 @@ nsSVGUtils::GetCanvasTM(nsIFrame *aFrame)
|
||||||
return containerFrame->GetCanvasTM();
|
return containerFrame->GetCanvasTM();
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<nsSVGPathGeometryFrame*>(aFrame)->GetCanvasTM();
|
return static_cast<SVGGeometryFrame*>(aFrame)->GetCanvasTM();
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxMatrix
|
gfxMatrix
|
||||||
|
|
@ -1223,7 +1223,7 @@ nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame)
|
||||||
}
|
}
|
||||||
nsIAtom *type = aFrame->GetType();
|
nsIAtom *type = aFrame->GetType();
|
||||||
if (type != nsGkAtoms::svgImageFrame &&
|
if (type != nsGkAtoms::svgImageFrame &&
|
||||||
type != nsGkAtoms::svgPathGeometryFrame) {
|
type != nsGkAtoms::svgGeometryFrame) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (aFrame->StyleEffects()->HasFilters()) {
|
if (aFrame->StyleEffects()->HasFilters()) {
|
||||||
|
|
@ -1329,7 +1329,7 @@ nsSVGUtils::PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
|
||||||
|
|
||||||
/*static*/ gfxRect
|
/*static*/ gfxRect
|
||||||
nsSVGUtils::PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
|
nsSVGUtils::PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
|
||||||
nsSVGPathGeometryFrame* aFrame,
|
SVGGeometryFrame* aFrame,
|
||||||
const gfxMatrix& aMatrix)
|
const gfxMatrix& aMatrix)
|
||||||
{
|
{
|
||||||
bool strokeMayHaveCorners =
|
bool strokeMayHaveCorners =
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ class nsSVGElement;
|
||||||
class nsSVGEnum;
|
class nsSVGEnum;
|
||||||
class nsSVGLength2;
|
class nsSVGLength2;
|
||||||
class nsSVGOuterSVGFrame;
|
class nsSVGOuterSVGFrame;
|
||||||
class nsSVGPathGeometryFrame;
|
|
||||||
class nsTextFrame;
|
class nsTextFrame;
|
||||||
|
|
||||||
struct nsStyleSVG;
|
struct nsStyleSVG;
|
||||||
|
|
@ -48,6 +47,7 @@ struct nsRect;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class SVGContextPaint;
|
class SVGContextPaint;
|
||||||
struct SVGContextPaintImpl;
|
struct SVGContextPaintImpl;
|
||||||
|
class SVGGeometryFrame;
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class Element;
|
class Element;
|
||||||
class UserSpaceMetrics;
|
class UserSpaceMetrics;
|
||||||
|
|
@ -186,6 +186,7 @@ public:
|
||||||
typedef mozilla::gfx::Size Size;
|
typedef mozilla::gfx::Size Size;
|
||||||
typedef mozilla::SVGContextPaint SVGContextPaint;
|
typedef mozilla::SVGContextPaint SVGContextPaint;
|
||||||
typedef mozilla::SVGContextPaintImpl SVGContextPaintImpl;
|
typedef mozilla::SVGContextPaintImpl SVGContextPaintImpl;
|
||||||
|
typedef mozilla::SVGGeometryFrame SVGGeometryFrame;
|
||||||
typedef mozilla::image::DrawResult DrawResult;
|
typedef mozilla::image::DrawResult DrawResult;
|
||||||
|
|
||||||
static void Init();
|
static void Init();
|
||||||
|
|
@ -482,7 +483,7 @@ public:
|
||||||
nsTextFrame* aFrame,
|
nsTextFrame* aFrame,
|
||||||
const gfxMatrix& aMatrix);
|
const gfxMatrix& aMatrix);
|
||||||
static gfxRect PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
|
static gfxRect PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
|
||||||
nsSVGPathGeometryFrame* aFrame,
|
SVGGeometryFrame* aFrame,
|
||||||
const gfxMatrix& aMatrix);
|
const gfxMatrix& aMatrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue