2015-05-03 19:32:37 +00: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 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/. */
|
2007-01-26 23:45:15 +00:00
|
|
|
|
2013-01-10 05:30:13 +00:00
|
|
|
#include "mozilla/dom/SVGAElement.h"
|
2013-07-10 09:56:47 +00:00
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-18 04:48:21 +00:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-04-03 04:18:36 +00:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-01-10 05:30:13 +00:00
|
|
|
#include "mozilla/dom/SVGAElementBinding.h"
|
2007-01-26 23:45:15 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2011-08-11 13:29:50 +00:00
|
|
|
#include "nsContentUtils.h"
|
2013-07-10 09:56:47 +00:00
|
|
|
#include "nsGkAtoms.h"
|
|
|
|
#include "nsSVGString.h"
|
2013-08-24 02:42:40 +00:00
|
|
|
#include "nsIURI.h"
|
2007-01-26 23:45:15 +00:00
|
|
|
|
2013-01-10 05:30:13 +00: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 14:13:33 +00:00
|
|
|
SVGAElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-01-10 05:30:13 +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 SVGAElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-01-10 05:30:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGElement::StringInfo SVGAElement::sStringInfo[2] =
|
2008-06-14 09:01:02 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
{ &nsGkAtoms::href, kNameSpaceID_XLink, true },
|
|
|
|
{ &nsGkAtoms::target, kNameSpaceID_None, true }
|
2008-06-14 09:01:02 +00:00
|
|
|
};
|
|
|
|
|
2007-01-26 23:45:15 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISupports methods
|
|
|
|
|
2013-12-12 19:30:27 +00:00
|
|
|
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(SVGAElement)
|
2014-04-27 07:06:00 +00:00
|
|
|
NS_INTERFACE_TABLE_INHERITED(SVGAElement,
|
|
|
|
nsIDOMNode,
|
|
|
|
nsIDOMElement,
|
|
|
|
nsIDOMSVGElement,
|
|
|
|
Link)
|
2013-12-12 19:30:27 +00:00
|
|
|
NS_INTERFACE_TABLE_TAIL_INHERITING(SVGAElementBase)
|
2007-01-26 23:45:15 +00:00
|
|
|
|
2013-12-12 19:30:27 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(SVGAElement)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SVGAElement,
|
|
|
|
SVGAElementBase)
|
2014-10-23 15:32:35 +00:00
|
|
|
tmp->Link::Traverse(cb);
|
2013-12-12 19:30:27 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SVGAElement,
|
|
|
|
SVGAElementBase)
|
2014-10-23 15:32:35 +00:00
|
|
|
tmp->Link::Unlink();
|
2013-12-12 19:30:27 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF_INHERITED(SVGAElement, SVGAElementBase)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(SVGAElement, SVGAElementBase)
|
2007-01-26 23:45:15 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2014-06-20 02:01:40 +00:00
|
|
|
SVGAElement::SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-07-10 09:56:47 +00:00
|
|
|
: SVGAElementBase(aNodeInfo)
|
2015-01-07 05:39:46 +00:00
|
|
|
, Link(this)
|
2007-01-26 23:45:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-08 21:23:16 +00:00
|
|
|
SVGAElement::~SVGAElement()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-14 22:37:27 +00:00
|
|
|
already_AddRefed<SVGAnimatedString>
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::Href()
|
2007-01-26 23:45:15 +00:00
|
|
|
{
|
2013-03-10 07:58:53 +00:00
|
|
|
return mStringAttributes[HREF].ToDOMAnimatedString(this);
|
2007-01-26 23:45:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsINode methods
|
|
|
|
|
2007-04-23 07:31:21 +00:00
|
|
|
nsresult
|
2014-03-18 04:48:19 +00:00
|
|
|
SVGAElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2007-04-23 07:31:21 +00:00
|
|
|
{
|
2012-11-14 22:10:08 +00:00
|
|
|
nsresult rv = Element::PreHandleEvent(aVisitor);
|
2007-04-23 07:31:21 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
return PreHandleEventForLinks(aVisitor);
|
|
|
|
}
|
|
|
|
|
2007-01-26 23:45:15 +00:00
|
|
|
nsresult
|
2014-03-18 04:48:20 +00:00
|
|
|
SVGAElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
2007-01-26 23:45:15 +00:00
|
|
|
{
|
|
|
|
return PostHandleEventForLinks(aVisitor);
|
|
|
|
}
|
|
|
|
|
2013-01-10 05:30:13 +00:00
|
|
|
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAElement)
|
2007-01-26 23:45:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2013-06-14 22:37:27 +00:00
|
|
|
already_AddRefed<SVGAnimatedString>
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::Target()
|
|
|
|
{
|
2013-03-10 07:58:53 +00:00
|
|
|
return mStringAttributes[TARGET].ToDOMAnimatedString(this);
|
2013-01-10 05:30:13 +00:00
|
|
|
}
|
|
|
|
|
2013-02-18 22:48:53 +00:00
|
|
|
void
|
|
|
|
SVGAElement::GetDownload(nsAString & aDownload)
|
|
|
|
{
|
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::download, aDownload);
|
|
|
|
}
|
2013-01-10 05:30:13 +00:00
|
|
|
|
2013-02-18 22:48:53 +00:00
|
|
|
void
|
|
|
|
SVGAElement::SetDownload(const nsAString & aDownload, ErrorResult& rv)
|
|
|
|
{
|
|
|
|
rv = SetAttr(kNameSpaceID_None, nsGkAtoms::download, aDownload, true);
|
|
|
|
}
|
2007-01-26 23:45:15 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2009-07-13 11:48:06 +00:00
|
|
|
// nsIContent methods
|
2007-01-26 23:45:15 +00:00
|
|
|
|
2009-11-23 18:48:52 +00:00
|
|
|
nsresult
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
|
|
|
nsIContent *aBindingParent,
|
|
|
|
bool aCompileEventHandlers)
|
2009-11-23 18:48:52 +00:00
|
|
|
{
|
2012-12-07 14:35:14 +00:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2009-11-23 18:48:52 +00:00
|
|
|
|
2013-01-10 05:30:13 +00:00
|
|
|
nsresult rv = SVGAElementBase::BindToTree(aDocument, aParent,
|
|
|
|
aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
2009-11-23 18:48:52 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2013-01-10 05:30:13 +00:00
|
|
|
|
2014-10-03 12:32:26 +00:00
|
|
|
nsIDocument* doc = GetComposedDoc();
|
|
|
|
if (doc) {
|
|
|
|
doc->RegisterPendingLinkUpdate(this);
|
2011-11-14 03:24:41 +00:00
|
|
|
}
|
2009-11-23 18:48:52 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2009-11-23 18:48:52 +00: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 14:35:14 +00:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2013-01-10 05:30:13 +00:00
|
|
|
|
2014-10-03 12:32:26 +00:00
|
|
|
// Note, we need to use OwnerDoc() here since GetComposedDoc() may
|
|
|
|
// return null already at this point.
|
|
|
|
nsIDocument* doc = OwnerDoc();
|
2011-11-14 03:24:41 +00:00
|
|
|
if (doc) {
|
|
|
|
doc->UnregisterPendingLinkUpdate(this);
|
|
|
|
}
|
2009-11-23 18:48:52 +00:00
|
|
|
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElementBase::UnbindFromTree(aDeep, aNullParent);
|
2009-11-23 18:48:52 +00:00
|
|
|
}
|
|
|
|
|
2009-07-13 11:48:06 +00:00
|
|
|
already_AddRefed<nsIURI>
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::GetHrefURI() const
|
2007-01-26 23:45:15 +00:00
|
|
|
{
|
2009-11-09 18:00:54 +00:00
|
|
|
nsCOMPtr<nsIURI> hrefURI;
|
2012-07-30 14:20:58 +00:00
|
|
|
return IsLink(getter_AddRefs(hrefURI)) ? hrefURI.forget() : nullptr;
|
2007-01-26 23:45:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHODIMP_(bool)
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::IsAttributeMapped(const nsIAtom* name) const
|
2010-06-09 18:53:40 +00:00
|
|
|
{
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
sFEFloodMap,
|
|
|
|
sFiltersMap,
|
|
|
|
sFontSpecificationMap,
|
|
|
|
sGradientStopMap,
|
|
|
|
sLightingEffectsMap,
|
|
|
|
sMarkersMap,
|
|
|
|
sTextContentElementsMap,
|
|
|
|
sViewportsMap
|
|
|
|
};
|
|
|
|
|
2011-12-18 10:09:27 +00:00
|
|
|
return FindAttributeDependence(name, map) ||
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElementBase::IsAttributeMapped(name);
|
2010-06-09 18:53:40 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2013-11-19 22:21:16 +00:00
|
|
|
SVGAElement::IsFocusableInternal(int32_t *aTabIndex, bool aWithMouse)
|
2007-01-26 23:45:15 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
if (IsLink(getter_AddRefs(uri))) {
|
|
|
|
if (aTabIndex) {
|
|
|
|
*aTabIndex = ((sTabFocusModel & eTabFocus_linksMask) == 0 ? -1 : 0);
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2007-01-26 23:45:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (aTabIndex) {
|
|
|
|
*aTabIndex = -1;
|
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2007-01-26 23:45:15 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::IsLink(nsIURI** aURI) const
|
2007-01-26 23:45:15 +00: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 14:59:28 +00:00
|
|
|
// result is poorly specified. Either way, we return false.
|
2007-01-26 23:45:15 +00:00
|
|
|
|
|
|
|
static nsIContent::AttrValuesArray sTypeVals[] =
|
2012-07-30 14:20:58 +00:00
|
|
|
{ &nsGkAtoms::_empty, &nsGkAtoms::simple, nullptr };
|
2007-01-26 23:45:15 +00:00
|
|
|
|
|
|
|
static nsIContent::AttrValuesArray sShowVals[] =
|
2012-07-30 14:20:58 +00:00
|
|
|
{ &nsGkAtoms::_empty, &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr };
|
2007-01-26 23:45:15 +00:00
|
|
|
|
|
|
|
static nsIContent::AttrValuesArray sActuateVals[] =
|
2012-07-30 14:20:58 +00:00
|
|
|
{ &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nullptr };
|
2007-01-26 23:45:15 +00: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-22 00:56:51 +00:00
|
|
|
nsAutoString str;
|
|
|
|
mStringAttributes[HREF].GetAnimValue(str, this);
|
|
|
|
nsContentUtils::NewURIWithDocumentCharset(aURI, str,
|
2011-10-18 10:53:36 +00:00
|
|
|
OwnerDoc(), baseURI);
|
2007-01-26 23:45:15 +00:00
|
|
|
// must promise out param is non-null if we return true
|
|
|
|
return !!*aURI;
|
|
|
|
}
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
*aURI = nullptr;
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2007-01-26 23:45:15 +00:00
|
|
|
}
|
|
|
|
|
2007-04-03 08:59:11 +00:00
|
|
|
void
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::GetLinkTarget(nsAString& aTarget)
|
2007-04-03 08:59:11 +00:00
|
|
|
{
|
2009-01-22 00:56:51 +00:00
|
|
|
mStringAttributes[TARGET].GetAnimValue(aTarget, this);
|
2007-04-03 08:59:11 +00:00
|
|
|
if (aTarget.IsEmpty()) {
|
2008-08-01 09:52:23 +00:00
|
|
|
|
|
|
|
static nsIContent::AttrValuesArray sShowVals[] =
|
2012-07-30 14:20:58 +00:00
|
|
|
{ &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr };
|
2008-08-01 09:52:23 +00:00
|
|
|
|
|
|
|
switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show,
|
|
|
|
sShowVals, eCaseMatters)) {
|
|
|
|
case 0:
|
|
|
|
aTarget.AssignLiteral("_blank");
|
|
|
|
return;
|
|
|
|
case 1:
|
|
|
|
return;
|
|
|
|
}
|
2011-10-18 10:53:36 +00:00
|
|
|
nsIDocument* ownerDoc = OwnerDoc();
|
2007-04-03 08:59:11 +00:00
|
|
|
if (ownerDoc) {
|
|
|
|
ownerDoc->GetBaseTarget(aTarget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-06-14 09:01:02 +00:00
|
|
|
|
2014-04-03 04:18:36 +00:00
|
|
|
EventStates
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::IntrinsicState() const
|
2009-12-16 00:04:09 +00:00
|
|
|
{
|
2013-01-10 05:30:13 +00:00
|
|
|
return Link::LinkState() | SVGAElementBase::IntrinsicState();
|
2009-12-16 00:04:09 +00:00
|
|
|
}
|
|
|
|
|
2010-02-24 16:37:02 +00:00
|
|
|
nsresult
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
|
|
|
bool aNotify)
|
2010-02-24 16:37:02 +00:00
|
|
|
{
|
2013-01-10 05:30:13 +00:00
|
|
|
nsresult rv = SVGAElementBase::SetAttr(aNameSpaceID, aName, aPrefix,
|
|
|
|
aValue, aNotify);
|
2010-02-24 16:37:38 +00: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 16:37:02 +00:00
|
|
|
if (aName == nsGkAtoms::href && aNameSpaceID == kNameSpaceID_XLink) {
|
2012-12-07 14:35:14 +00:00
|
|
|
Link::ResetLinkState(!!aNotify, true);
|
2010-02-24 16:37:02 +00:00
|
|
|
}
|
|
|
|
|
2010-02-24 16:37:38 +00:00
|
|
|
return rv;
|
2010-02-24 16:37:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttr,
|
|
|
|
bool aNotify)
|
2010-02-24 16:37:02 +00:00
|
|
|
{
|
2013-01-06 06:25:52 +00:00
|
|
|
nsresult rv = nsSVGElement::UnsetAttr(aNameSpaceID, aAttr, aNotify);
|
2010-03-03 20:55:35 +00: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 16:37:02 +00:00
|
|
|
if (aAttr == nsGkAtoms::href && aNameSpaceID == kNameSpaceID_XLink) {
|
2012-12-07 14:35:14 +00:00
|
|
|
Link::ResetLinkState(!!aNotify, false);
|
2010-02-24 16:37:02 +00:00
|
|
|
}
|
|
|
|
|
2010-03-03 20:55:35 +00:00
|
|
|
return rv;
|
2010-02-24 16:37:02 +00:00
|
|
|
}
|
|
|
|
|
2008-06-14 09:01:02 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsSVGElement methods
|
|
|
|
|
|
|
|
nsSVGElement::StringAttributesInfo
|
2013-01-10 05:30:13 +00:00
|
|
|
SVGAElement::GetStringInfo()
|
2008-06-14 09:01:02 +00:00
|
|
|
{
|
|
|
|
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
2011-10-11 05:50:08 +00:00
|
|
|
ArrayLength(sStringInfo));
|
2008-06-14 09:01:02 +00:00
|
|
|
}
|
2013-01-10 05:30:13 +00:00
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|