mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1435138 part 3. Remove nsIDOMSVGLength's SVG_LENGTHTYPE_* constants. r=qdot
MozReview-Commit-ID: GvzWbe6cr5r
This commit is contained in:
parent
c79197d0df
commit
3afbe4d699
@ -8,18 +8,6 @@
|
||||
[uuid(2596325c-aed0-487e-96a1-0a6d589b9c6b)]
|
||||
interface nsIDOMSVGLength : nsISupports
|
||||
{
|
||||
// Length Unit Types
|
||||
const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0;
|
||||
const unsigned short SVG_LENGTHTYPE_NUMBER = 1;
|
||||
const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2;
|
||||
const unsigned short SVG_LENGTHTYPE_EMS = 3;
|
||||
const unsigned short SVG_LENGTHTYPE_EXS = 4;
|
||||
const unsigned short SVG_LENGTHTYPE_PX = 5;
|
||||
const unsigned short SVG_LENGTHTYPE_CM = 6;
|
||||
const unsigned short SVG_LENGTHTYPE_MM = 7;
|
||||
const unsigned short SVG_LENGTHTYPE_IN = 8;
|
||||
const unsigned short SVG_LENGTHTYPE_PT = 9;
|
||||
const unsigned short SVG_LENGTHTYPE_PC = 10;
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
|
||||
static nsSVGAttrTearoffTable<nsSVGLength2, DOMSVGLength>
|
||||
sBaseSVGLengthTearOffTable,
|
||||
sAnimSVGLengthTearOffTable;
|
||||
@ -100,7 +102,7 @@ DOMSVGLength::DOMSVGLength(DOMSVGLengthList *aList,
|
||||
, mListIndex(aListIndex)
|
||||
, mAttrEnum(aAttrEnum)
|
||||
, mIsAnimValItem(aIsAnimValItem)
|
||||
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)
|
||||
, mUnit(SVGLengthBinding::SVG_LENGTHTYPE_NUMBER)
|
||||
, mValue(0.0f)
|
||||
, mVal(nullptr)
|
||||
{
|
||||
@ -118,7 +120,7 @@ DOMSVGLength::DOMSVGLength()
|
||||
, mListIndex(0)
|
||||
, mAttrEnum(0)
|
||||
, mIsAnimValItem(false)
|
||||
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)
|
||||
, mUnit(SVGLengthBinding::SVG_LENGTHTYPE_NUMBER)
|
||||
, mValue(0.0f)
|
||||
, mVal(nullptr)
|
||||
{
|
||||
@ -130,7 +132,7 @@ DOMSVGLength::DOMSVGLength(nsSVGLength2* aVal, nsSVGElement* aSVGElement,
|
||||
, mListIndex(0)
|
||||
, mAttrEnum(0)
|
||||
, mIsAnimValItem(aAnimVal)
|
||||
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)
|
||||
, mUnit(SVGLengthBinding::SVG_LENGTHTYPE_NUMBER)
|
||||
, mValue(0.0f)
|
||||
, mVal(aVal)
|
||||
, mSVGElement(aSVGElement)
|
||||
@ -232,8 +234,8 @@ DOMSVGLength::GetValue(ErrorResult& aRv)
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
}
|
||||
return value;
|
||||
} else if (mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER ||
|
||||
mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_PX) {
|
||||
} else if (mUnit == SVGLengthBinding::SVG_LENGTHTYPE_NUMBER ||
|
||||
mUnit == SVGLengthBinding::SVG_LENGTHTYPE_PX) {
|
||||
return mValue;
|
||||
}
|
||||
// else [SVGWG issue] Can't convert this length's value to user units
|
||||
@ -274,8 +276,8 @@ DOMSVGLength::SetValue(float aUserUnitValue, ErrorResult& aRv)
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER ||
|
||||
mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_PX) {
|
||||
} else if (mUnit == SVGLengthBinding::SVG_LENGTHTYPE_NUMBER ||
|
||||
mUnit == SVGLengthBinding::SVG_LENGTHTYPE_PX) {
|
||||
mValue = aUserUnitValue;
|
||||
return;
|
||||
}
|
||||
@ -454,7 +456,7 @@ DOMSVGLength::ConvertToSpecifiedUnits(uint16_t aUnit, ErrorResult& aRv)
|
||||
JSObject*
|
||||
DOMSVGLength::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return dom::SVGLengthBinding::Wrap(aCx, this, aGivenProto);
|
||||
return SVGLengthBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -12,9 +12,12 @@
|
||||
#include "nsSVGAttrTearoffTable.h"
|
||||
#include "nsSMILValue.h"
|
||||
#include "SVGLengthListSMILType.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
|
||||
nsresult
|
||||
SVGAnimatedLengthList::SetBaseValueString(const nsAString& aValue)
|
||||
{
|
||||
@ -160,9 +163,9 @@ SVGAnimatedLengthList::
|
||||
aPreventCachingOfSandwich = false;
|
||||
for (uint32_t i = 0; i < llai->Length(); ++i) {
|
||||
uint8_t unit = (*llai)[i].GetUnit();
|
||||
if (unit == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE ||
|
||||
unit == nsIDOMSVGLength::SVG_LENGTHTYPE_EMS ||
|
||||
unit == nsIDOMSVGLength::SVG_LENGTHTYPE_EXS) {
|
||||
if (unit == SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE ||
|
||||
unit == SVGLengthBinding::SVG_LENGTHTYPE_EMS ||
|
||||
unit == SVGLengthBinding::SVG_LENGTHTYPE_EXS) {
|
||||
aPreventCachingOfSandwich = true;
|
||||
break;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/SVGCircleElementBinding.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Circle)
|
||||
|
||||
@ -24,9 +25,9 @@ SVGCircleElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGCircleElement::sLengthInfo[3] =
|
||||
{
|
||||
{ &nsGkAtoms::cx, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::cy, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::r, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY }
|
||||
{ &nsGkAtoms::cx, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::cy, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::r, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/SVGEllipseElement.h"
|
||||
#include "mozilla/dom/SVGEllipseElementBinding.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
@ -25,10 +26,10 @@ SVGEllipseElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGEllipseElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::cx, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::cy, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::rx, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::ry, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::cx, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::cy, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::rx, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::ry, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/dom/SVGFilterElement.h"
|
||||
#include "mozilla/dom/SVGFilterElementBinding.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "nsSVGUtils.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Filter)
|
||||
@ -25,10 +26,10 @@ SVGFilterElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGFilterElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x, -10, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, -10, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 120, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 120, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo SVGFilterElement::sEnumInfo[2] =
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "mozilla/dom/SVGDocument.h"
|
||||
#include "mozilla/dom/SVGForeignObjectElement.h"
|
||||
#include "mozilla/dom/SVGForeignObjectElementBinding.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ForeignObject)
|
||||
|
||||
@ -24,10 +25,10 @@ SVGForeignObjectElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenPr
|
||||
|
||||
nsSVGElement::LengthInfo SVGForeignObjectElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "DOMSVGPoint.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "nsComputedDOMStyle.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsSVGLength2.h"
|
||||
@ -16,6 +17,7 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsSVGElement::NumberInfo SVGGeometryElement::sNumberInfo =
|
||||
{ &nsGkAtoms::pathLength, 0, false };
|
||||
@ -76,7 +78,8 @@ SVGGeometryElement::GeometryDependsOnCoordCtx()
|
||||
// Check the nsSVGLength2 attribute
|
||||
LengthAttributesInfo info = const_cast<SVGGeometryElement*>(this)->GetLengthInfo();
|
||||
for (uint32_t i = 0; i < info.mLengthCount; i++) {
|
||||
if (info.mLengths[i].GetSpecifiedUnitType() == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE) {
|
||||
if (info.mLengths[i].GetSpecifiedUnitType() ==
|
||||
SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/dom/SVGAnimatedTransformList.h"
|
||||
#include "mozilla/dom/SVGRadialGradientElementBinding.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGLinearGradientElementBinding.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@ -126,10 +127,10 @@ SVGLinearGradientElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenP
|
||||
|
||||
nsSVGElement::LengthInfo SVGLinearGradientElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x1, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y1, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x2, 100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y2, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x1, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y1, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x2, 100, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y2, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -200,12 +201,12 @@ SVGRadialGradientElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenP
|
||||
|
||||
nsSVGElement::LengthInfo SVGRadialGradientElement::sLengthInfo[6] =
|
||||
{
|
||||
{ &nsGkAtoms::cx, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::cy, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::r, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY },
|
||||
{ &nsGkAtoms::fx, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::fy, 50, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::fr, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY },
|
||||
{ &nsGkAtoms::cx, 50, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::cy, 50, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::r, 50, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY },
|
||||
{ &nsGkAtoms::fx, 50, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::fy, 50, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::fr, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::XY },
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "imgINotificationObserver.h"
|
||||
#include "mozilla/dom/SVGImageElementBinding.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Image)
|
||||
@ -32,10 +33,10 @@ SVGImageElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGImageElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo SVGImageElement::sStringInfo[2] =
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
// Declare some helpers defined below:
|
||||
static void GetUnitString(nsAString& unit, uint16_t unitType);
|
||||
static uint16_t GetUnitTypeForString(const nsAString& unitStr);
|
||||
@ -57,8 +59,8 @@ SVGLength::SetValueFromString(const nsAString &aString)
|
||||
inline static bool
|
||||
IsAbsoluteUnit(uint8_t aUnit)
|
||||
{
|
||||
return aUnit >= nsIDOMSVGLength::SVG_LENGTHTYPE_CM &&
|
||||
aUnit <= nsIDOMSVGLength::SVG_LENGTHTYPE_PC;
|
||||
return aUnit >= SVGLengthBinding::SVG_LENGTHTYPE_CM &&
|
||||
aUnit <= SVGLengthBinding::SVG_LENGTHTYPE_PC;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,8 +71,8 @@ IsAbsoluteUnit(uint8_t aUnit)
|
||||
*
|
||||
* Example usage: to find out how many centimeters there are per inch:
|
||||
*
|
||||
* GetAbsUnitsPerAbsUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_CM,
|
||||
* nsIDOMSVGLength::SVG_LENGTHTYPE_IN)
|
||||
* GetAbsUnitsPerAbsUnit(SVGLengthBinding::SVG_LENGTHTYPE_CM,
|
||||
* SVGLengthBinding::SVG_LENGTHTYPE_IN)
|
||||
*/
|
||||
inline static float GetAbsUnitsPerAbsUnit(uint8_t aUnits, uint8_t aPerUnit)
|
||||
{
|
||||
@ -102,10 +104,10 @@ SVGLength::GetValueInSpecifiedUnit(uint8_t aUnit,
|
||||
if (aUnit == mUnit) {
|
||||
return mValue;
|
||||
}
|
||||
if ((aUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER &&
|
||||
mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_PX) ||
|
||||
(aUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_PX &&
|
||||
mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER)) {
|
||||
if ((aUnit == SVGLengthBinding::SVG_LENGTHTYPE_NUMBER &&
|
||||
mUnit == SVGLengthBinding::SVG_LENGTHTYPE_PX) ||
|
||||
(aUnit == SVGLengthBinding::SVG_LENGTHTYPE_PX &&
|
||||
mUnit == SVGLengthBinding::SVG_LENGTHTYPE_NUMBER)) {
|
||||
return mValue;
|
||||
}
|
||||
if (IsAbsoluteUnit(aUnit) && IsAbsoluteUnit(mUnit)) {
|
||||
@ -144,24 +146,24 @@ float
|
||||
SVGLength::GetUserUnitsPerUnit(const nsSVGElement *aElement, uint8_t aAxis) const
|
||||
{
|
||||
switch (mUnit) {
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER:
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_PX:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_NUMBER:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_PX:
|
||||
return 1.0f;
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_MM:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_MM:
|
||||
return INCHES_PER_MM_FLOAT * GetUserUnitsPerInch();
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_CM:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_CM:
|
||||
return INCHES_PER_CM_FLOAT * GetUserUnitsPerInch();
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_IN:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_IN:
|
||||
return GetUserUnitsPerInch();
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_PT:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_PT:
|
||||
return (1.0f/POINTS_PER_INCH_FLOAT) * GetUserUnitsPerInch();
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_PC:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_PC:
|
||||
return (12.0f/POINTS_PER_INCH_FLOAT) * GetUserUnitsPerInch();
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE:
|
||||
return GetUserUnitsPerPercent(aElement, aAxis);
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_EMS:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_EMS:
|
||||
return SVGContentUtils::GetFontSize(const_cast<nsSVGElement*>(aElement));
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_EXS:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_EXS:
|
||||
return SVGContentUtils::GetFontXHeight(const_cast<nsSVGElement*>(aElement));
|
||||
default:
|
||||
NS_NOTREACHED("Unknown unit type");
|
||||
@ -183,7 +185,7 @@ SVGLength::GetUserUnitsPerPercent(const nsSVGElement *aElement, uint8_t aAxis)
|
||||
|
||||
// Helpers:
|
||||
|
||||
// These items must be at the same index as the nsIDOMSVGLength constants!
|
||||
// These items must be at the same index as the SVGLength constants!
|
||||
static nsStaticAtom** const unitMap[] =
|
||||
{
|
||||
nullptr, /* SVG_LENGTHTYPE_UNKNOWN */
|
||||
@ -215,7 +217,7 @@ static uint16_t
|
||||
GetUnitTypeForString(const nsAString& unitStr)
|
||||
{
|
||||
if (unitStr.IsEmpty())
|
||||
return nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER;
|
||||
return SVGLengthBinding::SVG_LENGTHTYPE_NUMBER;
|
||||
|
||||
nsAtom* unitAtom = NS_GetStaticAtom(unitStr);
|
||||
|
||||
@ -226,7 +228,7 @@ GetUnitTypeForString(const nsAString& unitStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN;
|
||||
return SVGLengthBinding::SVG_LENGTHTYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIDOMSVGLength.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
|
||||
class nsSVGElement;
|
||||
|
||||
@ -35,7 +36,7 @@ public:
|
||||
SVGLength()
|
||||
#ifdef DEBUG
|
||||
: mValue(0.0f)
|
||||
, mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN) // caught by IsValid()
|
||||
, mUnit(dom::SVGLengthBinding::SVG_LENGTHTYPE_UNKNOWN) // caught by IsValid()
|
||||
#endif
|
||||
{}
|
||||
|
||||
@ -120,12 +121,12 @@ public:
|
||||
uint8_t aAxis) const;
|
||||
|
||||
bool IsPercentage() const {
|
||||
return mUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE;
|
||||
return mUnit == dom::SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE;
|
||||
}
|
||||
|
||||
static bool IsValidUnitType(uint16_t unit) {
|
||||
return unit > nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN &&
|
||||
unit <= nsIDOMSVGLength::SVG_LENGTHTYPE_PC;
|
||||
return unit > dom::SVGLengthBinding::SVG_LENGTHTYPE_UNKNOWN &&
|
||||
unit <= dom::SVGLengthBinding::SVG_LENGTHTYPE_PC;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsTArray.h"
|
||||
#include "SVGLength.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -337,7 +338,7 @@ public:
|
||||
|
||||
bool HasPercentageValueAt(uint32_t aIndex) const {
|
||||
const SVGLength& length = (*mList)[aIndex];
|
||||
return length.GetUnit() == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE;
|
||||
return length.GetUnit() == dom::SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/SVGLineElement.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGLineElementBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
@ -23,10 +24,10 @@ SVGLineElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGLineElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x1, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y1, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x2, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y2, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x1, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y1, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x2, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y2, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/dom/SVGAngle.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGMarkerElement.h"
|
||||
#include "mozilla/dom/SVGMarkerElementBinding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -33,10 +34,10 @@ SVGMarkerElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGMarkerElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::refX, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::refY, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::markerWidth, 3, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::markerHeight, 3, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::refX, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::refY, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::markerWidth, 3, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::markerHeight, 3, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGEnumMapping SVGMarkerElement::sUnitsMap[] = {
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGMaskElement.h"
|
||||
#include "mozilla/dom/SVGMaskElementBinding.h"
|
||||
|
||||
@ -26,10 +27,10 @@ SVGMaskElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGMaskElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x, -10, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, -10, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 120, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 120, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo SVGMaskElement::sEnumInfo[2] =
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/SVGAnimatedTransformList.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGPatternElement.h"
|
||||
#include "mozilla/dom/SVGPatternElementBinding.h"
|
||||
|
||||
@ -27,10 +28,10 @@ SVGPatternElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGPatternElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo SVGPatternElement::sEnumInfo[2] =
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/SVGRectElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGRectElementBinding.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
@ -30,12 +31,12 @@ SVGRectElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGRectElement::sLengthInfo[6] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::rx, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::ry, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y }
|
||||
{ &nsGkAtoms::x, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::rx, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::ry, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/SVGTextContentElement.h"
|
||||
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGIRect.h"
|
||||
#include "nsBidiUtils.h"
|
||||
#include "nsISVGPoint.h"
|
||||
@ -30,7 +31,7 @@ nsSVGElement::EnumInfo SVGTextContentElement::sEnumInfo[1] =
|
||||
|
||||
nsSVGElement::LengthInfo SVGTextContentElement::sLengthInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::textLength, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY }
|
||||
{ &nsGkAtoms::textLength, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY }
|
||||
};
|
||||
|
||||
SVGTextFrame*
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/SVGTextPathElement.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGTextPathElementBinding.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@ -26,9 +27,9 @@ SVGTextPathElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
nsSVGElement::LengthInfo SVGTextPathElement::sLengthInfo[2] =
|
||||
{
|
||||
// from SVGTextContentElement:
|
||||
{ &nsGkAtoms::textLength, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY },
|
||||
{ &nsGkAtoms::textLength, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY },
|
||||
// from SVGTextPathElement:
|
||||
{ &nsGkAtoms::startOffset, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X }
|
||||
{ &nsGkAtoms::startOffset, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X }
|
||||
};
|
||||
|
||||
nsSVGEnumMapping SVGTextPathElement::sMethodMap[] = {
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
#include "mozilla/dom/SVGUseElement.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGUseElementBinding.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "mozilla/dom/SVGSVGElement.h"
|
||||
@ -36,10 +37,10 @@ SVGUseElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
|
||||
nsSVGElement::LengthInfo SVGUseElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo SVGUseElement::sStringInfo[2] =
|
||||
@ -350,7 +351,7 @@ SVGUseElement::SyncWidthOrHeight(nsAtom* aName)
|
||||
// need to set the value to 100%
|
||||
nsSVGLength2 length;
|
||||
length.Init(SVGContentUtils::XY, 0xff,
|
||||
100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE);
|
||||
100, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE);
|
||||
target->SetLength(aName, length);
|
||||
return;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGMatrix.h"
|
||||
#include "mozilla/dom/SVGViewportElement.h"
|
||||
#include "mozilla/dom/SVGViewElement.h"
|
||||
@ -39,10 +40,10 @@ namespace dom {
|
||||
|
||||
nsSVGElement::LengthInfo SVGViewportElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::x, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, SVGLengthBinding::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 100, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 100, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "nsSVGElement.h"
|
||||
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGSVGElement.h"
|
||||
#include "mozilla/dom/SVGTests.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -1692,12 +1693,12 @@ nsSVGElement::GetAnimatedLengthValues(float *aFirst, ...)
|
||||
while (f && i < info.mLengthCount) {
|
||||
uint8_t type = info.mLengths[i].GetSpecifiedUnitType();
|
||||
if (!ctx) {
|
||||
if (type != nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER &&
|
||||
type != nsIDOMSVGLength::SVG_LENGTHTYPE_PX)
|
||||
if (type != SVGLengthBinding::SVG_LENGTHTYPE_NUMBER &&
|
||||
type != SVGLengthBinding::SVG_LENGTHTYPE_PX)
|
||||
ctx = GetCtx();
|
||||
}
|
||||
if (type == nsIDOMSVGLength::SVG_LENGTHTYPE_EMS ||
|
||||
type == nsIDOMSVGLength::SVG_LENGTHTYPE_EXS)
|
||||
if (type == SVGLengthBinding::SVG_LENGTHTYPE_EMS ||
|
||||
type == SVGLengthBinding::SVG_LENGTHTYPE_EXS)
|
||||
*f = info.mLengths[i++].GetAnimValue(this);
|
||||
else
|
||||
*f = info.mLengths[i++].GetAnimValue(ctx);
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "mozilla/dom/SVGFEFuncRElementBinding.h"
|
||||
#include "mozilla/dom/SVGFEPointLightElement.h"
|
||||
#include "mozilla/dom/SVGFESpotLightElement.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// Prevent Windows redefining LoadImage
|
||||
@ -52,10 +53,10 @@ using namespace mozilla::gfx;
|
||||
|
||||
nsSVGElement::LengthInfo nsSVGFE::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y }
|
||||
{ &nsGkAtoms::x, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
{ &nsGkAtoms::width, 100, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::height, 100, SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -45,8 +45,8 @@ static nsSVGAttrTearoffTable<nsSVGLength2, SVGAnimatedLength>
|
||||
static bool
|
||||
IsValidUnitType(uint16_t unit)
|
||||
{
|
||||
if (unit > nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN &&
|
||||
unit <= nsIDOMSVGLength::SVG_LENGTHTYPE_PC)
|
||||
if (unit > SVGLengthBinding::SVG_LENGTHTYPE_UNKNOWN &&
|
||||
unit <= SVGLengthBinding::SVG_LENGTHTYPE_PC)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -69,7 +69,7 @@ static uint16_t
|
||||
GetUnitTypeForString(const nsAString& unitStr)
|
||||
{
|
||||
if (unitStr.IsEmpty())
|
||||
return nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER;
|
||||
return SVGLengthBinding::SVG_LENGTHTYPE_NUMBER;
|
||||
|
||||
nsAtom *unitAtom = NS_GetStaticAtom(unitStr);
|
||||
if (unitAtom) {
|
||||
@ -80,7 +80,7 @@ GetUnitTypeForString(const nsAString& unitStr)
|
||||
}
|
||||
}
|
||||
|
||||
return nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN;
|
||||
return SVGLengthBinding::SVG_LENGTHTYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -243,24 +243,24 @@ nsSVGLength2::GetPixelsPerUnit(const UserSpaceMetrics& aMetrics,
|
||||
uint8_t aUnitType) const
|
||||
{
|
||||
switch (aUnitType) {
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER:
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_PX:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_NUMBER:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_PX:
|
||||
return 1;
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_MM:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_MM:
|
||||
return DPI / MM_PER_INCH_FLOAT;
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_CM:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_CM:
|
||||
return 10.0f * DPI / MM_PER_INCH_FLOAT;
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_IN:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_IN:
|
||||
return DPI;
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_PT:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_PT:
|
||||
return DPI / POINTS_PER_INCH_FLOAT;
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_PC:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_PC:
|
||||
return 12.0f * DPI / POINTS_PER_INCH_FLOAT;
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE:
|
||||
return aMetrics.GetAxisLength(mCtxType) / 100.0f;
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_EMS:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_EMS:
|
||||
return aMetrics.GetEmLength();
|
||||
case nsIDOMSVGLength::SVG_LENGTHTYPE_EXS:
|
||||
case SVGLengthBinding::SVG_LENGTHTYPE_EXS:
|
||||
return aMetrics.GetExLength();
|
||||
default:
|
||||
NS_NOTREACHED("Unknown unit type");
|
||||
@ -518,9 +518,9 @@ nsSVGLength2::SMILLength::ValueFromString(const nsAString& aStr,
|
||||
val.mU.mDouble = value * mVal->GetPixelsPerUnit(mSVGElement, unitType);
|
||||
aValue = val;
|
||||
aPreventCachingOfSandwich =
|
||||
(unitType == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE ||
|
||||
unitType == nsIDOMSVGLength::SVG_LENGTHTYPE_EMS ||
|
||||
unitType == nsIDOMSVGLength::SVG_LENGTHTYPE_EXS);
|
||||
(unitType == SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE ||
|
||||
unitType == SVGLengthBinding::SVG_LENGTHTYPE_EMS ||
|
||||
unitType == SVGLengthBinding::SVG_LENGTHTYPE_EXS);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsError.h"
|
||||
@ -97,7 +98,8 @@ public:
|
||||
void Init(uint8_t aCtxType = SVGContentUtils::XY,
|
||||
uint8_t aAttrEnum = 0xff,
|
||||
float aValue = 0,
|
||||
uint8_t aUnitType = nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER) {
|
||||
uint8_t aUnitType =
|
||||
mozilla::dom::SVGLengthBinding::SVG_LENGTHTYPE_NUMBER) {
|
||||
mAnimVal = mBaseVal = aValue;
|
||||
mSpecifiedUnitType = aUnitType;
|
||||
mAttrEnum = aAttrEnum;
|
||||
@ -136,7 +138,8 @@ public:
|
||||
uint8_t GetCtxType() const { return mCtxType; }
|
||||
uint8_t GetSpecifiedUnitType() const { return mSpecifiedUnitType; }
|
||||
bool IsPercentage() const
|
||||
{ return mSpecifiedUnitType == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE; }
|
||||
{ return mSpecifiedUnitType ==
|
||||
mozilla::dom::SVGLengthBinding::SVG_LENGTHTYPE_PERCENTAGE; }
|
||||
float GetAnimValInSpecifiedUnits() const { return mAnimVal; }
|
||||
float GetBaseValInSpecifiedUnits() const { return mBaseVal; }
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsSVGDisplayableFrame.h"
|
||||
#include "mozilla/dom/HTMLCanvasElement.h"
|
||||
#include "mozilla/dom/IDTracker.h"
|
||||
#include "mozilla/dom/SVGLengthBinding.h"
|
||||
#include "mozilla/dom/SVGFilterElement.h"
|
||||
#include "SVGObserverUtils.h"
|
||||
#include "nsSVGFilterFrame.h"
|
||||
@ -161,7 +162,7 @@ nsSVGFilterInstance::GetPrimitiveNumber(uint8_t aCtxType, float aValue) const
|
||||
{
|
||||
nsSVGLength2 val;
|
||||
val.Init(aCtxType, 0xff, aValue,
|
||||
nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
|
||||
SVGLengthBinding::SVG_LENGTHTYPE_NUMBER);
|
||||
|
||||
float value;
|
||||
if (mPrimitiveUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
|
||||
@ -188,14 +189,14 @@ nsSVGFilterInstance::ConvertLocation(const Point3D& aPoint) const
|
||||
{
|
||||
nsSVGLength2 val[4];
|
||||
val[0].Init(SVGContentUtils::X, 0xff, aPoint.x,
|
||||
nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
|
||||
SVGLengthBinding::SVG_LENGTHTYPE_NUMBER);
|
||||
val[1].Init(SVGContentUtils::Y, 0xff, aPoint.y,
|
||||
nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
|
||||
SVGLengthBinding::SVG_LENGTHTYPE_NUMBER);
|
||||
// Dummy width/height values
|
||||
val[2].Init(SVGContentUtils::X, 0xff, 0,
|
||||
nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
|
||||
SVGLengthBinding::SVG_LENGTHTYPE_NUMBER);
|
||||
val[3].Init(SVGContentUtils::Y, 0xff, 0,
|
||||
nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
|
||||
SVGLengthBinding::SVG_LENGTHTYPE_NUMBER);
|
||||
|
||||
gfxRect feArea = nsSVGUtils::GetRelativeRect(mPrimitiveUnits,
|
||||
val, mTargetBBox, mMetrics);
|
||||
|
Loading…
Reference in New Issue
Block a user