зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace arg). Mostly done via sed, with a couple helpers to use the faster lookups where possible. Differential Revision: https://phabricator.services.mozilla.com/D181795
This commit is contained in:
Родитель
8c8c1bb7f3
Коммит
4cc6758558
|
@ -1593,7 +1593,7 @@ nsAtom* AttrIterator::AttrName() const { return mAttrAtom; }
|
|||
|
||||
void AttrIterator::AttrValue(nsAString& aAttrValue) const {
|
||||
nsAutoString value;
|
||||
if (mAttrs->GetAttr(kNameSpaceID_None, mAttrAtom, value)) {
|
||||
if (mAttrs->GetAttr(mAttrAtom, value)) {
|
||||
if (mAttrCharacteristics & ATTR_VALTOKEN) {
|
||||
nsAtom* normalizedValue =
|
||||
nsAccUtils::NormalizeARIAToken(mAttrs, mAttrAtom);
|
||||
|
@ -1632,7 +1632,7 @@ bool AttrIterator::ExposeAttr(AccAttributes* aTargetAttrs) const {
|
|||
return false; // Invalid value.
|
||||
}
|
||||
nsAutoString value;
|
||||
if (mAttrs->GetAttr(kNameSpaceID_None, mAttrAtom, value)) {
|
||||
if (mAttrs->GetAttr(mAttrAtom, value)) {
|
||||
aTargetAttrs->SetAttribute(mAttrAtom, std::move(value));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -74,8 +74,7 @@ RelatedAccIterator::RelatedAccIterator(DocAccessible* aDocument,
|
|||
: mDocument(aDocument), mRelAttr(aRelAttr), mProviders(nullptr), mIndex(0) {
|
||||
nsAutoString id;
|
||||
if (aDependentContent->IsElement() &&
|
||||
aDependentContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::id,
|
||||
id)) {
|
||||
aDependentContent->AsElement()->GetAttr(nsGkAtoms::id, id)) {
|
||||
mProviders = mDocument->GetRelProviders(aDependentContent->AsElement(), id);
|
||||
}
|
||||
}
|
||||
|
@ -140,8 +139,7 @@ LocalAccessible* HTMLLabelIterator::Next() {
|
|||
LocalAccessible* walkUp = mAcc->LocalParent();
|
||||
while (walkUp && !walkUp->IsDoc()) {
|
||||
nsIContent* walkUpEl = walkUp->GetContent();
|
||||
if (IsLabel(walkUp) &&
|
||||
!walkUpEl->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
|
||||
if (IsLabel(walkUp) && !walkUpEl->AsElement()->HasAttr(nsGkAtoms::_for)) {
|
||||
mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
|
||||
return walkUp;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ MARKUPMAP(
|
|||
return nullptr;
|
||||
}
|
||||
// Always create an accessible if the div has an id.
|
||||
if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
|
||||
if (aElement->HasAttr(nsGkAtoms::id)) {
|
||||
return new HyperTextAccessibleWrap(aElement, aContext->Document());
|
||||
}
|
||||
// Never create an accessible if the div is not display:block; or
|
||||
|
@ -365,7 +365,7 @@ MARKUPMAP(
|
|||
if (!aContext->IsHTMLTableRow()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::scope)) {
|
||||
if (aElement->HasAttr(nsGkAtoms::scope)) {
|
||||
return new HTMLTableHeaderCellAccessible(aElement,
|
||||
aContext->Document());
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ bool nsAccUtils::HasDefinedARIAToken(nsIContent* aContent, nsAtom* aAtom) {
|
|||
}
|
||||
|
||||
bool nsAccUtils::HasDefinedARIAToken(const AttrArray* aAttrs, nsAtom* aAtom) {
|
||||
return aAttrs->HasAttr(kNameSpaceID_None, aAtom) &&
|
||||
return aAttrs->HasAttr(aAtom) &&
|
||||
!aAttrs->AttrValueIs(kNameSpaceID_None, aAtom, nsGkAtoms::_empty,
|
||||
eCaseMatters) &&
|
||||
!aAttrs->AttrValueIs(kNameSpaceID_None, aAtom, nsGkAtoms::_undefined,
|
||||
|
@ -544,26 +544,26 @@ const AttrArray* nsAccUtils::GetARIADefaults(dom::Element* aElement) {
|
|||
}
|
||||
|
||||
bool nsAccUtils::HasARIAAttr(dom::Element* aElement, const nsAtom* aName) {
|
||||
if (aElement->HasAttr(kNameSpaceID_None, aName)) {
|
||||
if (aElement->HasAttr(aName)) {
|
||||
return true;
|
||||
}
|
||||
const auto* defaults = GetARIADefaults(aElement);
|
||||
if (!defaults) {
|
||||
return false;
|
||||
}
|
||||
return defaults->HasAttr(kNameSpaceID_None, aName);
|
||||
return defaults->HasAttr(aName);
|
||||
}
|
||||
|
||||
bool nsAccUtils::GetARIAAttr(dom::Element* aElement, const nsAtom* aName,
|
||||
nsAString& aResult) {
|
||||
if (aElement->GetAttr(kNameSpaceID_None, aName, aResult)) {
|
||||
if (aElement->GetAttr(aName, aResult)) {
|
||||
return true;
|
||||
}
|
||||
const auto* defaults = GetARIADefaults(aElement);
|
||||
if (!defaults) {
|
||||
return false;
|
||||
}
|
||||
return defaults->GetAttr(kNameSpaceID_None, aName, aResult);
|
||||
return defaults->GetAttr(aName, aResult);
|
||||
}
|
||||
|
||||
const nsAttrValue* nsAccUtils::GetARIAAttr(dom::Element* aElement,
|
||||
|
|
|
@ -368,7 +368,7 @@ PresShell* nsCoreUtils::GetPresShellFor(nsINode* aNode) {
|
|||
|
||||
bool nsCoreUtils::GetID(nsIContent* aContent, nsAString& aID) {
|
||||
return aContent->IsElement() &&
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aID);
|
||||
aContent->AsElement()->GetAttr(nsGkAtoms::id, aID);
|
||||
}
|
||||
|
||||
bool nsCoreUtils::GetUIntAttr(nsIContent* aContent, nsAtom* aAttr,
|
||||
|
@ -405,8 +405,7 @@ void nsCoreUtils::GetLanguageFor(nsIContent* aContent, nsIContent* aRootContent,
|
|||
nsIContent* walkUp = aContent;
|
||||
while (walkUp && walkUp != aRootContent &&
|
||||
(!walkUp->IsElement() ||
|
||||
!walkUp->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::lang,
|
||||
aLanguage))) {
|
||||
!walkUp->AsElement()->GetAttr(nsGkAtoms::lang, aLanguage))) {
|
||||
walkUp = walkUp->GetParent();
|
||||
}
|
||||
}
|
||||
|
@ -533,7 +532,7 @@ void nsCoreUtils::ScrollTo(PresShell* aPresShell, nsIContent* aContent,
|
|||
bool nsCoreUtils::IsHTMLTableHeader(nsIContent* aContent) {
|
||||
return aContent->NodeInfo()->Equals(nsGkAtoms::th) ||
|
||||
(aContent->IsElement() &&
|
||||
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::scope));
|
||||
aContent->AsElement()->HasAttr(nsGkAtoms::scope));
|
||||
}
|
||||
|
||||
bool nsCoreUtils::IsWhitespaceString(const nsAString& aString) {
|
||||
|
|
|
@ -275,16 +275,13 @@ nsresult nsTextEquivUtils::AppendFromDOMNode(nsIContent* aContent,
|
|||
if (aContent->IsXULElement()) {
|
||||
nsAutoString textEquivalent;
|
||||
if (aContent->NodeInfo()->Equals(nsGkAtoms::label, kNameSpaceID_XUL)) {
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
textEquivalent);
|
||||
aContent->AsElement()->GetAttr(nsGkAtoms::value, textEquivalent);
|
||||
} else {
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label,
|
||||
textEquivalent);
|
||||
aContent->AsElement()->GetAttr(nsGkAtoms::label, textEquivalent);
|
||||
}
|
||||
|
||||
if (textEquivalent.IsEmpty()) {
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext,
|
||||
textEquivalent);
|
||||
aContent->AsElement()->GetAttr(nsGkAtoms::tooltiptext, textEquivalent);
|
||||
}
|
||||
|
||||
AppendString(aString, textEquivalent);
|
||||
|
|
|
@ -1019,7 +1019,7 @@ void HyperTextAccessible::PasteText(int32_t aPosition) {
|
|||
ENameValueFlag HyperTextAccessible::NativeName(nsString& aName) const {
|
||||
// Check @alt attribute for invalid img elements.
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::img)) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::alt, aName);
|
||||
if (!aName.IsEmpty()) return eNameOK;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ uint64_t ImageAccessible::NativeState() const {
|
|||
}
|
||||
|
||||
ENameValueFlag ImageAccessible::NativeName(nsString& aName) const {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::alt, aName);
|
||||
if (!aName.IsEmpty()) return eNameOK;
|
||||
|
||||
ENameValueFlag nameFlag = LocalAccessible::NativeName(aName);
|
||||
|
@ -171,7 +171,7 @@ already_AddRefed<AccAttributes> ImageAccessible::NativeAttributes() {
|
|||
RefPtr<AccAttributes> attributes = LinkableAccessible::NativeAttributes();
|
||||
|
||||
nsString src;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::src, src);
|
||||
if (!src.IsEmpty()) attributes->SetAttribute(nsGkAtoms::src, std::move(src));
|
||||
|
||||
return attributes.forget();
|
||||
|
@ -181,11 +181,10 @@ already_AddRefed<AccAttributes> ImageAccessible::NativeAttributes() {
|
|||
// Private methods
|
||||
|
||||
already_AddRefed<nsIURI> ImageAccessible::GetLongDescURI() const {
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::longdesc)) {
|
||||
// To check if longdesc contains an invalid url.
|
||||
nsAutoString longdesc;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::longdesc,
|
||||
longdesc);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::longdesc, longdesc);
|
||||
if (longdesc.FindChar(' ') != -1 || longdesc.FindChar('\t') != -1 ||
|
||||
longdesc.FindChar('\r') != -1 || longdesc.FindChar('\n') != -1) {
|
||||
return nullptr;
|
||||
|
@ -203,7 +202,7 @@ already_AddRefed<nsIURI> ImageAccessible::GetLongDescURI() const {
|
|||
while (nsIContent* target = iter.NextElem()) {
|
||||
if ((target->IsHTMLElement(nsGkAtoms::a) ||
|
||||
target->IsHTMLElement(nsGkAtoms::area)) &&
|
||||
target->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
target->AsElement()->HasAttr(nsGkAtoms::href)) {
|
||||
nsGenericHTMLElement* element = nsGenericHTMLElement::FromNode(target);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
|
|
@ -154,14 +154,12 @@ ENameValueFlag LocalAccessible::Name(nsString& aName) const {
|
|||
|
||||
// In the end get the name from tooltip.
|
||||
if (mContent->IsHTMLElement()) {
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::title,
|
||||
aName)) {
|
||||
if (mContent->AsElement()->GetAttr(nsGkAtoms::title, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return eNameFromTooltip;
|
||||
}
|
||||
} else if (mContent->IsXULElement()) {
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::tooltiptext, aName)) {
|
||||
if (mContent->AsElement()->GetAttr(nsGkAtoms::tooltiptext, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return eNameFromTooltip;
|
||||
}
|
||||
|
@ -199,11 +197,9 @@ void LocalAccessible::Description(nsString& aDescription) const {
|
|||
if (aDescription.IsEmpty()) {
|
||||
// Keep the Name() method logic.
|
||||
if (mContent->IsHTMLElement()) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::title,
|
||||
aDescription);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::title, aDescription);
|
||||
} else if (mContent->IsXULElement()) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::tooltiptext, aDescription);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::tooltiptext, aDescription);
|
||||
} else if (mContent->IsSVGElement()) {
|
||||
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
||||
childElm = childElm->GetNextSibling()) {
|
||||
|
@ -414,7 +410,7 @@ uint64_t LocalAccessible::NativeState() const {
|
|||
|
||||
// Check if a XUL element has the popup attribute (an attached popup menu).
|
||||
if (HasOwnContent() && mContent->IsXULElement() &&
|
||||
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup)) {
|
||||
mContent->AsElement()->HasAttr(nsGkAtoms::popup)) {
|
||||
state |= states::HASPOPUP;
|
||||
}
|
||||
|
||||
|
@ -822,7 +818,7 @@ void LocalAccessible::NameFromAssociatedXULLabel(DocAccessible* aDocument,
|
|||
XULLabelIterator iter(aDocument, aElm);
|
||||
while ((label = iter.Next())) {
|
||||
// Check if label's value attribute is used
|
||||
label->Elm()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
|
||||
label->Elm()->GetAttr(nsGkAtoms::value, aName);
|
||||
if (aName.IsEmpty()) {
|
||||
// If no value attribute, a non-empty label must contain
|
||||
// children that define its text -- possibly using HTML
|
||||
|
@ -854,7 +850,7 @@ void LocalAccessible::XULElmName(DocAccessible* aDocument, nsIContent* aElm,
|
|||
nsCOMPtr<nsIDOMXULSelectControlElement> select =
|
||||
aElm->AsElement()->AsXULSelectControl();
|
||||
if (!select) {
|
||||
aElm->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
aElm->AsElement()->GetAttr(nsGkAtoms::label, aName);
|
||||
}
|
||||
|
||||
// CASE #2 -- label as <label control="id" ... ></label>
|
||||
|
@ -1127,8 +1123,7 @@ already_AddRefed<AccAttributes> LocalAccessible::NativeAttributes() {
|
|||
|
||||
// Expose class because it may have useful microformat information.
|
||||
nsString _class;
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
_class)) {
|
||||
if (mContent->AsElement()->GetAttr(nsGkAtoms::_class, _class)) {
|
||||
attributes->SetAttribute(nsGkAtoms::_class, std::move(_class));
|
||||
}
|
||||
|
||||
|
@ -3017,7 +3012,7 @@ uint32_t LocalAccessible::GetActionRule() const {
|
|||
|
||||
// Return "click" action on elements that have an attached popup menu.
|
||||
if (mContent->IsXULElement()) {
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::popup)) {
|
||||
return eClickAction;
|
||||
}
|
||||
}
|
||||
|
@ -3167,7 +3162,7 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
|
|||
// inaccessible images.
|
||||
MOZ_ASSERT(mContent, "Image must have mContent");
|
||||
nsString src;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::src, src);
|
||||
if (!src.IsEmpty()) {
|
||||
fields->SetAttribute(nsGkAtoms::src, std::move(src));
|
||||
} else if (aUpdateType == CacheUpdateType::Update) {
|
||||
|
@ -3645,8 +3640,7 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
|
|||
} else if (aUpdateType == CacheUpdateType::Update) {
|
||||
fields->SetAttribute(nsGkAtoms::colspan, DeleteEntry());
|
||||
}
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::headers)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::headers)) {
|
||||
nsTArray<uint64_t> headers;
|
||||
IDRefsIterator iter(mDoc, mContent, nsGkAtoms::headers);
|
||||
while (LocalAccessible* cell = iter.Next()) {
|
||||
|
@ -3689,7 +3683,7 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
|
|||
// requested. Computing LINKS_TO also requires we cache `name` on
|
||||
// anchor elements.
|
||||
nsString name;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::name, name);
|
||||
if (!name.IsEmpty()) {
|
||||
fields->SetAttribute(nsGkAtoms::attributeName, std::move(name));
|
||||
} else if (aUpdateType != CacheUpdateType::Initial) {
|
||||
|
|
|
@ -114,9 +114,9 @@ Relation HTMLRadioButtonAccessible::ComputeGroupAttributes(
|
|||
mContent->NodeInfo()->GetName(tagName);
|
||||
|
||||
nsAutoString type;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::type, type);
|
||||
nsAutoString name;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::name, name);
|
||||
|
||||
RefPtr<nsContentList> inputElms;
|
||||
|
||||
|
@ -221,9 +221,8 @@ ENameValueFlag HTMLButtonAccessible::NativeName(nsString& aName) const {
|
|||
return nameFlag;
|
||||
}
|
||||
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt,
|
||||
aName)) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
|
||||
if (!mContent->AsElement()->GetAttr(nsGkAtoms::alt, aName)) {
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::value, aName);
|
||||
}
|
||||
|
||||
aName.CompressWhitespace();
|
||||
|
@ -243,7 +242,7 @@ void HTMLButtonAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
|||
if (elm->IsHTMLElement(nsGkAtoms::input) ||
|
||||
(elm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::image,
|
||||
eCaseMatters) &&
|
||||
!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::alt))) {
|
||||
!elm->HasAttr(nsGkAtoms::alt))) {
|
||||
if (!nsAccUtils::HasARIAAttr(elm, nsGkAtoms::aria_labelledby) &&
|
||||
!nsAccUtils::HasARIAAttr(elm, nsGkAtoms::aria_label)) {
|
||||
mDoc->FireDelayedEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
|
||||
|
@ -274,7 +273,7 @@ role HTMLTextFieldAccessible::NativeRole() const {
|
|||
if (mType == eHTMLTextPasswordFieldType) {
|
||||
return roles::PASSWORD_TEXT;
|
||||
}
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::list_)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::list_)) {
|
||||
return roles::EDITCOMBOBOX;
|
||||
}
|
||||
return roles::ENTRY;
|
||||
|
@ -299,8 +298,7 @@ already_AddRefed<AccAttributes> HTMLTextFieldAccessible::NativeAttributes() {
|
|||
// If this element has the placeholder attribute set,
|
||||
// and if that is not identical to the name, expose it as an object attribute.
|
||||
nsString placeholderText;
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder,
|
||||
placeholderText)) {
|
||||
if (mContent->AsElement()->GetAttr(nsGkAtoms::placeholder, placeholderText)) {
|
||||
nsAutoString name;
|
||||
const_cast<HTMLTextFieldAccessible*>(this)->Name(name);
|
||||
if (!name.Equals(placeholderText)) {
|
||||
|
@ -319,8 +317,7 @@ ENameValueFlag HTMLTextFieldAccessible::NativeName(nsString& aName) const {
|
|||
if (!aName.IsEmpty()) return eNameOK;
|
||||
|
||||
// text inputs and textareas might have useful placeholder text
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder,
|
||||
aName);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::placeholder, aName);
|
||||
return eNameOK;
|
||||
}
|
||||
|
||||
|
@ -371,7 +368,7 @@ uint64_t HTMLTextFieldAccessible::NativeState() const {
|
|||
state |= states::PROTECTED;
|
||||
}
|
||||
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::readonly)) {
|
||||
state |= states::READONLY;
|
||||
}
|
||||
|
||||
|
@ -386,7 +383,7 @@ uint64_t HTMLTextFieldAccessible::NativeState() const {
|
|||
}
|
||||
|
||||
// Expose autocomplete state if it has associated autocomplete list.
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::list_)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::list_)) {
|
||||
return state | states::SUPPORTS_AUTOCOMPLETION | states::HASPOPUP;
|
||||
}
|
||||
|
||||
|
@ -397,14 +394,12 @@ uint64_t HTMLTextFieldAccessible::NativeState() const {
|
|||
// we're talking here is based on what the user types, where a popup of
|
||||
// possible choices comes up.
|
||||
nsAutoString autocomplete;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete,
|
||||
autocomplete);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::autocomplete, autocomplete);
|
||||
|
||||
if (!autocomplete.LowerCaseEqualsLiteral("off")) {
|
||||
Element* formElement = input->GetForm();
|
||||
if (formElement) {
|
||||
formElement->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete,
|
||||
autocomplete);
|
||||
formElement->GetAttr(nsGkAtoms::autocomplete, autocomplete);
|
||||
}
|
||||
|
||||
if (!formElement || !autocomplete.LowerCaseEqualsLiteral("off")) {
|
||||
|
@ -753,8 +748,7 @@ uint64_t HTMLProgressAccessible::NativeState() const {
|
|||
|
||||
// An undetermined progressbar (i.e. without a value) has a mixed state.
|
||||
nsAutoString attrValue;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
attrValue);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::value, attrValue);
|
||||
if (attrValue.IsEmpty()) {
|
||||
state |= states::MIXED;
|
||||
}
|
||||
|
@ -795,8 +789,7 @@ double HTMLProgressAccessible::MaxValue() const {
|
|||
}
|
||||
|
||||
nsAutoString strValue;
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::max,
|
||||
strValue)) {
|
||||
if (mContent->AsElement()->GetAttr(nsGkAtoms::max, strValue)) {
|
||||
nsresult result = NS_OK;
|
||||
value = strValue.ToDouble(&result);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
|
@ -824,8 +817,7 @@ double HTMLProgressAccessible::CurValue() const {
|
|||
}
|
||||
|
||||
nsAutoString attrValue;
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
attrValue)) {
|
||||
if (!mContent->AsElement()->GetAttr(nsGkAtoms::value, attrValue)) {
|
||||
return UnspecifiedNaN<double>();
|
||||
}
|
||||
|
||||
|
@ -900,8 +892,7 @@ double HTMLMeterAccessible::MaxValue() const {
|
|||
|
||||
// If we didn't find a max value, check for the max attribute
|
||||
nsAutoString strValue;
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::max,
|
||||
strValue)) {
|
||||
if (mContent->AsElement()->GetAttr(nsGkAtoms::max, strValue)) {
|
||||
nsresult result = NS_OK;
|
||||
max = strValue.ToDouble(&result);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
|
@ -919,8 +910,7 @@ double HTMLMeterAccessible::MinValue() const {
|
|||
}
|
||||
|
||||
nsAutoString strValue;
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::min,
|
||||
strValue)) {
|
||||
if (mContent->AsElement()->GetAttr(nsGkAtoms::min, strValue)) {
|
||||
nsresult result = NS_OK;
|
||||
min = strValue.ToDouble(&result);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
|
@ -939,8 +929,7 @@ double HTMLMeterAccessible::CurValue() const {
|
|||
/* If we didn't find a value from the LeafAccessible call above, check
|
||||
* for a value attribute */
|
||||
nsAutoString attrValue;
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
attrValue)) {
|
||||
if (!mContent->AsElement()->GetAttr(nsGkAtoms::value, attrValue)) {
|
||||
return minValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,8 +112,7 @@ ENameValueFlag HTMLAreaAccessible::NativeName(nsString& aName) const {
|
|||
ENameValueFlag nameFlag = LocalAccessible::NativeName(aName);
|
||||
if (!aName.IsEmpty()) return nameFlag;
|
||||
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt,
|
||||
aName)) {
|
||||
if (!mContent->AsElement()->GetAttr(nsGkAtoms::alt, aName)) {
|
||||
Value(aName);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ uint64_t HTMLLinkAccessible::NativeInteractiveState() const {
|
|||
// This is how we indicate it is a named anchor. In other words, this anchor
|
||||
// can be selected as a location :) There is no other better state to use to
|
||||
// indicate this.
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::name)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::name)) {
|
||||
state |= states::SELECTABLE;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ HTMLSelectListAccessible::HTMLSelectListAccessible(nsIContent* aContent,
|
|||
|
||||
uint64_t HTMLSelectListAccessible::NativeState() const {
|
||||
uint64_t state = AccessibleWrap::NativeState();
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::multiple)) {
|
||||
state |= states::MULTISELECTABLE | states::EXTSELECTABLE;
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,13 @@ role HTMLSelectListAccessible::NativeRole() const { return roles::LISTBOX; }
|
|||
// HTMLSelectListAccessible: SelectAccessible
|
||||
|
||||
bool HTMLSelectListAccessible::SelectAll() {
|
||||
return mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)
|
||||
return mContent->AsElement()->HasAttr(nsGkAtoms::multiple)
|
||||
? AccessibleWrap::SelectAll()
|
||||
: false;
|
||||
}
|
||||
|
||||
bool HTMLSelectListAccessible::UnselectAll() {
|
||||
return mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)
|
||||
return mContent->AsElement()->HasAttr(nsGkAtoms::multiple)
|
||||
? AccessibleWrap::UnselectAll()
|
||||
: false;
|
||||
}
|
||||
|
|
|
@ -126,8 +126,7 @@ already_AddRefed<AccAttributes> HTMLTableCellAccessible::NativeAttributes() {
|
|||
}
|
||||
}
|
||||
if (abbrText.IsEmpty()) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::abbr,
|
||||
abbrText);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::abbr, abbrText);
|
||||
}
|
||||
|
||||
if (!abbrText.IsEmpty()) {
|
||||
|
@ -136,7 +135,7 @@ already_AddRefed<AccAttributes> HTMLTableCellAccessible::NativeAttributes() {
|
|||
|
||||
// axis attribute
|
||||
nsString axisText;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::axis, axisText);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::axis, axisText);
|
||||
if (!axisText.IsEmpty()) {
|
||||
attributes->SetAttribute(nsGkAtoms::axis, std::move(axisText));
|
||||
}
|
||||
|
@ -372,7 +371,7 @@ ENameValueFlag HTMLTableAccessible::NativeName(nsString& aName) const {
|
|||
}
|
||||
|
||||
// If no caption then use summary as a name.
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, aName);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::summary, aName);
|
||||
return eNameOK;
|
||||
}
|
||||
|
||||
|
@ -565,12 +564,9 @@ bool HTMLTableAccessible::IsProbablyLayoutTable() {
|
|||
"Has th -- legitimate table structures");
|
||||
}
|
||||
|
||||
if (cellElm->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::headers) ||
|
||||
cellElm->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::scope) ||
|
||||
cellElm->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::abbr)) {
|
||||
if (cellElm->AsElement()->HasAttr(nsGkAtoms::headers) ||
|
||||
cellElm->AsElement()->HasAttr(nsGkAtoms::scope) ||
|
||||
cellElm->AsElement()->HasAttr(nsGkAtoms::abbr)) {
|
||||
RETURN_LAYOUT_ANSWER(false,
|
||||
"Has headers, scope, or abbr attribute -- "
|
||||
"legitimate table structures");
|
||||
|
@ -729,8 +725,7 @@ void HTMLTableAccessible::Description(nsString& aDescription) const {
|
|||
&captionText);
|
||||
|
||||
if (!captionText.IsEmpty()) { // summary isn't used as a name.
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::summary,
|
||||
aDescription);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::summary, aDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ MsaaXULMenuitemAccessible::get_accName(
|
|||
|
||||
nsAutoString accel;
|
||||
if (dom::Element* el = acc->Elm()) {
|
||||
el->GetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, accel);
|
||||
el->GetAttr(nsGkAtoms::acceltext, accel);
|
||||
}
|
||||
if (!accel.IsEmpty()) {
|
||||
name += u"\t"_ns + accel;
|
||||
|
|
|
@ -142,11 +142,11 @@ XULLinkAccessible::~XULLinkAccessible() {}
|
|||
void XULLinkAccessible::Value(nsString& aValue) const {
|
||||
aValue.Truncate();
|
||||
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, aValue);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::href, aValue);
|
||||
}
|
||||
|
||||
ENameValueFlag XULLinkAccessible::NativeName(nsString& aName) const {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::value, aName);
|
||||
if (!aName.IsEmpty()) return eNameOK;
|
||||
|
||||
nsTextEquivUtils::GetNameFromSubtree(this, aName);
|
||||
|
@ -193,7 +193,7 @@ already_AddRefed<nsIURI> XULLinkAccessible::AnchorURIAt(
|
|||
if (aAnchorIndex != 0) return nullptr;
|
||||
|
||||
nsAutoString href;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::href, href);
|
||||
|
||||
dom::Document* document = mContent->OwnerDoc();
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ uint64_t XULButtonAccessible::NativeState() const {
|
|||
|
||||
if (ContainsMenu()) state |= states::HASPOPUP;
|
||||
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_default)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::_default)) {
|
||||
state |= states::DEFAULT;
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ bool XULToolbarButtonAccessible::IsAcceptableChild(nsIContent* aEl) const {
|
|||
return aEl->IsXULElement(nsGkAtoms::menupopup) ||
|
||||
aEl->IsXULElement(nsGkAtoms::popup) ||
|
||||
(aEl->IsXULElement(nsGkAtoms::label) &&
|
||||
!mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::label));
|
||||
!mContent->AsElement()->HasAttr(nsGkAtoms::label));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -427,8 +427,7 @@ XULToolbarAccessible::XULToolbarAccessible(nsIContent* aContent,
|
|||
role XULToolbarAccessible::NativeRole() const { return roles::TOOLBAR; }
|
||||
|
||||
ENameValueFlag XULToolbarAccessible::NativeName(nsString& aName) const {
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::toolbarname,
|
||||
aName)) {
|
||||
if (mContent->AsElement()->GetAttr(nsGkAtoms::toolbarname, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ uint64_t XULMenuitemAccessible::NativeState() const {
|
|||
// Has Popup?
|
||||
if (mContent->NodeInfo()->Equals(nsGkAtoms::menu, kNameSpaceID_XUL)) {
|
||||
state |= states::HASPOPUP;
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::open)) {
|
||||
if (mContent->AsElement()->HasAttr(nsGkAtoms::open)) {
|
||||
state |= states::EXPANDED;
|
||||
} else {
|
||||
state |= states::COLLAPSED;
|
||||
|
@ -128,13 +128,12 @@ uint64_t XULMenuitemAccessible::NativeInteractiveState() const {
|
|||
}
|
||||
|
||||
ENameValueFlag XULMenuitemAccessible::NativeName(nsString& aName) const {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::label, aName);
|
||||
return eNameOK;
|
||||
}
|
||||
|
||||
void XULMenuitemAccessible::Description(nsString& aDescription) const {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::description,
|
||||
aDescription);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::description, aDescription);
|
||||
}
|
||||
|
||||
KeyBinding XULMenuitemAccessible::AccessKey() const {
|
||||
|
@ -145,8 +144,7 @@ KeyBinding XULMenuitemAccessible::AccessKey() const {
|
|||
// We do not use nsCoreUtils::GetAccesskeyFor() because accesskeys for
|
||||
// menu are't registered by EventStateManager.
|
||||
nsAutoString accesskey;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey,
|
||||
accesskey);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::accesskey, accesskey);
|
||||
if (accesskey.IsEmpty()) return KeyBinding();
|
||||
|
||||
uint32_t modifierKey = 0;
|
||||
|
@ -183,7 +181,7 @@ KeyBinding XULMenuitemAccessible::AccessKey() const {
|
|||
|
||||
KeyBinding XULMenuitemAccessible::KeyboardShortcut() const {
|
||||
nsAutoString keyElmId;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyElmId);
|
||||
mContent->AsElement()->GetAttr(nsGkAtoms::key, keyElmId);
|
||||
if (keyElmId.IsEmpty()) return KeyBinding();
|
||||
|
||||
dom::Element* keyElm = mContent->OwnerDoc()->GetElementById(keyElmId);
|
||||
|
@ -192,10 +190,10 @@ KeyBinding XULMenuitemAccessible::KeyboardShortcut() const {
|
|||
uint32_t key = 0;
|
||||
|
||||
nsAutoString keyStr;
|
||||
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyStr);
|
||||
keyElm->GetAttr(nsGkAtoms::key, keyStr);
|
||||
if (keyStr.IsEmpty()) {
|
||||
nsAutoString keyCodeStr;
|
||||
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, keyCodeStr);
|
||||
keyElm->GetAttr(nsGkAtoms::keycode, keyCodeStr);
|
||||
nsresult errorCode;
|
||||
key = keyStr.ToInteger(&errorCode, /* aRadix = */ 10);
|
||||
if (NS_FAILED(errorCode)) {
|
||||
|
@ -206,7 +204,7 @@ KeyBinding XULMenuitemAccessible::KeyboardShortcut() const {
|
|||
}
|
||||
|
||||
nsAutoString modifiersStr;
|
||||
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::modifiers, modifiersStr);
|
||||
keyElm->GetAttr(nsGkAtoms::modifiers, modifiersStr);
|
||||
|
||||
uint32_t modifierMask = 0;
|
||||
if (modifiersStr.Find(u"shift") != -1) modifierMask |= KeyBinding::kShift;
|
||||
|
@ -344,15 +342,13 @@ uint64_t XULMenupopupAccessible::NativeState() const {
|
|||
|
||||
#ifdef DEBUG
|
||||
// We are onscreen if our parent is active
|
||||
bool isActive =
|
||||
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::menuactive);
|
||||
bool isActive = mContent->AsElement()->HasAttr(nsGkAtoms::menuactive);
|
||||
if (!isActive) {
|
||||
LocalAccessible* parent = LocalParent();
|
||||
if (parent) {
|
||||
nsIContent* parentContent = parent->GetContent();
|
||||
if (parentContent && parentContent->IsElement())
|
||||
isActive = parentContent->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::open);
|
||||
isActive = parentContent->AsElement()->HasAttr(nsGkAtoms::open);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,7 +365,7 @@ ENameValueFlag XULMenupopupAccessible::NativeName(nsString& aName) const {
|
|||
nsIContent* content = mContent;
|
||||
while (content && aName.IsEmpty()) {
|
||||
if (content->IsElement()) {
|
||||
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
content->AsElement()->GetAttr(nsGkAtoms::label, aName);
|
||||
}
|
||||
content = content->GetFlattenedTreeParent();
|
||||
}
|
||||
|
|
|
@ -13042,8 +13042,7 @@ nsresult nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
|||
if (elementCanHaveNoopener) {
|
||||
MOZ_ASSERT(aContent->IsHTMLElement() || aContent->IsSVGElement());
|
||||
nsAutoString relString;
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::rel,
|
||||
relString);
|
||||
aContent->AsElement()->GetAttr(nsGkAtoms::rel, relString);
|
||||
nsWhitespaceTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tok(
|
||||
relString);
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ static void ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback,
|
|||
}
|
||||
|
||||
nsAutoString value;
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::ping, value);
|
||||
aContent->AsElement()->GetAttr(nsGkAtoms::ping, value);
|
||||
if (value.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -45,23 +45,29 @@ void AttrArray::SetMappedDeclarationBlock(
|
|||
MOZ_ASSERT(!IsPendingMappedAttributeEvaluation());
|
||||
}
|
||||
|
||||
const nsAttrValue* AttrArray::GetAttr(const nsAtom* aLocalName,
|
||||
int32_t aNamespaceID) const {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
// This should be the common case so lets make an optimized loop
|
||||
for (const InternalAttr& attr : Attrs()) {
|
||||
if (attr.mName.Equals(aLocalName)) {
|
||||
return &attr.mValue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const InternalAttr& attr : Attrs()) {
|
||||
if (attr.mName.Equals(aLocalName, aNamespaceID)) {
|
||||
return &attr.mValue;
|
||||
}
|
||||
const nsAttrValue* AttrArray::GetAttr(const nsAtom* aLocalName) const {
|
||||
NS_ASSERTION(aLocalName, "Must have attr name");
|
||||
for (const InternalAttr& attr : Attrs()) {
|
||||
if (attr.mName.Equals(aLocalName)) {
|
||||
return &attr.mValue;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const nsAttrValue* AttrArray::GetAttr(const nsAtom* aLocalName,
|
||||
int32_t aNamespaceID) const {
|
||||
NS_ASSERTION(aLocalName, "Must have attr name");
|
||||
NS_ASSERTION(aNamespaceID != kNameSpaceID_Unknown, "Must have namespace");
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
// This should be the common case so lets use the optimized loop
|
||||
return GetAttr(aLocalName);
|
||||
}
|
||||
for (const InternalAttr& attr : Attrs()) {
|
||||
if (attr.mName.Equals(aLocalName, aNamespaceID)) {
|
||||
return &attr.mValue;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -194,35 +200,30 @@ const nsAttrName* AttrArray::GetExistingAttrNameFromQName(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t AttrArray::IndexOfAttr(const nsAtom* aLocalName) const {
|
||||
int32_t i = 0;
|
||||
for (const InternalAttr& attr : Attrs()) {
|
||||
if (attr.mName.Equals(aLocalName)) {
|
||||
return i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t AttrArray::IndexOfAttr(const nsAtom* aLocalName,
|
||||
int32_t aNamespaceID) const {
|
||||
if (!mImpl) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t i = 0;
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
// This should be the common case so lets make an optimized loop
|
||||
// Note that here we don't check for AttrSlotIsTaken() in the loop
|
||||
// condition for the sake of performance because comparing aLocalName
|
||||
// against null would fail in the loop body (since Equals() just compares
|
||||
// the raw pointer value of aLocalName to what AttrSlotIsTaken() would be
|
||||
// checking.
|
||||
for (const InternalAttr& attr : Attrs()) {
|
||||
if (attr.mName.Equals(aLocalName)) {
|
||||
return i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
for (const InternalAttr& attr : Attrs()) {
|
||||
if (attr.mName.Equals(aLocalName, aNamespaceID)) {
|
||||
return i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
// This should be the common case so lets use the optimized loop
|
||||
return IndexOfAttr(aLocalName);
|
||||
}
|
||||
int32_t i = 0;
|
||||
for (const InternalAttr& attr : Attrs()) {
|
||||
if (attr.mName.Equals(aLocalName, aNamespaceID)) {
|
||||
return i;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,10 @@ class AttrArray {
|
|||
|
||||
uint32_t AttrCount() const { return mImpl ? mImpl->mAttrCount : 0; }
|
||||
|
||||
const nsAttrValue* GetAttr(const nsAtom* aLocalName) const;
|
||||
|
||||
const nsAttrValue* GetAttr(const nsAtom* aLocalName,
|
||||
int32_t aNamespaceID = kNameSpaceID_None) const;
|
||||
int32_t aNamespaceID) const;
|
||||
// As above but using a string attr name and always using
|
||||
// kNameSpaceID_None. This is always case-sensitive.
|
||||
const nsAttrValue* GetAttr(const nsAString& aName) const;
|
||||
|
@ -85,8 +87,8 @@ class AttrArray {
|
|||
const nsAttrName* GetSafeAttrNameAt(uint32_t aPos) const;
|
||||
|
||||
const nsAttrName* GetExistingAttrNameFromQName(const nsAString& aName) const;
|
||||
int32_t IndexOfAttr(const nsAtom* aLocalName,
|
||||
int32_t aNamespaceID = kNameSpaceID_None) const;
|
||||
int32_t IndexOfAttr(const nsAtom* aLocalName) const;
|
||||
int32_t IndexOfAttr(const nsAtom* aLocalName, int32_t aNamespaceID) const;
|
||||
|
||||
void Compact();
|
||||
|
||||
|
@ -127,17 +129,28 @@ class AttrArray {
|
|||
inline bool GetAttr(int32_t aNameSpaceID, const nsAtom* aName,
|
||||
nsAString& aResult) const {
|
||||
MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
|
||||
|
||||
const nsAttrValue* val = GetAttr(aName, aNameSpaceID);
|
||||
if (val) {
|
||||
val->ToString(aResult);
|
||||
return true;
|
||||
if (!val) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
val->ToString(aResult);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool GetAttr(const nsAtom* aName, nsAString& aResult) const {
|
||||
MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
|
||||
const nsAttrValue* val = GetAttr(aName);
|
||||
if (!val) {
|
||||
return false;
|
||||
}
|
||||
val->ToString(aResult);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool HasAttr(const nsAtom* aName) const { return !!GetAttr(aName); }
|
||||
|
||||
inline bool HasAttr(int32_t aNameSpaceID, const nsAtom* aName) const {
|
||||
return GetAttr(aName, aNameSpaceID) != nullptr;
|
||||
return !!GetAttr(aName, aNameSpaceID);
|
||||
}
|
||||
|
||||
inline bool AttrValueIs(int32_t aNameSpaceID, const nsAtom* aName,
|
||||
|
@ -145,7 +158,6 @@ class AttrArray {
|
|||
nsCaseTreatment aCaseSensitive) const {
|
||||
NS_ASSERTION(aName, "Must have attr name");
|
||||
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
|
||||
|
||||
const nsAttrValue* val = GetAttr(aName, aNameSpaceID);
|
||||
return val && val->Equals(aValue, aCaseSensitive);
|
||||
}
|
||||
|
|
|
@ -4361,7 +4361,7 @@ void Document::LocalizationLinkAdded(Element* aLinkElement) {
|
|||
}
|
||||
|
||||
nsAutoString href;
|
||||
aLinkElement->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
aLinkElement->GetAttr(nsGkAtoms::href, href);
|
||||
|
||||
if (!mDocumentL10n) {
|
||||
Element* elem = GetDocumentElement();
|
||||
|
@ -4398,7 +4398,7 @@ void Document::LocalizationLinkRemoved(Element* aLinkElement) {
|
|||
|
||||
if (mDocumentL10n) {
|
||||
nsAutoString href;
|
||||
aLinkElement->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
aLinkElement->GetAttr(nsGkAtoms::href, href);
|
||||
uint32_t remaining =
|
||||
mDocumentL10n->RemoveResourceId(NS_ConvertUTF16toUTF8(href));
|
||||
if (remaining == 0) {
|
||||
|
@ -9512,7 +9512,7 @@ nsIHTMLCollection* Document::Embeds() {
|
|||
static bool MatchLinks(Element* aElement, int32_t aNamespaceID, nsAtom* aAtom,
|
||||
void* aData) {
|
||||
return aElement->IsAnyOfHTMLElements(nsGkAtoms::a, nsGkAtoms::area) &&
|
||||
aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::href);
|
||||
aElement->HasAttr(nsGkAtoms::href);
|
||||
}
|
||||
|
||||
nsIHTMLCollection* Document::Links() {
|
||||
|
@ -9550,7 +9550,7 @@ nsIHTMLCollection* Document::Applets() {
|
|||
static bool MatchAnchors(Element* aElement, int32_t aNamespaceID, nsAtom* aAtom,
|
||||
void* aData) {
|
||||
return aElement->IsHTMLElement(nsGkAtoms::a) &&
|
||||
aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::name);
|
||||
aElement->HasAttr(nsGkAtoms::name);
|
||||
}
|
||||
|
||||
nsIHTMLCollection* Document::Anchors() {
|
||||
|
@ -11094,7 +11094,7 @@ void Document::ProcessMETATag(HTMLMetaElement* aMetaElement) {
|
|||
if (aMetaElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nsGkAtoms::handheldFriendly, eIgnoreCase)) {
|
||||
nsAutoString result;
|
||||
aMetaElement->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
|
||||
aMetaElement->GetAttr(nsGkAtoms::content, result);
|
||||
if (!result.IsEmpty()) {
|
||||
nsContentUtils::ASCIIToLower(result);
|
||||
SetHeaderData(nsGkAtoms::handheldFriendly, result);
|
||||
|
@ -11180,7 +11180,7 @@ void Document::Sanitize() {
|
|||
HTMLFormElement::FromNodeOrNull(nodes->Item(i));
|
||||
if (!form) continue;
|
||||
|
||||
form->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete, value);
|
||||
form->GetAttr(nsGkAtoms::autocomplete, value);
|
||||
if (value.LowerCaseEqualsLiteral("off")) form->Reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1160,9 +1160,7 @@ void Element::SetSlot(const nsAString& aName, ErrorResult& aError) {
|
|||
aError = SetAttr(kNameSpaceID_None, nsGkAtoms::slot, aName, true);
|
||||
}
|
||||
|
||||
void Element::GetSlot(nsAString& aName) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::slot, aName);
|
||||
}
|
||||
void Element::GetSlot(nsAString& aName) { GetAttr(nsGkAtoms::slot, aName); }
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-shadowroot
|
||||
ShadowRoot* Element::GetShadowRootByMode() const {
|
||||
|
@ -2840,6 +2838,13 @@ EventListenerManager* Element::GetEventListenerManagerForAttr(nsAtom* aAttrName,
|
|||
return GetOrCreateListenerManager();
|
||||
}
|
||||
|
||||
bool Element::GetAttr(const nsAtom* aName, nsAString& aResult) const {
|
||||
DOMString str;
|
||||
bool haveAttr = GetAttr(aName, str);
|
||||
str.ToString(aResult);
|
||||
return haveAttr;
|
||||
}
|
||||
|
||||
bool Element::GetAttr(int32_t aNameSpaceID, const nsAtom* aName,
|
||||
nsAString& aResult) const {
|
||||
DOMString str;
|
||||
|
@ -4791,7 +4796,7 @@ nsAtom* Element::GetEventNameForAttr(nsAtom* aAttr) {
|
|||
void Element::RegUnRegAccessKey(bool aDoReg) {
|
||||
// first check to see if we have an access key
|
||||
nsAutoString accessKey;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, accessKey);
|
||||
GetAttr(nsGkAtoms::accesskey, accessKey);
|
||||
if (accessKey.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -903,10 +903,7 @@ class Element : public FragmentOrElement {
|
|||
*/
|
||||
bool GetAttr(int32_t aNameSpaceID, const nsAtom* aName,
|
||||
nsAString& aResult) const;
|
||||
|
||||
bool GetAttr(const nsAtom* aName, nsAString& aResult) const {
|
||||
return GetAttr(kNameSpaceID_None, aName, aResult);
|
||||
}
|
||||
bool GetAttr(const nsAtom* aName, nsAString& aResult) const;
|
||||
|
||||
/**
|
||||
* Determine if an attribute has been set (empty string or otherwise).
|
||||
|
@ -916,12 +913,12 @@ class Element : public FragmentOrElement {
|
|||
* @param aAttr the attribute name
|
||||
* @return whether an attribute exists
|
||||
*/
|
||||
inline bool HasAttr(int32_t aNameSpaceID, const nsAtom* aName) const;
|
||||
|
||||
bool HasAttr(const nsAtom* aAttr) const {
|
||||
return HasAttr(kNameSpaceID_None, aAttr);
|
||||
inline bool HasAttr(int32_t aNameSpaceID, const nsAtom* aName) const {
|
||||
return mAttrs.HasAttr(aNameSpaceID, aName);
|
||||
}
|
||||
|
||||
bool HasAttr(const nsAtom* aAttr) const { return mAttrs.HasAttr(aAttr); }
|
||||
|
||||
/**
|
||||
* Determine if an attribute has been set to a non-empty string value. If the
|
||||
* attribute is not set at all, this will return false.
|
||||
|
@ -1150,19 +1147,25 @@ class Element : public FragmentOrElement {
|
|||
uint32_t aMapCount);
|
||||
|
||||
protected:
|
||||
inline bool GetAttr(const nsAtom* aName, DOMString& aResult) const {
|
||||
MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
|
||||
const nsAttrValue* val = mAttrs.GetAttr(aName);
|
||||
if (!val) {
|
||||
return false; // DOMString comes pre-emptied.
|
||||
}
|
||||
val->ToString(aResult);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool GetAttr(int32_t aNameSpaceID, const nsAtom* aName,
|
||||
DOMString& aResult) const {
|
||||
NS_ASSERTION(nullptr != aName, "must have attribute name");
|
||||
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
|
||||
"must have a real namespace ID!");
|
||||
MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
|
||||
const nsAttrValue* val = mAttrs.GetAttr(aName, aNameSpaceID);
|
||||
if (val) {
|
||||
val->ToString(aResult);
|
||||
return true;
|
||||
if (!val) {
|
||||
return false; // DOMString comes pre-emptied.
|
||||
}
|
||||
// else DOMString comes pre-emptied.
|
||||
return false;
|
||||
val->ToString(aResult);
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -1180,20 +1183,16 @@ class Element : public FragmentOrElement {
|
|||
}
|
||||
|
||||
void GetTagName(nsAString& aTagName) const { aTagName = NodeName(); }
|
||||
void GetId(nsAString& aId) const {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, aId);
|
||||
}
|
||||
void GetId(DOMString& aId) const {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, aId);
|
||||
}
|
||||
void GetId(nsAString& aId) const { GetAttr(nsGkAtoms::id, aId); }
|
||||
void GetId(DOMString& aId) const { GetAttr(nsGkAtoms::id, aId); }
|
||||
void SetId(const nsAString& aId) {
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::id, aId, true);
|
||||
}
|
||||
void GetClassName(nsAString& aClassName) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName);
|
||||
GetAttr(nsGkAtoms::_class, aClassName);
|
||||
}
|
||||
void GetClassName(DOMString& aClassName) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName);
|
||||
GetAttr(nsGkAtoms::_class, aClassName);
|
||||
}
|
||||
void SetClassName(const nsAString& aClassName) {
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName, true);
|
||||
|
@ -1655,9 +1654,7 @@ class Element : public FragmentOrElement {
|
|||
* @param aAttr name of attribute.
|
||||
* @param aValue Boolean value of attribute.
|
||||
*/
|
||||
bool GetBoolAttr(nsAtom* aAttr) const {
|
||||
return HasAttr(kNameSpaceID_None, aAttr);
|
||||
}
|
||||
bool GetBoolAttr(nsAtom* aAttr) const { return HasAttr(aAttr); }
|
||||
|
||||
/**
|
||||
* Sets value of boolean attribute by removing attribute or setting it to
|
||||
|
@ -2150,14 +2147,6 @@ class Element : public FragmentOrElement {
|
|||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(Element, NS_ELEMENT_IID)
|
||||
|
||||
inline bool Element::HasAttr(int32_t aNameSpaceID, const nsAtom* aName) const {
|
||||
NS_ASSERTION(nullptr != aName, "must have attribute name");
|
||||
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
|
||||
"must have a real namespace ID!");
|
||||
|
||||
return mAttrs.IndexOfAttr(aName, aNameSpaceID) >= 0;
|
||||
}
|
||||
|
||||
inline bool Element::HasNonEmptyAttr(int32_t aNameSpaceID,
|
||||
const nsAtom* aName) const {
|
||||
MOZ_ASSERT(aNameSpaceID > kNameSpaceID_Unknown, "Must have namespace");
|
||||
|
|
|
@ -85,11 +85,11 @@ void LinkStyle::GetTitleAndMediaForElement(const Element& aSelf,
|
|||
// [2]: https://html.spec.whatwg.org/#attr-style-title
|
||||
// [3]: https://github.com/w3c/webcomponents/issues/535
|
||||
if (aSelf.IsInUncomposedDoc()) {
|
||||
aSelf.GetAttr(kNameSpaceID_None, nsGkAtoms::title, aTitle);
|
||||
aSelf.GetAttr(nsGkAtoms::title, aTitle);
|
||||
aTitle.CompressWhitespace();
|
||||
}
|
||||
|
||||
aSelf.GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
|
||||
aSelf.GetAttr(nsGkAtoms::media, aMedia);
|
||||
// The HTML5 spec is formulated in terms of the CSSOM spec, which specifies
|
||||
// that media queries should be ASCII lowercased during serialization.
|
||||
//
|
||||
|
@ -104,7 +104,7 @@ bool LinkStyle::IsCSSMimeTypeAttributeForStyleElement(const Element& aSelf) {
|
|||
// step 4, for style elements we should only accept empty and "text/css" type
|
||||
// attribute values.
|
||||
nsAutoString type;
|
||||
aSelf.GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
||||
aSelf.GetAttr(nsGkAtoms::type, type);
|
||||
return type.IsEmpty() || type.LowerCaseEqualsLiteral("text/css");
|
||||
}
|
||||
|
||||
|
@ -304,8 +304,7 @@ Result<LinkStyle::Update, nsresult> LinkStyle::DoUpdateStyleSheet(
|
|||
}
|
||||
if (thisContent.IsElement()) {
|
||||
nsAutoString integrity;
|
||||
thisContent.AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::integrity,
|
||||
integrity);
|
||||
thisContent.AsElement()->GetAttr(nsGkAtoms::integrity, integrity);
|
||||
if (!integrity.IsEmpty()) {
|
||||
MOZ_LOG(SRILogHelper::GetSriLog(), mozilla::LogLevel::Debug,
|
||||
("LinkStyle::DoUpdateStyleSheet, integrity=%s",
|
||||
|
|
|
@ -55,7 +55,7 @@ void GetPrefix(const nsINode* aNode, nsAString& aResult) {
|
|||
void GetNameAttribute(const nsINode* aNode, nsAString& aResult) {
|
||||
if (aNode->HasName()) {
|
||||
const mozilla::dom::Element* elem = aNode->AsElement();
|
||||
elem->GetAttr(kNameSpaceID_None, nsGkAtoms::name, aResult);
|
||||
elem->GetAttr(nsGkAtoms::name, aResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1838,7 +1838,7 @@ void nsContentUtils::GetOfflineAppManifest(Document* aDocument, nsIURI** aURI) {
|
|||
}
|
||||
|
||||
nsAutoString manifestSpec;
|
||||
docElement->GetAttr(kNameSpaceID_None, nsGkAtoms::manifest, manifestSpec);
|
||||
docElement->GetAttr(nsGkAtoms::manifest, manifestSpec);
|
||||
|
||||
// Manifest URIs can't have fragment identifiers.
|
||||
if (manifestSpec.IsEmpty() || manifestSpec.Contains('#')) {
|
||||
|
@ -3335,7 +3335,7 @@ void nsContentUtils::GenerateStateKey(nsIContent* aContent, Document* aDocument,
|
|||
|
||||
// Append the form name
|
||||
nsAutoString formName;
|
||||
formElement->GetAttr(kNameSpaceID_None, nsGkAtoms::name, formName);
|
||||
formElement->GetAttr(nsGkAtoms::name, formName);
|
||||
KeyAppendString(formName, aKey);
|
||||
} else {
|
||||
// Not in a form. Append the control number, if this is a parser
|
||||
|
@ -3357,8 +3357,7 @@ void nsContentUtils::GenerateStateKey(nsIContent* aContent, Document* aDocument,
|
|||
|
||||
// Append the control name
|
||||
nsAutoString name;
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name,
|
||||
name);
|
||||
aContent->AsElement()->GetAttr(nsGkAtoms::name, name);
|
||||
KeyAppendString(name, aKey);
|
||||
}
|
||||
}
|
||||
|
@ -5884,8 +5883,7 @@ void nsContentUtils::TriggerLink(nsIContent* aContent, nsIURI* aLinkURI,
|
|||
if ((!aContent->IsHTMLElement(nsGkAtoms::a) &&
|
||||
!aContent->IsHTMLElement(nsGkAtoms::area) &&
|
||||
!aContent->IsSVGElement(nsGkAtoms::a)) ||
|
||||
!aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::download,
|
||||
fileName) ||
|
||||
!aContent->AsElement()->GetAttr(nsGkAtoms::download, fileName) ||
|
||||
NS_FAILED(aContent->NodePrincipal()->CheckMayLoad(aLinkURI, true))) {
|
||||
fileName.SetIsVoid(true); // No actionable download attribute was found.
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ void nsDOMTokenList::GetValue(nsAString& aResult) {
|
|||
return;
|
||||
}
|
||||
|
||||
mElement->GetAttr(kNameSpaceID_None, mAttrAtom, aResult);
|
||||
mElement->GetAttr(mAttrAtom, aResult);
|
||||
}
|
||||
|
||||
void nsDOMTokenList::SetValue(const nsAString& aValue, ErrorResult& rv) {
|
||||
|
|
|
@ -3525,8 +3525,7 @@ nsresult nsFocusManager::DetermineElementToMoveFocus(
|
|||
if (forDocumentNavigation && nsContentUtils::IsChromeDoc(doc)) {
|
||||
nsAutoString retarget;
|
||||
|
||||
if (rootElement->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::retargetdocumentfocus, retarget)) {
|
||||
if (rootElement->GetAttr(nsGkAtoms::retargetdocumentfocus, retarget)) {
|
||||
nsIContent* retargetElement = doc->GetElementById(retarget);
|
||||
// The common case here is the urlbar where focus is on the anonymous
|
||||
// input inside the textbox, but the retargetdocumentfocus attribute
|
||||
|
@ -4348,8 +4347,7 @@ nsresult nsFocusManager::GetNextTabbableContent(
|
|||
"IsFocusable set a tabindex for a frame with no content");
|
||||
if (!aForDocumentNavigation &&
|
||||
currentContent->IsHTMLElement(nsGkAtoms::img) &&
|
||||
currentContent->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::usemap)) {
|
||||
currentContent->AsElement()->HasAttr(nsGkAtoms::usemap)) {
|
||||
// This is an image with a map. Image map areas are not traversed by
|
||||
// nsIFrameTraversal so look for the next or previous area element.
|
||||
nsIContent* areaContent = GetNextTabbableMapArea(
|
||||
|
@ -4603,8 +4601,7 @@ int32_t nsFocusManager::GetNextTabIndex(nsIContent* aParent,
|
|||
|
||||
nsAutoString tabIndexStr;
|
||||
if (child->IsElement()) {
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex,
|
||||
tabIndexStr);
|
||||
child->AsElement()->GetAttr(nsGkAtoms::tabindex, tabIndexStr);
|
||||
}
|
||||
nsresult ec;
|
||||
int32_t val = tabIndexStr.ToInteger(&ec);
|
||||
|
@ -4628,8 +4625,7 @@ int32_t nsFocusManager::GetNextTabIndex(nsIContent* aParent,
|
|||
|
||||
nsAutoString tabIndexStr;
|
||||
if (child->IsElement()) {
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex,
|
||||
tabIndexStr);
|
||||
child->AsElement()->GetAttr(nsGkAtoms::tabindex, tabIndexStr);
|
||||
}
|
||||
nsresult ec;
|
||||
int32_t val = tabIndexStr.ToInteger(&ec);
|
||||
|
@ -4659,8 +4655,7 @@ nsresult nsFocusManager::FocusFirst(Element* aRootElement,
|
|||
// urlbar during document navigation.
|
||||
nsAutoString retarget;
|
||||
|
||||
if (aRootElement->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::retargetdocumentfocus, retarget)) {
|
||||
if (aRootElement->GetAttr(nsGkAtoms::retargetdocumentfocus, retarget)) {
|
||||
RefPtr<Element> element = doc->GetElementById(retarget);
|
||||
nsCOMPtr<nsIContent> retargetElement =
|
||||
FlushAndCheckIfFocusable(element, 0);
|
||||
|
|
|
@ -217,13 +217,13 @@ static nsAtom* TypeAttrName(Element* aOwnerContent) {
|
|||
static void GetFrameName(Element* aOwnerContent, nsAString& aFrameName) {
|
||||
int32_t namespaceID = aOwnerContent->GetNameSpaceID();
|
||||
if (namespaceID == kNameSpaceID_XHTML && !aOwnerContent->IsInHTMLDocument()) {
|
||||
aOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aFrameName);
|
||||
aOwnerContent->GetAttr(nsGkAtoms::id, aFrameName);
|
||||
} else {
|
||||
aOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, aFrameName);
|
||||
aOwnerContent->GetAttr(nsGkAtoms::name, aFrameName);
|
||||
// XXX if no NAME then use ID, after a transition period this will be
|
||||
// changed so that XUL only uses ID too (bug 254284).
|
||||
if (aFrameName.IsEmpty() && namespaceID == kNameSpaceID_XUL) {
|
||||
aOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aFrameName);
|
||||
aOwnerContent->GetAttr(nsGkAtoms::id, aFrameName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,8 +366,7 @@ static bool InitialLoadIsRemote(Element* aOwner) {
|
|||
// fall back to the default.
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aOwner);
|
||||
bool isMozBrowserFrame = browserFrame && browserFrame->GetReallyIsBrowser();
|
||||
if (isMozBrowserFrame &&
|
||||
!aOwner->HasAttr(kNameSpaceID_None, nsGkAtoms::remote)) {
|
||||
if (isMozBrowserFrame && !aOwner->HasAttr(nsGkAtoms::remote)) {
|
||||
return Preferences::GetBool("dom.ipc.browser_frames.oop_by_default", false);
|
||||
}
|
||||
|
||||
|
@ -456,7 +455,7 @@ already_AddRefed<nsFrameLoader> nsFrameLoader::Create(
|
|||
if (isRemoteFrame) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
nsAutoString remoteType;
|
||||
if (aOwner->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType, remoteType) &&
|
||||
if (aOwner->GetAttr(nsGkAtoms::RemoteType, remoteType) &&
|
||||
!remoteType.IsEmpty()) {
|
||||
CopyUTF16toUTF8(remoteType, fl->mRemoteType);
|
||||
} else {
|
||||
|
@ -513,7 +512,7 @@ void nsFrameLoader::LoadFrame(bool aOriginalSrc) {
|
|||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
|
||||
bool isSrcdoc = mOwnerContent->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc);
|
||||
mOwnerContent->HasAttr(nsGkAtoms::srcdoc);
|
||||
if (isSrcdoc) {
|
||||
src.AssignLiteral("about:srcdoc");
|
||||
principal = mOwnerContent->NodePrincipal();
|
||||
|
@ -684,9 +683,8 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
|
|||
}
|
||||
|
||||
nsAutoString srcdoc;
|
||||
bool isSrcdoc =
|
||||
mOwnerContent->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::srcdoc, srcdoc);
|
||||
bool isSrcdoc = mOwnerContent->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
mOwnerContent->GetAttr(nsGkAtoms::srcdoc, srcdoc);
|
||||
|
||||
if (isSrcdoc) {
|
||||
loadState->SetSrcdocData(srcdoc);
|
||||
|
@ -1251,13 +1249,12 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool ourHasHistory =
|
||||
mIsTopLevelContent && ourContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
!ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory);
|
||||
bool otherHasHistory =
|
||||
aOther->mIsTopLevelContent &&
|
||||
otherContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
!otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory);
|
||||
bool ourHasHistory = mIsTopLevelContent &&
|
||||
ourContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
!ourContent->HasAttr(nsGkAtoms::disablehistory);
|
||||
bool otherHasHistory = aOther->mIsTopLevelContent &&
|
||||
otherContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
!otherContent->HasAttr(nsGkAtoms::disablehistory);
|
||||
if (ourHasHistory != otherHasHistory) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -1495,10 +1492,9 @@ nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
}
|
||||
|
||||
bool ourHasSrcdoc = ourContent->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc);
|
||||
bool otherHasSrcdoc =
|
||||
otherContent->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc);
|
||||
ourContent->HasAttr(nsGkAtoms::srcdoc);
|
||||
bool otherHasSrcdoc = otherContent->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
otherContent->HasAttr(nsGkAtoms::srcdoc);
|
||||
if (ourHasSrcdoc || otherHasSrcdoc) {
|
||||
// Ignore this case entirely for now, since we support XUL <-> HTML swapping
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -2288,7 +2284,7 @@ nsresult nsFrameLoader::MaybeCreateDocShell() {
|
|||
|
||||
// If we are an in-process browser, we want to set up our session history.
|
||||
if (mIsTopLevelContent && mOwnerContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory)) {
|
||||
!mOwnerContent->HasAttr(nsGkAtoms::disablehistory)) {
|
||||
// XXX(nika): Set this up more explicitly?
|
||||
mPendingBrowsingContext->InitSessionHistory();
|
||||
}
|
||||
|
@ -2309,7 +2305,7 @@ nsresult nsFrameLoader::MaybeCreateDocShell() {
|
|||
if (OwnerIsMozBrowserFrame()) {
|
||||
// For inproc frames, set the docshell properties.
|
||||
nsAutoString name;
|
||||
if (mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
|
||||
if (mOwnerContent->GetAttr(nsGkAtoms::name, name)) {
|
||||
docShell->SetName(name);
|
||||
}
|
||||
}
|
||||
|
@ -2345,9 +2341,9 @@ void nsFrameLoader::GetURL(nsString& aURI, nsIPrincipal** aTriggeringPrincipal,
|
|||
nsCOMPtr<nsIContentSecurityPolicy> csp = mOwnerContent->GetCsp();
|
||||
|
||||
if (mOwnerContent->IsHTMLElement(nsGkAtoms::object)) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, aURI);
|
||||
mOwnerContent->GetAttr(nsGkAtoms::data, aURI);
|
||||
} else {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::src, aURI);
|
||||
mOwnerContent->GetAttr(nsGkAtoms::src, aURI);
|
||||
if (RefPtr<nsGenericHTMLFrameElement> frame =
|
||||
do_QueryObject(mOwnerContent)) {
|
||||
nsCOMPtr<nsIPrincipal> srcPrincipal = frame->GetSrcTriggeringPrincipal();
|
||||
|
@ -2774,7 +2770,7 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
|
|||
if (mOwnerContent->IsXULElement()) {
|
||||
// Send down the name of the browser through browserParent if it is set.
|
||||
nsAutoString frameName;
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, frameName);
|
||||
mOwnerContent->GetAttr(nsGkAtoms::name, frameName);
|
||||
if (nsContentUtils::IsOverridingWindowName(frameName)) {
|
||||
MOZ_ALWAYS_SUCCEEDS(mPendingBrowsingContext->SetName(frameName));
|
||||
}
|
||||
|
@ -3037,8 +3033,7 @@ nsresult nsFrameLoader::EnsureMessageManager() {
|
|||
if (window && window->IsChromeWindow()) {
|
||||
nsAutoString messagemanagergroup;
|
||||
if (mOwnerContent->IsXULElement() &&
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::messagemanagergroup,
|
||||
mOwnerContent->GetAttr(nsGkAtoms::messagemanagergroup,
|
||||
messagemanagergroup)) {
|
||||
parentManager = window->GetGroupMessageManager(messagemanagergroup);
|
||||
}
|
||||
|
@ -3643,8 +3638,7 @@ nsresult nsFrameLoader::PopulateOriginContextIdsFromAttributes(
|
|||
nsAutoString attributeValue;
|
||||
if (aAttr.mUserContextId ==
|
||||
nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID &&
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::usercontextid,
|
||||
attributeValue) &&
|
||||
mOwnerContent->GetAttr(nsGkAtoms::usercontextid, attributeValue) &&
|
||||
!attributeValue.IsEmpty()) {
|
||||
nsresult rv;
|
||||
aAttr.mUserContextId = attributeValue.ToInteger(&rv);
|
||||
|
@ -3652,8 +3646,7 @@ nsresult nsFrameLoader::PopulateOriginContextIdsFromAttributes(
|
|||
}
|
||||
|
||||
if (aAttr.mGeckoViewSessionContextId.IsEmpty() &&
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::geckoViewSessionContextId,
|
||||
mOwnerContent->GetAttr(nsGkAtoms::geckoViewSessionContextId,
|
||||
attributeValue) &&
|
||||
!attributeValue.IsEmpty()) {
|
||||
// XXX: Should we check the format from `GeckoViewNavigation.jsm` here?
|
||||
|
@ -3863,8 +3856,7 @@ bool nsFrameLoader::EnsureBrowsingContextAttached() {
|
|||
// <iframe mozbrowser> is allowed to set `mozprivatebrowsing` to
|
||||
// force-enable private browsing.
|
||||
if (OwnerIsMozBrowserFrame()) {
|
||||
if (mOwnerContent->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::mozprivatebrowsing)) {
|
||||
if (mOwnerContent->HasAttr(nsGkAtoms::mozprivatebrowsing)) {
|
||||
attrs.SyncAttributesWithPrivateBrowsing(true);
|
||||
usePrivateBrowsing = true;
|
||||
}
|
||||
|
|
|
@ -1810,7 +1810,7 @@ Element* nsImageLoadingContent::FindImageMap() {
|
|||
Element* thisElement = thisContent->AsElement();
|
||||
|
||||
nsAutoString useMap;
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::usemap, useMap);
|
||||
thisElement->GetAttr(nsGkAtoms::usemap, useMap);
|
||||
if (useMap.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -386,9 +386,9 @@ nsresult nsObjectLoadingContent::BuildParametersArray() {
|
|||
// attribute and add another entry to the bottom of the array if there isn't
|
||||
// already a "src" specified.
|
||||
if (element->IsHTMLElement(nsGkAtoms::object) &&
|
||||
!element->HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
|
||||
!element->HasAttr(nsGkAtoms::src)) {
|
||||
MozPluginParameter param;
|
||||
element->GetAttr(kNameSpaceID_None, nsGkAtoms::data, param.mValue);
|
||||
element->GetAttr(nsGkAtoms::data, param.mValue);
|
||||
if (!param.mValue.IsEmpty()) {
|
||||
param.mName = u"SRC"_ns;
|
||||
mCachedAttributes.AppendElement(param);
|
||||
|
@ -929,7 +929,7 @@ nsObjectLoadingContent::UpdateObjectParameters() {
|
|||
|
||||
if (caps & eFallbackIfClassIDPresent) {
|
||||
nsAutoString classIDAttr;
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
|
||||
thisElement->GetAttr(nsGkAtoms::classid, classIDAttr);
|
||||
// We don't support class ID plugin references, so we should always treat
|
||||
// having class Ids as attributes as invalid, and fallback accordingly.
|
||||
if (!classIDAttr.IsEmpty()) {
|
||||
|
@ -944,7 +944,7 @@ nsObjectLoadingContent::UpdateObjectParameters() {
|
|||
|
||||
nsAutoString codebaseStr;
|
||||
nsIURI* docBaseURI = thisElement->GetBaseURI();
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::codebase, codebaseStr);
|
||||
thisElement->GetAttr(nsGkAtoms::codebase, codebaseStr);
|
||||
|
||||
if (!codebaseStr.IsEmpty()) {
|
||||
rv = nsContentUtils::NewURIWithDocumentCharset(
|
||||
|
@ -965,7 +965,7 @@ nsObjectLoadingContent::UpdateObjectParameters() {
|
|||
}
|
||||
|
||||
nsAutoString rawTypeAttr;
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr);
|
||||
thisElement->GetAttr(nsGkAtoms::type, rawTypeAttr);
|
||||
if (!rawTypeAttr.IsEmpty()) {
|
||||
typeAttr = rawTypeAttr;
|
||||
nsAutoString params;
|
||||
|
@ -981,9 +981,9 @@ nsObjectLoadingContent::UpdateObjectParameters() {
|
|||
nsAutoString uriStr;
|
||||
// Different elements keep this in various locations
|
||||
if (thisElement->NodeInfo()->Equals(nsGkAtoms::object)) {
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::data, uriStr);
|
||||
thisElement->GetAttr(nsGkAtoms::data, uriStr);
|
||||
} else if (thisElement->NodeInfo()->Equals(nsGkAtoms::embed)) {
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::src, uriStr);
|
||||
thisElement->GetAttr(nsGkAtoms::src, uriStr);
|
||||
} else {
|
||||
MOZ_ASSERT_UNREACHABLE("Unrecognized plugin-loading tag");
|
||||
}
|
||||
|
|
|
@ -83,13 +83,13 @@ void nsStyledElement::InlineStyleDeclarationWillChange(
|
|||
|
||||
if (needsOldValue) {
|
||||
nsAutoString oldValueStr;
|
||||
modification = GetAttr(kNameSpaceID_None, nsGkAtoms::style, oldValueStr);
|
||||
modification = GetAttr(nsGkAtoms::style, oldValueStr);
|
||||
if (modification) {
|
||||
aData.mOldValue.emplace();
|
||||
aData.mOldValue->SetTo(oldValueStr);
|
||||
}
|
||||
} else {
|
||||
modification = HasAttr(kNameSpaceID_None, nsGkAtoms::style);
|
||||
modification = HasAttr(nsGkAtoms::style);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1660,16 +1660,16 @@ bool nsTreeSanitizer::MustPrune(int32_t aNamespace, nsAtom* aLocal,
|
|||
return true;
|
||||
}
|
||||
if (nsGkAtoms::meta == aLocal &&
|
||||
(aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::charset) ||
|
||||
aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv))) {
|
||||
(aElement->HasAttr(nsGkAtoms::charset) ||
|
||||
aElement->HasAttr(nsGkAtoms::httpEquiv))) {
|
||||
// Throw away charset declarations even if they also have microdata
|
||||
// which they can't validly have.
|
||||
return true;
|
||||
}
|
||||
if (((!mFullDocument && nsGkAtoms::meta == aLocal) ||
|
||||
nsGkAtoms::link == aLocal) &&
|
||||
!(aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::itemprop) ||
|
||||
aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::itemscope))) {
|
||||
!(aElement->HasAttr(nsGkAtoms::itemprop) ||
|
||||
aElement->HasAttr(nsGkAtoms::itemscope))) {
|
||||
// emulate old behavior for non-Microdata <meta> and <link> presumably
|
||||
// in <head>. <meta> and <link> are whitelisted in order to avoid
|
||||
// corrupting Microdata when they appear in <body>. Note that
|
||||
|
|
|
@ -1092,7 +1092,7 @@ nsresult EventListenerManager::CompileEventHandlerInternal(
|
|||
attrName = nsGkAtoms::onwebkittransitionend;
|
||||
}
|
||||
|
||||
element->GetAttr(kNameSpaceID_None, attrName, handlerBody);
|
||||
element->GetAttr(attrName, handlerBody);
|
||||
body = &handlerBody;
|
||||
aElement = element;
|
||||
}
|
||||
|
|
|
@ -1115,8 +1115,7 @@ static bool IsAccessKeyTarget(Element* aElement, nsAString& aKey) {
|
|||
// Use GetAttr because we want Unicode case=insensitive matching
|
||||
// XXXbz shouldn't this be case-sensitive, per spec?
|
||||
nsString contentKey;
|
||||
if (!aElement ||
|
||||
!aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, contentKey) ||
|
||||
if (!aElement || !aElement->GetAttr(nsGkAtoms::accesskey, contentKey) ||
|
||||
!contentKey.Equals(aKey, nsCaseInsensitiveStringComparator)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -5961,7 +5960,7 @@ uint32_t EventStateManager::GetRegisteredAccessKey(Element* aElement) {
|
|||
}
|
||||
|
||||
nsAutoString accessKey;
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, accessKey);
|
||||
aElement->GetAttr(nsGkAtoms::accesskey, accessKey);
|
||||
return accessKey.First();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,10 +62,9 @@ static void BuildHandlerChain(nsIContent* aContent, KeyEventHandler** aResult) {
|
|||
// definition on the locale. See bug 426501.
|
||||
nsAutoString valKey, valCharCode, valKeyCode;
|
||||
// Hopefully at least one of the attributes is set:
|
||||
keyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::key, valKey) ||
|
||||
keyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::charcode,
|
||||
valCharCode) ||
|
||||
keyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, valKeyCode);
|
||||
keyElement->GetAttr(nsGkAtoms::key, valKey) ||
|
||||
keyElement->GetAttr(nsGkAtoms::charcode, valCharCode) ||
|
||||
keyElement->GetAttr(nsGkAtoms::keycode, valKeyCode);
|
||||
// If not, ignore this key element.
|
||||
if (valKey.IsEmpty() && valCharCode.IsEmpty() && valKeyCode.IsEmpty()) {
|
||||
continue;
|
||||
|
@ -564,7 +563,7 @@ bool XULKeySetGlobalKeyListener::GetElementForHandler(
|
|||
|
||||
// We are in a XUL doc. Obtain our command attribute.
|
||||
nsAutoString command;
|
||||
keyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::command, command);
|
||||
keyElement->GetAttr(nsGkAtoms::command, command);
|
||||
if (command.IsEmpty()) {
|
||||
// There is no command element associated with the key element.
|
||||
NS_WARNING_ASSERTION(keyElement->IsInUncomposedDoc(), "uncomposed");
|
||||
|
|
|
@ -1586,8 +1586,7 @@ MOZ_CAN_RUN_SCRIPT static void GetActionHint(const IMEState& aState,
|
|||
}
|
||||
|
||||
// XXX This is old compatibility, but we might be able to remove this.
|
||||
aContent.AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::moz_action_hint,
|
||||
aActionHint);
|
||||
aContent.AsElement()->GetAttr(nsGkAtoms::moz_action_hint, aActionHint);
|
||||
|
||||
if (!aActionHint.IsEmpty()) {
|
||||
ToLowerCase(aActionHint);
|
||||
|
@ -1655,8 +1654,7 @@ static void GetInputMode(const IMEState& aState, const nsIContent& aContent,
|
|||
if (aState.IsEditable() &&
|
||||
(StaticPrefs::dom_forms_inputmode() ||
|
||||
nsContentUtils::IsChromeDoc(aContent.OwnerDoc()))) {
|
||||
aContent.AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::inputmode,
|
||||
aInputMode);
|
||||
aContent.AsElement()->GetAttr(nsGkAtoms::inputmode, aInputMode);
|
||||
if (aContent.IsHTMLElement(nsGkAtoms::input) &&
|
||||
aInputMode.EqualsLiteral("mozAwesomebar")) {
|
||||
if (!nsContentUtils::IsChromeDoc(aContent.OwnerDoc())) {
|
||||
|
|
|
@ -546,7 +546,7 @@ void KeyEventHandler::GetEventType(nsAString& aEvent) {
|
|||
aEvent.Truncate();
|
||||
return;
|
||||
}
|
||||
handlerElement->GetAttr(kNameSpaceID_None, nsGkAtoms::event, aEvent);
|
||||
handlerElement->GetAttr(nsGkAtoms::event, aEvent);
|
||||
|
||||
if (aEvent.IsEmpty() && mIsXULKey) {
|
||||
// If no type is specified for a XUL <key> element, let's assume that we're
|
||||
|
@ -580,7 +580,7 @@ void KeyEventHandler::ConstructPrototype(dom::Element* aKeyElement,
|
|||
}
|
||||
mEventName = NS_Atomize(event);
|
||||
|
||||
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::modifiers, modifiers);
|
||||
aKeyElement->GetAttr(nsGkAtoms::modifiers, modifiers);
|
||||
} else {
|
||||
mCommand = ToNewUnicode(nsDependentString(aCommand));
|
||||
mEventName = NS_Atomize(aEvent);
|
||||
|
@ -592,9 +592,9 @@ void KeyEventHandler::ConstructPrototype(dom::Element* aKeyElement,
|
|||
nsAutoString key(aCharCode);
|
||||
if (key.IsEmpty()) {
|
||||
if (mIsXULKey) {
|
||||
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::key, key);
|
||||
aKeyElement->GetAttr(nsGkAtoms::key, key);
|
||||
if (key.IsEmpty()) {
|
||||
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::charcode, key);
|
||||
aKeyElement->GetAttr(nsGkAtoms::charcode, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ void KeyEventHandler::ConstructPrototype(dom::Element* aKeyElement,
|
|||
} else {
|
||||
key.Assign(aKeyCode);
|
||||
if (mIsXULKey) {
|
||||
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, key);
|
||||
aKeyElement->GetAttr(nsGkAtoms::keycode, key);
|
||||
}
|
||||
|
||||
if (!key.IsEmpty()) {
|
||||
|
@ -677,7 +677,7 @@ void KeyEventHandler::ReportKeyConflict(const char16_t* aKey,
|
|||
nsCOMPtr<dom::Document> doc = aKeyElement->OwnerDoc();
|
||||
|
||||
nsAutoString id;
|
||||
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id);
|
||||
aKeyElement->GetAttr(nsGkAtoms::id, id);
|
||||
AutoTArray<nsString, 3> params;
|
||||
params.AppendElement(aKey);
|
||||
params.AppendElement(aModifiers);
|
||||
|
|
|
@ -434,9 +434,8 @@ nsresult ElementInternals::SetAttr(nsAtom* aName, const nsAString& aValue) {
|
|||
Document* document = mTarget->GetComposedDoc();
|
||||
mozAutoDocUpdate updateBatch(document, true);
|
||||
|
||||
uint8_t modType = mAttrs.HasAttr(kNameSpaceID_None, aName)
|
||||
? MutationEvent_Binding::MODIFICATION
|
||||
: MutationEvent_Binding::ADDITION;
|
||||
uint8_t modType = mAttrs.HasAttr(aName) ? MutationEvent_Binding::MODIFICATION
|
||||
: MutationEvent_Binding::ADDITION;
|
||||
|
||||
MutationObservers::NotifyARIAAttributeDefaultWillChange(mTarget, aName,
|
||||
modType);
|
||||
|
|
|
@ -29,7 +29,7 @@ HTMLAnchorElement::~HTMLAnchorElement() {
|
|||
}
|
||||
|
||||
bool HTMLAnchorElement::IsInteractiveHTMLContent() const {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::href) ||
|
||||
return HasAttr(nsGkAtoms::href) ||
|
||||
nsGenericHTMLElement::IsInteractiveHTMLContent();
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ int32_t HTMLAnchorElement::TabIndexDefault() { return 0; }
|
|||
bool HTMLAnchorElement::Draggable() const {
|
||||
// links can be dragged as long as there is an href and the
|
||||
// draggable attribute isn't false
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
if (!HasAttr(nsGkAtoms::href)) {
|
||||
// no href, so just use the same behavior as other elements
|
||||
return nsGenericHTMLElement::Draggable();
|
||||
}
|
||||
|
@ -148,14 +148,14 @@ nsresult HTMLAnchorElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
|||
}
|
||||
|
||||
void HTMLAnchorElement::GetLinkTarget(nsAString& aTarget) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::target, aTarget);
|
||||
GetAttr(nsGkAtoms::target, aTarget);
|
||||
if (aTarget.IsEmpty()) {
|
||||
GetBaseTarget(aTarget);
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLAnchorElement::GetTarget(nsAString& aValue) const {
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue)) {
|
||||
if (!GetAttr(nsGkAtoms::target, aValue)) {
|
||||
GetBaseTarget(aValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLAreaElement)
|
|||
int32_t HTMLAreaElement::TabIndexDefault() { return 0; }
|
||||
|
||||
void HTMLAreaElement::GetTarget(DOMString& aValue) {
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue)) {
|
||||
if (!GetAttr(nsGkAtoms::target, aValue)) {
|
||||
GetBaseTarget(aValue);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ nsresult HTMLAreaElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
|||
}
|
||||
|
||||
void HTMLAreaElement::GetLinkTarget(nsAString& aTarget) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::target, aTarget);
|
||||
GetAttr(nsGkAtoms::target, aTarget);
|
||||
if (aTarget.IsEmpty()) {
|
||||
GetBaseTarget(aTarget);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ HTMLAudioElement::~HTMLAudioElement() {
|
|||
}
|
||||
|
||||
bool HTMLAudioElement::IsInteractiveHTMLContent() const {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::controls) ||
|
||||
return HasAttr(nsGkAtoms::controls) ||
|
||||
HTMLMediaElement::IsInteractiveHTMLContent();
|
||||
}
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ void HTMLButtonElement::SaveState() {
|
|||
if (state) {
|
||||
// We do not want to save the real disabled state but the disabled
|
||||
// attribute.
|
||||
state->disabled() = HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
|
||||
state->disabled() = HasAttr(nsGkAtoms::disabled);
|
||||
state->disabledSet() = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1181,7 +1181,7 @@ bool HTMLCanvasElement::GetIsOpaque() {
|
|||
}
|
||||
|
||||
bool HTMLCanvasElement::GetOpaqueAttr() {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque);
|
||||
return HasAttr(nsGkAtoms::moz_opaque);
|
||||
}
|
||||
|
||||
CanvasContextType HTMLCanvasElement::GetCurrentContextType() {
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLDataListElement)
|
|||
bool HTMLDataListElement::MatchOptions(Element* aElement, int32_t aNamespaceID,
|
||||
nsAtom* aAtom, void* aData) {
|
||||
return aElement->NodeInfo()->Equals(nsGkAtoms::option, kNameSpaceID_XHTML) &&
|
||||
!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
|
||||
!aElement->HasAttr(nsGkAtoms::disabled);
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
|
|
@ -191,8 +191,7 @@ void HTMLElement::UpdateFormOwner() {
|
|||
// corresponding id. If @form isn't set, the element *has* to have a parent,
|
||||
// otherwise it wouldn't be possible to find a form ancestor. We should not
|
||||
// call UpdateFormOwner if none of these conditions are fulfilled.
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::form) ? IsInComposedDoc()
|
||||
: !!GetParent()) {
|
||||
if (HasAttr(nsGkAtoms::form) ? IsInComposedDoc() : !!GetParent()) {
|
||||
UpdateFormOwner(true, nullptr);
|
||||
}
|
||||
UpdateFieldSet(true);
|
||||
|
|
|
@ -239,9 +239,8 @@ void HTMLFormElement::MaybeSubmit(Element* aSubmitter) {
|
|||
// If the result is negative (i.e., the constraint validation concluded
|
||||
// that there were invalid fields and probably informed the user of this)
|
||||
bool noValidateState =
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
|
||||
(aSubmitter &&
|
||||
aSubmitter->HasAttr(kNameSpaceID_None, nsGkAtoms::formnovalidate));
|
||||
HasAttr(nsGkAtoms::novalidate) ||
|
||||
(aSubmitter && aSubmitter->HasAttr(nsGkAtoms::formnovalidate));
|
||||
if (!noValidateState && !CheckValidFormSubmission()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1053,7 +1052,7 @@ nsresult HTMLFormElement::ConstructEntryList(FormData* aFormData) {
|
|||
|
||||
NotNull<const Encoding*> HTMLFormElement::GetSubmitEncoding() {
|
||||
nsAutoString acceptCharsetValue;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::acceptcharset, acceptCharsetValue);
|
||||
GetAttr(nsGkAtoms::acceptcharset, acceptCharsetValue);
|
||||
|
||||
int32_t charsetLen = acceptCharsetValue.Length();
|
||||
if (charsetLen > 0) {
|
||||
|
@ -1107,11 +1106,10 @@ int32_t HTMLFormElement::CompareFormControlPosition(Element* aElement1,
|
|||
|
||||
// If an element has a @form, we can assume it *might* be able to not have
|
||||
// a parent and still be in the form.
|
||||
NS_ASSERTION((aElement1->HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
|
||||
aElement1->GetParent()) &&
|
||||
(aElement2->HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
|
||||
aElement2->GetParent()),
|
||||
"Form controls should always have parents");
|
||||
NS_ASSERTION(
|
||||
(aElement1->HasAttr(nsGkAtoms::form) || aElement1->GetParent()) &&
|
||||
(aElement2->HasAttr(nsGkAtoms::form) || aElement2->GetParent()),
|
||||
"Form controls should always have parents");
|
||||
|
||||
// If we pass aForm, we are assuming both controls are form descendants which
|
||||
// is not always the case. This function should work but maybe slower.
|
||||
|
@ -1267,8 +1265,7 @@ nsresult HTMLFormElement::AddElement(nsGenericHTMLFormElement* aChild,
|
|||
bool aUpdateValidity, bool aNotify) {
|
||||
// If an element has a @form, we can assume it *might* be able to not have
|
||||
// a parent and still be in the form.
|
||||
NS_ASSERTION(aChild->HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
|
||||
aChild->GetParent(),
|
||||
NS_ASSERTION(aChild->HasAttr(nsGkAtoms::form) || aChild->GetParent(),
|
||||
"Form control should have a parent");
|
||||
nsCOMPtr<nsIFormControl> fc = do_QueryObject(aChild);
|
||||
MOZ_ASSERT(fc);
|
||||
|
@ -1609,8 +1606,7 @@ void HTMLFormElement::FlushPendingSubmission() {
|
|||
}
|
||||
|
||||
void HTMLFormElement::GetAction(nsString& aValue) {
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::action, aValue) ||
|
||||
aValue.IsEmpty()) {
|
||||
if (!GetAttr(nsGkAtoms::action, aValue) || aValue.IsEmpty()) {
|
||||
Document* document = OwnerDoc();
|
||||
nsIURI* docURI = document->GetDocumentURI();
|
||||
if (docURI) {
|
||||
|
@ -1643,7 +1639,7 @@ nsresult HTMLFormElement::GetActionURL(nsIURI** aActionURL,
|
|||
nsAutoString action;
|
||||
|
||||
if (aOriginatingElement &&
|
||||
aOriginatingElement->HasAttr(kNameSpaceID_None, nsGkAtoms::formaction)) {
|
||||
aOriginatingElement->HasAttr(nsGkAtoms::formaction)) {
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIFormControl> formControl =
|
||||
do_QueryInterface(aOriginatingElement);
|
||||
|
@ -1894,7 +1890,7 @@ bool HTMLFormElement::CheckValidFormSubmission() {
|
|||
* submitted when invalid. See bug 587671.
|
||||
*/
|
||||
|
||||
NS_ASSERTION(!HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate),
|
||||
NS_ASSERTION(!HasAttr(nsGkAtoms::novalidate),
|
||||
"We shouldn't be there if novalidate is set!");
|
||||
|
||||
AutoTArray<RefPtr<Element>, 32> invalidElements;
|
||||
|
|
|
@ -810,16 +810,14 @@ nsresult HTMLFormSubmission::GetFromForm(HTMLFormElement* aForm,
|
|||
// with a target attribute, then the value of the target attribute of the
|
||||
// first such base element; or, if there is no such element, the empty string.
|
||||
nsAutoString target;
|
||||
if (!(aSubmitter && aSubmitter->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::formtarget, target)) &&
|
||||
!aForm->GetAttr(kNameSpaceID_None, nsGkAtoms::target, target)) {
|
||||
if (!(aSubmitter && aSubmitter->GetAttr(nsGkAtoms::formtarget, target)) &&
|
||||
!aForm->GetAttr(nsGkAtoms::target, target)) {
|
||||
aForm->GetBaseTarget(target);
|
||||
}
|
||||
|
||||
// Get encoding type (default: urlencoded)
|
||||
int32_t enctype = NS_FORM_ENCTYPE_URLENCODED;
|
||||
if (aSubmitter &&
|
||||
aSubmitter->HasAttr(kNameSpaceID_None, nsGkAtoms::formenctype)) {
|
||||
if (aSubmitter && aSubmitter->HasAttr(nsGkAtoms::formenctype)) {
|
||||
GetEnumAttr(aSubmitter, nsGkAtoms::formenctype, &enctype);
|
||||
} else {
|
||||
GetEnumAttr(aForm, nsGkAtoms::enctype, &enctype);
|
||||
|
@ -827,8 +825,7 @@ nsresult HTMLFormSubmission::GetFromForm(HTMLFormElement* aForm,
|
|||
|
||||
// Get method (default: GET)
|
||||
int32_t method = NS_FORM_METHOD_GET;
|
||||
if (aSubmitter &&
|
||||
aSubmitter->HasAttr(kNameSpaceID_None, nsGkAtoms::formmethod)) {
|
||||
if (aSubmitter && aSubmitter->HasAttr(nsGkAtoms::formmethod)) {
|
||||
GetEnumAttr(aSubmitter, nsGkAtoms::formmethod, &method);
|
||||
} else {
|
||||
GetEnumAttr(aForm, nsGkAtoms::method, &method);
|
||||
|
@ -868,12 +865,10 @@ nsresult HTMLFormSubmission::GetFromForm(HTMLFormElement* aForm,
|
|||
enctype == NS_FORM_ENCTYPE_TEXTPLAIN) {
|
||||
AutoTArray<nsString, 1> args;
|
||||
nsString& enctypeStr = *args.AppendElement();
|
||||
if (aSubmitter &&
|
||||
aSubmitter->HasAttr(kNameSpaceID_None, nsGkAtoms::formenctype)) {
|
||||
aSubmitter->GetAttr(kNameSpaceID_None, nsGkAtoms::formenctype,
|
||||
enctypeStr);
|
||||
if (aSubmitter && aSubmitter->HasAttr(nsGkAtoms::formenctype)) {
|
||||
aSubmitter->GetAttr(nsGkAtoms::formenctype, enctypeStr);
|
||||
} else {
|
||||
aForm->GetAttr(kNameSpaceID_None, nsGkAtoms::enctype, enctypeStr);
|
||||
aForm->GetAttr(nsGkAtoms::enctype, enctypeStr);
|
||||
}
|
||||
|
||||
SendJSWarning(doc, "ForgotPostWarning", args);
|
||||
|
|
|
@ -243,7 +243,7 @@ already_AddRefed<nsIPrincipal>
|
|||
HTMLIFrameElement::GetFeaturePolicyDefaultOrigin() const {
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc)) {
|
||||
if (HasAttr(nsGkAtoms::srcdoc)) {
|
||||
principal = NodePrincipal();
|
||||
return principal.forget();
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLImageElement,
|
|||
NS_IMPL_ELEMENT_CLONE(HTMLImageElement)
|
||||
|
||||
bool HTMLImageElement::IsInteractiveHTMLContent() const {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::usemap) ||
|
||||
return HasAttr(nsGkAtoms::usemap) ||
|
||||
nsGenericHTMLElement::IsInteractiveHTMLContent();
|
||||
}
|
||||
|
||||
|
@ -616,8 +616,8 @@ void HTMLImageElement::UpdateFormOwner() {
|
|||
if (mForm && !HasFlag(ADDED_TO_FORM)) {
|
||||
// Now we need to add ourselves to the form
|
||||
nsAutoString nameVal, idVal;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, nameVal);
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, idVal);
|
||||
GetAttr(nsGkAtoms::name, nameVal);
|
||||
GetAttr(nsGkAtoms::id, idVal);
|
||||
|
||||
SetFlags(ADDED_TO_FORM);
|
||||
|
||||
|
@ -1154,7 +1154,7 @@ bool HTMLImageElement::SourceElementMatches(Element* aSourceElement) {
|
|||
}
|
||||
|
||||
nsAutoString type;
|
||||
if (src->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) &&
|
||||
if (src->GetAttr(nsGkAtoms::type, type) &&
|
||||
!SupportedPictureSourceType(type)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -562,7 +562,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(
|
|||
new DispatchChangeEventCallback(mInput);
|
||||
|
||||
if (StaticPrefs::dom_webkitBlink_dirPicker_enabled() &&
|
||||
mInput->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
|
||||
mInput->HasAttr(nsGkAtoms::webkitdirectory)) {
|
||||
ErrorResult error;
|
||||
GetFilesHelper* helper = mInput->GetOrCreateGetFilesHelper(true, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
|
@ -1190,7 +1190,7 @@ void HTMLInputElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
if (container && ((aValue && !HasAttr(aNameSpaceID, aName)) ||
|
||||
(!aValue && HasAttr(aNameSpaceID, aName)))) {
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
container->RadioRequiredWillChange(name, !!aValue);
|
||||
}
|
||||
}
|
||||
|
@ -1416,7 +1416,7 @@ void HTMLInputElement::ResultForDialogSubmit(nsAString& aResult) {
|
|||
aResult.AppendLiteral(",");
|
||||
aResult.AppendInt(y);
|
||||
} else {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::value, aResult);
|
||||
GetAttr(nsGkAtoms::value, aResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1557,12 +1557,12 @@ void HTMLInputElement::GetNonFileValueInternal(nsAString& aValue) const {
|
|||
|
||||
case VALUE_MODE_DEFAULT:
|
||||
// Treat defaultValue as value.
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue);
|
||||
GetAttr(nsGkAtoms::value, aValue);
|
||||
return;
|
||||
|
||||
case VALUE_MODE_DEFAULT_ON:
|
||||
// Treat default value as value and returns "on" if no value.
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue)) {
|
||||
if (!GetAttr(nsGkAtoms::value, aValue)) {
|
||||
aValue.AssignLiteral("on");
|
||||
}
|
||||
return;
|
||||
|
@ -1666,7 +1666,7 @@ void HTMLInputElement::SetValue(const nsAString& aValue, CallerType aCallerType,
|
|||
|
||||
HTMLDataListElement* HTMLInputElement::GetList() const {
|
||||
nsAutoString dataListId;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::list_, dataListId);
|
||||
GetAttr(nsGkAtoms::list_, dataListId);
|
||||
if (dataListId.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1865,12 +1865,12 @@ Decimal HTMLInputElement::GetMinimum() const {
|
|||
Decimal defaultMinimum =
|
||||
mType == FormControlType::InputRange ? Decimal(0) : Decimal::nan();
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::min)) {
|
||||
if (!HasAttr(nsGkAtoms::min)) {
|
||||
return defaultMinimum;
|
||||
}
|
||||
|
||||
nsAutoString minStr;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
|
||||
GetAttr(nsGkAtoms::min, minStr);
|
||||
|
||||
Decimal min;
|
||||
return mInputType->ConvertStringToNumber(minStr, min) ? min : defaultMinimum;
|
||||
|
@ -1885,12 +1885,12 @@ Decimal HTMLInputElement::GetMaximum() const {
|
|||
Decimal defaultMaximum =
|
||||
mType == FormControlType::InputRange ? Decimal(100) : Decimal::nan();
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::max)) {
|
||||
if (!HasAttr(nsGkAtoms::max)) {
|
||||
return defaultMaximum;
|
||||
}
|
||||
|
||||
nsAutoString maxStr;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
|
||||
GetAttr(nsGkAtoms::max, maxStr);
|
||||
|
||||
Decimal max;
|
||||
return mInputType->ConvertStringToNumber(maxStr, max) ? max : defaultMaximum;
|
||||
|
@ -1907,14 +1907,14 @@ Decimal HTMLInputElement::GetStepBase() const {
|
|||
// Do NOT use GetMinimum here - the spec says to use "the min content
|
||||
// attribute", not "the minimum".
|
||||
nsAutoString minStr;
|
||||
if (GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr) &&
|
||||
if (GetAttr(nsGkAtoms::min, minStr) &&
|
||||
mInputType->ConvertStringToNumber(minStr, stepBase)) {
|
||||
return stepBase;
|
||||
}
|
||||
|
||||
// If @min is not a double, we should use @value.
|
||||
nsAutoString valueStr;
|
||||
if (GetAttr(kNameSpaceID_None, nsGkAtoms::value, valueStr) &&
|
||||
if (GetAttr(nsGkAtoms::value, valueStr) &&
|
||||
mInputType->ConvertStringToNumber(valueStr, stepBase)) {
|
||||
return stepBase;
|
||||
}
|
||||
|
@ -2409,11 +2409,11 @@ void HTMLInputElement::GetDisplayFileName(nsAString& aValue) const {
|
|||
|
||||
if (mFileData->mFilesOrDirectories.IsEmpty()) {
|
||||
if (StaticPrefs::dom_webkitBlink_dirPicker_enabled() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
|
||||
HasAttr(nsGkAtoms::webkitdirectory)) {
|
||||
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"NoDirSelected", OwnerDoc(),
|
||||
value);
|
||||
} else if (HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
|
||||
} else if (HasAttr(nsGkAtoms::multiple)) {
|
||||
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"NoFilesSelected", OwnerDoc(),
|
||||
value);
|
||||
|
@ -2501,7 +2501,7 @@ void HTMLInputElement::MozSetDndFilesAndDirectories(
|
|||
new DispatchChangeEventCallback(this);
|
||||
|
||||
if (StaticPrefs::dom_webkitBlink_dirPicker_enabled() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
|
||||
HasAttr(nsGkAtoms::webkitdirectory)) {
|
||||
ErrorResult rv;
|
||||
GetFilesHelper* helper =
|
||||
GetOrCreateGetFilesHelper(true /* recursionFlag */, rv);
|
||||
|
@ -2833,7 +2833,7 @@ void HTMLInputElement::DoSetChecked(bool aChecked, bool aNotify,
|
|||
nsIRadioGroupContainer* container = GetRadioGroupContainer();
|
||||
if (container) {
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
container->SetCurrentRadioButton(name, nullptr);
|
||||
}
|
||||
// SetCheckedInternal is going to ask all radios to update their
|
||||
|
@ -2857,7 +2857,7 @@ void HTMLInputElement::RadioSetChecked(bool aNotify) {
|
|||
nsIRadioGroupContainer* container = GetRadioGroupContainer();
|
||||
if (container) {
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
container->SetCurrentRadioButton(name, this);
|
||||
}
|
||||
|
||||
|
@ -2872,7 +2872,7 @@ nsIRadioGroupContainer* HTMLInputElement::GetRadioGroupContainer() const {
|
|||
"GetRadioGroupContainer should only be called when type='radio'");
|
||||
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
|
||||
if (name.IsEmpty()) {
|
||||
return nullptr;
|
||||
|
@ -2903,7 +2903,7 @@ HTMLInputElement* HTMLInputElement::GetSelectedRadioButton() const {
|
|||
}
|
||||
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
|
||||
HTMLInputElement* selected = container->GetCurrentRadioButton(name);
|
||||
return selected;
|
||||
|
@ -3508,7 +3508,7 @@ nsresult HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor) {
|
|||
nsIContent::FromEventTargetOrNull(aVisitor.mEvent->mOriginalTarget);
|
||||
if (target && target->FindFirstNonChromeOnlyAccessContent() == this &&
|
||||
StaticPrefs::dom_webkitBlink_dirPicker_enabled() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
|
||||
HasAttr(nsGkAtoms::webkitdirectory)) {
|
||||
type = FILE_PICKER_DIRECTORY;
|
||||
}
|
||||
return InitFilePicker(type);
|
||||
|
@ -4065,7 +4065,7 @@ nsresult HTMLInputElement::MaybeHandleRadioButtonNavigation(
|
|||
RefPtr<HTMLInputElement> selectedRadioButton;
|
||||
if (nsIRadioGroupContainer* container = GetRadioGroupContainer()) {
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
container->GetNextRadioButton(name, move == RadioButtonMove::Back, this,
|
||||
getter_AddRefs(selectedRadioButton));
|
||||
}
|
||||
|
@ -4184,8 +4184,7 @@ void HTMLInputElement::MaybeLoadImage() {
|
|||
// Our base URI may have changed; claim that our URI changed, and the
|
||||
// nsImageLoadingContent will decide whether a new image load is warranted.
|
||||
nsAutoString uri;
|
||||
if (mType == FormControlType::InputImage &&
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::src, uri) &&
|
||||
if (mType == FormControlType::InputImage && GetAttr(nsGkAtoms::src, uri) &&
|
||||
(NS_FAILED(LoadImage(uri, false, true, eImageLoadType_Normal,
|
||||
mSrcTriggeringPrincipal)) ||
|
||||
!LoadingEnabled())) {
|
||||
|
@ -4203,7 +4202,7 @@ nsresult HTMLInputElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
|||
if (mType == FormControlType::InputImage) {
|
||||
// Our base URI may have changed; claim that our URI changed, and the
|
||||
// nsImageLoadingContent will decide whether a new image load is warranted.
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
|
||||
if (HasAttr(nsGkAtoms::src)) {
|
||||
// Mark channel as urgent-start before load image if the image load is
|
||||
// initaiated by a user interaction.
|
||||
mUseUrgentStartForChannel = UserActivation::IsHandlingUserInput();
|
||||
|
@ -4442,7 +4441,7 @@ void HTMLInputElement::HandleTypeChange(FormControlType aNewType,
|
|||
// Update or clear our required states since we may have changed from a
|
||||
// required input type to a non-required input type or viceversa.
|
||||
if (DoesRequiredApply()) {
|
||||
bool isRequired = HasAttr(kNameSpaceID_None, nsGkAtoms::required);
|
||||
bool isRequired = HasAttr(nsGkAtoms::required);
|
||||
UpdateRequiredState(isRequired, aNotify);
|
||||
} else if (aNotify) {
|
||||
RemoveStates(ElementState::REQUIRED_STATES);
|
||||
|
@ -5763,7 +5762,7 @@ HTMLInputElement::SubmitNamesValues(FormData* aFormData) {
|
|||
|
||||
// Get the name
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
|
||||
// Submit .x, .y for input type=image
|
||||
if (mType == FormControlType::InputImage) {
|
||||
|
@ -5852,7 +5851,7 @@ HTMLInputElement::SubmitNamesValues(FormData* aFormData) {
|
|||
GetValue(value, CallerType::System);
|
||||
|
||||
if (mType == FormControlType::InputSubmit && value.IsEmpty() &&
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
|
||||
!HasAttr(nsGkAtoms::value)) {
|
||||
// Get our default value, which is the same as our default label
|
||||
nsAutoString defaultValue;
|
||||
nsContentUtils::GetMaybeLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
|
@ -5956,7 +5955,7 @@ void HTMLInputElement::SaveState() {
|
|||
if (state) {
|
||||
// We do not want to save the real disabled state but the disabled
|
||||
// attribute.
|
||||
state->disabled() = HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
|
||||
state->disabled() = HasAttr(nsGkAtoms::disabled);
|
||||
state->disabledSet() = true;
|
||||
}
|
||||
}
|
||||
|
@ -6226,7 +6225,7 @@ void HTMLInputElement::AddedToRadioGroup() {
|
|||
nsCOMPtr<nsIRadioGroupContainer> container = GetRadioGroupContainer();
|
||||
if (container) {
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
container->AddToRadioGroup(name, this);
|
||||
|
||||
// We initialize the validity of the element to the validity of the group
|
||||
|
@ -6243,7 +6242,7 @@ void HTMLInputElement::WillRemoveFromRadioGroup() {
|
|||
}
|
||||
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
|
||||
// If this button was checked, we need to notify the group that there is no
|
||||
// longer a selected radio button
|
||||
|
@ -6322,7 +6321,7 @@ bool HTMLInputElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
|||
}
|
||||
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
|
||||
if (container->GetCurrentRadioButton(name)) {
|
||||
*aTabIndex = -1;
|
||||
|
@ -6335,7 +6334,7 @@ nsresult HTMLInputElement::VisitGroup(nsIRadioVisitor* aVisitor) {
|
|||
nsIRadioGroupContainer* container = GetRadioGroupContainer();
|
||||
if (container) {
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
return container->WalkRadioGroup(name, aVisitor);
|
||||
}
|
||||
|
||||
|
@ -6383,8 +6382,8 @@ HTMLInputElement::ValueModeType HTMLInputElement::GetValueMode() const {
|
|||
}
|
||||
|
||||
bool HTMLInputElement::IsMutable() const {
|
||||
return !IsDisabled() && !(DoesReadOnlyApply() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::readonly));
|
||||
return !IsDisabled() &&
|
||||
!(DoesReadOnlyApply() && HasAttr(nsGkAtoms::readonly));
|
||||
}
|
||||
|
||||
bool HTMLInputElement::DoesRequiredApply() const {
|
||||
|
@ -6509,12 +6508,12 @@ bool HTMLInputElement::DoesAutocompleteApply() const {
|
|||
Decimal HTMLInputElement::GetStep() const {
|
||||
MOZ_ASSERT(DoesStepApply(), "GetStep() can only be called if @step applies");
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::step)) {
|
||||
if (!HasAttr(nsGkAtoms::step)) {
|
||||
return GetDefaultStep() * GetStepScaleFactor();
|
||||
}
|
||||
|
||||
nsAutoString stepStr;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::step, stepStr);
|
||||
GetAttr(nsGkAtoms::step, stepStr);
|
||||
|
||||
if (stepStr.LowerCaseEqualsLiteral("any")) {
|
||||
// The element can't suffer from step mismatch if there is no step.
|
||||
|
@ -6628,7 +6627,7 @@ void HTMLInputElement::UpdateValueMissingValidityStateForRadio(
|
|||
nsCOMPtr<nsIRadioGroupContainer> container = GetRadioGroupContainer();
|
||||
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
|
||||
if (!container) {
|
||||
// As per the spec, a radio button not within a radio button group cannot
|
||||
|
@ -6724,8 +6723,7 @@ void HTMLInputElement::UpdateBarredFromConstraintValidation() {
|
|||
SetBarredFromConstraintValidation(
|
||||
mType == FormControlType::InputHidden ||
|
||||
mType == FormControlType::InputButton ||
|
||||
mType == FormControlType::InputReset ||
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::readonly) ||
|
||||
mType == FormControlType::InputReset || HasAttr(nsGkAtoms::readonly) ||
|
||||
HasFlag(ELEMENT_IS_DATALIST_OR_HAS_DATALIST_ANCESTOR) || IsDisabled());
|
||||
}
|
||||
|
||||
|
@ -6878,7 +6876,7 @@ void HTMLInputElement::SetFilePickerFiltersFromAccept(
|
|||
// We always add |filterAll|
|
||||
filePicker->AppendFilters(nsIFilePicker::filterAll);
|
||||
|
||||
NS_ASSERTION(HasAttr(kNameSpaceID_None, nsGkAtoms::accept),
|
||||
NS_ASSERTION(HasAttr(nsGkAtoms::accept),
|
||||
"You should not call SetFilePickerFiltersFromAccept if the"
|
||||
" element has no accept attribute!");
|
||||
|
||||
|
@ -6902,7 +6900,7 @@ void HTMLInputElement::SetFilePickerFiltersFromAccept(
|
|||
}
|
||||
|
||||
nsAutoString accept;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::accept, accept);
|
||||
GetAttr(nsGkAtoms::accept, accept);
|
||||
|
||||
HTMLSplitOnSpacesTokenizer tokenizer(accept, ',');
|
||||
|
||||
|
|
|
@ -462,9 +462,7 @@ class HTMLInputElement final : public TextControlElement,
|
|||
SetHTMLAttr(nsGkAtoms::capture, aValue, aRv);
|
||||
}
|
||||
|
||||
bool DefaultChecked() const {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::checked);
|
||||
}
|
||||
bool DefaultChecked() const { return HasAttr(nsGkAtoms::checked); }
|
||||
|
||||
void SetDefaultChecked(bool aValue, ErrorResult& aRv) {
|
||||
SetHTMLBoolAttr(nsGkAtoms::checked, aValue, aRv);
|
||||
|
@ -709,7 +707,7 @@ class HTMLInputElement final : public TextControlElement,
|
|||
void ShowPicker(ErrorResult& aRv);
|
||||
|
||||
bool WebkitDirectoryAttr() const {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory);
|
||||
return HasAttr(nsGkAtoms::webkitdirectory);
|
||||
}
|
||||
|
||||
void SetWebkitDirectoryAttr(bool aValue, ErrorResult& aRv) {
|
||||
|
|
|
@ -205,7 +205,7 @@ Result<bool, nsresult> HTMLLabelElement::PerformAccesskey(
|
|||
nsGenericHTMLElement* HTMLLabelElement::GetLabeledElement() const {
|
||||
nsAutoString elementId;
|
||||
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::_for, elementId)) {
|
||||
if (!GetAttr(nsGkAtoms::_for, elementId)) {
|
||||
// No @for, so we are a label for our first form control element.
|
||||
// Do a depth-first traversal to look for the first form control element.
|
||||
return GetFirstLabelableDescendant();
|
||||
|
|
|
@ -341,7 +341,7 @@ nsDOMTokenList* HTMLLinkElement::RelList() {
|
|||
|
||||
Maybe<LinkStyle::SheetInfo> HTMLLinkElement::GetStyleSheetInfo() {
|
||||
nsAutoString rel;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::rel, rel);
|
||||
GetAttr(nsGkAtoms::rel, rel);
|
||||
uint32_t linkTypes = ParseLinkTypes(rel);
|
||||
if (!(linkTypes & eSTYLESHEET)) {
|
||||
return Nothing();
|
||||
|
@ -419,16 +419,16 @@ void HTMLLinkElement::GetContentPolicyMimeTypeMedia(
|
|||
nsAttrValue& aAsAttr, nsContentPolicyType& aPolicyType, nsString& aMimeType,
|
||||
nsAString& aMedia) {
|
||||
nsAutoString as;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::as, as);
|
||||
GetAttr(nsGkAtoms::as, as);
|
||||
net::ParseAsValue(as, aAsAttr);
|
||||
aPolicyType = net::AsValueToContentPolicy(aAsAttr);
|
||||
|
||||
nsAutoString type;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
||||
GetAttr(nsGkAtoms::type, type);
|
||||
nsAutoString notUsed;
|
||||
nsContentUtils::SplitMimeType(type, aMimeType, notUsed);
|
||||
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
|
||||
GetAttr(nsGkAtoms::media, aMedia);
|
||||
}
|
||||
|
||||
void HTMLLinkElement::
|
||||
|
@ -693,7 +693,7 @@ bool HTMLLinkElement::IsCSSMimeTypeAttributeForLinkElement(
|
|||
nsAutoString type;
|
||||
nsAutoString mimeType;
|
||||
nsAutoString notUsed;
|
||||
aSelf.GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
||||
aSelf.GetAttr(nsGkAtoms::type, type);
|
||||
nsContentUtils::SplitMimeType(type, mimeType, notUsed);
|
||||
return mimeType.IsEmpty() || mimeType.LowerCaseEqualsLiteral("text/css");
|
||||
}
|
||||
|
|
|
@ -1612,7 +1612,7 @@ class HTMLMediaElement::AudioChannelAgentCallback final
|
|||
}
|
||||
|
||||
// A loop always is playing
|
||||
if (mOwner->HasAttr(kNameSpaceID_None, nsGkAtoms::loop)) {
|
||||
if (mOwner->HasAttr(nsGkAtoms::loop)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2468,10 +2468,9 @@ void HTMLMediaElement::Load() {
|
|||
"handlingInput=%d hasAutoplayAttr=%d AllowedToPlay=%d "
|
||||
"ownerDoc=%p (%s) ownerDocUserActivated=%d "
|
||||
"muted=%d volume=%f",
|
||||
this, !!mSrcAttrStream, HasAttr(kNameSpaceID_None, nsGkAtoms::src),
|
||||
HasSourceChildren(this), UserActivation::IsHandlingUserInput(),
|
||||
HasAttr(nsGkAtoms::autoplay), AllowedToPlay(), OwnerDoc(),
|
||||
DocumentOrigin(OwnerDoc()).get(),
|
||||
this, !!mSrcAttrStream, HasAttr(nsGkAtoms::src), HasSourceChildren(this),
|
||||
UserActivation::IsHandlingUserInput(), HasAttr(nsGkAtoms::autoplay),
|
||||
AllowedToPlay(), OwnerDoc(), DocumentOrigin(OwnerDoc()).get(),
|
||||
OwnerDoc()->HasBeenUserGestureActivated(), mMuted, mVolume));
|
||||
|
||||
if (mIsRunningLoadMethod) {
|
||||
|
@ -2547,8 +2546,7 @@ void HTMLMediaElement::SelectResourceWrapper() {
|
|||
}
|
||||
|
||||
void HTMLMediaElement::SelectResource() {
|
||||
if (!mSrcAttrStream && !HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
|
||||
!HasSourceChildren(this)) {
|
||||
if (!mSrcAttrStream && !HasAttr(nsGkAtoms::src) && !HasSourceChildren(this)) {
|
||||
// The media element has neither a src attribute nor any source
|
||||
// element children, abort the load.
|
||||
ChangeNetworkState(NETWORK_EMPTY);
|
||||
|
@ -2571,7 +2569,7 @@ void HTMLMediaElement::SelectResource() {
|
|||
nsAutoString src;
|
||||
if (mSrcAttrStream) {
|
||||
SetupSrcMediaStreamPlayback(mSrcAttrStream);
|
||||
} else if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
|
||||
} else if (GetAttr(nsGkAtoms::src, src)) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
MediaResult rv = NewURIFromString(src, getter_AddRefs(uri));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -2796,7 +2794,7 @@ void HTMLMediaElement::LoadFromSourceChildren() {
|
|||
|
||||
// Must have src attribute.
|
||||
nsAutoString src;
|
||||
if (!child->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
|
||||
if (!child->GetAttr(nsGkAtoms::src, src)) {
|
||||
ReportLoadError("MediaLoadSourceMissingSrc");
|
||||
DealWithFailedElement(child);
|
||||
return;
|
||||
|
@ -2804,8 +2802,7 @@ void HTMLMediaElement::LoadFromSourceChildren() {
|
|||
|
||||
// If we have a type attribute, it must be a supported type.
|
||||
nsAutoString type;
|
||||
if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) &&
|
||||
!type.IsEmpty()) {
|
||||
if (child->GetAttr(nsGkAtoms::type, type) && !type.IsEmpty()) {
|
||||
DecoderDoctorDiagnostics diagnostics;
|
||||
CanPlayStatus canPlay = GetCanPlay(type, &diagnostics);
|
||||
diagnostics.StoreFormatDiagnostics(OwnerDoc(), type,
|
||||
|
@ -3026,7 +3023,7 @@ MediaResult HTMLMediaElement::LoadResource() {
|
|||
this, this, mMuted ? 0.0 : mVolume, mPreservesPitch,
|
||||
ClampPlaybackRate(mPlaybackRate),
|
||||
mPreloadAction == HTMLMediaElement::PRELOAD_METADATA, mHasSuspendTaint,
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::loop),
|
||||
HasAttr(nsGkAtoms::loop),
|
||||
MediaContainerType(MEDIAMIMETYPE("application/x.mediasource")));
|
||||
|
||||
RefPtr<MediaSourceDecoder> decoder = new MediaSourceDecoder(decoderInit);
|
||||
|
@ -4716,7 +4713,7 @@ bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
|||
}
|
||||
|
||||
void HTMLMediaElement::DoneCreatingElement() {
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::muted)) {
|
||||
if (HasAttr(nsGkAtoms::muted)) {
|
||||
mMuted |= MUTED_BY_CONTENT;
|
||||
}
|
||||
}
|
||||
|
@ -4937,7 +4934,7 @@ nsresult HTMLMediaElement::InitializeDecoderAsClone(
|
|||
this, this, mMuted ? 0.0 : mVolume, mPreservesPitch,
|
||||
ClampPlaybackRate(mPlaybackRate),
|
||||
mPreloadAction == HTMLMediaElement::PRELOAD_METADATA, mHasSuspendTaint,
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::loop), aOriginal->ContainerType());
|
||||
HasAttr(nsGkAtoms::loop), aOriginal->ContainerType());
|
||||
|
||||
RefPtr<ChannelMediaDecoder> decoder = aOriginal->Clone(decoderInit);
|
||||
if (!decoder) return NS_ERROR_FAILURE;
|
||||
|
@ -5014,7 +5011,7 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(
|
|||
this, this, mMuted ? 0.0 : mVolume, mPreservesPitch,
|
||||
ClampPlaybackRate(mPlaybackRate),
|
||||
mPreloadAction == HTMLMediaElement::PRELOAD_METADATA, mHasSuspendTaint,
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::loop), *containerType);
|
||||
HasAttr(nsGkAtoms::loop), *containerType);
|
||||
|
||||
#ifdef MOZ_ANDROID_HLS_SUPPORT
|
||||
if (HLSDecoder::IsSupportedType(*containerType)) {
|
||||
|
@ -5454,7 +5451,7 @@ void HTMLMediaElement::FirstFrameLoaded() {
|
|||
ChangeDelayLoadStatus(false);
|
||||
|
||||
if (mDecoder && mAllowSuspendAfterFirstFrame && mPaused &&
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay) &&
|
||||
!HasAttr(nsGkAtoms::autoplay) &&
|
||||
mPreloadAction == HTMLMediaElement::PRELOAD_METADATA) {
|
||||
mSuspendedAfterFirstFrame = true;
|
||||
mDecoder->Suspend();
|
||||
|
@ -5532,7 +5529,7 @@ void HTMLMediaElement::PlaybackEnded() {
|
|||
// mediacapture-main:
|
||||
// Setting the loop attribute has no effect since a MediaStream has no
|
||||
// defined end and therefore cannot be looped.
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::loop)) {
|
||||
if (HasAttr(nsGkAtoms::loop)) {
|
||||
SetCurrentTime(0);
|
||||
return;
|
||||
}
|
||||
|
@ -6046,7 +6043,7 @@ bool HTMLMediaElement::IsEligibleForAutoplay() {
|
|||
// download is controlled by the script and there is no way to evaluate
|
||||
// MediaDecoder::CanPlayThrough().
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay)) {
|
||||
if (!HasAttr(nsGkAtoms::autoplay)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -6547,8 +6544,7 @@ void HTMLMediaElement::NotifyAddedSource() {
|
|||
// that has no src attribute and whose networkState has the value
|
||||
// NETWORK_EMPTY, the user agent must invoke the media element's
|
||||
// resource selection algorithm.
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
|
||||
mNetworkState == NETWORK_EMPTY) {
|
||||
if (!HasAttr(nsGkAtoms::src) && mNetworkState == NETWORK_EMPTY) {
|
||||
AssertReadyStateIsNothing();
|
||||
QueueSelectResourceTask();
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ void HTMLOptionElement::OptGroupDisabledChanged(bool aNotify) {
|
|||
}
|
||||
|
||||
void HTMLOptionElement::UpdateDisabledState(bool aNotify) {
|
||||
bool isDisabled = HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
|
||||
bool isDisabled = HasAttr(nsGkAtoms::disabled);
|
||||
|
||||
if (!isDisabled) {
|
||||
nsIContent* parent = GetParent();
|
||||
|
|
|
@ -80,14 +80,13 @@ class HTMLOptionElement final : public nsGenericHTMLElement {
|
|||
HTMLFormElement* GetForm();
|
||||
|
||||
void GetRenderedLabel(nsAString& aLabel) {
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::label, aLabel) ||
|
||||
aLabel.IsEmpty()) {
|
||||
if (!GetAttr(nsGkAtoms::label, aLabel) || aLabel.IsEmpty()) {
|
||||
GetText(aLabel);
|
||||
}
|
||||
}
|
||||
|
||||
void GetLabel(nsAString& aLabel) {
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::label, aLabel)) {
|
||||
if (!GetAttr(nsGkAtoms::label, aLabel)) {
|
||||
GetText(aLabel);
|
||||
}
|
||||
}
|
||||
|
@ -95,15 +94,13 @@ class HTMLOptionElement final : public nsGenericHTMLElement {
|
|||
SetHTMLAttr(nsGkAtoms::label, aLabel, aError);
|
||||
}
|
||||
|
||||
bool DefaultSelected() const {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::selected);
|
||||
}
|
||||
bool DefaultSelected() const { return HasAttr(nsGkAtoms::selected); }
|
||||
void SetDefaultSelected(bool aValue, ErrorResult& aRv) {
|
||||
SetHTMLBoolAttr(nsGkAtoms::selected, aValue, aRv);
|
||||
}
|
||||
|
||||
void GetValue(nsAString& aValue) {
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue)) {
|
||||
if (!GetAttr(nsGkAtoms::value, aValue)) {
|
||||
GetText(aValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ void HTMLScriptElement::FreezeExecutionAttrs(Document* aOwnerDoc) {
|
|||
// need to be transfered when modifying. Note that we don't use GetSrc here
|
||||
// because it will return the base URL when the attr value is "".
|
||||
nsAutoString src;
|
||||
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src)) {
|
||||
if (GetAttr(nsGkAtoms::src, src)) {
|
||||
// Empty src should be treated as invalid URL.
|
||||
if (!src.IsEmpty()) {
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(mUri), src,
|
||||
|
@ -227,7 +227,7 @@ mozilla::dom::ReferrerPolicy HTMLScriptElement::GetReferrerPolicy() {
|
|||
}
|
||||
|
||||
bool HTMLScriptElement::HasScriptContent() {
|
||||
return (mFrozen ? mExternal : HasAttr(kNameSpaceID_None, nsGkAtoms::src)) ||
|
||||
return (mFrozen ? mExternal : HasAttr(nsGkAtoms::src)) ||
|
||||
nsContentUtils::HasNonEmptyTextContent(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ void HTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
|
|||
RefPtr<HTMLOptionElement> option = Item(i);
|
||||
if (option && option->Selected()) {
|
||||
// Clear all other options
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
|
||||
if (!HasAttr(nsGkAtoms::multiple)) {
|
||||
OptionFlags mask{OptionFlag::IsSelected, OptionFlag::ClearAll,
|
||||
OptionFlag::SetDisabled, OptionFlag::Notify,
|
||||
OptionFlag::InsertingOptions};
|
||||
|
@ -560,7 +560,7 @@ void HTMLSelectElement::Remove(int32_t aIndex) const {
|
|||
}
|
||||
|
||||
void HTMLSelectElement::GetType(nsAString& aType) {
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
|
||||
if (HasAttr(nsGkAtoms::multiple)) {
|
||||
aType.AssignLiteral("select-multiple");
|
||||
} else {
|
||||
aType.AssignLiteral("select-one");
|
||||
|
@ -1297,7 +1297,7 @@ void HTMLSelectElement::SaveState() {
|
|||
if (mDisabledChanged) {
|
||||
// We do not want to save the real disabled state but the disabled
|
||||
// attribute.
|
||||
presState->disabled() = HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
|
||||
presState->disabled() = HasAttr(nsGkAtoms::disabled);
|
||||
presState->disabledSet() = true;
|
||||
}
|
||||
}
|
||||
|
@ -1415,7 +1415,7 @@ HTMLSelectElement::SubmitNamesValues(FormData* aFormData) {
|
|||
// Get the name (if no name, no submit)
|
||||
//
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
if (name.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ static void SetBaseURIUsingFirstBaseWithHref(Document* aDocument,
|
|||
for (nsIContent* child = aDocument->GetFirstChild(); child;
|
||||
child = child->GetNextNode()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::base) &&
|
||||
child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
child->AsElement()->HasAttr(nsGkAtoms::href)) {
|
||||
if (aMustMatch && child != aMustMatch) {
|
||||
return;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ static void SetBaseURIUsingFirstBaseWithHref(Document* aDocument,
|
|||
// Resolve the <base> element's href relative to our document's
|
||||
// fallback base URI.
|
||||
nsAutoString href;
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
child->AsElement()->GetAttr(nsGkAtoms::href, href);
|
||||
|
||||
nsCOMPtr<nsIURI> newBaseURI;
|
||||
nsContentUtils::NewURIWithDocumentCharset(
|
||||
|
@ -117,13 +117,13 @@ static void SetBaseTargetUsingFirstBaseWithTarget(Document* aDocument,
|
|||
for (nsIContent* child = aDocument->GetFirstChild(); child;
|
||||
child = child->GetNextNode()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::base) &&
|
||||
child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
||||
child->AsElement()->HasAttr(nsGkAtoms::target)) {
|
||||
if (aMustMatch && child != aMustMatch) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsString target;
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::target, target);
|
||||
child->AsElement()->GetAttr(nsGkAtoms::target, target);
|
||||
aDocument->SetBaseTarget(target);
|
||||
return;
|
||||
}
|
||||
|
@ -170,10 +170,10 @@ nsresult HTMLSharedElement::BindToTree(BindContext& aContext,
|
|||
// The document stores a pointer to its base URI and base target, which we may
|
||||
// need to update here.
|
||||
if (mNodeInfo->Equals(nsGkAtoms::base) && IsInUncomposedDoc()) {
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
if (HasAttr(nsGkAtoms::href)) {
|
||||
SetBaseURIUsingFirstBaseWithHref(&aContext.OwnerDoc(), this);
|
||||
}
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
||||
if (HasAttr(nsGkAtoms::target)) {
|
||||
SetBaseTargetUsingFirstBaseWithTarget(&aContext.OwnerDoc(), this);
|
||||
}
|
||||
}
|
||||
|
@ -189,10 +189,10 @@ void HTMLSharedElement::UnbindFromTree(bool aNullParent) {
|
|||
// If we're removing a <base> from a document, we may need to update the
|
||||
// document's base URI and base target
|
||||
if (doc && mNodeInfo->Equals(nsGkAtoms::base)) {
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
if (HasAttr(nsGkAtoms::href)) {
|
||||
SetBaseURIUsingFirstBaseWithHref(doc, nullptr);
|
||||
}
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
||||
if (HasAttr(nsGkAtoms::target)) {
|
||||
SetBaseTargetUsingFirstBaseWithTarget(doc, nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ HTMLTableCellElement::GetMappedAttributesInheritedFromTable() const {
|
|||
}
|
||||
|
||||
void HTMLTableCellElement::GetAlign(DOMString& aValue) {
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::align, aValue)) {
|
||||
if (!GetAttr(nsGkAtoms::align, aValue)) {
|
||||
// There's no align attribute, ask the row for the alignment.
|
||||
HTMLTableRowElement* row = GetRow();
|
||||
if (row) {
|
||||
|
|
|
@ -675,7 +675,7 @@ HTMLTextAreaElement::SubmitNamesValues(FormData* aFormData) {
|
|||
// Get the name (if no name, no submit)
|
||||
//
|
||||
nsAutoString name;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
GetAttr(nsGkAtoms::name, name);
|
||||
if (name.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ void HTMLTextAreaElement::SaveState() {
|
|||
if (state) {
|
||||
// We do not want to save the real disabled state but the disabled
|
||||
// attribute.
|
||||
state->disabled() = HasAttr(kNameSpaceID_None, nsGkAtoms::disabled);
|
||||
state->disabled() = HasAttr(nsGkAtoms::disabled);
|
||||
state->disabledSet() = true;
|
||||
}
|
||||
}
|
||||
|
@ -1025,7 +1025,7 @@ void HTMLTextAreaElement::UpdateValueMissingValidityState() {
|
|||
|
||||
void HTMLTextAreaElement::UpdateBarredFromConstraintValidation() {
|
||||
SetBarredFromConstraintValidation(
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::readonly) ||
|
||||
HasAttr(nsGkAtoms::readonly) ||
|
||||
HasFlag(ELEMENT_IS_DATALIST_OR_HAS_DATALIST_ANCESTOR) || IsDisabled());
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ void HTMLTrackElement::SetSrc(const nsAString& aSrc, ErrorResult& aError) {
|
|||
LOG("Set src=%s", NS_ConvertUTF16toUTF8(aSrc).get());
|
||||
|
||||
nsAutoString src;
|
||||
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src) && src == aSrc) {
|
||||
if (GetAttr(nsGkAtoms::src, src) && src == aSrc) {
|
||||
LOG("No need to reload for same src url");
|
||||
return;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void HTMLTrackElement::LoadResource(RefPtr<WebVTTListener>&& aWebVTTListener) {
|
|||
mLoadResourceDispatched = false;
|
||||
|
||||
nsAutoString src;
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::src, src) || src.IsEmpty()) {
|
||||
if (!GetAttr(nsGkAtoms::src, src) || src.IsEmpty()) {
|
||||
LOG("Fail to load because no src");
|
||||
SetReadyState(TextTrackReadyState::FailedToLoad);
|
||||
return;
|
||||
|
|
|
@ -214,7 +214,7 @@ nsresult HTMLVideoElement::SetAcceptHeader(nsIHttpChannel* aChannel) {
|
|||
}
|
||||
|
||||
bool HTMLVideoElement::IsInteractiveHTMLContent() const {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::controls) ||
|
||||
return HasAttr(nsGkAtoms::controls) ||
|
||||
HTMLMediaElement::IsInteractiveHTMLContent();
|
||||
}
|
||||
|
||||
|
|
|
@ -1889,8 +1889,8 @@ nsresult TextControlState::PrepareEditor(const nsAString* aValue) {
|
|||
// Check if the readonly attribute is set.
|
||||
//
|
||||
// TODO: Should probably call IsDisabled(), as it is cheaper.
|
||||
if (mTextCtrlElement->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly) ||
|
||||
mTextCtrlElement->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) {
|
||||
if (mTextCtrlElement->HasAttr(nsGkAtoms::readonly) ||
|
||||
mTextCtrlElement->HasAttr(nsGkAtoms::disabled)) {
|
||||
editorFlags |= nsIEditor::eEditorReadonlyMask;
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ nsresult NumberInputType::GetBadInputMessage(nsAString& aMessage) {
|
|||
|
||||
bool NumberInputType::IsMutable() const {
|
||||
return !mInputElement->IsDisabled() &&
|
||||
!mInputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly);
|
||||
!mInputElement->HasAttr(nsGkAtoms::readonly);
|
||||
}
|
||||
|
||||
/* input type=range */
|
||||
|
|
|
@ -22,7 +22,7 @@ using namespace mozilla::dom;
|
|||
|
||||
bool SingleLineTextInputTypeBase::IsMutable() const {
|
||||
return !mInputElement->IsDisabled() &&
|
||||
!mInputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly);
|
||||
!mInputElement->HasAttr(nsGkAtoms::readonly);
|
||||
}
|
||||
|
||||
bool SingleLineTextInputTypeBase::IsTooLong() const {
|
||||
|
@ -69,7 +69,7 @@ Maybe<bool> SingleLineTextInputTypeBase::HasPatternMismatch() const {
|
|||
}
|
||||
|
||||
nsAutoString pattern;
|
||||
if (!mInputElement->GetAttr(kNameSpaceID_None, nsGkAtoms::pattern, pattern)) {
|
||||
if (!mInputElement->GetAttr(nsGkAtoms::pattern, pattern)) {
|
||||
return Some(false);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ Maybe<bool> SingleLineTextInputTypeBase::HasPatternMismatch() const {
|
|||
Document* doc = mInputElement->OwnerDoc();
|
||||
Maybe<bool> result = nsContentUtils::IsPatternMatching(
|
||||
value, std::move(pattern), doc,
|
||||
mInputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple));
|
||||
mInputElement->HasAttr(nsGkAtoms::multiple));
|
||||
return result ? Some(!*result) : Nothing();
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ bool EmailInputType::HasTypeMismatch() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
return mInputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)
|
||||
return mInputElement->HasAttr(nsGkAtoms::multiple)
|
||||
? !IsValidEmailAddressList(value)
|
||||
: !IsValidEmailAddress(value);
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ void nsDOMStringMap::NamedDeleter(const nsAString& aProp, bool& found) {
|
|||
RefPtr<nsAtom> attrAtom = NS_Atomize(attr);
|
||||
MOZ_ASSERT(attrAtom, "Should be infallible");
|
||||
|
||||
found = mElement->HasAttr(kNameSpaceID_None, attrAtom);
|
||||
found = mElement->HasAttr(attrAtom);
|
||||
|
||||
if (found) {
|
||||
mRemovingProp = true;
|
||||
|
|
|
@ -518,8 +518,7 @@ void nsGenericHTMLElement::UnbindFromTree(bool aNullParent) {
|
|||
|
||||
HTMLFormElement* nsGenericHTMLElement::FindAncestorForm(
|
||||
HTMLFormElement* aCurrentForm) {
|
||||
NS_ASSERTION(!HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
|
||||
IsHTMLElement(nsGkAtoms::img),
|
||||
NS_ASSERTION(!HasAttr(nsGkAtoms::form) || IsHTMLElement(nsGkAtoms::img),
|
||||
"FindAncestorForm should not be called if @form is set!");
|
||||
if (IsInNativeAnonymousSubtree()) {
|
||||
return nullptr;
|
||||
|
@ -1632,7 +1631,7 @@ void nsGenericHTMLElement::GetURIAttr(nsAtom* aAttr, nsAtom* aBaseAttr,
|
|||
|
||||
if (!uri) {
|
||||
// Just return the attr value
|
||||
GetAttr(kNameSpaceID_None, aAttr, aResult);
|
||||
GetAttr(aAttr, aResult);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1654,7 +1653,7 @@ bool nsGenericHTMLElement::GetURIAttr(nsAtom* aAttr, nsAtom* aBaseAttr,
|
|||
|
||||
if (aBaseAttr) {
|
||||
nsAutoString baseAttrValue;
|
||||
if (GetAttr(kNameSpaceID_None, aBaseAttr, baseAttrValue)) {
|
||||
if (GetAttr(aBaseAttr, baseAttrValue)) {
|
||||
nsCOMPtr<nsIURI> baseAttrURI;
|
||||
nsresult rv = nsContentUtils::NewURIWithDocumentCharset(
|
||||
getter_AddRefs(baseAttrURI), baseAttrValue, OwnerDoc(), baseURI);
|
||||
|
@ -1774,8 +1773,7 @@ nsresult nsGenericHTMLFormElement::BindToTree(BindContext& aContext,
|
|||
// corresponding id. If @form isn't set, the element *has* to have a parent,
|
||||
// otherwise it wouldn't be possible to find a form ancestor. We should not
|
||||
// call UpdateFormOwner if none of these conditions are fulfilled.
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::form) ? IsInComposedDoc()
|
||||
: aParent.IsContent()) {
|
||||
if (HasAttr(nsGkAtoms::form) ? IsInComposedDoc() : aParent.IsContent()) {
|
||||
UpdateFormOwner(true, nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -1795,8 +1793,7 @@ void nsGenericHTMLFormElement::UnbindFromTree(bool aNullParent) {
|
|||
ClearForm(true, true);
|
||||
} else {
|
||||
// Recheck whether we should still have an form.
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
|
||||
!FindAncestorForm(form)) {
|
||||
if (HasAttr(nsGkAtoms::form) || !FindAncestorForm(form)) {
|
||||
ClearForm(true, true);
|
||||
} else {
|
||||
UnsetFlags(MAYBE_ORPHAN_FORM_ELEMENT);
|
||||
|
@ -1834,7 +1831,7 @@ void nsGenericHTMLFormElement::BeforeSetAttr(int32_t aNameSpaceID,
|
|||
// remove the control from the hashtable as needed
|
||||
|
||||
if (form && (aName == nsGkAtoms::name || aName == nsGkAtoms::id)) {
|
||||
GetAttr(kNameSpaceID_None, aName, tmp);
|
||||
GetAttr(aName, tmp);
|
||||
|
||||
if (!tmp.IsEmpty()) {
|
||||
form->RemoveElementFromTable(this, tmp);
|
||||
|
@ -1842,13 +1839,13 @@ void nsGenericHTMLFormElement::BeforeSetAttr(int32_t aNameSpaceID,
|
|||
}
|
||||
|
||||
if (form && aName == nsGkAtoms::type) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, tmp);
|
||||
GetAttr(nsGkAtoms::name, tmp);
|
||||
|
||||
if (!tmp.IsEmpty()) {
|
||||
form->RemoveElementFromTable(this, tmp);
|
||||
}
|
||||
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, tmp);
|
||||
GetAttr(nsGkAtoms::id, tmp);
|
||||
|
||||
if (!tmp.IsEmpty()) {
|
||||
form->RemoveElementFromTable(this, tmp);
|
||||
|
@ -1892,13 +1889,13 @@ void nsGenericHTMLFormElement::AfterSetAttr(
|
|||
if (form && aName == nsGkAtoms::type) {
|
||||
nsAutoString tmp;
|
||||
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, tmp);
|
||||
GetAttr(nsGkAtoms::name, tmp);
|
||||
|
||||
if (!tmp.IsEmpty()) {
|
||||
form->AddElementToTable(this, tmp);
|
||||
}
|
||||
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, tmp);
|
||||
GetAttr(nsGkAtoms::id, tmp);
|
||||
|
||||
if (!tmp.IsEmpty()) {
|
||||
form->AddElementToTable(this, tmp);
|
||||
|
@ -1940,7 +1937,7 @@ Element* nsGenericHTMLFormElement::AddFormIdObserver() {
|
|||
|
||||
nsAutoString formId;
|
||||
DocumentOrShadowRoot* docOrShadow = GetUncomposedDocOrConnectedShadowRoot();
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::form, formId);
|
||||
GetAttr(nsGkAtoms::form, formId);
|
||||
NS_ASSERTION(!formId.IsEmpty(),
|
||||
"@form value should not be the empty string!");
|
||||
RefPtr<nsAtom> atom = NS_Atomize(formId);
|
||||
|
@ -1957,7 +1954,7 @@ void nsGenericHTMLFormElement::RemoveFormIdObserver() {
|
|||
}
|
||||
|
||||
nsAutoString formId;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::form, formId);
|
||||
GetAttr(nsGkAtoms::form, formId);
|
||||
NS_ASSERTION(!formId.IsEmpty(),
|
||||
"@form value should not be the empty string!");
|
||||
RefPtr<nsAtom> atom = NS_Atomize(formId);
|
||||
|
@ -2068,7 +2065,7 @@ void nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
|
|||
if (!oldForm) {
|
||||
// If @form is set, we have to use that to find the form.
|
||||
nsAutoString formId;
|
||||
if (GetAttr(kNameSpaceID_None, nsGkAtoms::form, formId)) {
|
||||
if (GetAttr(nsGkAtoms::form, formId)) {
|
||||
if (!formId.IsEmpty()) {
|
||||
Element* element = nullptr;
|
||||
|
||||
|
@ -2104,8 +2101,8 @@ void nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
|
|||
if (form && !HasFlag(ADDED_TO_FORM)) {
|
||||
// Now we need to add ourselves to the form
|
||||
nsAutoString nameVal, idVal;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, nameVal);
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, idVal);
|
||||
GetAttr(nsGkAtoms::name, nameVal);
|
||||
GetAttr(nsGkAtoms::id, idVal);
|
||||
|
||||
SetFlags(ADDED_TO_FORM);
|
||||
|
||||
|
@ -2473,8 +2470,7 @@ static void MakeContentDescendantsEditable(nsIContent* aContent) {
|
|||
for (nsIContent* child = aContent->GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (!child->IsElement() ||
|
||||
!child->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::contenteditable)) {
|
||||
!child->AsElement()->HasAttr(nsGkAtoms::contenteditable)) {
|
||||
MakeContentDescendantsEditable(child);
|
||||
}
|
||||
}
|
||||
|
@ -2793,9 +2789,9 @@ bool nsGenericHTMLFormControlElement::IsAutocapitalizeInheriting() const {
|
|||
nsresult nsGenericHTMLFormControlElement::SubmitDirnameDir(
|
||||
FormData* aFormData) {
|
||||
// Submit dirname=dir if element has non-empty dirname attribute
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::dirname)) {
|
||||
if (HasAttr(nsGkAtoms::dirname)) {
|
||||
nsAutoString dirname;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::dirname, dirname);
|
||||
GetAttr(nsGkAtoms::dirname, dirname);
|
||||
if (!dirname.IsEmpty()) {
|
||||
const Directionality eDir = GetDirectionality();
|
||||
MOZ_ASSERT(eDir == eDir_RTL || eDir == eDir_LTR,
|
||||
|
@ -2992,8 +2988,7 @@ void nsGenericHTMLFormControlElementWithState::GetFormAction(nsString& aValue) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::formaction, aValue) ||
|
||||
aValue.IsEmpty()) {
|
||||
if (!GetAttr(nsGkAtoms::formaction, aValue) || aValue.IsEmpty()) {
|
||||
Document* document = OwnerDoc();
|
||||
nsIURI* docURI = document->GetDocumentURI();
|
||||
if (docURI) {
|
||||
|
|
|
@ -653,9 +653,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase {
|
|||
*/
|
||||
bool GetURIAttr(nsAtom* aAttr, nsAtom* aBaseAttr, nsIURI** aURI) const;
|
||||
|
||||
bool IsHidden() const {
|
||||
return HasAttr(kNameSpaceID_None, nsGkAtoms::hidden);
|
||||
}
|
||||
bool IsHidden() const { return HasAttr(nsGkAtoms::hidden); }
|
||||
|
||||
bool IsLabelable() const override;
|
||||
|
||||
|
@ -686,7 +684,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase {
|
|||
}
|
||||
|
||||
virtual inline void ResultForDialogSubmit(nsAString& aResult) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::value, aResult);
|
||||
GetAttr(nsGkAtoms::value, aResult);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -746,7 +744,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase {
|
|||
GetAttr(aName, aResult);
|
||||
}
|
||||
void GetHTMLAttr(nsAtom* aName, mozilla::dom::DOMString& aResult) const {
|
||||
GetAttr(kNameSpaceID_None, aName, aResult);
|
||||
GetAttr(aName, aResult);
|
||||
}
|
||||
void GetHTMLEnumAttr(nsAtom* aName, nsAString& aResult) const {
|
||||
GetEnumAttr(aName, nullptr, aResult);
|
||||
|
|
|
@ -281,8 +281,7 @@ void nsGenericHTMLFrameElement::AfterMaybeChangeAttr(
|
|||
if (aName == nsGkAtoms::src) {
|
||||
mSrcTriggeringPrincipal = nsContentUtils::GetAttrTriggeringPrincipal(
|
||||
this, aValue ? aValue->String() : u""_ns, aMaybeScriptedPrincipal);
|
||||
if (!IsHTMLElement(nsGkAtoms::iframe) ||
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::srcdoc)) {
|
||||
if (!IsHTMLElement(nsGkAtoms::iframe) || !HasAttr(nsGkAtoms::srcdoc)) {
|
||||
// Don't propagate error here. The attribute was successfully
|
||||
// set or removed; that's what we should reflect.
|
||||
LoadSrc();
|
||||
|
|
|
@ -166,11 +166,11 @@ void DOMLocalization::GetAttributes(Element& aElement, L10nIdArgs& aResult,
|
|||
nsAutoString l10nId;
|
||||
nsAutoString l10nArgs;
|
||||
|
||||
if (aElement.GetAttr(kNameSpaceID_None, nsGkAtoms::datal10nid, l10nId)) {
|
||||
if (aElement.GetAttr(nsGkAtoms::datal10nid, l10nId)) {
|
||||
CopyUTF16toUTF8(l10nId, aResult.mId);
|
||||
}
|
||||
|
||||
if (aElement.GetAttr(kNameSpaceID_None, nsGkAtoms::datal10nargs, l10nArgs)) {
|
||||
if (aElement.GetAttr(nsGkAtoms::datal10nargs, l10nArgs)) {
|
||||
ConvertStringToL10nArgs(l10nArgs, aResult.mArgs.SetValue(), aRv);
|
||||
}
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ void DOMLocalization::GetTranslatables(
|
|||
|
||||
Element* domElement = node->AsElement();
|
||||
|
||||
if (!domElement->HasAttr(kNameSpaceID_None, nsGkAtoms::datal10nid)) {
|
||||
if (!domElement->HasAttr(nsGkAtoms::datal10nid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -531,7 +531,7 @@ bool DOMLocalization::ApplyTranslations(
|
|||
// It is possible that someone removed the `data-l10n-id` from the element
|
||||
// before the async translation completed. In that case, skip applying
|
||||
// the translation.
|
||||
if (!elem->HasAttr(kNameSpaceID_None, nsGkAtoms::datal10nid)) {
|
||||
if (!elem->HasAttr(nsGkAtoms::datal10nid)) {
|
||||
continue;
|
||||
}
|
||||
L10nOverlays::TranslateElement(*elem, aTranslations[i].Value(), errors,
|
||||
|
|
|
@ -142,8 +142,7 @@ void L10nOverlays::OverlayAttributes(
|
|||
|
||||
{
|
||||
nsAutoString l10nAttrs;
|
||||
if (aToElement->GetAttr(kNameSpaceID_None, nsGkAtoms::datal10nattrs,
|
||||
l10nAttrs)) {
|
||||
if (aToElement->GetAttr(nsGkAtoms::datal10nattrs, l10nAttrs)) {
|
||||
HTMLSplitOnSpacesTokenizer tokenizer(l10nAttrs, ',');
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
const nsAString& token = tokenizer.nextToken();
|
||||
|
@ -242,8 +241,7 @@ already_AddRefed<nsINode> L10nOverlays::GetNodeForNamedElement(
|
|||
Element* aSourceElement, Element* aTranslatedChild,
|
||||
nsTArray<L10nOverlaysError>& aErrors, ErrorResult& aRv) {
|
||||
nsAutoString childName;
|
||||
aTranslatedChild->GetAttr(kNameSpaceID_None, nsGkAtoms::datal10nname,
|
||||
childName);
|
||||
aTranslatedChild->GetAttr(nsGkAtoms::datal10nname, childName);
|
||||
RefPtr<Element> sourceChild = nullptr;
|
||||
|
||||
nsINodeList* childNodes = aSourceElement->ChildNodes();
|
||||
|
@ -362,7 +360,7 @@ void L10nOverlays::OverlayChildNodes(DocumentFragment* aFromFragment,
|
|||
|
||||
RefPtr<Element> childElement = childNode->AsElement();
|
||||
|
||||
if (childElement->HasAttr(kNameSpaceID_None, nsGkAtoms::datal10nname)) {
|
||||
if (childElement->HasAttr(nsGkAtoms::datal10nname)) {
|
||||
RefPtr<nsINode> sanitized =
|
||||
GetNodeForNamedElement(aToElement, childElement, aErrors, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
|
@ -409,8 +407,7 @@ void L10nOverlays::OverlayChildNodes(DocumentFragment* aFromFragment,
|
|||
nsIContent* child = aToElement->GetLastChild();
|
||||
#ifdef DEBUG
|
||||
if (child->IsElement()) {
|
||||
if (child->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::datal10nid)) {
|
||||
if (child->AsElement()->HasAttr(nsGkAtoms::datal10nid)) {
|
||||
L10nOverlaysError error;
|
||||
error.mCode.Construct(
|
||||
L10nOverlays_Binding::ERROR_TRANSLATED_ELEMENT_DISCONNECTED);
|
||||
|
|
|
@ -298,7 +298,7 @@ bool TextTrack::IsLoaded() {
|
|||
// MediaElement.
|
||||
if (mTrackElement) {
|
||||
nsAutoString src;
|
||||
if (!(mTrackElement->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src))) {
|
||||
if (!(mTrackElement->GetAttr(nsGkAtoms::src, src))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1107,7 +1107,7 @@ nsresult PrototypeDocumentContentSink::CreateElementFromPrototype(
|
|||
}
|
||||
|
||||
// FIXME(bug 1627474): Is this right if this is inside an <html:template>?
|
||||
if (result->HasAttr(kNameSpaceID_None, nsGkAtoms::datal10nid)) {
|
||||
if (result->HasAttr(nsGkAtoms::datal10nid)) {
|
||||
mDocument->mL10nProtoElements.InsertOrUpdate(result, RefPtr{aPrototype});
|
||||
result->SetElementCreatedFromPrototypeAndHasUnmodifiedL10n();
|
||||
}
|
||||
|
|
|
@ -153,8 +153,7 @@ bool ScriptElement::MaybeProcessScript() {
|
|||
// HTML script elements.
|
||||
if (cont->IsHTMLElement()) {
|
||||
nsAutoString language;
|
||||
cont->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::language,
|
||||
language);
|
||||
cont->AsElement()->GetAttr(nsGkAtoms::language, language);
|
||||
if (!language.IsEmpty() &&
|
||||
!nsContentUtils::IsJavaScriptLanguage(language)) {
|
||||
return false;
|
||||
|
|
|
@ -344,10 +344,8 @@ static bool IsScriptEventHandler(ScriptKind kind, nsIContent* aScriptElement) {
|
|||
}
|
||||
|
||||
nsAutoString forAttr, eventAttr;
|
||||
if (!aScriptElement->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::_for,
|
||||
forAttr) ||
|
||||
!aScriptElement->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::event,
|
||||
eventAttr)) {
|
||||
if (!aScriptElement->AsElement()->GetAttr(nsGkAtoms::_for, forAttr) ||
|
||||
!aScriptElement->AsElement()->GetAttr(nsGkAtoms::event, eventAttr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -919,8 +917,7 @@ bool ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement,
|
|||
// be ignored if it is)."
|
||||
if (mDocument->ModuleScriptsEnabled() && scriptKind == ScriptKind::eClassic &&
|
||||
scriptContent->IsHTMLElement() &&
|
||||
scriptContent->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::nomodule)) {
|
||||
scriptContent->AsElement()->HasAttr(nsGkAtoms::nomodule)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -966,8 +963,7 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement,
|
|||
SRIMetadata sriMetadata;
|
||||
{
|
||||
nsAutoString integrity;
|
||||
aScriptContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::integrity, integrity);
|
||||
aScriptContent->AsElement()->GetAttr(nsGkAtoms::integrity, integrity);
|
||||
GetSRIMetadata(integrity, &sriMetadata);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ bool nsHTMLContentSerializer::SerializeHTMLAttributes(
|
|||
// If we're serializing a <meta http-equiv="content-type">,
|
||||
// use the proper value, rather than what's in the document.
|
||||
nsAutoString header;
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
||||
aElement->GetAttr(nsGkAtoms::httpEquiv, header);
|
||||
if (header.LowerCaseEqualsLiteral("content-type")) {
|
||||
valueStr = u"text/html; charset="_ns + NS_ConvertASCIItoUTF16(mCharset);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
|
|||
nsAutoString start;
|
||||
int32_t startAttrVal = 0;
|
||||
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
|
||||
aElement->GetAttr(nsGkAtoms::start, start);
|
||||
if (!start.IsEmpty()) {
|
||||
nsresult rv = NS_OK;
|
||||
startAttrVal = start.ToInteger(&rv);
|
||||
|
@ -272,7 +272,7 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
|
|||
}
|
||||
|
||||
bool forceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
|
||||
aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
|
||||
aElement->HasAttr(nsGkAtoms::mozdirty);
|
||||
|
||||
if ((mDoFormat || forceFormat) && !mDoRaw && !PreLevel()) {
|
||||
DecrIndentation(name);
|
||||
|
|
|
@ -1655,7 +1655,7 @@ void nsPlainTextSerializer::Write(const nsAString& aStr) {
|
|||
nsresult nsPlainTextSerializer::GetAttributeValue(const nsAtom* aName,
|
||||
nsString& aValueRet) const {
|
||||
if (mElement) {
|
||||
if (mElement->GetAttr(kNameSpaceID_None, aName, aValueRet)) {
|
||||
if (mElement->GetAttr(aName, aValueRet)) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ bool nsXHTMLContentSerializer::SerializeAttributes(
|
|||
// Store its start attribute value in olState->startVal.
|
||||
nsAutoString start;
|
||||
int32_t startAttrVal = 0;
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
|
||||
aElement->GetAttr(nsGkAtoms::start, start);
|
||||
if (!start.IsEmpty()) {
|
||||
nsresult rv = NS_OK;
|
||||
startAttrVal = start.ToInteger(&rv);
|
||||
|
@ -284,7 +284,7 @@ bool nsXHTMLContentSerializer::SerializeAttributes(
|
|||
// If we're serializing a <meta http-equiv="content-type">,
|
||||
// use the proper value, rather than what's in the document.
|
||||
nsAutoString header;
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
||||
aElement->GetAttr(nsGkAtoms::httpEquiv, header);
|
||||
if (header.LowerCaseEqualsLiteral("content-type")) {
|
||||
valueStr =
|
||||
u"text/html; charset="_ns + NS_ConvertASCIItoUTF16(mCharset);
|
||||
|
@ -326,10 +326,9 @@ bool nsXHTMLContentSerializer::AfterElementStart(nsIContent* aContent,
|
|||
for (nsIContent* child = aContent->GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::meta) &&
|
||||
child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
|
||||
child->AsElement()->HasAttr(nsGkAtoms::content)) {
|
||||
nsAutoString header;
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv,
|
||||
header);
|
||||
child->AsElement()->GetAttr(nsGkAtoms::httpEquiv, header);
|
||||
|
||||
if (header.LowerCaseEqualsLiteral("content-type")) {
|
||||
hasMeta = true;
|
||||
|
@ -391,7 +390,7 @@ bool nsXHTMLContentSerializer::CheckElementStart(Element* aElement,
|
|||
// indicate that this element should be pretty printed
|
||||
// even if we're not in pretty printing mode
|
||||
aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
|
||||
aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
|
||||
aElement->HasAttr(nsGkAtoms::mozdirty);
|
||||
|
||||
if (aElement->IsHTMLElement(nsGkAtoms::br) &&
|
||||
(mFlags & nsIDocumentEncoder::OutputNoFormattingInPre) &&
|
||||
|
@ -415,7 +414,7 @@ bool nsXHTMLContentSerializer::CheckElementEnd(Element* aElement,
|
|||
"nsHTMLContentSerializer shouldn't call this method !");
|
||||
|
||||
aForceFormat = !(mFlags & nsIDocumentEncoder::OutputIgnoreMozDirty) &&
|
||||
aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty);
|
||||
aElement->HasAttr(nsGkAtoms::mozdirty);
|
||||
|
||||
if (mIsCopying && aElement->IsHTMLElement(nsGkAtoms::ol)) {
|
||||
NS_ASSERTION((!mOLStateStack.IsEmpty()), "Cannot have an empty OL Stack");
|
||||
|
@ -668,8 +667,7 @@ bool nsXHTMLContentSerializer::SerializeLIValueAttribute(nsIContent* aElement,
|
|||
nsIContent* currNode = aElement;
|
||||
while (currNode && !found) {
|
||||
if (currNode->IsHTMLElement(nsGkAtoms::li)) {
|
||||
currNode->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
valueStr);
|
||||
currNode->AsElement()->GetAttr(nsGkAtoms::value, valueStr);
|
||||
if (valueStr.IsEmpty()) {
|
||||
offset++;
|
||||
} else {
|
||||
|
|
|
@ -1802,7 +1802,7 @@ bool nsXMLContentSerializer::MaybeSerializeIsValue(Element* aElement,
|
|||
CustomElementData* ceData = aElement->GetCustomElementData();
|
||||
if (ceData) {
|
||||
nsAtom* isAttr = ceData->GetIs(aElement);
|
||||
if (isAttr && !aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::is)) {
|
||||
if (isAttr && !aElement->HasAttr(nsGkAtoms::is)) {
|
||||
NS_ENSURE_TRUE(aStr.AppendLiteral(" is=\"", mozilla::fallible), false);
|
||||
NS_ENSURE_TRUE(
|
||||
aStr.Append(nsDependentAtomString(isAttr), mozilla::fallible), false);
|
||||
|
|
|
@ -30,7 +30,7 @@ void SVGAnimatedClass::SetBaseValue(const nsAString& aValue,
|
|||
|
||||
void SVGAnimatedClass::GetBaseValue(nsAString& aValue,
|
||||
const SVGElement* aSVGElement) const {
|
||||
aSVGElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aValue);
|
||||
aSVGElement->GetAttr(nsGkAtoms::_class, aValue);
|
||||
}
|
||||
|
||||
void SVGAnimatedClass::GetAnimValue(nsAString& aResult,
|
||||
|
@ -40,7 +40,7 @@ void SVGAnimatedClass::GetAnimValue(nsAString& aResult,
|
|||
return;
|
||||
}
|
||||
|
||||
aSVGElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aResult);
|
||||
aSVGElement->GetAttr(nsGkAtoms::_class, aResult);
|
||||
}
|
||||
|
||||
void SVGAnimatedClass::SetAnimValue(const nsAString& aValue,
|
||||
|
@ -72,7 +72,7 @@ nsresult SVGAnimatedClass::SMILString::ValueFromString(
|
|||
|
||||
SMILValue SVGAnimatedClass::SMILString::GetBaseValue() const {
|
||||
SMILValue val(SMILStringType::Singleton());
|
||||
mSVGElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
mSVGElement->GetAttr(nsGkAtoms::_class,
|
||||
*static_cast<nsAString*>(val.mU.mPtr));
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ nsresult SVGAnimationElement::Init() {
|
|||
|
||||
Element* SVGAnimationElement::GetTargetElementContent() {
|
||||
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href) ||
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
HasAttr(nsGkAtoms::href)) {
|
||||
return mHrefTarget.get();
|
||||
}
|
||||
MOZ_ASSERT(!mHrefTarget.get(),
|
||||
|
@ -143,7 +143,7 @@ nsresult SVGAnimationElement::BindToTree(BindContext& aContext,
|
|||
controller->RegisterAnimationElement(this);
|
||||
}
|
||||
const nsAttrValue* href =
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::href)
|
||||
HasAttr(nsGkAtoms::href)
|
||||
? mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_None)
|
||||
: mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
|
||||
if (href) {
|
||||
|
@ -260,13 +260,13 @@ void SVGAnimationElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
|||
if (xlinkHref) {
|
||||
UpdateHrefTarget(xlinkHref->GetStringValue());
|
||||
}
|
||||
} else if (!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
} else if (!HasAttr(nsGkAtoms::href)) {
|
||||
mHrefTarget.Unlink();
|
||||
AnimationTargetChanged();
|
||||
} // else: we unset xlink:href, but we still have href attribute, so keep
|
||||
// mHrefTarget linking to href.
|
||||
} else if (!(aNamespaceID == kNameSpaceID_XLink &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::href))) {
|
||||
HasAttr(nsGkAtoms::href))) {
|
||||
// Note: "href" takes priority over xlink:href. So if "xlink:href" is being
|
||||
// set here, we only let that update our target if "href" is *unset*.
|
||||
MOZ_ASSERT(aValue->Type() == nsAttrValue::eString,
|
||||
|
|
|
@ -1354,9 +1354,8 @@ void SVGElement::DidChangeValue(nsAtom* aName,
|
|||
bool hasListeners = nsContentUtils::HasMutationListeners(
|
||||
this, NS_EVENT_BITS_MUTATION_ATTRMODIFIED, this);
|
||||
uint8_t modType =
|
||||
HasAttr(kNameSpaceID_None, aName)
|
||||
? static_cast<uint8_t>(MutationEvent_Binding::MODIFICATION)
|
||||
: static_cast<uint8_t>(MutationEvent_Binding::ADDITION);
|
||||
HasAttr(aName) ? static_cast<uint8_t>(MutationEvent_Binding::MODIFICATION)
|
||||
: static_cast<uint8_t>(MutationEvent_Binding::ADDITION);
|
||||
|
||||
// XXX Really, the fourth argument to SetAttrAndNotify should be null if
|
||||
// aEmptyOrOldValue does not represent the actual previous value of the
|
||||
|
|
|
@ -79,7 +79,7 @@ nsresult SVGMPathElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
|||
|
||||
if (IsInComposedDoc()) {
|
||||
const nsAttrValue* hrefAttrValue =
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::href)
|
||||
HasAttr(nsGkAtoms::href)
|
||||
? mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_None)
|
||||
: mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
|
||||
if (hrefAttrValue) {
|
||||
|
@ -168,7 +168,7 @@ void SVGMPathElement::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
|
|||
|
||||
SVGGeometryElement* SVGMPathElement::GetReferencedPath() {
|
||||
if (!HasAttr(kNameSpaceID_XLink, nsGkAtoms::href) &&
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
!HasAttr(nsGkAtoms::href)) {
|
||||
MOZ_ASSERT(!mPathTracker.get(),
|
||||
"We shouldn't have a href target "
|
||||
"if we don't have an xlink:href or href attribute");
|
||||
|
|
|
@ -180,7 +180,7 @@ void XULBroadcastManager::SynchronizeBroadcastListener(Element* aBroadcaster,
|
|||
RefPtr<nsAtom> name = NS_Atomize(aAttr);
|
||||
|
||||
nsAutoString value;
|
||||
if (aBroadcaster->GetAttr(kNameSpaceID_None, name, value)) {
|
||||
if (aBroadcaster->GetAttr(name, value)) {
|
||||
aListener->SetAttr(kNameSpaceID_None, name, value, notify);
|
||||
} else {
|
||||
aListener->UnsetAttr(kNameSpaceID_None, name, notify);
|
||||
|
@ -309,19 +309,17 @@ nsresult XULBroadcastManager::ExecuteOnBroadcastHandlerFor(
|
|||
|
||||
// Is this the element that was listening to us?
|
||||
nsAutoString listeningToID;
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::element,
|
||||
listeningToID);
|
||||
child->AsElement()->GetAttr(nsGkAtoms::element, listeningToID);
|
||||
|
||||
nsAutoString broadcasterID;
|
||||
aBroadcaster->GetAttr(kNameSpaceID_None, nsGkAtoms::id, broadcasterID);
|
||||
aBroadcaster->GetAttr(nsGkAtoms::id, broadcasterID);
|
||||
|
||||
if (listeningToID != broadcasterID) continue;
|
||||
|
||||
// We are observing the broadcaster, but is this the right
|
||||
// attribute?
|
||||
nsAutoString listeningToAttribute;
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::attribute,
|
||||
listeningToAttribute);
|
||||
child->AsElement()->GetAttr(nsGkAtoms::attribute, listeningToAttribute);
|
||||
|
||||
if (!aAttr->Equals(listeningToAttribute) &&
|
||||
!listeningToAttribute.EqualsLiteral("*")) {
|
||||
|
@ -358,7 +356,7 @@ void XULBroadcastManager::AttributeChanged(Element* aElement,
|
|||
if (entry) {
|
||||
// We've got listeners: push the value.
|
||||
nsAutoString value;
|
||||
bool attrSet = aElement->GetAttr(kNameSpaceID_None, aAttribute, value);
|
||||
bool attrSet = aElement->GetAttr(aAttribute, value);
|
||||
|
||||
for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
|
||||
BroadcastListener* bl = entry->mListeners[i];
|
||||
|
@ -367,8 +365,7 @@ void XULBroadcastManager::AttributeChanged(Element* aElement,
|
|||
nsCOMPtr<Element> listenerEl = do_QueryReferent(bl->mListener);
|
||||
if (listenerEl) {
|
||||
nsAutoString currentValue;
|
||||
bool hasAttr = listenerEl->GetAttr(kNameSpaceID_None, aAttribute,
|
||||
currentValue);
|
||||
bool hasAttr = listenerEl->GetAttr(aAttribute, currentValue);
|
||||
// We need to update listener only if we're
|
||||
// (1) removing an existing attribute,
|
||||
// (2) adding a new attribute or
|
||||
|
@ -472,22 +469,22 @@ nsresult XULBroadcastManager::FindBroadcaster(Element* aElement,
|
|||
*aListener = Element::FromNode(parent);
|
||||
NS_IF_ADDREF(*aListener);
|
||||
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::element, aBroadcasterID);
|
||||
aElement->GetAttr(nsGkAtoms::element, aBroadcasterID);
|
||||
if (aBroadcasterID.IsEmpty()) {
|
||||
return NS_FINDBROADCASTER_NOT_FOUND;
|
||||
}
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::attribute, aAttribute);
|
||||
aElement->GetAttr(nsGkAtoms::attribute, aAttribute);
|
||||
} else {
|
||||
// It's a generic element, which means that we'll use the
|
||||
// value of the 'observes' attribute to determine the ID of
|
||||
// the broadcaster element, and we'll watch _all_ of its
|
||||
// values.
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::observes, aBroadcasterID);
|
||||
aElement->GetAttr(nsGkAtoms::observes, aBroadcasterID);
|
||||
|
||||
// Bail if there's no aBroadcasterID
|
||||
if (aBroadcasterID.IsEmpty()) {
|
||||
// Try the command attribute next.
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::command, aBroadcasterID);
|
||||
aElement->GetAttr(nsGkAtoms::command, aBroadcasterID);
|
||||
if (!aBroadcasterID.IsEmpty()) {
|
||||
// We've got something in the command attribute. We
|
||||
// only treat this as a normal broadcaster if we are
|
||||
|
|
|
@ -486,7 +486,7 @@ Result<bool, nsresult> nsXULElement::PerformAccesskey(bool aKeyCausesActivation,
|
|||
bool aIsTrustedEvent) {
|
||||
if (IsXULElement(nsGkAtoms::label)) {
|
||||
nsAutoString control;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::control, control);
|
||||
GetAttr(nsGkAtoms::control, control);
|
||||
if (control.IsEmpty()) {
|
||||
return Err(NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ void nsXULElement::AddListenerForAttributeIfNeeded(nsAtom* aLocalName) {
|
|||
}
|
||||
if (nsContentUtils::IsEventAttributeName(aLocalName, EventNameType_XUL)) {
|
||||
nsAutoString value;
|
||||
GetAttr(kNameSpaceID_None, aLocalName, value);
|
||||
GetAttr(aLocalName, value);
|
||||
SetEventHandler(aLocalName, value, true);
|
||||
}
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ nsresult nsXULElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
|||
// attribute 'csp' on the root element.
|
||||
if (doc.GetRootElement() == this) {
|
||||
nsAutoString cspPolicyStr;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::csp, cspPolicyStr);
|
||||
GetAttr(nsGkAtoms::csp, cspPolicyStr);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
@ -782,9 +782,9 @@ void nsXULElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
|||
// XXX Why does this not also remove broadcast listeners if the
|
||||
// "element" attribute was changed on an <observer>?
|
||||
nsAutoString oldValue;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::observes, oldValue);
|
||||
GetAttr(nsGkAtoms::observes, oldValue);
|
||||
if (oldValue.IsEmpty()) {
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::command, oldValue);
|
||||
GetAttr(nsGkAtoms::command, oldValue);
|
||||
}
|
||||
Document* doc = GetUncomposedDoc();
|
||||
if (!oldValue.IsEmpty() && doc->HasXULBroadcastManager()) {
|
||||
|
@ -987,7 +987,7 @@ void nsXULElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
|||
nsresult nsXULElement::PreHandleEvent(EventChainVisitor& aVisitor) {
|
||||
if (aVisitor.mItemFlags & NS_DISPATCH_XUL_COMMAND) {
|
||||
nsAutoString command;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::command, command);
|
||||
GetAttr(nsGkAtoms::command, command);
|
||||
MOZ_ASSERT(!command.IsEmpty());
|
||||
return DispatchXULCommand(aVisitor, command);
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ class nsXULElement : public nsStyledElement {
|
|||
|
||||
using DOMString = mozilla::dom::DOMString;
|
||||
void GetXULAttr(nsAtom* aName, DOMString& aResult) const {
|
||||
GetAttr(kNameSpaceID_None, aName, aResult);
|
||||
GetAttr(aName, aResult);
|
||||
}
|
||||
void SetXULAttr(nsAtom* aName, const nsAString& aValue,
|
||||
mozilla::ErrorResult& aError) {
|
||||
|
|
|
@ -210,12 +210,11 @@ nsresult nsXULPopupListener::LaunchPopup(MouseEvent* aEvent) {
|
|||
|
||||
nsAutoString identifier;
|
||||
nsAtom* type = mIsContext ? nsGkAtoms::context : nsGkAtoms::popup;
|
||||
bool hasPopupAttr = mElement->GetAttr(kNameSpaceID_None, type, identifier);
|
||||
bool hasPopupAttr = mElement->GetAttr(type, identifier);
|
||||
|
||||
if (identifier.IsEmpty()) {
|
||||
hasPopupAttr =
|
||||
mElement->GetAttr(kNameSpaceID_None,
|
||||
mIsContext ? nsGkAtoms::contextmenu : nsGkAtoms::menu,
|
||||
mElement->GetAttr(mIsContext ? nsGkAtoms::contextmenu : nsGkAtoms::menu,
|
||||
identifier) ||
|
||||
hasPopupAttr;
|
||||
}
|
||||
|
@ -270,10 +269,9 @@ nsresult nsXULPopupListener::LaunchPopup(MouseEvent* aEvent) {
|
|||
// element, otherwise just open it at the screen position where the mouse
|
||||
// was clicked. Context menus always open at the mouse position.
|
||||
mPopupContent = popup;
|
||||
if (!mIsContext &&
|
||||
(mPopupContent->HasAttr(kNameSpaceID_None, nsGkAtoms::position) ||
|
||||
(mPopupContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popupanchor) &&
|
||||
mPopupContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popupalign)))) {
|
||||
if (!mIsContext && (mPopupContent->HasAttr(nsGkAtoms::position) ||
|
||||
(mPopupContent->HasAttr(nsGkAtoms::popupanchor) &&
|
||||
mPopupContent->HasAttr(nsGkAtoms::popupalign)))) {
|
||||
pm->ShowPopup(mPopupContent, mElement, u""_ns, 0, 0, false, true, false,
|
||||
aEvent);
|
||||
} else {
|
||||
|
|
|
@ -78,7 +78,7 @@ static void SetSortColumnHints(nsIContent* content,
|
|||
SetSortColumnHints(child, sortResource, sortDirection);
|
||||
} else if (child->IsXULElement(nsGkAtoms::treecol)) {
|
||||
nsAutoString value;
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::sort, value);
|
||||
child->AsElement()->GetAttr(nsGkAtoms::sort, value);
|
||||
if (value == sortResource) {
|
||||
child->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::sortActive,
|
||||
u"true"_ns, true);
|
||||
|
@ -200,12 +200,10 @@ static int testSortCallback(const void* data1, const void* data2,
|
|||
// compare attributes. Ignore namespaces for now.
|
||||
nsAutoString leftstr, rightstr;
|
||||
if (left->content->IsElement()) {
|
||||
left->content->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
sortState->sortKeys[t], leftstr);
|
||||
left->content->AsElement()->GetAttr(sortState->sortKeys[t], leftstr);
|
||||
}
|
||||
if (right->content->IsElement()) {
|
||||
right->content->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
sortState->sortKeys[t], rightstr);
|
||||
right->content->AsElement()->GetAttr(sortState->sortKeys[t], rightstr);
|
||||
}
|
||||
|
||||
sortOrder = CompareValues(leftstr, rightstr, sortState->sortHints);
|
||||
|
@ -359,10 +357,9 @@ static nsresult InitializeSortState(Element* aRootElement, Element* aContainer,
|
|||
aSortState->invertSort = false;
|
||||
|
||||
nsAutoString existingsort;
|
||||
aRootElement->GetAttr(kNameSpaceID_None, nsGkAtoms::sort, existingsort);
|
||||
aRootElement->GetAttr(nsGkAtoms::sort, existingsort);
|
||||
nsAutoString existingsortDirection;
|
||||
aRootElement->GetAttr(kNameSpaceID_None, nsGkAtoms::sortDirection,
|
||||
existingsortDirection);
|
||||
aRootElement->GetAttr(nsGkAtoms::sortDirection, existingsortDirection);
|
||||
|
||||
// if just switching direction, set the invertSort flag
|
||||
if (sort.Equals(existingsort)) {
|
||||
|
|
|
@ -1212,8 +1212,8 @@ Result<bool, nsresult> CSSEditUtils::HaveCSSEquivalentStyles(
|
|||
// static
|
||||
bool CSSEditUtils::DoStyledElementsHaveSameStyle(
|
||||
nsStyledElement& aStyledElement, nsStyledElement& aOtherStyledElement) {
|
||||
if (aStyledElement.HasAttr(kNameSpaceID_None, nsGkAtoms::id) ||
|
||||
aOtherStyledElement.HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
|
||||
if (aStyledElement.HasAttr(nsGkAtoms::id) ||
|
||||
aOtherStyledElement.HasAttr(nsGkAtoms::id)) {
|
||||
// at least one of the spans carries an ID ; suspect a CSS rule applies to
|
||||
// it and refuse to merge the nodes
|
||||
return false;
|
||||
|
@ -1221,7 +1221,7 @@ bool CSSEditUtils::DoStyledElementsHaveSameStyle(
|
|||
|
||||
nsAutoString firstClass, otherClass;
|
||||
bool isElementClassSet =
|
||||
aStyledElement.GetAttr(kNameSpaceID_None, nsGkAtoms::_class, firstClass);
|
||||
aStyledElement.GetAttr(nsGkAtoms::_class, firstClass);
|
||||
bool isOtherElementClassSet = aOtherStyledElement.GetAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::_class, otherClass);
|
||||
if (isElementClassSet && isOtherElementClassSet) {
|
||||
|
|
|
@ -71,8 +71,7 @@ NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
|
|||
NS_IMETHODIMP ChangeAttributeTransaction::DoTransaction() {
|
||||
// Need to get the current value of the attribute and save it, and set
|
||||
// mAttributeWasSet
|
||||
mAttributeWasSet =
|
||||
mElement->GetAttr(kNameSpaceID_None, mAttribute, mUndoValue);
|
||||
mAttributeWasSet = mElement->GetAttr(mAttribute, mUndoValue);
|
||||
|
||||
// XXX: hack until attribute-was-set code is implemented
|
||||
if (!mUndoValue.IsEmpty()) {
|
||||
|
|
|
@ -144,8 +144,7 @@ NS_IMETHODIMP ChangeStyleTransaction::DoTransaction() {
|
|||
nsAutoCString propertyNameString;
|
||||
mProperty->ToUTF8String(propertyNameString);
|
||||
|
||||
mUndoAttributeWasSet =
|
||||
mStyledElement->HasAttr(kNameSpaceID_None, nsGkAtoms::style);
|
||||
mUndoAttributeWasSet = mStyledElement->HasAttr(nsGkAtoms::style);
|
||||
|
||||
nsAutoCString values;
|
||||
nsresult rv = cssDecl->GetPropertyValue(propertyNameString, values);
|
||||
|
|
|
@ -2888,7 +2888,7 @@ nsresult EditorBase::CloneAttributeWithTransaction(nsAtom& aAttribute,
|
|||
Element& aDestElement,
|
||||
Element& aSourceElement) {
|
||||
nsAutoString attrValue;
|
||||
if (aSourceElement.GetAttr(kNameSpaceID_None, &aAttribute, attrValue)) {
|
||||
if (aSourceElement.GetAttr(&aAttribute, attrValue)) {
|
||||
nsresult rv =
|
||||
SetAttributeWithTransaction(aDestElement, aAttribute, attrValue);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
|
||||
|
@ -6220,7 +6220,7 @@ NS_IMETHODIMP EditorBase::SetWrapWidth(int32_t aWrapColumn) {
|
|||
|
||||
// Get the current style for this root element:
|
||||
nsAutoString styleValue;
|
||||
rootElement->GetAttr(kNameSpaceID_None, nsGkAtoms::style, styleValue);
|
||||
rootElement->GetAttr(nsGkAtoms::style, styleValue);
|
||||
|
||||
// We'll replace styles for these values:
|
||||
CutStyle("white-space", styleValue);
|
||||
|
|
|
@ -519,8 +519,7 @@ nsresult HTMLEditor::GetPositionAndDimensions(Element& aElement, int32_t& aX,
|
|||
int32_t& aMarginLeft,
|
||||
int32_t& aMarginTop) {
|
||||
// Is the element positioned ? let's check the cheap way first...
|
||||
bool isPositioned =
|
||||
aElement.HasAttr(kNameSpaceID_None, nsGkAtoms::_moz_abspos);
|
||||
bool isPositioned = aElement.HasAttr(nsGkAtoms::_moz_abspos);
|
||||
if (!isPositioned) {
|
||||
// hmmm... the expensive way now...
|
||||
nsAutoString positionValue;
|
||||
|
|
|
@ -138,7 +138,7 @@ bool EditorInlineStyle::IsRepresentedBy(const nsIContent& aContent) const {
|
|||
if (mHTMLProperty == nsGkAtoms::a) {
|
||||
return true;
|
||||
}
|
||||
return !mAttribute || element.HasAttr(kNameSpaceID_None, mAttribute);
|
||||
return !mAttribute || element.HasAttr(mAttribute);
|
||||
}
|
||||
// Special case for linking or naming an <a> element.
|
||||
if ((mHTMLProperty == nsGkAtoms::href && HTMLEditUtils::IsLink(&element)) ||
|
||||
|
|
|
@ -9573,7 +9573,7 @@ nsresult HTMLEditor::GetInlineStyles(
|
|||
}
|
||||
if (inclusiveAncestor->IsHTMLElement(nsGkAtoms::font)) {
|
||||
if (NeedToAppend(*nsGkAtoms::font, nsGkAtoms::face)) {
|
||||
inclusiveAncestor->GetAttr(kNameSpaceID_None, nsGkAtoms::face, value);
|
||||
inclusiveAncestor->GetAttr(nsGkAtoms::face, value);
|
||||
if (!value.IsEmpty()) {
|
||||
aPendingStyleCacheArray.AppendElement(
|
||||
PendingStyleCache(*nsGkAtoms::font, nsGkAtoms::face, value));
|
||||
|
@ -9581,7 +9581,7 @@ nsresult HTMLEditor::GetInlineStyles(
|
|||
}
|
||||
}
|
||||
if (NeedToAppend(*nsGkAtoms::font, nsGkAtoms::size)) {
|
||||
inclusiveAncestor->GetAttr(kNameSpaceID_None, nsGkAtoms::size, value);
|
||||
inclusiveAncestor->GetAttr(nsGkAtoms::size, value);
|
||||
if (!value.IsEmpty()) {
|
||||
aPendingStyleCacheArray.AppendElement(
|
||||
PendingStyleCache(*nsGkAtoms::font, nsGkAtoms::size, value));
|
||||
|
@ -9589,8 +9589,7 @@ nsresult HTMLEditor::GetInlineStyles(
|
|||
}
|
||||
}
|
||||
if (NeedToAppend(*nsGkAtoms::font, nsGkAtoms::color)) {
|
||||
inclusiveAncestor->GetAttr(kNameSpaceID_None, nsGkAtoms::color,
|
||||
value);
|
||||
inclusiveAncestor->GetAttr(nsGkAtoms::color, value);
|
||||
if (!value.IsEmpty()) {
|
||||
aPendingStyleCacheArray.AppendElement(
|
||||
PendingStyleCache(*nsGkAtoms::font, nsGkAtoms::color, value));
|
||||
|
|
|
@ -431,9 +431,7 @@ bool HTMLEditUtils::IsNamedAnchor(const nsINode* aNode) {
|
|||
}
|
||||
|
||||
nsAutoString text;
|
||||
return aNode->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name,
|
||||
text) &&
|
||||
!text.IsEmpty();
|
||||
return aNode->AsElement()->GetAttr(nsGkAtoms::name, text) && !text.IsEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2206,7 +2204,7 @@ bool HTMLEditUtils::IsInlineStyleSetByElement(
|
|||
return true;
|
||||
}
|
||||
nsAutoString value;
|
||||
element->GetAttr(kNameSpaceID_None, aStyle.mAttribute, value);
|
||||
element->GetAttr(aStyle.mAttribute, value);
|
||||
if (aOutValue) {
|
||||
*aOutValue = value;
|
||||
}
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче