2015-05-03 12:32:37 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-01-06 06:14:43 -08:00
|
|
|
#include "mozilla/dom/SVGTextPathElement.h"
|
|
|
|
#include "mozilla/dom/SVGTextPathElementBinding.h"
|
2012-12-23 00:22:22 -08:00
|
|
|
#include "nsSVGElement.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsGkAtoms.h"
|
2012-07-27 07:03:27 -07:00
|
|
|
#include "nsError.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-01-06 06:14:43 -08:00
|
|
|
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TextPath)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-03-11 15:05:58 -07:00
|
|
|
class SVGAnimatedLength;
|
|
|
|
|
2013-01-06 06:14:43 -08:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
SVGTextPathElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-01-06 06:14:43 -08:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
return SVGTextPathElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-01-06 06:14:43 -08:00
|
|
|
}
|
2011-10-10 22:50:08 -07:00
|
|
|
|
2013-07-23 17:01:35 -07:00
|
|
|
nsSVGElement::LengthInfo SVGTextPathElement::sLengthInfo[2] =
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-07-23 17:01:35 -07:00
|
|
|
// from SVGTextContentElement:
|
|
|
|
{ &nsGkAtoms::textLength, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY },
|
|
|
|
// from SVGTextPathElement:
|
|
|
|
{ &nsGkAtoms::startOffset, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X }
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2013-01-06 06:14:43 -08:00
|
|
|
nsSVGEnumMapping SVGTextPathElement::sMethodMap[] = {
|
2013-02-08 11:55:49 -08:00
|
|
|
{&nsGkAtoms::align, TEXTPATH_METHODTYPE_ALIGN},
|
|
|
|
{&nsGkAtoms::stretch, TEXTPATH_METHODTYPE_STRETCH},
|
2012-07-30 07:20:58 -07:00
|
|
|
{nullptr, 0}
|
2007-08-27 16:11:14 -07:00
|
|
|
};
|
|
|
|
|
2013-01-06 06:14:43 -08:00
|
|
|
nsSVGEnumMapping SVGTextPathElement::sSpacingMap[] = {
|
2013-02-08 11:55:49 -08:00
|
|
|
{&nsGkAtoms::_auto, TEXTPATH_SPACINGTYPE_AUTO},
|
|
|
|
{&nsGkAtoms::exact, TEXTPATH_SPACINGTYPE_EXACT},
|
2012-07-30 07:20:58 -07:00
|
|
|
{nullptr, 0}
|
2007-08-27 16:11:14 -07:00
|
|
|
};
|
|
|
|
|
2013-07-23 17:01:35 -07:00
|
|
|
nsSVGElement::EnumInfo SVGTextPathElement::sEnumInfo[3] =
|
2007-08-27 16:11:14 -07:00
|
|
|
{
|
2013-07-23 17:01:35 -07:00
|
|
|
// from SVGTextContentElement:
|
|
|
|
{ &nsGkAtoms::lengthAdjust,
|
|
|
|
sLengthAdjustMap,
|
|
|
|
SVG_LENGTHADJUST_SPACING
|
|
|
|
},
|
|
|
|
// from SVGTextPathElement:
|
2007-08-27 16:11:14 -07:00
|
|
|
{ &nsGkAtoms::method,
|
|
|
|
sMethodMap,
|
2013-02-08 11:55:49 -08:00
|
|
|
TEXTPATH_METHODTYPE_ALIGN
|
2007-08-27 16:11:14 -07:00
|
|
|
},
|
|
|
|
{ &nsGkAtoms::spacing,
|
|
|
|
sSpacingMap,
|
2013-02-08 11:55:49 -08:00
|
|
|
TEXTPATH_SPACINGTYPE_EXACT
|
2007-08-27 16:11:14 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-01-06 06:14:43 -08:00
|
|
|
nsSVGElement::StringInfo SVGTextPathElement::sStringInfo[1] =
|
2008-06-14 02:01:02 -07:00
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
{ &nsGkAtoms::href, kNameSpaceID_XLink, true }
|
2008-06-14 02:01:02 -07:00
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
SVGTextPathElement::SVGTextPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-01-06 06:14:43 -08:00
|
|
|
: SVGTextPathElementBase(aNodeInfo)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIDOMNode methods
|
|
|
|
|
2013-01-06 06:14:43 -08:00
|
|
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTextPathElement)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-06-14 15:37:27 -07:00
|
|
|
already_AddRefed<SVGAnimatedString>
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElement::Href()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-02-07 00:08:56 -08:00
|
|
|
return mStringAttributes[HREF].ToDOMAnimatedString(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2013-01-06 06:14:43 -08:00
|
|
|
|
2013-01-19 12:56:00 -08:00
|
|
|
already_AddRefed<SVGAnimatedLength>
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElement::StartOffset()
|
|
|
|
{
|
|
|
|
return mLengthAttributes[STARTOFFSET].ToDOMAnimatedLength(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-07-01 00:02:46 -07:00
|
|
|
already_AddRefed<SVGAnimatedEnumeration>
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElement::Method()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-01-06 06:14:43 -08:00
|
|
|
return mEnumAttributes[METHOD].ToDOMAnimatedEnum(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-07-01 00:02:46 -07:00
|
|
|
already_AddRefed<SVGAnimatedEnumeration>
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElement::Spacing()
|
|
|
|
{
|
|
|
|
return mEnumAttributes[SPACING].ToDOMAnimatedEnum(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIContent methods
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHODIMP_(bool)
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElement::IsAttributeMapped(const nsIAtom* name) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
sColorMap,
|
|
|
|
sFillStrokeMap,
|
|
|
|
sFontSpecificationMap,
|
|
|
|
sGraphicsMap,
|
|
|
|
sTextContentElementsMap
|
|
|
|
};
|
2013-01-06 06:14:43 -08:00
|
|
|
|
2011-12-18 02:09:27 -08:00
|
|
|
return FindAttributeDependence(name, map) ||
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElementBase::IsAttributeMapped(name);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-01-02 12:24:07 -08:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSVGElement overrides
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsSVGElement::LengthAttributesInfo
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElement::GetLengthInfo()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
|
2011-10-10 22:50:08 -07:00
|
|
|
ArrayLength(sLengthInfo));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2007-08-27 16:11:14 -07:00
|
|
|
nsSVGElement::EnumAttributesInfo
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElement::GetEnumInfo()
|
2007-08-27 16:11:14 -07:00
|
|
|
{
|
|
|
|
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
2011-10-10 22:50:08 -07:00
|
|
|
ArrayLength(sEnumInfo));
|
2007-08-27 16:11:14 -07:00
|
|
|
}
|
|
|
|
|
2008-06-14 02:01:02 -07:00
|
|
|
nsSVGElement::StringAttributesInfo
|
2013-01-06 06:14:43 -08:00
|
|
|
SVGTextPathElement::GetStringInfo()
|
2008-06-14 02:01:02 -07:00
|
|
|
{
|
|
|
|
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
2011-10-10 22:50:08 -07:00
|
|
|
ArrayLength(sStringInfo));
|
2008-06-14 02:01:02 -07:00
|
|
|
}
|
2013-01-06 06:14:43 -08:00
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|