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
|
|
|
|
2018-12-21 14:43:29 +03:00
|
|
|
NS_IMPL_NS_NEW_SVG_ELEMENT(View)
|
2013-01-08 07:22:41 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2018-06-26 00:20:54 +03:00
|
|
|
using namespace SVGViewElement_Binding;
|
2018-02-18 18:53:13 +03: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
|
|
|
JSObject* SVGViewElement::WrapNode(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-26 00:20:54 +03:00
|
|
|
return SVGViewElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-01-08 07:22:41 +04:00
|
|
|
}
|
|
|
|
|
2019-01-02 21:24:11 +03:00
|
|
|
SVGEnumMapping SVGViewElement::sZoomAndPanMap[] = {
|
2018-03-29 12:45:28 +03:00
|
|
|
{nsGkAtoms::disable, SVG_ZOOMANDPAN_DISABLE},
|
|
|
|
{nsGkAtoms::magnify, SVG_ZOOMANDPAN_MAGNIFY},
|
2012-07-30 18:20:58 +04:00
|
|
|
{nullptr, 0}};
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-12-21 11:58:14 +03:00
|
|
|
SVGElement::EnumInfo SVGViewElement::sEnumInfo[1] = {
|
2018-03-29 12:45:24 +03:00
|
|
|
{nsGkAtoms::zoomAndPan, sZoomAndPanMap, SVG_ZOOMANDPAN_MAGNIFY}};
|
2012-05-17 14:02:41 +04:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2018-09-21 23:45:49 +03:00
|
|
|
SVGViewElement::SVGViewElement(
|
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
|
|
|
: SVGViewElementBase(std::move(aNodeInfo)) {}
|
2012-05-17 14:02:41 +04:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-05-30 05:58:49 +03:00
|
|
|
// nsINode methods
|
2012-05-17 14:02:41 +04:00
|
|
|
|
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) {
|
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> 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() {
|
2015-01-27 12:51:34 +03:00
|
|
|
return mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(this);
|
2012-05-17 14:02:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-12-21 11:58:14 +03:00
|
|
|
// SVGElement methods
|
2012-05-17 14:02:41 +04:00
|
|
|
|
2018-12-21 11:58:14 +03:00
|
|
|
SVGElement::EnumAttributesInfo SVGViewElement::GetEnumInfo() {
|
2012-05-17 14:02:41 +04:00
|
|
|
return EnumAttributesInfo(mEnumAttributes, sEnumInfo, ArrayLength(sEnumInfo));
|
|
|
|
}
|
|
|
|
|
2019-04-10 07:08:14 +03:00
|
|
|
SVGAnimatedViewBox* SVGViewElement::GetAnimatedViewBox() { return &mViewBox; }
|
2012-05-17 14:02:41 +04:00
|
|
|
|
2019-04-10 07:08:14 +03:00
|
|
|
SVGAnimatedPreserveAspectRatio*
|
|
|
|
SVGViewElement::GetAnimatedPreserveAspectRatio() {
|
2012-05-17 14:02:41 +04:00
|
|
|
return &mPreserveAspectRatio;
|
|
|
|
}
|
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|