2015-05-03 12:32:37 -07: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 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-01-09 21:30:13 -08:00
|
|
|
#include "mozilla/dom/SVGAElement.h"
|
2013-07-10 02:56:47 -07:00
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-17 21:48:21 -07:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-04-02 21:18:36 -07:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-01-09 21:30:13 -08:00
|
|
|
#include "mozilla/dom/SVGAElementBinding.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsCOMPtr.h"
|
2011-08-11 06:29:50 -07:00
|
|
|
#include "nsContentUtils.h"
|
2013-07-10 02:56:47 -07:00
|
|
|
#include "nsGkAtoms.h"
|
|
|
|
#include "nsSVGString.h"
|
2013-08-23 19:42:40 -07:00
|
|
|
#include "nsIURI.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-01-09 21:30:13 -08:00
|
|
|
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(A)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
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 07:13:33 -07:00
|
|
|
SVGAElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-01-09 21:30:13 -08: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 07:13:33 -07:00
|
|
|
return SVGAElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-01-09 21:30:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGElement::StringInfo SVGAElement::sStringInfo[2] =
|
2008-06-14 02:01:02 -07:00
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
{ &nsGkAtoms::href, kNameSpaceID_XLink, true },
|
|
|
|
{ &nsGkAtoms::target, kNameSpaceID_None, true }
|
2008-06-14 02:01:02 -07:00
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISupports methods
|
|
|
|
|
2013-12-12 11:30:27 -08:00
|
|
|
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(SVGAElement)
|
2014-04-27 00:06:00 -07:00
|
|
|
NS_INTERFACE_TABLE_INHERITED(SVGAElement,
|
|
|
|
nsIDOMNode,
|
|
|
|
nsIDOMElement,
|
|
|
|
nsIDOMSVGElement,
|
|
|
|
Link)
|
2013-12-12 11:30:27 -08:00
|
|
|
NS_INTERFACE_TABLE_TAIL_INHERITING(SVGAElementBase)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-12-12 11:30:27 -08:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(SVGAElement)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SVGAElement,
|
|
|
|
SVGAElementBase)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SVGAElement,
|
|
|
|
SVGAElementBase)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF_INHERITED(SVGAElement, SVGAElementBase)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(SVGAElement, SVGAElementBase)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
SVGAElement::SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-07-10 02:56:47 -07:00
|
|
|
: SVGAElementBase(aNodeInfo)
|
2015-01-06 21:39:46 -08:00
|
|
|
, Link(this)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-08 14:23:16 -07:00
|
|
|
SVGAElement::~SVGAElement()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-14 15:37:27 -07:00
|
|
|
already_AddRefed<SVGAnimatedString>
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::Href()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-03-09 23:58:53 -08:00
|
|
|
return mStringAttributes[HREF].ToDOMAnimatedString(this);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsINode methods
|
|
|
|
|
2007-04-23 00:31:21 -07:00
|
|
|
nsresult
|
2014-03-17 21:48:19 -07:00
|
|
|
SVGAElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2007-04-23 00:31:21 -07:00
|
|
|
{
|
2012-11-14 14:10:08 -08:00
|
|
|
nsresult rv = Element::PreHandleEvent(aVisitor);
|
2007-04-23 00:31:21 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
return PreHandleEventForLinks(aVisitor);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
2014-03-17 21:48:20 -07:00
|
|
|
SVGAElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return PostHandleEventForLinks(aVisitor);
|
|
|
|
}
|
|
|
|
|
2013-01-09 21:30:13 -08:00
|
|
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAElement)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2013-06-14 15:37:27 -07:00
|
|
|
already_AddRefed<SVGAnimatedString>
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::Target()
|
|
|
|
{
|
2013-03-09 23:58:53 -08:00
|
|
|
return mStringAttributes[TARGET].ToDOMAnimatedString(this);
|
2013-01-09 21:30:13 -08:00
|
|
|
}
|
|
|
|
|
2013-02-18 14:48:53 -08:00
|
|
|
void
|
|
|
|
SVGAElement::GetDownload(nsAString & aDownload)
|
|
|
|
{
|
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::download, aDownload);
|
|
|
|
}
|
2013-01-09 21:30:13 -08:00
|
|
|
|
2013-02-18 14:48:53 -08:00
|
|
|
void
|
|
|
|
SVGAElement::SetDownload(const nsAString & aDownload, ErrorResult& rv)
|
|
|
|
{
|
|
|
|
rv = SetAttr(kNameSpaceID_None, nsGkAtoms::download, aDownload, true);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2009-07-13 04:48:06 -07:00
|
|
|
// nsIContent methods
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-11-23 10:48:52 -08:00
|
|
|
nsresult
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
|
|
|
nsIContent *aBindingParent,
|
|
|
|
bool aCompileEventHandlers)
|
2009-11-23 10:48:52 -08:00
|
|
|
{
|
2012-12-07 06:35:14 -08:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2009-11-23 10:48:52 -08:00
|
|
|
|
2013-01-09 21:30:13 -08:00
|
|
|
nsresult rv = SVGAElementBase::BindToTree(aDocument, aParent,
|
|
|
|
aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
2009-11-23 10:48:52 -08:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2013-01-09 21:30:13 -08:00
|
|
|
|
2014-10-03 05:32:26 -07:00
|
|
|
nsIDocument* doc = GetComposedDoc();
|
|
|
|
if (doc) {
|
|
|
|
doc->RegisterPendingLinkUpdate(this);
|
2011-11-13 19:24:41 -08:00
|
|
|
}
|
2009-11-23 10:48:52 -08:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2009-11-23 10:48:52 -08:00
|
|
|
{
|
|
|
|
// If this link is ever reinserted into a document, it might
|
|
|
|
// be under a different xml:base, so forget the cached state now.
|
2012-12-07 06:35:14 -08:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2013-01-09 21:30:13 -08:00
|
|
|
|
2014-10-03 05:32:26 -07:00
|
|
|
// Note, we need to use OwnerDoc() here since GetComposedDoc() may
|
|
|
|
// return null already at this point.
|
|
|
|
nsIDocument* doc = OwnerDoc();
|
2011-11-13 19:24:41 -08:00
|
|
|
if (doc) {
|
|
|
|
doc->UnregisterPendingLinkUpdate(this);
|
|
|
|
}
|
2009-11-23 10:48:52 -08:00
|
|
|
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElementBase::UnbindFromTree(aDeep, aNullParent);
|
2009-11-23 10:48:52 -08:00
|
|
|
}
|
|
|
|
|
2009-07-13 04:48:06 -07:00
|
|
|
already_AddRefed<nsIURI>
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::GetHrefURI() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2009-11-09 10:00:54 -08:00
|
|
|
nsCOMPtr<nsIURI> hrefURI;
|
2012-07-30 07:20:58 -07:00
|
|
|
return IsLink(getter_AddRefs(hrefURI)) ? hrefURI.forget() : nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHODIMP_(bool)
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::IsAttributeMapped(const nsIAtom* name) const
|
2010-06-09 11:53:40 -07:00
|
|
|
{
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
sFEFloodMap,
|
|
|
|
sFiltersMap,
|
|
|
|
sFontSpecificationMap,
|
|
|
|
sGradientStopMap,
|
|
|
|
sLightingEffectsMap,
|
|
|
|
sMarkersMap,
|
|
|
|
sTextContentElementsMap,
|
|
|
|
sViewportsMap
|
|
|
|
};
|
|
|
|
|
2011-12-18 02:09:27 -08:00
|
|
|
return FindAttributeDependence(name, map) ||
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElementBase::IsAttributeMapped(name);
|
2010-06-09 11:53:40 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2013-11-19 14:21:16 -08:00
|
|
|
SVGAElement::IsFocusableInternal(int32_t *aTabIndex, bool aWithMouse)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
if (IsLink(getter_AddRefs(uri))) {
|
|
|
|
if (aTabIndex) {
|
|
|
|
*aTabIndex = ((sTabFocusModel & eTabFocus_linksMask) == 0 ? -1 : 0);
|
|
|
|
}
|
2011-10-17 07:59:28 -07:00
|
|
|
return true;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (aTabIndex) {
|
|
|
|
*aTabIndex = -1;
|
|
|
|
}
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::IsLink(nsIURI** aURI) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
// To be a clickable XLink for styling and interaction purposes, we require:
|
|
|
|
//
|
|
|
|
// xlink:href - must be set
|
|
|
|
// xlink:type - must be unset or set to "" or set to "simple"
|
|
|
|
// xlink:show - must be unset or set to "", "new" or "replace"
|
|
|
|
// xlink:actuate - must be unset or set to "" or "onRequest"
|
|
|
|
//
|
|
|
|
// For any other values, we're either not a *clickable* XLink, or the end
|
2011-10-17 07:59:28 -07:00
|
|
|
// result is poorly specified. Either way, we return false.
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static nsIContent::AttrValuesArray sTypeVals[] =
|
2012-07-30 07:20:58 -07:00
|
|
|
{ &nsGkAtoms::_empty, &nsGkAtoms::simple, nullptr };
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static nsIContent::AttrValuesArray sShowVals[] =
|
2012-07-30 07:20:58 -07:00
|
|
|
{ &nsGkAtoms::_empty, &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr };
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static nsIContent::AttrValuesArray sActuateVals[] =
|
2012-07-30 07:20:58 -07:00
|
|
|
{ &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nullptr };
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Optimization: check for href first for early return
|
|
|
|
const nsAttrValue* href = mAttrsAndChildren.GetAttr(nsGkAtoms::href,
|
|
|
|
kNameSpaceID_XLink);
|
|
|
|
if (href &&
|
|
|
|
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::type,
|
|
|
|
sTypeVals, eCaseMatters) !=
|
|
|
|
nsIContent::ATTR_VALUE_NO_MATCH &&
|
|
|
|
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show,
|
|
|
|
sShowVals, eCaseMatters) !=
|
|
|
|
nsIContent::ATTR_VALUE_NO_MATCH &&
|
|
|
|
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate,
|
|
|
|
sActuateVals, eCaseMatters) !=
|
|
|
|
nsIContent::ATTR_VALUE_NO_MATCH) {
|
|
|
|
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
|
|
|
// Get absolute URI
|
2009-01-21 16:56:51 -08:00
|
|
|
nsAutoString str;
|
|
|
|
mStringAttributes[HREF].GetAnimValue(str, this);
|
|
|
|
nsContentUtils::NewURIWithDocumentCharset(aURI, str,
|
2011-10-18 03:53:36 -07:00
|
|
|
OwnerDoc(), baseURI);
|
2007-03-22 10:30:00 -07:00
|
|
|
// must promise out param is non-null if we return true
|
|
|
|
return !!*aURI;
|
|
|
|
}
|
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
*aURI = nullptr;
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2007-04-03 01:59:11 -07:00
|
|
|
void
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::GetLinkTarget(nsAString& aTarget)
|
2007-04-03 01:59:11 -07:00
|
|
|
{
|
2009-01-21 16:56:51 -08:00
|
|
|
mStringAttributes[TARGET].GetAnimValue(aTarget, this);
|
2007-04-03 01:59:11 -07:00
|
|
|
if (aTarget.IsEmpty()) {
|
2008-08-01 02:52:23 -07:00
|
|
|
|
|
|
|
static nsIContent::AttrValuesArray sShowVals[] =
|
2012-07-30 07:20:58 -07:00
|
|
|
{ &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr };
|
2008-08-01 02:52:23 -07:00
|
|
|
|
|
|
|
switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show,
|
|
|
|
sShowVals, eCaseMatters)) {
|
|
|
|
case 0:
|
|
|
|
aTarget.AssignLiteral("_blank");
|
|
|
|
return;
|
|
|
|
case 1:
|
|
|
|
return;
|
|
|
|
}
|
2011-10-18 03:53:36 -07:00
|
|
|
nsIDocument* ownerDoc = OwnerDoc();
|
2007-04-03 01:59:11 -07:00
|
|
|
if (ownerDoc) {
|
|
|
|
ownerDoc->GetBaseTarget(aTarget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-06-14 02:01:02 -07:00
|
|
|
|
2014-04-02 21:18:36 -07:00
|
|
|
EventStates
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::IntrinsicState() const
|
2009-12-15 16:04:09 -08:00
|
|
|
{
|
2013-01-09 21:30:13 -08:00
|
|
|
return Link::LinkState() | SVGAElementBase::IntrinsicState();
|
2009-12-15 16:04:09 -08:00
|
|
|
}
|
|
|
|
|
2010-02-24 08:37:02 -08:00
|
|
|
nsresult
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
|
|
|
bool aNotify)
|
2010-02-24 08:37:02 -08:00
|
|
|
{
|
2013-01-09 21:30:13 -08:00
|
|
|
nsresult rv = SVGAElementBase::SetAttr(aNameSpaceID, aName, aPrefix,
|
|
|
|
aValue, aNotify);
|
2010-02-24 08:37:38 -08:00
|
|
|
|
|
|
|
// The ordering of the parent class's SetAttr call and Link::ResetLinkState
|
|
|
|
// is important here! The attribute is not set until SetAttr returns, and
|
|
|
|
// we will need the updated attribute value because notifying the document
|
|
|
|
// that content states have changed will call IntrinsicState, which will try
|
|
|
|
// to get updated information about the visitedness from Link.
|
2010-02-24 08:37:02 -08:00
|
|
|
if (aName == nsGkAtoms::href && aNameSpaceID == kNameSpaceID_XLink) {
|
2012-12-07 06:35:14 -08:00
|
|
|
Link::ResetLinkState(!!aNotify, true);
|
2010-02-24 08:37:02 -08:00
|
|
|
}
|
|
|
|
|
2010-02-24 08:37:38 -08:00
|
|
|
return rv;
|
2010-02-24 08:37:02 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttr,
|
|
|
|
bool aNotify)
|
2010-02-24 08:37:02 -08:00
|
|
|
{
|
2013-01-05 22:25:52 -08:00
|
|
|
nsresult rv = nsSVGElement::UnsetAttr(aNameSpaceID, aAttr, aNotify);
|
2010-03-03 12:55:35 -08:00
|
|
|
|
|
|
|
// The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
|
|
|
|
// is important here! The attribute is not unset until UnsetAttr returns, and
|
|
|
|
// we will need the updated attribute value because notifying the document
|
|
|
|
// that content states have changed will call IntrinsicState, which will try
|
|
|
|
// to get updated information about the visitedness from Link.
|
2010-02-24 08:37:02 -08:00
|
|
|
if (aAttr == nsGkAtoms::href && aNameSpaceID == kNameSpaceID_XLink) {
|
2012-12-07 06:35:14 -08:00
|
|
|
Link::ResetLinkState(!!aNotify, false);
|
2010-02-24 08:37:02 -08:00
|
|
|
}
|
|
|
|
|
2010-03-03 12:55:35 -08:00
|
|
|
return rv;
|
2010-02-24 08:37:02 -08:00
|
|
|
}
|
|
|
|
|
2008-06-14 02:01:02 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSVGElement methods
|
|
|
|
|
|
|
|
nsSVGElement::StringAttributesInfo
|
2013-01-09 21:30:13 -08:00
|
|
|
SVGAElement::GetStringInfo()
|
2008-06-14 02:01:02 -07:00
|
|
|
{
|
|
|
|
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
2011-10-10 22:50:08 -07:00
|
|
|
ArrayLength(sStringInfo));
|
2008-06-14 02:01:02 -07:00
|
|
|
}
|
2013-01-09 21:30:13 -08:00
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|