2012-05-17 03:02:41 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
2012-05-17 03:02:41 -07:00
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
#include "mozilla/dom/SVGViewElement.h"
|
2013-01-07 19:22:41 -08:00
|
|
|
#include "mozilla/dom/SVGViewElementBinding.h"
|
2012-05-17 03:02:41 -07:00
|
|
|
#include "DOMSVGStringList.h"
|
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(View)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
JSObject*
|
2014-04-08 15:27:17 -07:00
|
|
|
SVGViewElement::WrapNode(JSContext *aCx)
|
2013-01-07 19:22:41 -08:00
|
|
|
{
|
Bug 991742 part 6. Remove the "aScope" argument of binding Wrap() methods. r=bholley
This patch was mostly generated with this command:
find . -name "*.h" -o -name "*.cpp" | xargs sed -e 's/Binding::Wrap(aCx, aScope, this/Binding::Wrap(aCx, this/' -e 's/Binding_workers::Wrap(aCx, aScope, this/Binding_workers::Wrap(aCx, this/' -e 's/Binding::Wrap(cx, scope, this/Binding::Wrap(cx, this/' -i ""
plus a few manual fixes to dom/bindings/Codegen.py, js/xpconnect/src/event_impl_gen.py, and a few C++ files that were not caught in the search-and-replace above.
2014-04-08 15:27:17 -07:00
|
|
|
return SVGViewElementBinding::Wrap(aCx, this);
|
2013-01-07 19:22:41 -08:00
|
|
|
}
|
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
nsSVGElement::StringListInfo SVGViewElement::sStringListInfo[1] =
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
|
|
|
{ &nsGkAtoms::viewTarget }
|
|
|
|
};
|
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
nsSVGEnumMapping SVGViewElement::sZoomAndPanMap[] = {
|
2013-01-09 21:24:37 -08:00
|
|
|
{&nsGkAtoms::disable, SVG_ZOOMANDPAN_DISABLE},
|
|
|
|
{&nsGkAtoms::magnify, SVG_ZOOMANDPAN_MAGNIFY},
|
2012-07-30 07:20:58 -07:00
|
|
|
{nullptr, 0}
|
2012-05-17 03:02:41 -07:00
|
|
|
};
|
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
nsSVGElement::EnumInfo SVGViewElement::sEnumInfo[1] =
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
|
|
|
{ &nsGkAtoms::zoomAndPan,
|
|
|
|
sZoomAndPanMap,
|
2013-01-09 21:24:37 -08:00
|
|
|
SVG_ZOOMANDPAN_MAGNIFY
|
2012-05-17 03:02:41 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
SVGViewElement::SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-01-07 19:22:41 -08:00
|
|
|
: SVGViewElementBase(aNodeInfo)
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIDOMNode methods
|
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGViewElement)
|
2012-05-17 03:02:41 -07:00
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
void
|
|
|
|
SVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
2013-01-09 21:24:37 -08:00
|
|
|
if (aZoomAndPan == SVG_ZOOMANDPAN_DISABLE ||
|
|
|
|
aZoomAndPan == SVG_ZOOMANDPAN_MAGNIFY) {
|
2012-05-17 03:02:41 -07:00
|
|
|
mEnumAttributes[ZOOMANDPAN].SetBaseValue(aZoomAndPan, this);
|
2013-01-07 19:22:41 -08:00
|
|
|
return;
|
2012-05-17 03:02:41 -07:00
|
|
|
}
|
|
|
|
|
2015-02-04 03:46:26 -08:00
|
|
|
rv.ThrowRangeError(MSG_INVALID_ZOOMANDPAN_VALUE_ERROR);
|
2012-05-17 03:02:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2013-01-07 19:22:41 -08:00
|
|
|
|
2013-05-09 10:42:12 -07:00
|
|
|
already_AddRefed<SVGAnimatedRect>
|
2013-01-07 19:22:41 -08:00
|
|
|
SVGViewElement::ViewBox()
|
|
|
|
{
|
2013-05-20 04:46:12 -07:00
|
|
|
return mViewBox.ToSVGAnimatedRect(this);
|
2012-05-17 03:02:41 -07:00
|
|
|
}
|
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
|
|
|
|
SVGViewElement::PreserveAspectRatio()
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
2015-01-27 01:51:34 -08:00
|
|
|
return mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(this);
|
2012-05-17 03:02:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2013-04-20 23:42:00 -07:00
|
|
|
already_AddRefed<DOMSVGStringList>
|
2013-01-07 19:22:41 -08:00
|
|
|
SVGViewElement::ViewTarget()
|
|
|
|
{
|
|
|
|
return DOMSVGStringList::GetDOMWrapper(
|
|
|
|
&mStringListAttributes[VIEW_TARGET], this, false, VIEW_TARGET);
|
|
|
|
}
|
|
|
|
|
2012-05-17 03:02:41 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSVGElement methods
|
|
|
|
|
|
|
|
nsSVGElement::EnumAttributesInfo
|
2013-01-07 19:22:41 -08:00
|
|
|
SVGViewElement::GetEnumInfo()
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
|
|
|
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
|
|
|
ArrayLength(sEnumInfo));
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGViewBox *
|
2013-01-07 19:22:41 -08:00
|
|
|
SVGViewElement::GetViewBox()
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
|
|
|
return &mViewBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
SVGAnimatedPreserveAspectRatio *
|
2013-01-07 19:22:41 -08:00
|
|
|
SVGViewElement::GetPreserveAspectRatio()
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
|
|
|
return &mPreserveAspectRatio;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGElement::StringListAttributesInfo
|
2013-01-07 19:22:41 -08:00
|
|
|
SVGViewElement::GetStringListInfo()
|
2012-05-17 03:02:41 -07:00
|
|
|
{
|
|
|
|
return StringListAttributesInfo(mStringListAttributes, sStringListInfo,
|
|
|
|
ArrayLength(sStringListInfo));
|
|
|
|
}
|
2013-01-07 19:22:41 -08:00
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|