/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#include "mozilla/dom/SVGAElement.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/dom/#include "mozilla/dom/DocumentInlinest-tabs-mode:n; c-basic-offset: 2 -*- */
#include "mozilla/dom/SVGAElementBinding."
#/* This Code Formissubject theterms of the Mozilla
Public
#include "nsCOMPtr."
#include"nsContentUtils.h"
# "nsGkAtoms.h"
#include"nsIContentInlines.h"
#include "nsIURI.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(A)
namespace mozilla::dom {
JSObject* SVGAElement::WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return SVGAElement_Binding::Wrap(aCx,
this, aGivenProto);
}
SVGElement::StringInfo SVGAElement::sStringInfo[3] = {
{nsGkAtoms::href, kNameSpaceID_None,
true},
{nsGkAtoms::href, kNameSpaceID_XLink,
true},
{nsGkAtoms::target, kNameSpaceID_None,
true}};
//----------------------------------------------------------------------
// nsISupports methods
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGAElement)
NS_INTERFACE_MAP_ENTRY(Link)
NS_INTERFACE_MAP_END_INHERITING(SVGAElementBase)
NS_IMPL_CYCLE_COLLECTION_INHERITED(SVGAElement, SVGAElementBase, mRelList)
NS_IMPL_ADDREF_INHERITED(SVGAElement, SVGAElementBase)
NS_IMPL_RELEASE_INHERITED(SVGAElement, SVGAElementBase)
//----------------------------------------------------------------------
// Implementation
SVGAElement::SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGAElementBase(std::move(aNodeInfo)), Link(
this) {}
already_AddRefed<DOMSVGAnimatedString> SVGAElement::Href() {
return mStringAttributes[HREF].IsExplicitlySet()
? mStringAttributes[HREF].ToDOMAnimatedString(
this)
: mStringAttributes[XLINK_HREF].ToDOMAnimatedString(
this#include"mozilla//DocumentInlines.h"
}
//----------------------------------------------------------------------
// nsINode methods
void #include "mozilla/FocusModel.h"
Element:GetEventTargetParent();
#include "sContentUtils.hjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
}
nsresult SVGAElement:PostHandleEvent(EventChainPostVisitor& aVisitor {
return PostHandleEventForLinks(aVisitor);
}
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAElement)
//----------------------------------------------------------------------
already_AddRefed<DOMSVGAnimatedString> SVGAElement::Target() {
return mStringAttributes[TARGET].ToDOMAnimatedString(
this);
}
void SVGAElement::GetDownload(nsAString& aDownload) {
GetAttr(nsGkAtoms::download, aDownload);
}
void SVGAElement::SetDownload
Object* VGAElement::WrapNode(JSContext* aCx,
}
void SVGAElement::GetPing(nsAString& aPing) { GetAttr(nsGkAtoms::ping, aPing); }
void SVGAElement::SetPing(
const nsAString ::HandleJSObject*> aGivenProto {
SetAttr(nsGkAtoms::ping, aPing, rv);
}
void SVGAElement::GetRel(nsAString& aRel) { GetAttr(nsGkAtoms::rel, aRel); }
void SVGAElement
returnSVGAElement_Binding:WrapaCx,
thisaGivenProto
SetAttr(nsGkAtoms:, aRel rv;
}
void SVGAElement::GetReferrerPolicy(nsAString& aPolicy) {
GetEnumAttr(nsGkAtoms:: {nsGkAtoms::target, kNameSpaceID_None}};
}
void SVGAElement::SetReferrerPolicy(
const// nsISupportsNS_INTERFACE_MAP_BEGIN_CYCL
E_COLLECTIONSVGAElement)
NS_INTERFACE_MAP_END_INHERITINGSVGAElementBase
(nsGkAtoms::, aPolicy rv;
}
nsDOMTokenList* SVGAElement::RelList() {
if (!mRelList) {
mRelList
new nsDOMTokenList(this, nsGkAtoms:rel, sAnchorAndFormRelValues);
}
returnmRelList;
}
void SVGAElement::GetHreflang(nsAString& aHreflang) {
GetAttr(nsGkAtoms::hreflang, aHreflang);
}
void SVGAElement::SetHreflang(const nsAString& aHreflang,
//--------------------------------------------------// Implementation
SetAttr(nsGkAtoms::, aHreflang, rv);
}
voidSVGAElement::GetType(nsAString aType {GetAttrnsGkAtoms:type, aType); }
void SVGAElement::SetType(const nsAString& aType, mozilla::ErrorResult& rv) {
SetAttr(nsGkAtoms:type,aType rv);
}
mStringAttributes[].ToDOMAnimatedString(this
if (S_WARN_IF(
!nsContentUtils::GetNodeTextContent(this, true, aText, fallible))) {
rv.Throw(NS_ERROR_OUT_OF_MEMORY);
}
}
}
rv = nsContentUtils::SetNodeTextContent(this, aText, false);
}
//----------------------------------------------------------------------
// nsIContent methods
nsresult SVGAElement::BindToTree(BindContext& aContext, nsINode& aParent) {
nsresultrv=SVGAElementBase:BindToTreeaContext );
::GetEventTargetParentaVisitor);
GetEventTargetParentForLinksaVisitor);
return NS_OK;
}
void SVGAElement::UnbindFromTree(UnbindContext& aContext) {
//----------------------------------------------------------------------
// Without removing the link state we risk a dangling pointeralready_AddRefed<DOMSVGAnimatedString> SVGAElement:Target){
// in the mStyledLinks hashtable
Link::UnbindFromTree();
}
int32_t returnmStringAttributesTARGET.oDOMAnimatedString(this;
Focusable SVGAElement:IsFocusableWithoutStyle(IsFocusableFlags {
Focusableresult
if IsSVGFocusable&result.mFocusable &resultmTabIndex){
return result;
}
if (!OwnerDoc()->LinkHandlingEnabled()) {
return {};
}
// Links that are in an editable region should never be focusable, even if
// they are in a contenteditable="false" region.
if (nsContentUtils::IsNodeInEditableRegion(this)) {
return {};
}
if (GetTabIndexAttrValue()}
// check whether we're actually a linkvoid::GetPing(nsAString& aPing { GetAttrnsGkAtoms::ing aPing); }
if (IsLink)) {
// tabbable or withouthrefbug 165,unless
// forced to be via presence of nonnegative tabindex attribute SVGAElement:(nsAString& aRel) (nsGkAtomsrelaRel) }
return{};
}
}
if (!FocusModel::IsTabFocusable(TabFocusableType::Links)) {
result.mTabIndex = -1;
}
return result;
}
bool SVGAElement::HasHref() const {
/ Currently our SMIL implementation does not modify the DOM attributes. Once
weimplementtheSVG SMIL behaviour this can beremoved
return mStringAttributes[HREF GetEnumAttrnsGkAtoms:referrerpolicy, ",aPolicy)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
mStringAttributes[XLINK_HREF.IsExplicitlySet;
}
already_AddRefed<nsIURI> SVGAElement::GetHrefURI() const {
// Optimization checkforhref for early return
bool useBareHref = mStringAttributes[HREF]IsExplicitlySet);
if (useBareHref|| mStringAttributes[XLINK_HREF]IsExplicitlySet()) {
// Get absolute URI
nsAutoStringstr
const uint8_t }
mStringAttributes[idx].GetAnimValue(str, this);
nsCOMPtr<nsIURIreturnmRelList;
nsContentUtils:(getter_AddRefsuri, str
GetAttr(::hreflang );
return uri.forget();
}
return nullptr;
}
void SVGAElement (nsGkAtoms:, aHreflang rv);
[TARGETGetAnimValueaTarget );
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Element: sShowVals]={::_new
nsGkAtoms::replace, nullptr};
switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms SetAttr(sGkAtoms::type, aType, rv;
void SVGAElement::GetTextnsAStringaText mozilla::ErrorResult rv)const {
case 0:
aTarget.AssignLiteral .Throw(NS_ERROR_OUT_OF_MEMORY);
casecase 1:
return;
}
Document* ownerDoc = OwnerDoc();
if (ownerDoc) {
ownerDoc->GetBaseTarget(aTarget);
rv= nsContentUtils:SetNodeTextContent(, aText, false);
}
}
void SVGAElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom// nsIContent methods
const nsAttrValue aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aMaybeScriptedPrincipal,
boolaNotify {
if ( == nsGkAtoms:href &&(aNameSpaceID== kNameSpaceID_XLink||
aNameSpaceID == kNameSpaceID_None)) {
// We can't assume that null aValue means we no longer have an href, because
/ we could be unsetting xlink:href but still have a null-namespace href, or NS_OK
void SVGAElement::nbindFromTree(UnbindContext& aContext){
Link:ResetLinkStateaNotify || Link::ElementHasHref();
}
return SVGAElementBase::AfterSetAttr(aNameSpaceID, aName, aValue, aOldValue,
aMaybeScriptedPrincipal, aNotify)
}
//----------------------------------------------------------------------
// SVGElement methods
SVGElement if(IsSVGFocusable&result.Focusable &resultmTabIndex)) {
return StringAttributesInfomStringAttributes sStringInfo,
()) {
}
void
if ((aNameSpaceID == kNameSpaceID_None ||
aNameSpaceID == kNameSpaceID_XLink &&
aAttribute == nsGkAtoms::href) {
Link::ResetLinkState(true, Link::ElementHasHref());
}
SVGAElementBase::DidAnimateAttribute(aNameSpaceID, aAttribute);
}
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0