2015-05-03 22:32:37 +03: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 15:12:37 +04: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/. */
|
2012-05-17 14:02:41 +04:00
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
#include "mozilla/dom/SVGViewElement.h"
|
2013-01-08 07:22:41 +04:00
|
|
|
#include "mozilla/dom/SVGViewElementBinding.h"
|
2012-05-17 14:02:41 +04:00
|
|
|
#include "DOMSVGStringList.h"
|
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(View)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-01-08 07:22:41 +04: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 17:13:33 +03:00
|
|
|
SVGViewElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-01-08 07:22:41 +04: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 17:13:33 +03:00
|
|
|
return SVGViewElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-01-08 07:22:41 +04:00
|
|
|
}
|
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
nsSVGElement::StringListInfo SVGViewElement::sStringListInfo[1] =
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
|
|
|
{ &nsGkAtoms::viewTarget }
|
|
|
|
};
|
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
nsSVGEnumMapping SVGViewElement::sZoomAndPanMap[] = {
|
2013-01-10 09:24:37 +04:00
|
|
|
{&nsGkAtoms::disable, SVG_ZOOMANDPAN_DISABLE},
|
|
|
|
{&nsGkAtoms::magnify, SVG_ZOOMANDPAN_MAGNIFY},
|
2012-07-30 18:20:58 +04:00
|
|
|
{nullptr, 0}
|
2012-05-17 14:02:41 +04:00
|
|
|
};
|
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
nsSVGElement::EnumInfo SVGViewElement::sEnumInfo[1] =
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
|
|
|
{ &nsGkAtoms::zoomAndPan,
|
|
|
|
sZoomAndPanMap,
|
2013-01-10 09:24:37 +04:00
|
|
|
SVG_ZOOMANDPAN_MAGNIFY
|
2012-05-17 14:02:41 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
SVGViewElement::SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-01-08 07:22:41 +04:00
|
|
|
: SVGViewElementBase(aNodeInfo)
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIDOMNode methods
|
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGViewElement)
|
2012-05-17 14:02:41 +04:00
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
void
|
|
|
|
SVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
2013-01-10 09:24:37 +04:00
|
|
|
if (aZoomAndPan == SVG_ZOOMANDPAN_DISABLE ||
|
|
|
|
aZoomAndPan == SVG_ZOOMANDPAN_MAGNIFY) {
|
2012-05-17 14:02:41 +04:00
|
|
|
mEnumAttributes[ZOOMANDPAN].SetBaseValue(aZoomAndPan, this);
|
2013-01-08 07:22:41 +04:00
|
|
|
return;
|
2012-05-17 14:02:41 +04:00
|
|
|
}
|
|
|
|
|
2015-10-05 19:38:14 +03:00
|
|
|
rv.ThrowRangeError<MSG_INVALID_ZOOMANDPAN_VALUE_ERROR>();
|
2012-05-17 14:02:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2013-01-08 07:22:41 +04:00
|
|
|
|
2013-05-09 21:42:12 +04:00
|
|
|
already_AddRefed<SVGAnimatedRect>
|
2013-01-08 07:22:41 +04:00
|
|
|
SVGViewElement::ViewBox()
|
|
|
|
{
|
2013-05-20 15:46:12 +04:00
|
|
|
return mViewBox.ToSVGAnimatedRect(this);
|
2012-05-17 14:02:41 +04:00
|
|
|
}
|
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
|
|
|
|
SVGViewElement::PreserveAspectRatio()
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
2015-01-27 12:51:34 +03:00
|
|
|
return mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(this);
|
2012-05-17 14:02:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2013-04-21 10:42:00 +04:00
|
|
|
already_AddRefed<DOMSVGStringList>
|
2013-01-08 07:22:41 +04:00
|
|
|
SVGViewElement::ViewTarget()
|
|
|
|
{
|
|
|
|
return DOMSVGStringList::GetDOMWrapper(
|
|
|
|
&mStringListAttributes[VIEW_TARGET], this, false, VIEW_TARGET);
|
|
|
|
}
|
|
|
|
|
2012-05-17 14:02:41 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSVGElement methods
|
|
|
|
|
|
|
|
nsSVGElement::EnumAttributesInfo
|
2013-01-08 07:22:41 +04:00
|
|
|
SVGViewElement::GetEnumInfo()
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
|
|
|
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
|
|
|
ArrayLength(sEnumInfo));
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGViewBox *
|
2013-01-08 07:22:41 +04:00
|
|
|
SVGViewElement::GetViewBox()
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
|
|
|
return &mViewBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
SVGAnimatedPreserveAspectRatio *
|
2013-01-08 07:22:41 +04:00
|
|
|
SVGViewElement::GetPreserveAspectRatio()
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
|
|
|
return &mPreserveAspectRatio;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGElement::StringListAttributesInfo
|
2013-01-08 07:22:41 +04:00
|
|
|
SVGViewElement::GetStringListInfo()
|
2012-05-17 14:02:41 +04:00
|
|
|
{
|
|
|
|
return StringListAttributesInfo(mStringListAttributes, sStringListInfo,
|
|
|
|
ArrayLength(sStringListInfo));
|
|
|
|
}
|
2013-01-08 07:22:41 +04:00
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|