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