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*
|
2014-04-08 22:27:17 +00:00
|
|
|
SVGViewElement::WrapNode(JSContext *aCx)
|
2013-01-08 03:22:41 +00: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 22:27:17 +00:00
|
|
|
return SVGViewElementBinding::Wrap(aCx, this);
|
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
|
|
|
}
|
|
|
|
|
2013-01-08 03:22:41 +00:00
|
|
|
rv.Throw(NS_ERROR_RANGE_ERR);
|
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
|
|
|
{
|
2013-01-06 09:32:01 +00:00
|
|
|
nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
|
|
|
|
mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
|
2013-01-08 03:22:41 +00:00
|
|
|
return ratio.forget();
|
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
|