зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1423990: Move the last few attribute-related methods outside of nsIContent. r=bz
MozReview-Commit-ID: 8JZuS6O8f8W
This commit is contained in:
Родитель
1b76f26695
Коммит
c8eb630ebe
|
@ -1375,8 +1375,10 @@ aria::HasDefinedARIAHidden(nsIContent* aContent)
|
|||
{
|
||||
return aContent &&
|
||||
nsAccUtils::HasDefinedARIAToken(aContent, nsGkAtoms::aria_hidden) &&
|
||||
!aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_hidden,
|
||||
nsGkAtoms::_false, eCaseMatters);
|
||||
!aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_hidden,
|
||||
nsGkAtoms::_false,
|
||||
eCaseMatters);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -23,7 +23,7 @@ struct EnumTypeData
|
|||
nsStaticAtom* const mAttrName;
|
||||
|
||||
// States if the attribute value is matched to the enum value. Used as
|
||||
// nsIContent::AttrValuesArray, last item must be nullptr.
|
||||
// Element::AttrValuesArray, last item must be nullptr.
|
||||
nsStaticAtom* const* const mValues[4];
|
||||
|
||||
// States applied if corresponding enum values are matched.
|
||||
|
|
|
@ -85,7 +85,8 @@ RelatedAccIterator::
|
|||
nsGkAtoms::anonid : nsGkAtoms::id;
|
||||
|
||||
nsAutoString id;
|
||||
if (aDependentContent->GetAttr(kNameSpaceID_None, IDAttr, id))
|
||||
if (aDependentContent->IsElement() &&
|
||||
aDependentContent->AsElement()->GetAttr(kNameSpaceID_None, IDAttr, id))
|
||||
mProviders = mDocument->mDependentIDsHash.Get(id);
|
||||
}
|
||||
|
||||
|
@ -165,7 +166,7 @@ HTMLLabelIterator::Next()
|
|||
while (walkUp && !walkUp->IsDoc()) {
|
||||
nsIContent* walkUpEl = walkUp->GetContent();
|
||||
if (IsLabel(walkUp) &&
|
||||
!walkUpEl->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
|
||||
!walkUpEl->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
|
||||
mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
|
||||
return walkUp;
|
||||
}
|
||||
|
@ -257,8 +258,8 @@ IDRefsIterator::
|
|||
nsAtom* aIDRefsAttr) :
|
||||
mContent(aContent), mDoc(aDoc), mCurrIdx(0)
|
||||
{
|
||||
if (mContent->IsInUncomposedDoc())
|
||||
mContent->GetAttr(kNameSpaceID_None, aIDRefsAttr, mIDs);
|
||||
if (mContent->IsInUncomposedDoc() && mContent->IsElement())
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, aIDRefsAttr, mIDs);
|
||||
}
|
||||
|
||||
const nsDependentSubstring
|
||||
|
|
|
@ -301,13 +301,13 @@ TextAttrsMgr::InvalidTextAttr::
|
|||
nsIContent* elm = aElm;
|
||||
do {
|
||||
if (nsAccUtils::HasDefinedARIAToken(elm, nsGkAtoms::aria_invalid)) {
|
||||
static nsIContent::AttrValuesArray tokens[] =
|
||||
static Element::AttrValuesArray tokens[] =
|
||||
{ &nsGkAtoms::_false, &nsGkAtoms::grammar, &nsGkAtoms::spelling,
|
||||
nullptr };
|
||||
|
||||
int32_t idx = elm->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_invalid, tokens,
|
||||
eCaseMatters);
|
||||
int32_t idx = elm->AsElement()->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_invalid,
|
||||
tokens, eCaseMatters);
|
||||
switch (idx) {
|
||||
case 0:
|
||||
*aValue = eFalse;
|
||||
|
|
|
@ -141,7 +141,8 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
|||
// container-relevant attribute
|
||||
if (relevant.IsEmpty() &&
|
||||
HasDefinedARIAToken(ancestor, nsGkAtoms::aria_relevant) &&
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_relevant, relevant))
|
||||
ancestor->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_relevant, relevant))
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerRelevant, relevant);
|
||||
|
||||
// container-live, and container-live-role attributes
|
||||
|
@ -151,7 +152,7 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
|||
role = aria::GetRoleMap(ancestor->AsElement());
|
||||
}
|
||||
if (HasDefinedARIAToken(ancestor, nsGkAtoms::aria_live)) {
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_live, live);
|
||||
ancestor->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_live, live);
|
||||
} else if (role) {
|
||||
GetLiveAttrValue(role->liveAttRule, live);
|
||||
}
|
||||
|
@ -165,8 +166,10 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
|||
}
|
||||
|
||||
// container-atomic attribute
|
||||
if (ancestor->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_atomic,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
if (ancestor->IsElement() &&
|
||||
ancestor->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_atomic,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerAtomic,
|
||||
NS_LITERAL_STRING("true"));
|
||||
}
|
||||
|
@ -174,7 +177,7 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
|||
// container-busy attribute
|
||||
if (busy.IsEmpty() &&
|
||||
HasDefinedARIAToken(ancestor, nsGkAtoms::aria_busy) &&
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_busy, busy))
|
||||
ancestor->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_busy, busy))
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerBusy, busy);
|
||||
|
||||
if (ancestor == aTopEl)
|
||||
|
@ -191,11 +194,15 @@ nsAccUtils::HasDefinedARIAToken(nsIContent *aContent, nsAtom *aAtom)
|
|||
{
|
||||
NS_ASSERTION(aContent, "aContent is null in call to HasDefinedARIAToken!");
|
||||
|
||||
if (!aContent->HasAttr(kNameSpaceID_None, aAtom) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_None, aAtom,
|
||||
nsGkAtoms::_empty, eCaseMatters) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_None, aAtom,
|
||||
nsGkAtoms::_undefined, eCaseMatters)) {
|
||||
if (!aContent->IsElement())
|
||||
return false;
|
||||
|
||||
Element* element = aContent->AsElement();
|
||||
if (!element->HasAttr(kNameSpaceID_None, aAtom) ||
|
||||
element->AttrValueIs(kNameSpaceID_None, aAtom, nsGkAtoms::_empty,
|
||||
eCaseMatters) ||
|
||||
element->AttrValueIs(kNameSpaceID_None, aAtom, nsGkAtoms::_undefined,
|
||||
eCaseMatters)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -207,7 +214,7 @@ nsAccUtils::GetARIAToken(dom::Element* aElement, nsAtom* aAttr)
|
|||
if (!HasDefinedARIAToken(aElement, aAttr))
|
||||
return nsGkAtoms::_empty;
|
||||
|
||||
static nsIContent::AttrValuesArray tokens[] =
|
||||
static Element::AttrValuesArray tokens[] =
|
||||
{ &nsGkAtoms::_false, &nsGkAtoms::_true,
|
||||
&nsGkAtoms::mixed, nullptr};
|
||||
|
||||
|
@ -239,7 +246,9 @@ nsAccUtils::GetSelectableContainer(Accessible* aAccessible, uint64_t aState)
|
|||
bool
|
||||
nsAccUtils::IsARIASelected(Accessible* aAccessible)
|
||||
{
|
||||
return aAccessible->GetContent()->
|
||||
if (!aAccessible->GetContent()->IsElement())
|
||||
return false;
|
||||
return aAccessible->GetContent()->AsElement()->
|
||||
AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_selected,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
|
|
@ -209,20 +209,25 @@ static Accessible* New_HTMLLabel(nsIContent* aContent, Accessible* aContext)
|
|||
|
||||
static Accessible* New_HTMLInput(nsIContent* aContent, Accessible* aContext)
|
||||
{
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::checkbox, eIgnoreCase)) {
|
||||
if (!aContent->IsElement()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Element* element = aContent->AsElement();
|
||||
if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::checkbox, eIgnoreCase)) {
|
||||
return new HTMLCheckboxAccessible(aContent, aContext->Document());
|
||||
}
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::radio, eIgnoreCase)) {
|
||||
if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::radio, eIgnoreCase)) {
|
||||
return new HTMLRadioButtonAccessible(aContent, aContext->Document());
|
||||
}
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::time, eIgnoreCase)) {
|
||||
if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::time, eIgnoreCase)) {
|
||||
return new EnumRoleAccessible<roles::GROUPING>(aContent, aContext->Document());
|
||||
}
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::date, eIgnoreCase)) {
|
||||
if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::date, eIgnoreCase)) {
|
||||
return new EnumRoleAccessible<roles::DATE_EDITOR>(aContent, aContext->Document());
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -261,7 +266,8 @@ static Accessible*
|
|||
New_HTMLTableHeaderCellIfScope(nsIContent* aContent, Accessible* aContext)
|
||||
{
|
||||
if (aContext->IsTableRow() && aContext->GetContent() == aContent->GetParent() &&
|
||||
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scope))
|
||||
aContent->IsElement() &&
|
||||
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::scope))
|
||||
return new HTMLTableHeaderCellAccessibleWrap(aContent, aContext->Document());
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -271,12 +277,14 @@ static Accessible*
|
|||
New_MaybeImageOrToolbarButtonAccessible(nsIContent* aContent,
|
||||
Accessible* aContext)
|
||||
{
|
||||
if (aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
|
||||
if (aContent->IsElement() &&
|
||||
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
|
||||
return new XULToolbarButtonAccessible(aContent, aContext->Document());
|
||||
}
|
||||
|
||||
// Don't include nameless images in accessible tree.
|
||||
if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) {
|
||||
if (!aContent->IsElement() ||
|
||||
!aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1551,8 +1559,10 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
|
|||
accessible = new EnumRoleAccessible<roles::PANE>(aContent, aDoc);
|
||||
|
||||
} else if (role.EqualsLiteral("xul:panel")) {
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
if (aContent->IsElement() &&
|
||||
aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::noautofocus,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
accessible = new XULAlertAccessible(aContent, aDoc);
|
||||
else
|
||||
accessible = new EnumRoleAccessible<roles::PANE>(aContent, aDoc);
|
||||
|
@ -1765,15 +1775,22 @@ nsAccessibilityService::MarkupAttributes(const nsIContent* aContent,
|
|||
|
||||
if (info->DOMAttrName) {
|
||||
if (info->DOMAttrValue) {
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, *info->DOMAttrName,
|
||||
*info->DOMAttrValue, eCaseMatters)) {
|
||||
if (aContent->IsElement() &&
|
||||
aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
*info->DOMAttrName,
|
||||
*info->DOMAttrValue,
|
||||
eCaseMatters)) {
|
||||
nsAccUtils::SetAccAttr(aAttributes, *info->name, *info->DOMAttrValue);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
nsAutoString value;
|
||||
aContent->GetAttr(kNameSpaceID_None, *info->DOMAttrName, value);
|
||||
|
||||
if (aContent->IsElement()) {
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, *info->DOMAttrName, value);
|
||||
}
|
||||
|
||||
if (!value.IsEmpty())
|
||||
nsAccUtils::SetAccAttr(aAttributes, *info->name, value);
|
||||
|
||||
|
|
|
@ -184,7 +184,8 @@ nsCoreUtils::GetAccessKeyFor(nsIContent* aContent)
|
|||
// Accesskeys are registered by @accesskey attribute only. At first check
|
||||
// whether it is presented on the given element to avoid the slow
|
||||
// EventStateManager::GetRegisteredAccessKey() method.
|
||||
if (!aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::accesskey))
|
||||
if (!aContent->IsElement() ||
|
||||
!aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::accesskey))
|
||||
return 0;
|
||||
|
||||
nsIPresShell* presShell = aContent->OwnerDoc()->GetShell();
|
||||
|
@ -199,7 +200,7 @@ nsCoreUtils::GetAccessKeyFor(nsIContent* aContent)
|
|||
if (!esm)
|
||||
return 0;
|
||||
|
||||
return esm->GetRegisteredAccessKey(aContent);
|
||||
return esm->GetRegisteredAccessKey(aContent->AsElement());
|
||||
}
|
||||
|
||||
nsIContent *
|
||||
|
@ -455,14 +456,18 @@ nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
|
|||
bool
|
||||
nsCoreUtils::GetID(nsIContent *aContent, nsAString& aID)
|
||||
{
|
||||
return aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aID);
|
||||
return aContent->IsElement() &&
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aID);
|
||||
}
|
||||
|
||||
bool
|
||||
nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsAtom *aAttr, int32_t *aUInt)
|
||||
{
|
||||
nsAutoString value;
|
||||
aContent->GetAttr(kNameSpaceID_None, aAttr, value);
|
||||
if (!aContent->IsElement()) {
|
||||
return false;
|
||||
}
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, aAttr, value);
|
||||
if (!value.IsEmpty()) {
|
||||
nsresult error = NS_OK;
|
||||
int32_t integer = value.ToInteger(&error);
|
||||
|
@ -483,7 +488,8 @@ nsCoreUtils::GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
|
|||
|
||||
nsIContent *walkUp = aContent;
|
||||
while (walkUp && walkUp != aRootContent &&
|
||||
!walkUp->GetAttr(kNameSpaceID_None, nsGkAtoms::lang, aLanguage))
|
||||
(!walkUp->IsElement() ||
|
||||
!walkUp->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::lang, aLanguage)))
|
||||
walkUp = walkUp->GetParent();
|
||||
}
|
||||
|
||||
|
@ -617,7 +623,7 @@ nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn)
|
|||
{
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
aColumn->GetElement(getter_AddRefs(element));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(element);
|
||||
nsCOMPtr<Element> content = do_QueryInterface(element);
|
||||
return content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
@ -677,7 +683,7 @@ nsCoreUtils::XBLBindingRole(const nsIContent* aEl, nsAString& aRole)
|
|||
{
|
||||
for (const nsXBLBinding* binding = aEl->GetXBLBinding(); binding;
|
||||
binding = binding->GetBaseBinding()) {
|
||||
nsIContent* bindingElm = binding->PrototypeBinding()->GetBindingElement();
|
||||
Element* bindingElm = binding->PrototypeBinding()->GetBindingElement();
|
||||
bindingElm->GetAttr(kNameSpaceID_None, nsGkAtoms::role, aRole);
|
||||
if (!aRole.IsEmpty())
|
||||
break;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define nsCoreUtils_h_
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h" // for GetShell()
|
||||
|
@ -291,7 +292,8 @@ public:
|
|||
static bool IsHTMLTableHeader(nsIContent *aContent)
|
||||
{
|
||||
return aContent->NodeInfo()->Equals(nsGkAtoms::th) ||
|
||||
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scope);
|
||||
(aContent->IsElement() &&
|
||||
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::scope));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -313,12 +313,12 @@ nsTextEquivUtils::AppendFromDOMNode(nsIContent *aContent, nsAString *aString)
|
|||
} else {
|
||||
if (aContent->NodeInfo()->Equals(nsGkAtoms::label,
|
||||
kNameSpaceID_XUL))
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
textEquivalent);
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
textEquivalent);
|
||||
|
||||
if (textEquivalent.IsEmpty())
|
||||
aContent->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::tooltiptext, textEquivalent);
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::tooltiptext, textEquivalent);
|
||||
}
|
||||
|
||||
AppendString(aString, textEquivalent);
|
||||
|
|
|
@ -641,11 +641,10 @@ ARIAGridCellAccessible::ApplyARIAState(uint64_t* aState) const
|
|||
return;
|
||||
|
||||
nsIContent *rowContent = row->GetContent();
|
||||
if (nsAccUtils::HasDefinedARIAToken(rowContent,
|
||||
nsGkAtoms::aria_selected) &&
|
||||
!rowContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_selected,
|
||||
nsGkAtoms::_false, eCaseMatters))
|
||||
if (nsAccUtils::HasDefinedARIAToken(rowContent, nsGkAtoms::aria_selected) &&
|
||||
!rowContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_selected,
|
||||
nsGkAtoms::_false, eCaseMatters))
|
||||
*aState |= states::SELECTABLE | states::SELECTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@ Accessible::IsSearchbox() const
|
|||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
return (roleMapEntry && roleMapEntry->Is(nsGkAtoms::searchbox)) ||
|
||||
(mContent->IsHTMLElement(nsGkAtoms::input) &&
|
||||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::search, eCaseMatters));
|
||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::search, eCaseMatters));
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
|
|
@ -153,12 +153,12 @@ Accessible::Name(nsString& aName)
|
|||
|
||||
// In the end get the name from tooltip.
|
||||
if (mContent->IsHTMLElement()) {
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return eNameFromTooltip;
|
||||
}
|
||||
} else if (mContent->IsXULElement()) {
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return eNameFromTooltip;
|
||||
}
|
||||
|
@ -202,9 +202,9 @@ Accessible::Description(nsString& aDescription)
|
|||
if (aDescription.IsEmpty()) {
|
||||
// Keep the Name() method logic.
|
||||
if (mContent->IsHTMLElement()) {
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aDescription);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aDescription);
|
||||
} else if (mContent->IsXULElement()) {
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aDescription);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aDescription);
|
||||
} else if (mContent->IsSVGElement()) {
|
||||
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
||||
childElm = childElm->GetNextSibling()) {
|
||||
|
@ -451,7 +451,7 @@ Accessible::NativeState()
|
|||
|
||||
// Check if a XUL element has the popup attribute (an attached popup menu).
|
||||
if (HasOwnContent() && mContent->IsXULElement() &&
|
||||
mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
state |= states::HASPOPUP;
|
||||
|
||||
// Bypass the link states specialization for non links.
|
||||
|
@ -491,8 +491,9 @@ Accessible::NativelyUnavailable() const
|
|||
if (mContent->IsHTMLElement())
|
||||
return mContent->AsElement()->State().HasState(NS_EVENT_STATE_DISABLED);
|
||||
|
||||
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
return mContent->IsElement() &&
|
||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
||||
Accessible*
|
||||
|
@ -827,9 +828,10 @@ Accessible::XULElmName(DocAccessible* aDocument,
|
|||
nsAutoString ancestorTitle;
|
||||
while (parent) {
|
||||
if (parent->IsXULElement(nsGkAtoms::toolbaritem) &&
|
||||
parent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, ancestorTitle)) {
|
||||
parent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::title, ancestorTitle)) {
|
||||
// Before returning this, check if the element itself has a tooltip:
|
||||
if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
|
||||
if (aElm->IsElement() &&
|
||||
aElm->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return;
|
||||
}
|
||||
|
@ -944,7 +946,7 @@ Accessible::Attributes()
|
|||
} else {
|
||||
// 'xml-roles' attribute coming from ARIA.
|
||||
nsAutoString xmlRoles;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::role, xmlRoles))
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::role, xmlRoles))
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles, xmlRoles);
|
||||
}
|
||||
|
||||
|
@ -1065,7 +1067,7 @@ Accessible::NativeAttributes()
|
|||
|
||||
// Expose class because it may have useful microformat information.
|
||||
nsAutoString _class;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, _class))
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, _class))
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::_class, _class);
|
||||
|
||||
// Expose tag.
|
||||
|
@ -1179,9 +1181,10 @@ Accessible::State()
|
|||
// it as selected to make ARIA widget authors life easier.
|
||||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
if (roleMapEntry && !(state & states::SELECTED) &&
|
||||
!mContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_selected,
|
||||
nsGkAtoms::_false, eCaseMatters)) {
|
||||
(!mContent->IsElement() ||
|
||||
!mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_selected,
|
||||
nsGkAtoms::_false, eCaseMatters))) {
|
||||
// Special case for tabs: focused tab or focus inside related tab panel
|
||||
// implies selected state.
|
||||
if (roleMapEntry->role == roles::PAGETAB) {
|
||||
|
@ -1339,10 +1342,14 @@ Accessible::Value(nsString& aValue)
|
|||
// aria-valuenow is a number, and aria-valuetext is the optional text
|
||||
// equivalent. For the string value, we will try the optional text
|
||||
// equivalent first.
|
||||
if (!mContent->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_valuetext, aValue)) {
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow,
|
||||
aValue);
|
||||
if (!mContent->IsElement()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_valuetext, aValue)) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow,
|
||||
aValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1454,10 +1461,11 @@ Accessible::ARIATransformRole(role aRole)
|
|||
return roles::TOGGLE_BUTTON;
|
||||
}
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_haspopup,
|
||||
nsGkAtoms::_true,
|
||||
eCaseMatters)) {
|
||||
if (mContent->IsElement() &&
|
||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_haspopup,
|
||||
nsGkAtoms::_true,
|
||||
eCaseMatters)) {
|
||||
// For button with aria-haspopup="true".
|
||||
return roles::BUTTONMENU;
|
||||
}
|
||||
|
@ -1482,8 +1490,9 @@ Accessible::ARIATransformRole(role aRole)
|
|||
|
||||
} else if (aRole == roles::MENUITEM) {
|
||||
// Menuitem has a submenu.
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_haspopup,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
if (mContent->IsElement() &&
|
||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_haspopup,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
return roles::PARENT_MENUITEM;
|
||||
}
|
||||
}
|
||||
|
@ -1597,7 +1606,10 @@ Accessible::GetAtomicRegion() const
|
|||
{
|
||||
nsIContent *loopContent = mContent;
|
||||
nsAutoString atomic;
|
||||
while (loopContent && !loopContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_atomic, atomic))
|
||||
while (loopContent &&
|
||||
(!loopContent->IsElement() ||
|
||||
!loopContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_atomic, atomic)))
|
||||
loopContent = loopContent->GetParent();
|
||||
|
||||
return atomic.EqualsLiteral("true") ? loopContent : nullptr;
|
||||
|
@ -1987,7 +1999,9 @@ Accessible::ARIAName(nsString& aName)
|
|||
}
|
||||
|
||||
if (aName.IsEmpty() &&
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_label, aName)) {
|
||||
mContent->IsElement() &&
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_label,
|
||||
aName)) {
|
||||
aName.CompressWhitespace();
|
||||
}
|
||||
}
|
||||
|
@ -2544,7 +2558,8 @@ bool
|
|||
Accessible::AreItemsOperable() const
|
||||
{
|
||||
return HasOwnContent() &&
|
||||
mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant);
|
||||
mContent->IsElement() &&
|
||||
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant);
|
||||
}
|
||||
|
||||
Accessible*
|
||||
|
@ -2556,8 +2571,9 @@ Accessible::CurrentItem()
|
|||
// with the aria-activedescendant attribute.
|
||||
nsAutoString id;
|
||||
if (HasOwnContent() &&
|
||||
mContent->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_activedescendant, id)) {
|
||||
mContent->IsElement() &&
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_activedescendant, id)) {
|
||||
nsIDocument* DOMDoc = mContent->OwnerDoc();
|
||||
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
|
||||
if (activeDescendantElm) {
|
||||
|
@ -2590,8 +2606,9 @@ Accessible::ContainerWidget() const
|
|||
for (Accessible* parent = Parent(); parent; parent = parent->Parent()) {
|
||||
nsIContent* parentContent = parent->GetContent();
|
||||
if (parentContent &&
|
||||
parentContent->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_activedescendant)) {
|
||||
parentContent->IsElement() &&
|
||||
parentContent->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_activedescendant)) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
@ -2664,7 +2681,8 @@ Accessible::AttrNumericValue(nsAtom* aAttr) const
|
|||
return UnspecifiedNaN<double>();
|
||||
|
||||
nsAutoString attrValue;
|
||||
if (!mContent->GetAttr(kNameSpaceID_None, aAttr, attrValue))
|
||||
if (!mContent->IsElement() ||
|
||||
!mContent->AsElement()->GetAttr(kNameSpaceID_None, aAttr, attrValue))
|
||||
return UnspecifiedNaN<double>();
|
||||
|
||||
nsresult error = NS_OK;
|
||||
|
@ -2680,7 +2698,7 @@ Accessible::GetActionRule() const
|
|||
|
||||
// Return "click" action on elements that have an attached popup menu.
|
||||
if (mContent->IsXULElement())
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
return eClickAction;
|
||||
|
||||
// Has registered 'click' event handler.
|
||||
|
|
|
@ -875,7 +875,7 @@ DocAccessible::AttributeChangedImpl(Accessible* aAccessible,
|
|||
return;
|
||||
}
|
||||
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
dom::Element* elm = aAccessible->GetContent()->AsElement();
|
||||
if (aAttribute == nsGkAtoms::aria_labelledby &&
|
||||
!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_label)) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, aAccessible);
|
||||
|
@ -996,7 +996,7 @@ DocAccessible::ARIAAttributeChanged(Accessible* aAccessible, nsAtom* aAttribute)
|
|||
FireDelayedEvent(event);
|
||||
}
|
||||
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
dom::Element* elm = aAccessible->GetContent()->AsElement();
|
||||
|
||||
// Update aria-hidden flag for the whole subtree iff aria-hidden is changed
|
||||
// on the root, i.e. ignore any affiliated aria-hidden changes in the subtree
|
||||
|
@ -1072,9 +1072,11 @@ void
|
|||
DocAccessible::ARIAActiveDescendantChanged(Accessible* aAccessible)
|
||||
{
|
||||
nsIContent* elm = aAccessible->GetContent();
|
||||
if (elm && aAccessible->IsActiveWidget()) {
|
||||
if (elm && elm->IsElement() && aAccessible->IsActiveWidget()) {
|
||||
nsAutoString id;
|
||||
if (elm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
|
||||
if (elm->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_activedescendant,
|
||||
id)) {
|
||||
dom::Element* activeDescendantElm = elm->OwnerDoc()->GetElementById(id);
|
||||
if (activeDescendantElm) {
|
||||
Accessible* activeDescendant = GetAccessible(activeDescendantElm);
|
||||
|
@ -1311,8 +1313,9 @@ DocAccessible::BindToDocument(Accessible* aAccessible,
|
|||
if (aAccessible->HasOwnContent()) {
|
||||
AddDependentIDsFor(aAccessible);
|
||||
|
||||
nsIContent* el = aAccessible->GetContent();
|
||||
if (el->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_owns)) {
|
||||
nsIContent* content = aAccessible->GetContent();
|
||||
if (content->IsElement() &&
|
||||
content->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_owns)) {
|
||||
mNotificationController->ScheduleRelocation(aAccessible);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ ProgressMeterAccessible<Max>::NativeState()
|
|||
|
||||
// An undetermined progressbar (i.e. without a value) has a mixed state.
|
||||
nsAutoString attrValue;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
|
||||
|
||||
if (attrValue.IsEmpty())
|
||||
state |= states::MIXED;
|
||||
|
@ -94,7 +94,7 @@ ProgressMeterAccessible<Max>::MaxValue() const
|
|||
return value;
|
||||
|
||||
nsAutoString strValue;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, strValue)) {
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::max, strValue)) {
|
||||
nsresult result = NS_OK;
|
||||
value = strValue.ToDouble(&result);
|
||||
if (NS_SUCCEEDED(result))
|
||||
|
@ -129,7 +129,7 @@ ProgressMeterAccessible<Max>::CurValue() const
|
|||
return value;
|
||||
|
||||
nsAutoString attrValue;
|
||||
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue))
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue))
|
||||
return UnspecifiedNaN<double>();
|
||||
|
||||
nsresult error = NS_OK;
|
||||
|
|
|
@ -269,12 +269,11 @@ HyperTextAccessible::DOMPointToOffset(nsINode* aNode, int32_t aNodeOffset,
|
|||
Accessible* descendant = nullptr;
|
||||
if (findNode) {
|
||||
nsCOMPtr<nsIContent> findContent(do_QueryInterface(findNode));
|
||||
if (findContent && findContent->IsHTMLElement() &&
|
||||
findContent->NodeInfo()->Equals(nsGkAtoms::br) &&
|
||||
findContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::mozeditorbogusnode,
|
||||
nsGkAtoms::_true,
|
||||
eIgnoreCase)) {
|
||||
if (findContent && findContent->IsHTMLElement(nsGkAtoms::br) &&
|
||||
findContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::mozeditorbogusnode,
|
||||
nsGkAtoms::_true,
|
||||
eIgnoreCase)) {
|
||||
// This <br> is the hacky "bogus node" used when there is no text in a control
|
||||
return 0;
|
||||
}
|
||||
|
@ -1852,7 +1851,8 @@ HyperTextAccessible::NativeName(nsString& aName)
|
|||
// Check @alt attribute for invalid img elements.
|
||||
bool hasImgAlt = false;
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::img)) {
|
||||
hasImgAlt = mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
hasImgAlt =
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return eNameOK;
|
||||
}
|
||||
|
@ -1865,7 +1865,7 @@ HyperTextAccessible::NativeName(nsString& aName)
|
|||
// a valid name from markup. Otherwise their name isn't picked up by recursive
|
||||
// name computation algorithm. See NS_OK_NAME_FROM_TOOLTIP.
|
||||
if (IsAbbreviation() &&
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName))
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName))
|
||||
aName.CompressWhitespace();
|
||||
|
||||
return hasImgAlt ? eNoNameOnPurpose : eNameOK;
|
||||
|
|
|
@ -74,7 +74,7 @@ ENameValueFlag
|
|||
ImageAccessible::NativeName(nsString& aName)
|
||||
{
|
||||
bool hasAltAttrib =
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return eNameOK;
|
||||
|
||||
|
@ -167,7 +167,7 @@ ImageAccessible::NativeAttributes()
|
|||
LinkableAccessible::NativeAttributes();
|
||||
|
||||
nsAutoString src;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
|
||||
if (!src.IsEmpty())
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::src, src);
|
||||
|
||||
|
@ -180,10 +180,10 @@ ImageAccessible::NativeAttributes()
|
|||
already_AddRefed<nsIURI>
|
||||
ImageAccessible::GetLongDescURI() const
|
||||
{
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc)) {
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc)) {
|
||||
// To check if longdesc contains an invalid url.
|
||||
nsAutoString longdesc;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::longdesc, longdesc);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::longdesc, longdesc);
|
||||
if (longdesc.FindChar(' ') != -1 || longdesc.FindChar('\t') != -1 ||
|
||||
longdesc.FindChar('\r') != -1 || longdesc.FindChar('\n') != -1) {
|
||||
return nullptr;
|
||||
|
@ -201,7 +201,7 @@ ImageAccessible::GetLongDescURI() const
|
|||
while (nsIContent* target = iter.NextElem()) {
|
||||
if ((target->IsHTMLElement(nsGkAtoms::a) ||
|
||||
target->IsHTMLElement(nsGkAtoms::area)) &&
|
||||
target->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
target->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
nsGenericHTMLElement* element =
|
||||
nsGenericHTMLElement::FromContent(target);
|
||||
|
||||
|
|
|
@ -131,9 +131,9 @@ HTMLRadioButtonAccessible::GetPositionAndSizeInternal(int32_t* aPosInSet,
|
|||
mContent->NodeInfo()->GetName(tagName);
|
||||
|
||||
nsAutoString type;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
|
||||
nsAutoString name;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
|
||||
RefPtr<nsContentList> inputElms;
|
||||
|
||||
|
@ -153,10 +153,11 @@ HTMLRadioButtonAccessible::GetPositionAndSizeInternal(int32_t* aPosInSet,
|
|||
|
||||
for (uint32_t index = 0; index < inputCount; index++) {
|
||||
nsIContent* inputElm = inputElms->Item(index, false);
|
||||
if (inputElm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
type, eCaseMatters) &&
|
||||
inputElm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
name, eCaseMatters) && mDoc->HasAccessible(inputElm)) {
|
||||
if (inputElm->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
type, eCaseMatters) &&
|
||||
inputElm->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
name, eCaseMatters) &&
|
||||
mDoc->HasAccessible(inputElm)) {
|
||||
count++;
|
||||
if (inputElm == mContent)
|
||||
indexOf = count;
|
||||
|
@ -252,12 +253,12 @@ HTMLButtonAccessible::NativeName(nsString& aName)
|
|||
|
||||
ENameValueFlag nameFlag = Accessible::NativeName(aName);
|
||||
if (!aName.IsEmpty() || !mContent->IsHTMLElement(nsGkAtoms::input) ||
|
||||
!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::image, eCaseMatters))
|
||||
!mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::image, eCaseMatters))
|
||||
return nameFlag;
|
||||
|
||||
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
|
||||
|
||||
aName.CompressWhitespace();
|
||||
return eNameOK;
|
||||
|
@ -290,8 +291,8 @@ NS_IMPL_ISUPPORTS_INHERITED0(HTMLTextFieldAccessible,
|
|||
role
|
||||
HTMLTextFieldAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::password, eIgnoreCase)) {
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::password, eIgnoreCase)) {
|
||||
return roles::PASSWORD_TEXT;
|
||||
}
|
||||
|
||||
|
@ -307,7 +308,7 @@ HTMLTextFieldAccessible::NativeAttributes()
|
|||
// Expose type for text input elements as it gives some useful context,
|
||||
// especially for mobile.
|
||||
nsAutoString type;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType, type);
|
||||
if (!ARIARoleMap() && type.EqualsLiteral("search")) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
|
@ -334,7 +335,7 @@ HTMLTextFieldAccessible::NativeName(nsString& aName)
|
|||
return eNameOK;
|
||||
|
||||
// text inputs and textareas might have useful placeholder text
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, aName);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, aName);
|
||||
return eNameOK;
|
||||
}
|
||||
|
||||
|
@ -382,12 +383,12 @@ HTMLTextFieldAccessible::NativeState()
|
|||
state |= states::EDITABLE;
|
||||
|
||||
// can be focusable, focused, protected. readonly, unavailable, selected
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::password, eIgnoreCase)) {
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::password, eIgnoreCase)) {
|
||||
state |= states::PROTECTED;
|
||||
}
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
|
||||
state |= states::READONLY;
|
||||
}
|
||||
|
||||
|
@ -408,7 +409,7 @@ HTMLTextFieldAccessible::NativeState()
|
|||
}
|
||||
|
||||
// Expose autocomplete state if it has associated autocomplete list.
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::list))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::list))
|
||||
return state | states::SUPPORTS_AUTOCOMPLETION | states::HASPOPUP;
|
||||
|
||||
// Ordinal XUL textboxes don't support autocomplete.
|
||||
|
@ -419,17 +420,17 @@ HTMLTextFieldAccessible::NativeState()
|
|||
// we're talking here is based on what the user types, where a popup of
|
||||
// possible choices comes up.
|
||||
nsAutoString autocomplete;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete,
|
||||
autocomplete);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete,
|
||||
autocomplete);
|
||||
|
||||
if (!autocomplete.LowerCaseEqualsLiteral("off")) {
|
||||
nsIContent* formContent = input->GetFormElement();
|
||||
if (formContent) {
|
||||
formContent->GetAttr(kNameSpaceID_None,
|
||||
Element* formElement = input->GetFormElement();
|
||||
if (formElement) {
|
||||
formElement->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::autocomplete, autocomplete);
|
||||
}
|
||||
|
||||
if (!formContent || !autocomplete.LowerCaseEqualsLiteral("off"))
|
||||
if (!formElement || !autocomplete.LowerCaseEqualsLiteral("off"))
|
||||
state |= states::SUPPORTS_AUTOCOMPLETION;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ HTMLAreaAccessible::NativeName(nsString& aName)
|
|||
if (!aName.IsEmpty())
|
||||
return nameFlag;
|
||||
|
||||
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
|
||||
Value(aName);
|
||||
|
||||
return eNameOK;
|
||||
|
@ -167,7 +167,8 @@ HTMLAreaAccessible::Description(nsString& aDescription)
|
|||
aDescription.Truncate();
|
||||
|
||||
// Still to do - follow IE's standard here
|
||||
RefPtr<HTMLAreaElement> area = HTMLAreaElement::FromContentOrNull(mContent);
|
||||
RefPtr<dom::HTMLAreaElement> area =
|
||||
dom::HTMLAreaElement::FromContentOrNull(mContent);
|
||||
if (area)
|
||||
area->GetShape(aDescription);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ 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->HasAttr(kNameSpaceID_None, nsGkAtoms::name))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::name))
|
||||
state |= states::SELECTABLE;
|
||||
|
||||
return state;
|
||||
|
|
|
@ -42,7 +42,7 @@ uint64_t
|
|||
HTMLSelectListAccessible::NativeState()
|
||||
{
|
||||
uint64_t state = AccessibleWrap::NativeState();
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple))
|
||||
state |= states::MULTISELECTABLE | states::EXTSELECTABLE;
|
||||
|
||||
return state;
|
||||
|
@ -60,14 +60,14 @@ HTMLSelectListAccessible::NativeRole()
|
|||
bool
|
||||
HTMLSelectListAccessible::SelectAll()
|
||||
{
|
||||
return mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple) ?
|
||||
return mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple) ?
|
||||
AccessibleWrap::SelectAll() : false;
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLSelectListAccessible::UnselectAll()
|
||||
{
|
||||
return mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple) ?
|
||||
return mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple) ?
|
||||
AccessibleWrap::UnselectAll() : false;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ HTMLSelectOptionAccessible::NativeName(nsString& aName)
|
|||
{
|
||||
// CASE #1 -- great majority of the cases
|
||||
// find the label attribute - this is what the W3C says we should use
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return eNameOK;
|
||||
|
||||
|
|
|
@ -122,14 +122,14 @@ HTMLTableCellAccessible::NativeAttributes()
|
|||
}
|
||||
}
|
||||
if (abbrText.IsEmpty())
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::abbr, abbrText);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::abbr, abbrText);
|
||||
|
||||
if (!abbrText.IsEmpty())
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::abbr, abbrText);
|
||||
|
||||
// axis attribute
|
||||
nsAutoString axisText;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::axis, axisText);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::axis, axisText);
|
||||
if (!axisText.IsEmpty())
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::axis, axisText);
|
||||
|
||||
|
@ -312,12 +312,12 @@ role
|
|||
HTMLTableHeaderCellAccessible::NativeRole()
|
||||
{
|
||||
// Check value of @scope attribute.
|
||||
static nsIContent::AttrValuesArray scopeValues[] =
|
||||
static Element::AttrValuesArray scopeValues[] =
|
||||
{ &nsGkAtoms::col, &nsGkAtoms::colgroup,
|
||||
&nsGkAtoms::row, &nsGkAtoms::rowgroup, nullptr };
|
||||
int32_t valueIdx =
|
||||
mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::scope,
|
||||
scopeValues, eCaseMatters);
|
||||
mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::scope,
|
||||
scopeValues, eCaseMatters);
|
||||
|
||||
switch (valueIdx) {
|
||||
case 0:
|
||||
|
@ -437,7 +437,7 @@ HTMLTableAccessible::NativeName(nsString& aName)
|
|||
}
|
||||
|
||||
// If no caption then use summary as a name.
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, aName);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, aName);
|
||||
return eNameOK;
|
||||
}
|
||||
|
||||
|
@ -863,8 +863,8 @@ HTMLTableAccessible::Description(nsString& aDescription)
|
|||
&captionText);
|
||||
|
||||
if (!captionText.IsEmpty()) { // summary isn't used as a name.
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::summary,
|
||||
aDescription);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::summary,
|
||||
aDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
|||
if (Role() != roles::TABLE)
|
||||
RETURN_LAYOUT_ANSWER(false, "Has role attribute");
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
|
||||
// Role attribute is present, but overridden roles have already been dealt with.
|
||||
// Only landmarks and other roles that don't override the role from native
|
||||
// markup are left to deal with here.
|
||||
|
@ -957,14 +957,14 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
|||
"table should not be built by CSS display:table style");
|
||||
|
||||
// Check if datatable attribute has "0" value.
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::datatable,
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::datatable,
|
||||
NS_LITERAL_STRING("0"), eCaseMatters)) {
|
||||
RETURN_LAYOUT_ANSWER(true, "Has datatable = 0 attribute, it's for layout");
|
||||
}
|
||||
|
||||
// Check for legitimate data table attributes.
|
||||
nsAutoString summary;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, summary) &&
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, summary) &&
|
||||
!summary.IsEmpty())
|
||||
RETURN_LAYOUT_ANSWER(false, "Has summary -- legitimate table structures");
|
||||
|
||||
|
@ -999,9 +999,9 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
|||
"Has th -- legitimate table structures");
|
||||
}
|
||||
|
||||
if (cellElm->HasAttr(kNameSpaceID_None, nsGkAtoms::headers) ||
|
||||
cellElm->HasAttr(kNameSpaceID_None, nsGkAtoms::scope) ||
|
||||
cellElm->HasAttr(kNameSpaceID_None, nsGkAtoms::abbr)) {
|
||||
if (cellElm->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::headers) ||
|
||||
cellElm->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::scope) ||
|
||||
cellElm->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::abbr)) {
|
||||
RETURN_LAYOUT_ANSWER(false,
|
||||
"Has headers, scope, or abbr attribute -- legitimate table structures");
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ AccessibleWrap::get_accRole(
|
|||
if (content->IsElement()) {
|
||||
nsAutoString roleString;
|
||||
// Try the role attribute.
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roleString);
|
||||
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roleString);
|
||||
|
||||
if (roleString.IsEmpty()) {
|
||||
// No role attribute (or it is an empty string).
|
||||
|
|
|
@ -28,7 +28,9 @@ XULMenuitemAccessibleWrap::Name(nsString& aName)
|
|||
return eNameOK;
|
||||
|
||||
nsAutoString accel;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, accel);
|
||||
if (mContent->IsElement()) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, accel);
|
||||
}
|
||||
if (!accel.IsEmpty())
|
||||
aName += NS_LITERAL_STRING("\t") + accel;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ XULColorPickerTileAccessible::Value(nsString& aValue)
|
|||
{
|
||||
aValue.Truncate();
|
||||
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::color, aValue);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::color, aValue);
|
||||
}
|
||||
|
||||
role
|
||||
|
@ -48,7 +48,7 @@ uint64_t
|
|||
XULColorPickerTileAccessible::NativeState()
|
||||
{
|
||||
uint64_t state = AccessibleWrap::NativeState();
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::selected))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::selected))
|
||||
state |= states::SELECTED;
|
||||
|
||||
return state;
|
||||
|
@ -138,6 +138,7 @@ XULColorPickerAccessible::IsAcceptableChild(nsIContent* aEl) const
|
|||
nsAutoString role;
|
||||
nsCoreUtils::XBLBindingRole(aEl, role);
|
||||
return role.EqualsLiteral("xul:panel") &&
|
||||
aEl->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
aEl->IsElement() &&
|
||||
aEl->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ XULComboboxAccessible::
|
|||
XULComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
AccessibleWrap(aContent, aDoc)
|
||||
{
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::autocomplete, eIgnoreCase))
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::autocomplete, eIgnoreCase))
|
||||
mGenericTypes |= eAutoComplete;
|
||||
else
|
||||
mGenericTypes |= eCombobox;
|
||||
|
@ -36,8 +36,9 @@ XULComboboxAccessible::
|
|||
// widgets use XULComboboxAccessible. We need to walk the anonymous children
|
||||
// for these so that the entry field is a child. Otherwise no XBL children.
|
||||
if (!mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) &&
|
||||
!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,
|
||||
nsGkAtoms::_true, eIgnoreCase)) {
|
||||
!mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::editable, nsGkAtoms::_true,
|
||||
eIgnoreCase)) {
|
||||
mStateFlags |= eNoXBLKids;
|
||||
}
|
||||
}
|
||||
|
@ -155,8 +156,8 @@ bool
|
|||
XULComboboxAccessible::IsActiveWidget() const
|
||||
{
|
||||
if (IsAutoComplete() ||
|
||||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,
|
||||
nsGkAtoms::_true, eIgnoreCase)) {
|
||||
mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,
|
||||
nsGkAtoms::_true, eIgnoreCase)) {
|
||||
int32_t childCount = mChildren.Length();
|
||||
for (int32_t idx = 0; idx < childCount; idx++) {
|
||||
Accessible* child = mChildren[idx];
|
||||
|
|
|
@ -184,13 +184,13 @@ XULLinkAccessible::Value(nsString& aValue)
|
|||
{
|
||||
aValue.Truncate();
|
||||
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, aValue);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, aValue);
|
||||
}
|
||||
|
||||
ENameValueFlag
|
||||
XULLinkAccessible::NativeName(nsString& aName)
|
||||
{
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return eNameOK;
|
||||
|
||||
|
@ -274,7 +274,7 @@ XULLinkAccessible::AnchorURIAt(uint32_t aAnchorIndex)
|
|||
return nullptr;
|
||||
|
||||
nsAutoString href;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
|
||||
nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
|
||||
nsIDocument* document = mContent->OwnerDoc();
|
||||
|
|
|
@ -122,7 +122,7 @@ XULButtonAccessible::NativeState()
|
|||
if (ContainsMenu())
|
||||
state |= states::HASPOPUP;
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::_default))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_default))
|
||||
state |= states::DEFAULT;
|
||||
|
||||
return state;
|
||||
|
@ -189,8 +189,8 @@ XULButtonAccessible::IsAcceptableChild(nsIContent* aEl) const
|
|||
return false;
|
||||
}
|
||||
|
||||
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::menuButton, eCaseMatters);
|
||||
return mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::menuButton, eCaseMatters);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -199,12 +199,12 @@ XULButtonAccessible::IsAcceptableChild(nsIContent* aEl) const
|
|||
bool
|
||||
XULButtonAccessible::ContainsMenu() const
|
||||
{
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::menu, &nsGkAtoms::menuButton, nullptr};
|
||||
|
||||
return mContent->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
strings, eCaseMatters) >= 0;
|
||||
return mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
strings, eCaseMatters) >= 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -603,7 +603,7 @@ XULToolbarAccessible::NativeRole()
|
|||
ENameValueFlag
|
||||
XULToolbarAccessible::NativeName(nsString& aName)
|
||||
{
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::toolbarname, aName))
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::toolbarname, aName))
|
||||
aName.CompressWhitespace();
|
||||
|
||||
return eNameOK;
|
||||
|
|
|
@ -126,8 +126,8 @@ XULListboxAccessible::NativeState()
|
|||
|
||||
// see if we are multiple select if so set ourselves as such
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::seltype,
|
||||
nsGkAtoms::multiple, eCaseMatters)) {
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::seltype,
|
||||
nsGkAtoms::multiple, eCaseMatters)) {
|
||||
states |= states::MULTISELECTABLE | states::EXTSELECTABLE;
|
||||
}
|
||||
|
||||
|
@ -536,10 +536,10 @@ XULListitemAccessible::
|
|||
XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
XULMenuitemAccessible(aContent, aDoc)
|
||||
{
|
||||
mIsCheckbox = mContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::checkbox,
|
||||
eCaseMatters);
|
||||
mIsCheckbox = mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::checkbox,
|
||||
eCaseMatters);
|
||||
mType = eXULListItemType;
|
||||
|
||||
// Walk XBL anonymous children for list items. Overrides the flag value from
|
||||
|
@ -597,7 +597,7 @@ XULListitemAccessible::NativeName(nsString& aName)
|
|||
if (childContent) {
|
||||
if (childContent->NodeInfo()->Equals(nsGkAtoms::listcell,
|
||||
kNameSpaceID_XUL)) {
|
||||
childContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
childContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
return eNameOK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,25 +52,25 @@ XULMenuitemAccessible::NativeState()
|
|||
// Has Popup?
|
||||
if (mContent->NodeInfo()->Equals(nsGkAtoms::menu, kNameSpaceID_XUL)) {
|
||||
state |= states::HASPOPUP;
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::open))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::open))
|
||||
state |= states::EXPANDED;
|
||||
else
|
||||
state |= states::COLLAPSED;
|
||||
}
|
||||
|
||||
// Checkable/checked?
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{ &nsGkAtoms::radio, &nsGkAtoms::checkbox, nullptr };
|
||||
|
||||
if (mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, strings,
|
||||
eCaseMatters) >= 0) {
|
||||
if (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type,
|
||||
strings, eCaseMatters) >= 0) {
|
||||
|
||||
// Checkable?
|
||||
state |= states::CHECKABLE;
|
||||
|
||||
// Checked?
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
state |= states::CHECKED;
|
||||
}
|
||||
|
||||
|
@ -137,15 +137,15 @@ XULMenuitemAccessible::NativeInteractiveState() const
|
|||
ENameValueFlag
|
||||
XULMenuitemAccessible::NativeName(nsString& aName)
|
||||
{
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
return eNameOK;
|
||||
}
|
||||
|
||||
void
|
||||
XULMenuitemAccessible::Description(nsString& aDescription)
|
||||
{
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::description,
|
||||
aDescription);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::description,
|
||||
aDescription);
|
||||
}
|
||||
|
||||
KeyBinding
|
||||
|
@ -157,8 +157,8 @@ XULMenuitemAccessible::AccessKey() const
|
|||
// We do not use nsCoreUtils::GetAccesskeyFor() because accesskeys for
|
||||
// menu are't registered by EventStateManager.
|
||||
nsAutoString accesskey;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey,
|
||||
accesskey);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey,
|
||||
accesskey);
|
||||
if (accesskey.IsEmpty())
|
||||
return KeyBinding();
|
||||
|
||||
|
@ -198,11 +198,11 @@ KeyBinding
|
|||
XULMenuitemAccessible::KeyboardShortcut() const
|
||||
{
|
||||
nsAutoString keyElmId;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyElmId);
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyElmId);
|
||||
if (keyElmId.IsEmpty())
|
||||
return KeyBinding();
|
||||
|
||||
nsIContent* keyElm = mContent->OwnerDoc()->GetElementById(keyElmId);
|
||||
Element* keyElm = mContent->OwnerDoc()->GetElementById(keyElmId);
|
||||
if (!keyElm)
|
||||
return KeyBinding();
|
||||
|
||||
|
@ -253,13 +253,12 @@ XULMenuitemAccessible::NativeRole()
|
|||
if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
|
||||
return roles::COMBOBOX_OPTION;
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::radio, eCaseMatters))
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::radio, eCaseMatters))
|
||||
return roles::RADIO_MENU_ITEM;
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::checkbox,
|
||||
eCaseMatters))
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::checkbox, eCaseMatters))
|
||||
return roles::CHECK_MENU_ITEM;
|
||||
|
||||
return roles::MENUITEM;
|
||||
|
@ -421,13 +420,14 @@ XULMenupopupAccessible::NativeState()
|
|||
|
||||
#ifdef DEBUG
|
||||
// We are onscreen if our parent is active
|
||||
bool isActive = mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::menuactive);
|
||||
bool isActive =
|
||||
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::menuactive);
|
||||
if (!isActive) {
|
||||
Accessible* parent = Parent();
|
||||
if (parent) {
|
||||
nsIContent* parentContent = parent->GetContent();
|
||||
if (parentContent)
|
||||
isActive = parentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::open);
|
||||
if (parentContent && parentContent->IsElement())
|
||||
isActive = parentContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::open);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,9 @@ XULMenupopupAccessible::NativeName(nsString& aName)
|
|||
{
|
||||
nsIContent* content = mContent;
|
||||
while (content && aName.IsEmpty()) {
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
if (content->IsElement()) {
|
||||
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
||||
}
|
||||
content = content->GetFlattenedTreeParent();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ XULSliderAccessible::NativeInteractiveState() const
|
|||
bool
|
||||
XULSliderAccessible::NativelyUnavailable() const
|
||||
{
|
||||
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
return mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -151,7 +151,7 @@ XULSliderAccessible::GetSliderAttr(nsAtom* aName, nsAString& aValue) const
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIContent* sliderElm = GetSliderElement();
|
||||
Element* sliderElm = GetSliderElement();
|
||||
if (sliderElm)
|
||||
sliderElm->GetAttr(kNameSpaceID_None, aName, aValue);
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ XULTabAccessible::NativeState()
|
|||
if (NS_SUCCEEDED(tab->GetSelected(&selected)) && selected)
|
||||
state |= states::SELECTED;
|
||||
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::pinned,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::pinned,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
state |= states::PINNED;
|
||||
|
||||
}
|
||||
|
|
|
@ -822,14 +822,14 @@ XULTreeGridCellAccessible::IsEditable() const
|
|||
if (!columnElm)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIContent> columnContent(do_QueryInterface(columnElm));
|
||||
nsCOMPtr<Element> columnContent(do_QueryInterface(columnElm));
|
||||
if (!columnContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::editable,
|
||||
nsGkAtoms::_true,
|
||||
eCaseMatters))
|
||||
return false;
|
||||
|
||||
return mContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::editable,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
return mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::editable,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
|
|
@ -370,13 +370,8 @@ ForEachPing(nsIContent* aContent, ForEachPingCallback aCallback, void* aClosure)
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsAtom> pingAtom = NS_Atomize("ping");
|
||||
if (!pingAtom) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoString value;
|
||||
aContent->GetAttr(kNameSpaceID_None, pingAtom, value);
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::ping, value);
|
||||
if (value.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -14567,7 +14562,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
|||
if (IsElementAnchor(aContent)) {
|
||||
MOZ_ASSERT(aContent->IsHTMLElement());
|
||||
nsAutoString referrer;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, referrer);
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, referrer);
|
||||
nsWhitespaceTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tok(referrer);
|
||||
while (tok.hasMoreTokens()) {
|
||||
const nsAString& token = tok.nextToken();
|
||||
|
|
|
@ -766,22 +766,82 @@ public:
|
|||
// either the input or output value of aParsedValue is StoresOwnData.
|
||||
nsresult SetParsedAttr(int32_t aNameSpaceID, nsAtom* aName, nsAtom* aPrefix,
|
||||
nsAttrValue& aParsedValue, bool aNotify);
|
||||
// GetAttr is not inlined on purpose, to keep down codesize from all
|
||||
// the inlined nsAttrValue bits for C++ callers.
|
||||
bool GetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
nsAString& aResult) const;
|
||||
/**
|
||||
* Get the current value of the attribute. This returns a form that is
|
||||
* suitable for passing back into SetAttr.
|
||||
*
|
||||
* @param aNameSpaceID the namespace of the attr
|
||||
* @param aName the name of the attr
|
||||
* @param aResult the value (may legitimately be the empty string) [OUT]
|
||||
* @returns true if the attribute was set (even when set to empty string)
|
||||
* false when not set.
|
||||
* GetAttr is not inlined on purpose, to keep down codesize from all the
|
||||
* inlined nsAttrValue bits for C++ callers.
|
||||
*/
|
||||
bool GetAttr(int32_t aNameSpaceID, nsAtom* aName, nsAString& aResult) const;
|
||||
|
||||
/**
|
||||
* Determine if an attribute has been set (empty string or otherwise).
|
||||
*
|
||||
* @param aNameSpaceId the namespace id of the attribute
|
||||
* @param aAttr the attribute name
|
||||
* @return whether an attribute exists
|
||||
*/
|
||||
inline bool HasAttr(int32_t aNameSpaceID, nsAtom* aName) const;
|
||||
// aCaseSensitive == eIgnoreCaase means ASCII case-insensitive matching.
|
||||
/**
|
||||
* Test whether this Element's given attribute has the given value. If the
|
||||
* attribute is not set at all, this will return false.
|
||||
*
|
||||
* @param aNameSpaceID The namespace ID of the attribute. Must not
|
||||
* be kNameSpaceID_Unknown.
|
||||
* @param aName The name atom of the attribute. Must not be null.
|
||||
* @param aValue The value to compare to.
|
||||
* @param aCaseSensitive Whether to do a case-sensitive compare on the value.
|
||||
*/
|
||||
inline bool AttrValueIs(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAString& aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
inline bool AttrValueIs(int32_t aNameSpaceID, nsAtom* aName,
|
||||
nsAtom* aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
|
||||
/**
|
||||
* Test whether this Element's given attribute has the given value. If the
|
||||
* attribute is not set at all, this will return false.
|
||||
*
|
||||
* @param aNameSpaceID The namespace ID of the attribute. Must not
|
||||
* be kNameSpaceID_Unknown.
|
||||
* @param aName The name atom of the attribute. Must not be null.
|
||||
* @param aValue The value to compare to. Must not be null.
|
||||
* @param aCaseSensitive Whether to do a case-sensitive compare on the value.
|
||||
*/
|
||||
bool AttrValueIs(int32_t aNameSpaceID,
|
||||
nsAtom* aName,
|
||||
nsAtom* aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
|
||||
enum {
|
||||
ATTR_MISSING = -1,
|
||||
ATTR_VALUE_NO_MATCH = -2
|
||||
};
|
||||
/**
|
||||
* Check whether this Element's given attribute has one of a given list of
|
||||
* values. If there is a match, we return the index in the list of the first
|
||||
* matching value. If there was no attribute at all, then we return
|
||||
* ATTR_MISSING. If there was an attribute but it didn't match, we return
|
||||
* ATTR_VALUE_NO_MATCH. A non-negative result always indicates a match.
|
||||
*
|
||||
* @param aNameSpaceID The namespace ID of the attribute. Must not
|
||||
* be kNameSpaceID_Unknown.
|
||||
* @param aName The name atom of the attribute. Must not be null.
|
||||
* @param aValues a nullptr-terminated array of pointers to atom values to test
|
||||
* against.
|
||||
* @param aCaseSensitive Whether to do a case-sensitive compare on the values.
|
||||
* @return ATTR_MISSING, ATTR_VALUE_NO_MATCH or the non-negative index
|
||||
* indicating the first value of aValues that matched
|
||||
*/
|
||||
typedef nsStaticAtom* const* const AttrValuesArray;
|
||||
int32_t FindAttrValueIn(int32_t aNameSpaceID,
|
||||
nsAtom* aName,
|
||||
AttrValuesArray* aValues,
|
||||
nsCaseTreatment aCaseSensitive) const override;
|
||||
nsAtom* aName,
|
||||
AttrValuesArray* aValues,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
|
||||
/**
|
||||
* Set attribute values. All attribute values are assumed to have a
|
||||
|
|
|
@ -471,9 +471,11 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
|
|||
}
|
||||
|
||||
// Otherwise check for xml:base attribute
|
||||
elem->GetAttr(kNameSpaceID_XML, nsGkAtoms::base, attr);
|
||||
if (!attr.IsEmpty()) {
|
||||
baseAttrs.AppendElement(attr);
|
||||
if (elem->IsElement()) {
|
||||
elem->AsElement()->GetAttr(kNameSpaceID_XML, nsGkAtoms::base, attr);
|
||||
if (!attr.IsEmpty()) {
|
||||
baseAttrs.AppendElement(attr);
|
||||
}
|
||||
}
|
||||
elem = elem->GetParent();
|
||||
} while(elem);
|
||||
|
@ -1126,43 +1128,6 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContent::GetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
nsAString& aResult) const
|
||||
{
|
||||
if (IsElement()) {
|
||||
return AsElement()->GetAttr(aNameSpaceID, aName, aResult);
|
||||
}
|
||||
aResult.Truncate();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContent::HasAttr(int32_t aNameSpaceID, nsAtom* aName) const
|
||||
{
|
||||
return IsElement() && AsElement()->HasAttr(aNameSpaceID, aName);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContent::AttrValueIs(int32_t aNameSpaceID,
|
||||
nsAtom* aName,
|
||||
const nsAString& aValue,
|
||||
nsCaseTreatment aCaseSensitive) const
|
||||
{
|
||||
return IsElement() &&
|
||||
AsElement()->AttrValueIs(aNameSpaceID, aName, aValue, aCaseSensitive);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContent::AttrValueIs(int32_t aNameSpaceID,
|
||||
nsAtom* aName,
|
||||
nsAtom* aValue,
|
||||
nsCaseTreatment aCaseSensitive) const
|
||||
{
|
||||
return IsElement() &&
|
||||
AsElement()->AttrValueIs(aNameSpaceID, aName, aValue, aCaseSensitive);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContent::IsFocusable(int32_t* aTabIndex, bool aWithMouse)
|
||||
{
|
||||
|
|
|
@ -157,7 +157,9 @@ ShadowRoot::AddSlot(HTMLSlotElement* aSlot)
|
|||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
nsAutoString slotName;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
|
||||
if (child->IsElement()) {
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
|
||||
}
|
||||
if (child->IsSlotable() && slotName.Equals(name)) {
|
||||
currentSlot->AppendAssignedNode(child);
|
||||
doEnqueueSlotChange = true;
|
||||
|
@ -350,7 +352,10 @@ ShadowRoot::AssignSlotFor(nsIContent* aContent)
|
|||
nsAutoString slotName;
|
||||
// Note that if slot attribute is missing, assign it to the first default
|
||||
// slot, if exists.
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
|
||||
if (aContent->IsElement()) {
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
|
||||
}
|
||||
|
||||
nsTArray<HTMLSlotElement*>* slots = mSlotMap.Get(slotName);
|
||||
if (!slots) {
|
||||
return nullptr;
|
||||
|
@ -596,7 +601,9 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument,
|
|||
|
||||
if (aContainer && aContainer == GetHost()) {
|
||||
nsAutoString slotName;
|
||||
aChild->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
|
||||
if (aChild->IsElement()) {
|
||||
aChild->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
|
||||
}
|
||||
if (const HTMLSlotElement* slot = UnassignSlotFor(aChild, slotName)) {
|
||||
slot->EnqueueSlotChangeEvent();
|
||||
}
|
||||
|
|
|
@ -558,10 +558,10 @@ nsContentList::NamedItem(const nsAString& aName, bool aDoFlush)
|
|||
// XXX Should this pass eIgnoreCase?
|
||||
if (content &&
|
||||
((content->IsHTMLElement() &&
|
||||
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
name, eCaseMatters)) ||
|
||||
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::id,
|
||||
name, eCaseMatters))) {
|
||||
content->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
name, eCaseMatters)) ||
|
||||
content->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::id,
|
||||
name, eCaseMatters))) {
|
||||
return content->AsElement();
|
||||
}
|
||||
}
|
||||
|
@ -684,8 +684,10 @@ nsContentList::Item(uint32_t aIndex)
|
|||
}
|
||||
|
||||
void
|
||||
nsContentList::AttributeChanged(nsIDocument *aDocument, Element* aElement,
|
||||
int32_t aNameSpaceID, nsAtom* aAttribute,
|
||||
nsContentList::AttributeChanged(nsIDocument* aDocument,
|
||||
Element* aElement,
|
||||
int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute,
|
||||
int32_t aModType,
|
||||
const nsAttrValue* aOldValue)
|
||||
{
|
||||
|
@ -716,7 +718,8 @@ nsContentList::AttributeChanged(nsIDocument *aDocument, Element* aElement,
|
|||
}
|
||||
|
||||
void
|
||||
nsContentList::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
|
||||
nsContentList::ContentAppended(nsIDocument* aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent)
|
||||
{
|
||||
NS_PRECONDITION(aContainer, "Can't get at the new content if no container!");
|
||||
|
|
|
@ -817,12 +817,15 @@ nsresult
|
|||
nsContentSink::ProcessMETATag(nsIContent* aContent)
|
||||
{
|
||||
NS_ASSERTION(aContent, "missing meta-element");
|
||||
MOZ_ASSERT(aContent->IsElement());
|
||||
|
||||
Element* element = aContent->AsElement();
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// set any HTTP-EQUIV data into document's header data as well as url
|
||||
nsAutoString header;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
||||
element->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
||||
if (!header.IsEmpty()) {
|
||||
// Ignore META REFRESH when document is sandboxed from automatic features.
|
||||
nsContentUtils::ASCIIToLower(header);
|
||||
|
@ -838,18 +841,18 @@ nsContentSink::ProcessMETATag(nsIContent* aContent)
|
|||
}
|
||||
|
||||
nsAutoString result;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
|
||||
element->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
|
||||
if (!result.IsEmpty()) {
|
||||
RefPtr<nsAtom> fieldAtom(NS_Atomize(header));
|
||||
rv = ProcessHeaderData(fieldAtom, result, aContent);
|
||||
rv = ProcessHeaderData(fieldAtom, result, element);
|
||||
}
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nsGkAtoms::handheldFriendly, eIgnoreCase)) {
|
||||
if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nsGkAtoms::handheldFriendly, eIgnoreCase)) {
|
||||
nsAutoString result;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
|
||||
element->GetAttr(kNameSpaceID_None, nsGkAtoms::content, result);
|
||||
if (!result.IsEmpty()) {
|
||||
nsContentUtils::ASCIIToLower(result);
|
||||
mDocument->SetHeaderData(nsGkAtoms::handheldFriendly, result);
|
||||
|
@ -1079,7 +1082,7 @@ nsContentSink::ProcessOfflineManifest(nsIContent *aElement)
|
|||
|
||||
// Check for a manifest= attribute.
|
||||
nsAutoString manifestSpec;
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::manifest, manifestSpec);
|
||||
aElement->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::manifest, manifestSpec);
|
||||
ProcessOfflineManifest(manifestSpec);
|
||||
}
|
||||
|
||||
|
|
|
@ -3021,10 +3021,13 @@ static inline void KeyAppendInt(int32_t aInt, nsACString& aKey)
|
|||
aKey.Append(nsPrintfCString("%d", aInt));
|
||||
}
|
||||
|
||||
static inline bool IsAutocompleteOff(const nsIContent* aElement)
|
||||
static inline bool IsAutocompleteOff(const nsIContent* aContent)
|
||||
{
|
||||
return aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::autocomplete,
|
||||
NS_LITERAL_STRING("off"), eIgnoreCase);
|
||||
return aContent->IsElement() &&
|
||||
aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::autocomplete,
|
||||
NS_LITERAL_STRING("off"),
|
||||
eIgnoreCase);
|
||||
}
|
||||
|
||||
/*static*/ nsresult
|
||||
|
@ -3143,7 +3146,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
|
|||
|
||||
// Append the control name
|
||||
nsAutoString name;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
||||
KeyAppendString(name, aKey);
|
||||
}
|
||||
}
|
||||
|
@ -3823,8 +3826,10 @@ nsContentUtils::ContentIsDraggable(nsIContent* aContent)
|
|||
if (draggable)
|
||||
return true;
|
||||
|
||||
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
||||
nsGkAtoms::_false, eIgnoreCase))
|
||||
if (aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::draggable,
|
||||
nsGkAtoms::_false,
|
||||
eIgnoreCase))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4703,12 +4708,14 @@ nsContentUtils::UnregisterShutdownObserver(nsIObserver* aObserver)
|
|||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::HasNonEmptyAttr(const nsIContent* aContent, int32_t aNameSpaceID,
|
||||
nsContentUtils::HasNonEmptyAttr(const nsIContent* aContent,
|
||||
int32_t aNameSpaceID,
|
||||
nsAtom* aName)
|
||||
{
|
||||
static nsIContent::AttrValuesArray strings[] = {&nsGkAtoms::_empty, nullptr};
|
||||
return aContent->FindAttrValueIn(aNameSpaceID, aName, strings, eCaseMatters)
|
||||
== nsIContent::ATTR_VALUE_NO_MATCH;
|
||||
static Element::AttrValuesArray strings[] = {&nsGkAtoms::_empty, nullptr};
|
||||
return aContent->IsElement() &&
|
||||
aContent->AsElement()->FindAttrValueIn(aNameSpaceID, aName, strings, eCaseMatters)
|
||||
== Element::ATTR_VALUE_NO_MATCH;
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -5545,7 +5552,7 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
|||
if ((!aContent->IsHTMLElement(nsGkAtoms::a) &&
|
||||
!aContent->IsHTMLElement(nsGkAtoms::area) &&
|
||||
!aContent->IsSVGElement(nsGkAtoms::a)) ||
|
||||
!aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::download, fileName) ||
|
||||
!aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::download, fileName) ||
|
||||
NS_FAILED(aContent->NodePrincipal()->CheckMayLoad(aLinkURI, false, true))) {
|
||||
fileName.SetIsVoid(true); // No actionable download attribute was found.
|
||||
}
|
||||
|
@ -10551,8 +10558,11 @@ nsContentUtils::QueryTriggeringPrincipal(nsIContent* aLoadingNode,
|
|||
}
|
||||
|
||||
nsAutoString loadingStr;
|
||||
aLoadingNode->GetAttr(kNameSpaceID_None, nsGkAtoms::triggeringprincipal,
|
||||
loadingStr);
|
||||
if (aLoadingNode->IsElement()) {
|
||||
aLoadingNode->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::triggeringprincipal,
|
||||
loadingStr);
|
||||
}
|
||||
|
||||
// Fall back if 'triggeringprincipal' isn't specified,
|
||||
if (loadingStr.IsEmpty()) {
|
||||
|
@ -10590,8 +10600,11 @@ nsContentUtils::GetContentPolicyTypeForUIImageLoading(nsIContent* aLoadingNode,
|
|||
aContentPolicyType = nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON;
|
||||
|
||||
nsAutoString requestContextID;
|
||||
aLoadingNode->GetAttr(kNameSpaceID_None, nsGkAtoms::requestcontextid,
|
||||
requestContextID);
|
||||
if (aLoadingNode->IsElement()) {
|
||||
aLoadingNode->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::requestcontextid,
|
||||
requestContextID);
|
||||
}
|
||||
nsresult rv;
|
||||
int64_t val = requestContextID.ToInteger64(&rv);
|
||||
*aRequestContextID = NS_SUCCEEDED(rv)
|
||||
|
@ -11117,9 +11130,16 @@ nsContentUtils::DevToolsEnabled(JSContext* aCx)
|
|||
/* static */ bool
|
||||
nsContentUtils::ContentIsLink(nsIContent* aContent)
|
||||
{
|
||||
return aContent && (aContent->IsHTMLElement(nsGkAtoms::a) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
nsGkAtoms::simple, eCaseMatters));
|
||||
if (!aContent || !aContent->IsElement()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::a)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return aContent->AsElement()->AttrValueIs(
|
||||
kNameSpaceID_XLink, nsGkAtoms::type, nsGkAtoms::simple, eCaseMatters);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<EventTarget>
|
||||
|
|
|
@ -6630,21 +6630,25 @@ nsIDocument::GetBindingParent(nsINode& aNode)
|
|||
}
|
||||
|
||||
static Element*
|
||||
GetElementByAttribute(nsIContent* aContent, nsAtom* aAttrName,
|
||||
GetElementByAttribute(Element* aElement, nsAtom* aAttrName,
|
||||
const nsAString& aAttrValue, bool aUniversalMatch)
|
||||
{
|
||||
if (aUniversalMatch ? aContent->HasAttr(kNameSpaceID_None, aAttrName) :
|
||||
aContent->AttrValueIs(kNameSpaceID_None, aAttrName,
|
||||
if (aUniversalMatch ? aElement->HasAttr(kNameSpaceID_None, aAttrName) :
|
||||
aElement->AttrValueIs(kNameSpaceID_None, aAttrName,
|
||||
aAttrValue, eCaseMatters)) {
|
||||
return aContent->AsElement();
|
||||
return aElement;
|
||||
}
|
||||
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
for (nsIContent* child = aElement->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (!child->IsElement()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Element* matchedElement =
|
||||
GetElementByAttribute(child, aAttrName, aAttrValue, aUniversalMatch);
|
||||
GetElementByAttribute(child->AsElement(), aAttrName, aAttrValue,
|
||||
aUniversalMatch);
|
||||
if (matchedElement)
|
||||
return matchedElement;
|
||||
}
|
||||
|
@ -6668,8 +6672,13 @@ nsDocument::GetAnonymousElementByAttribute(nsIContent* aElement,
|
|||
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsIContent* current = nodeList->Item(i);
|
||||
if (!current->IsElement()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Element* matchedElm =
|
||||
GetElementByAttribute(current, aAttrName, aAttrValue, universalMatch);
|
||||
GetElementByAttribute(current->AsElement(), aAttrName, aAttrValue,
|
||||
universalMatch);
|
||||
if (matchedElm)
|
||||
return matchedElm;
|
||||
}
|
||||
|
@ -10342,10 +10351,10 @@ nsDocument::FindImageMap(const nsAString& aUseMapValue)
|
|||
nsString name;
|
||||
for (i = 0; i < n; ++i) {
|
||||
nsIContent* map = mImageMaps->Item(i);
|
||||
if (map->AttrValueIs(kNameSpaceID_None, nsGkAtoms::id, mapName,
|
||||
eCaseMatters) ||
|
||||
map->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, mapName,
|
||||
eCaseMatters)) {
|
||||
if (map->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::id, mapName,
|
||||
eCaseMatters) ||
|
||||
map->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, mapName,
|
||||
eCaseMatters)) {
|
||||
return map->AsElement();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2723,10 +2723,10 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindowOuter* aWindow,
|
|||
}
|
||||
}
|
||||
|
||||
nsIContent* rootContent = doc->GetRootElement();
|
||||
Element* rootContent = doc->GetRootElement();
|
||||
NS_ENSURE_TRUE(rootContent, NS_OK);
|
||||
|
||||
nsIPresShell *presShell = doc->GetShell();
|
||||
nsIPresShell* presShell = doc->GetShell();
|
||||
NS_ENSURE_TRUE(presShell, NS_OK);
|
||||
|
||||
if (aType == MOVEFOCUS_FIRST) {
|
||||
|
@ -2784,7 +2784,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindowOuter* aWindow,
|
|||
if (popupFrame && !forDocumentNavigation) {
|
||||
// Don't navigate outside of a popup, so pretend that the
|
||||
// root content is the popup itself
|
||||
rootContent = popupFrame->GetContent();
|
||||
rootContent = popupFrame->GetContent()->AsElement();
|
||||
NS_ASSERTION(rootContent, "Popup frame doesn't have a content node");
|
||||
}
|
||||
else if (!forward) {
|
||||
|
@ -2822,7 +2822,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindowOuter* aWindow,
|
|||
// When navigating by documents, we start at the popup but can navigate
|
||||
// outside of it to look for other panels and documents.
|
||||
if (!forDocumentNavigation) {
|
||||
rootContent = startContent;
|
||||
rootContent = startContent->AsElement();
|
||||
}
|
||||
|
||||
doc = startContent ? startContent->GetComposedDoc() : nullptr;
|
||||
|
@ -3007,7 +3007,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindowOuter* aWindow,
|
|||
popupFrame = nsLayoutUtils::GetClosestFrameOfType(
|
||||
frame, LayoutFrameType::MenuPopup);
|
||||
if (popupFrame) {
|
||||
rootContent = popupFrame->GetContent();
|
||||
rootContent = popupFrame->GetContent()->AsElement();
|
||||
NS_ASSERTION(rootContent, "Popup frame doesn't have a content node");
|
||||
}
|
||||
}
|
||||
|
@ -3040,7 +3040,7 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindowOuter* aWindow,
|
|||
// Chrome documents however cannot be focused directly, so instead we
|
||||
// focus the first focusable element within the window.
|
||||
// For example, the urlbar.
|
||||
nsIContent* root = GetRootForFocus(piWindow, doc, true, true);
|
||||
Element* root = GetRootForFocus(piWindow, doc, true, true);
|
||||
return FocusFirst(root, aNextContent);
|
||||
}
|
||||
|
||||
|
@ -3205,12 +3205,12 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
|||
NS_ASSERTION(currentContent, "IsFocusable set a tabindex for a frame with no content");
|
||||
if (!aForDocumentNavigation &&
|
||||
currentContent->IsHTMLElement(nsGkAtoms::img) &&
|
||||
currentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::usemap)) {
|
||||
currentContent->AsElement()->HasAttr(kNameSpaceID_None, 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(aForward, aCurrentTabIndex,
|
||||
currentContent, iterStartContent);
|
||||
currentContent->AsElement(), iterStartContent);
|
||||
if (areaContent) {
|
||||
NS_ADDREF(*aResultContent = areaContent);
|
||||
return NS_OK;
|
||||
|
@ -3237,7 +3237,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
|||
// Next, for document navigation, check if this a non-remote child document.
|
||||
bool checkSubDocument = true;
|
||||
if (aForDocumentNavigation) {
|
||||
nsIContent* docRoot = GetRootForChildDocument(currentContent);
|
||||
Element* docRoot = GetRootForChildDocument(currentContent);
|
||||
if (docRoot) {
|
||||
// If GetRootForChildDocument returned something then call
|
||||
// FocusFirst to find the root or first element to focus within
|
||||
|
@ -3339,7 +3339,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
|||
nsCOMPtr<nsPIDOMWindowOuter> window = GetCurrentWindow(aRootContent);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContent> docRoot =
|
||||
RefPtr<Element> docRoot =
|
||||
GetRootForFocus(window, aRootContent->GetComposedDoc(), false, true);
|
||||
FocusFirst(docRoot, aResultContent);
|
||||
}
|
||||
|
@ -3357,7 +3357,7 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
|||
nsIContent*
|
||||
nsFocusManager::GetNextTabbableMapArea(bool aForward,
|
||||
int32_t aCurrentTabIndex,
|
||||
nsIContent* aImageContent,
|
||||
Element* aImageContent,
|
||||
nsIContent* aStartContent)
|
||||
{
|
||||
nsAutoString useMap;
|
||||
|
@ -3412,7 +3412,9 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
|
|||
}
|
||||
|
||||
nsAutoString tabIndexStr;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
|
||||
if (child->IsElement()) {
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
|
||||
}
|
||||
nsresult ec;
|
||||
int32_t val = tabIndexStr.ToInteger(&ec);
|
||||
if (NS_SUCCEEDED (ec) && val > aCurrentTabIndex && val != tabIndex) {
|
||||
|
@ -3432,7 +3434,9 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
|
|||
}
|
||||
|
||||
nsAutoString tabIndexStr;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
|
||||
if (child->IsElement()) {
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
|
||||
}
|
||||
nsresult ec;
|
||||
int32_t val = tabIndexStr.ToInteger(&ec);
|
||||
if (NS_SUCCEEDED (ec)) {
|
||||
|
@ -3448,13 +3452,13 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsFocusManager::FocusFirst(nsIContent* aRootContent, nsIContent** aNextContent)
|
||||
nsFocusManager::FocusFirst(Element* aRootElement, nsIContent** aNextContent)
|
||||
{
|
||||
if (!aRootContent) {
|
||||
if (!aRootElement) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument* doc = aRootContent->GetComposedDoc();
|
||||
nsIDocument* doc = aRootElement->GetComposedDoc();
|
||||
if (doc) {
|
||||
if (doc->IsXULDocument()) {
|
||||
// If the redirectdocumentfocus attribute is set, redirect the focus to a
|
||||
|
@ -3462,7 +3466,7 @@ nsFocusManager::FocusFirst(nsIContent* aRootContent, nsIContent** aNextContent)
|
|||
// urlbar during document navigation.
|
||||
nsAutoString retarget;
|
||||
|
||||
if (aRootContent->GetAttr(kNameSpaceID_None,
|
||||
if (aRootElement->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::retargetdocumentfocus, retarget)) {
|
||||
nsCOMPtr<Element> element = doc->GetElementById(retarget);
|
||||
nsCOMPtr<nsIContent> retargetElement =
|
||||
|
@ -3481,19 +3485,19 @@ nsFocusManager::FocusFirst(nsIContent* aRootContent, nsIContent** aNextContent)
|
|||
// always go forward and not back here.
|
||||
nsIPresShell* presShell = doc->GetShell();
|
||||
if (presShell) {
|
||||
return GetNextTabbableContent(presShell, aRootContent,
|
||||
nullptr, aRootContent,
|
||||
return GetNextTabbableContent(presShell, aRootElement,
|
||||
nullptr, aRootElement,
|
||||
true, 1, false, false,
|
||||
aNextContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(*aNextContent = aRootContent);
|
||||
NS_ADDREF(*aNextContent = aRootElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
Element*
|
||||
nsFocusManager::GetRootForFocus(nsPIDOMWindowOuter* aWindow,
|
||||
nsIDocument* aDocument,
|
||||
bool aForDocumentNavigation,
|
||||
|
@ -3511,7 +3515,7 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindowOuter* aWindow,
|
|||
|
||||
// If the body is contenteditable, use the editor's root element rather than
|
||||
// the actual root element.
|
||||
nsCOMPtr<nsIContent> rootElement =
|
||||
RefPtr<Element> rootElement =
|
||||
nsLayoutUtils::GetEditableRootContentByContentEditable(aDocument);
|
||||
if (!rootElement || !rootElement->GetPrimaryFrame()) {
|
||||
rootElement = aDocument->GetRootElement();
|
||||
|
@ -3527,7 +3531,7 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindowOuter* aWindow,
|
|||
// Finally, check if this is a frameset
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aDocument);
|
||||
if (htmlDoc) {
|
||||
nsIContent* htmlChild = aDocument->GetHtmlChildElement(nsGkAtoms::frameset);
|
||||
Element* htmlChild = aDocument->GetHtmlChildElement(nsGkAtoms::frameset);
|
||||
if (htmlChild) {
|
||||
// In document navigation mode, return the frameset so that navigation
|
||||
// descends into the child frames.
|
||||
|
@ -3538,7 +3542,7 @@ nsFocusManager::GetRootForFocus(nsPIDOMWindowOuter* aWindow,
|
|||
return rootElement;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
Element*
|
||||
nsFocusManager::GetRootForChildDocument(nsIContent* aContent)
|
||||
{
|
||||
// Check for elements that represent child documents, that is, browsers,
|
||||
|
|
|
@ -489,7 +489,7 @@ protected:
|
|||
*/
|
||||
nsIContent* GetNextTabbableMapArea(bool aForward,
|
||||
int32_t aCurrentTabIndex,
|
||||
nsIContent* aImageContent,
|
||||
mozilla::dom::Element* aImageContent,
|
||||
nsIContent* aStartContent);
|
||||
|
||||
/**
|
||||
|
@ -506,7 +506,7 @@ protected:
|
|||
* aRootContent. For content documents, this will be aRootContent itself, but
|
||||
* for chrome documents, this will locate the next focusable content.
|
||||
*/
|
||||
nsresult FocusFirst(nsIContent* aRootContent, nsIContent** aNextContent);
|
||||
nsresult FocusFirst(mozilla::dom::Element* aRootContent, nsIContent** aNextContent);
|
||||
|
||||
/**
|
||||
* Retrieves and returns the root node from aDocument to be focused. Will
|
||||
|
@ -517,16 +517,16 @@ protected:
|
|||
* - if aCheckVisibility is true and the aWindow is not visible.
|
||||
* - if aDocument is a frameset document.
|
||||
*/
|
||||
nsIContent* GetRootForFocus(nsPIDOMWindowOuter* aWindow,
|
||||
nsIDocument* aDocument,
|
||||
bool aForDocumentNavigation,
|
||||
bool aCheckVisibility);
|
||||
mozilla::dom::Element* GetRootForFocus(nsPIDOMWindowOuter* aWindow,
|
||||
nsIDocument* aDocument,
|
||||
bool aForDocumentNavigation,
|
||||
bool aCheckVisibility);
|
||||
|
||||
/**
|
||||
* Retrieves and returns the root node as with GetRootForFocus but only if
|
||||
* aContent is a frame with a valid child document.
|
||||
*/
|
||||
nsIContent* GetRootForChildDocument(nsIContent* aContent);
|
||||
mozilla::dom::Element* GetRootForChildDocument(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Retreives a focusable element within the current selection of aWindow.
|
||||
|
|
|
@ -355,90 +355,6 @@ public:
|
|||
mNodeInfo->NameAtom() == nsGkAtoms::mozgeneratedcontentafter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value of the attribute. This returns a form that is
|
||||
* suitable for passing back into SetAttr.
|
||||
*
|
||||
* @param aNameSpaceID the namespace of the attr
|
||||
* @param aName the name of the attr
|
||||
* @param aResult the value (may legitimately be the empty string) [OUT]
|
||||
* @returns true if the attribute was set (even when set to empty string)
|
||||
* false when not set.
|
||||
*
|
||||
* FIXME(emilio): Move to Element.
|
||||
*/
|
||||
bool GetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
nsAString& aResult) const;
|
||||
|
||||
/**
|
||||
* Determine if an attribute has been set (empty string or otherwise).
|
||||
*
|
||||
* @param aNameSpaceId the namespace id of the attribute
|
||||
* @param aAttr the attribute name
|
||||
* @return whether an attribute exists
|
||||
*/
|
||||
bool HasAttr(int32_t aNameSpaceID, nsAtom* aName) const;
|
||||
|
||||
/**
|
||||
* Test whether this content node's given attribute has the given value. If
|
||||
* the attribute is not set at all, this will return false.
|
||||
*
|
||||
* @param aNameSpaceID The namespace ID of the attribute. Must not
|
||||
* be kNameSpaceID_Unknown.
|
||||
* @param aName The name atom of the attribute. Must not be null.
|
||||
* @param aValue The value to compare to.
|
||||
* @param aCaseSensitive Whether to do a case-sensitive compare on the value.
|
||||
*/
|
||||
bool AttrValueIs(int32_t aNameSpaceID,
|
||||
nsAtom* aName,
|
||||
const nsAString& aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
|
||||
/**
|
||||
* Test whether this content node's given attribute has the given value. If
|
||||
* the attribute is not set at all, this will return false.
|
||||
*
|
||||
* @param aNameSpaceID The namespace ID of the attribute. Must not
|
||||
* be kNameSpaceID_Unknown.
|
||||
* @param aName The name atom of the attribute. Must not be null.
|
||||
* @param aValue The value to compare to. Must not be null.
|
||||
* @param aCaseSensitive Whether to do a case-sensitive compare on the value.
|
||||
*/
|
||||
bool AttrValueIs(int32_t aNameSpaceID,
|
||||
nsAtom* aName,
|
||||
nsAtom* aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
|
||||
enum {
|
||||
ATTR_MISSING = -1,
|
||||
ATTR_VALUE_NO_MATCH = -2
|
||||
};
|
||||
/**
|
||||
* Check whether this content node's given attribute has one of a given
|
||||
* list of values. If there is a match, we return the index in the list
|
||||
* of the first matching value. If there was no attribute at all, then
|
||||
* we return ATTR_MISSING. If there was an attribute but it didn't
|
||||
* match, we return ATTR_VALUE_NO_MATCH. A non-negative result always
|
||||
* indicates a match.
|
||||
*
|
||||
* @param aNameSpaceID The namespace ID of the attribute. Must not
|
||||
* be kNameSpaceID_Unknown.
|
||||
* @param aName The name atom of the attribute. Must not be null.
|
||||
* @param aValues a nullptr-terminated array of pointers to atom values to test
|
||||
* against.
|
||||
* @param aCaseSensitive Whether to do a case-sensitive compare on the values.
|
||||
* @return ATTR_MISSING, ATTR_VALUE_NO_MATCH or the non-negative index
|
||||
* indicating the first value of aValues that matched
|
||||
*/
|
||||
typedef nsStaticAtom* const* const AttrValuesArray;
|
||||
virtual int32_t FindAttrValueIn(int32_t aNameSpaceID,
|
||||
nsAtom* aName,
|
||||
AttrValuesArray* aValues,
|
||||
nsCaseTreatment aCaseSensitive) const
|
||||
{
|
||||
return ATTR_MISSING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get direct access (but read only) to the text in the text content.
|
||||
* NOTE: For elements this is *not* the concatenation of all text children,
|
||||
|
|
|
@ -620,10 +620,10 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
{
|
||||
nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent);
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
nsCOMPtr<Element> thisElement =
|
||||
do_QueryInterface(static_cast<nsIObjectLoadingContent*>(this));
|
||||
MOZ_ASSERT(thisContent);
|
||||
nsIDocument* ownerDoc = thisContent->OwnerDoc();
|
||||
MOZ_ASSERT(thisElement);
|
||||
nsIDocument* ownerDoc = thisElement->OwnerDoc();
|
||||
ownerDoc->RemovePlugin(this);
|
||||
|
||||
/// XXX(johns): Do we want to somehow propogate the reparenting behavior to
|
||||
|
@ -642,7 +642,7 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
UnloadObject();
|
||||
}
|
||||
if (mType == eType_Plugin) {
|
||||
nsIDocument* doc = thisContent->GetComposedDoc();
|
||||
nsIDocument* doc = thisElement->GetComposedDoc();
|
||||
if (doc && doc->IsActive()) {
|
||||
nsCOMPtr<nsIRunnable> ev = new nsSimplePluginEvent(doc,
|
||||
NS_LITERAL_STRING("PluginRemoved"));
|
||||
|
@ -1557,9 +1557,9 @@ nsObjectLoadingContent::CheckProcessPolicy(int16_t *aContentPolicy)
|
|||
nsObjectLoadingContent::ParameterUpdateFlags
|
||||
nsObjectLoadingContent::UpdateObjectParameters()
|
||||
{
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
nsCOMPtr<Element> thisElement =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ASSERTION(thisContent, "Must be an instance of content");
|
||||
MOZ_ASSERT(thisElement, "Must be an Element");
|
||||
|
||||
uint32_t caps = GetCapabilities();
|
||||
LOG(("OBJLC [%p]: Updating object parameters", this));
|
||||
|
@ -1593,16 +1593,13 @@ nsObjectLoadingContent::UpdateObjectParameters()
|
|||
///
|
||||
|
||||
nsAutoString codebaseStr;
|
||||
nsCOMPtr<nsIURI> docBaseURI = thisContent->GetBaseURI();
|
||||
bool hasCodebase = thisContent->HasAttr(kNameSpaceID_None, nsGkAtoms::codebase);
|
||||
if (hasCodebase) {
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::codebase, codebaseStr);
|
||||
}
|
||||
nsCOMPtr<nsIURI> docBaseURI = thisElement->GetBaseURI();
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::codebase, codebaseStr);
|
||||
|
||||
if (!codebaseStr.IsEmpty()) {
|
||||
rv = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(newBaseURI),
|
||||
codebaseStr,
|
||||
thisContent->OwnerDoc(),
|
||||
thisElement->OwnerDoc(),
|
||||
docBaseURI);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_TryToSetImmutable(newBaseURI);
|
||||
|
@ -1614,7 +1611,7 @@ nsObjectLoadingContent::UpdateObjectParameters()
|
|||
}
|
||||
|
||||
nsAutoString rawTypeAttr;
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr);
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr);
|
||||
if (!rawTypeAttr.IsEmpty()) {
|
||||
typeAttr = rawTypeAttr;
|
||||
CopyUTF16toUTF8(rawTypeAttr, newMime);
|
||||
|
@ -1631,10 +1628,10 @@ nsObjectLoadingContent::UpdateObjectParameters()
|
|||
|
||||
nsAutoString uriStr;
|
||||
// Different elements keep this in various locations
|
||||
if (thisContent->NodeInfo()->Equals(nsGkAtoms::object)) {
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, uriStr);
|
||||
} else if (thisContent->NodeInfo()->Equals(nsGkAtoms::embed)) {
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::src, uriStr);
|
||||
if (thisElement->NodeInfo()->Equals(nsGkAtoms::object)) {
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::data, uriStr);
|
||||
} else if (thisElement->NodeInfo()->Equals(nsGkAtoms::embed)) {
|
||||
thisElement->GetAttr(kNameSpaceID_None, nsGkAtoms::src, uriStr);
|
||||
} else {
|
||||
NS_NOTREACHED("Unrecognized plugin-loading tag");
|
||||
}
|
||||
|
@ -1645,7 +1642,7 @@ nsObjectLoadingContent::UpdateObjectParameters()
|
|||
if (!uriStr.IsEmpty()) {
|
||||
rv = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(newURI),
|
||||
uriStr,
|
||||
thisContent->OwnerDoc(),
|
||||
thisElement->OwnerDoc(),
|
||||
newBaseURI);
|
||||
nsCOMPtr<nsIURI> rewrittenURI;
|
||||
MaybeRewriteYoutubeEmbed(newURI,
|
||||
|
@ -1747,7 +1744,7 @@ nsObjectLoadingContent::UpdateObjectParameters()
|
|||
// 5) Use the channel type
|
||||
|
||||
bool overrideChannelType = false;
|
||||
if (thisContent->HasAttr(kNameSpaceID_None, nsGkAtoms::typemustmatch)) {
|
||||
if (thisElement->HasAttr(kNameSpaceID_None, nsGkAtoms::typemustmatch)) {
|
||||
if (!typeAttr.LowerCaseEqualsASCII(channelType.get())) {
|
||||
stateInvalid = true;
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ IsScopedStyleElement(nsIContent* aContent)
|
|||
// if it is scoped.
|
||||
return (aContent->IsHTMLElement(nsGkAtoms::style) ||
|
||||
aContent->IsSVGElement(nsGkAtoms::style)) &&
|
||||
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scoped) &&
|
||||
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::scoped) &&
|
||||
aContent->OwnerDoc()->IsScopedStyleEnabled();
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,8 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
|||
|
||||
MOZ_ASSERT(thisContent->NodeInfo()->NameAtom() != nsGkAtoms::link,
|
||||
"<link> is not 'inline', and needs different CSP checks");
|
||||
if (!nsStyleUtil::CSPAllowsInlineStyle(thisContent,
|
||||
MOZ_ASSERT(thisContent->IsElement());
|
||||
if (!nsStyleUtil::CSPAllowsInlineStyle(thisContent->AsElement(),
|
||||
thisContent->NodePrincipal(),
|
||||
triggeringPrincipal,
|
||||
doc->GetDocumentURI(),
|
||||
|
@ -550,10 +551,12 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
|||
LoadInlineStyle(thisContent, text, triggeringPrincipal, mLineNumber,
|
||||
title, media, referrerPolicy, scopeElement,
|
||||
aObserver, &doneLoading, &isAlternate);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
nsAutoString integrity;
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::integrity, integrity);
|
||||
if (thisContent->IsElement()) {
|
||||
thisContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::integrity,
|
||||
integrity);
|
||||
}
|
||||
if (!integrity.IsEmpty()) {
|
||||
MOZ_LOG(SRILogHelper::GetSriLog(), mozilla::LogLevel::Debug,
|
||||
("nsStyleLinkElement::DoUpdateStyleSheet, integrity=%s",
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
// while we're bound to the document tree, and it points to an ancestor
|
||||
// so the ancestor must be bound to the document tree the whole time
|
||||
// and can't be deleted.
|
||||
nsIContent* mGrandparent;
|
||||
Element* mGrandparent;
|
||||
// What attribute we're showing
|
||||
int32_t mNameSpaceID;
|
||||
RefPtr<nsAtom> mAttrName;
|
||||
|
@ -249,7 +249,7 @@ nsAttributeTextNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ASSERTION(!mGrandparent, "We were already bound!");
|
||||
mGrandparent = aParent->GetParent();
|
||||
mGrandparent = aParent->GetParent()->AsElement();
|
||||
mGrandparent->AddMutationObserver(this);
|
||||
|
||||
// Note that there is no need to notify here, since we have no
|
||||
|
|
|
@ -358,9 +358,9 @@ nsXHTMLContentSerializer::AfterElementStart(nsIContent* aContent,
|
|||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::meta) &&
|
||||
child->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
|
||||
child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::content)) {
|
||||
nsAutoString header;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, header);
|
||||
|
||||
if (header.LowerCaseEqualsLiteral("content-type")) {
|
||||
hasMeta = true;
|
||||
|
|
|
@ -1294,12 +1294,12 @@ void
|
|||
nsXMLContentSerializer::MaybeEnterInPreContent(nsIContent* aNode)
|
||||
{
|
||||
// support of the xml:space attribute
|
||||
nsAutoString space;
|
||||
if (ShouldMaintainPreLevel() &&
|
||||
aNode->HasAttr(kNameSpaceID_XML, nsGkAtoms::space)) {
|
||||
nsAutoString space;
|
||||
aNode->GetAttr(kNameSpaceID_XML, nsGkAtoms::space, space);
|
||||
if (space.EqualsLiteral("preserve"))
|
||||
++PreLevel();
|
||||
aNode->IsElement() &&
|
||||
aNode->AsElement()->GetAttr(kNameSpaceID_XML, nsGkAtoms::space, space) &&
|
||||
space.EqualsLiteral("preserve")) {
|
||||
++PreLevel();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1307,12 +1307,12 @@ void
|
|||
nsXMLContentSerializer::MaybeLeaveFromPreContent(nsIContent* aNode)
|
||||
{
|
||||
// support of the xml:space attribute
|
||||
nsAutoString space;
|
||||
if (ShouldMaintainPreLevel() &&
|
||||
aNode->HasAttr(kNameSpaceID_XML, nsGkAtoms::space)) {
|
||||
nsAutoString space;
|
||||
aNode->GetAttr(kNameSpaceID_XML, nsGkAtoms::space, space);
|
||||
if (space.EqualsLiteral("preserve"))
|
||||
--PreLevel();
|
||||
aNode->IsElement() &&
|
||||
aNode->AsElement()->GetAttr(kNameSpaceID_XML, nsGkAtoms::space, space) &&
|
||||
space.EqualsLiteral("preserve")) {
|
||||
--PreLevel();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -546,14 +546,14 @@ ContentEventHandler::QueryContentRect(nsIContent* aContent,
|
|||
static bool IsContentBR(nsIContent* aContent)
|
||||
{
|
||||
return aContent->IsHTMLElement(nsGkAtoms::br) &&
|
||||
!aContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::moz,
|
||||
eIgnoreCase) &&
|
||||
!aContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::mozeditorbogusnode,
|
||||
nsGkAtoms::_true,
|
||||
eIgnoreCase);
|
||||
!aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::moz,
|
||||
eIgnoreCase) &&
|
||||
!aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::mozeditorbogusnode,
|
||||
nsGkAtoms::_true,
|
||||
eIgnoreCase);
|
||||
}
|
||||
|
||||
static bool IsMozBR(nsIContent* aContent)
|
||||
|
|
|
@ -997,7 +997,8 @@ IsAccessKeyTarget(nsIContent* aContent, nsIFrame* aFrame, nsAString& aKey)
|
|||
// Use GetAttr because we want Unicode case=insensitive matching
|
||||
// XXXbz shouldn't this be case-sensitive, per spec?
|
||||
nsString contentKey;
|
||||
if (!aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, contentKey) ||
|
||||
if (!aContent->IsElement() ||
|
||||
!aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, contentKey) ||
|
||||
!contentKey.Equals(aKey, nsCaseInsensitiveStringComparator()))
|
||||
return false;
|
||||
|
||||
|
@ -1601,9 +1602,12 @@ EventStateManager::FireContextClick()
|
|||
allowedToDispatch = false;
|
||||
} else {
|
||||
// If the toolbar button has an open menu, don't attempt to open
|
||||
// a second menu
|
||||
if (mGestureDownContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
// a second menu
|
||||
if (mGestureDownContent->IsElement() &&
|
||||
mGestureDownContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::open,
|
||||
nsGkAtoms::_true,
|
||||
eCaseMatters)) {
|
||||
allowedToDispatch = false;
|
||||
}
|
||||
}
|
||||
|
@ -2953,7 +2957,7 @@ NodeAllowsClickThrough(nsINode* aNode)
|
|||
while (aNode) {
|
||||
if (aNode->IsXULElement()) {
|
||||
mozilla::dom::Element* element = aNode->AsElement();
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::always, &nsGkAtoms::never, nullptr};
|
||||
switch (element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::clickthrough,
|
||||
strings, eCaseMatters)) {
|
||||
|
@ -5321,29 +5325,29 @@ EventStateManager::EventStatusOK(WidgetGUIEvent* aEvent)
|
|||
// Access Key Registration
|
||||
//-------------------------------------------
|
||||
void
|
||||
EventStateManager::RegisterAccessKey(nsIContent* aContent, uint32_t aKey)
|
||||
EventStateManager::RegisterAccessKey(Element* aElement, uint32_t aKey)
|
||||
{
|
||||
if (aContent && mAccessKeys.IndexOf(aContent) == -1)
|
||||
mAccessKeys.AppendObject(aContent);
|
||||
if (aElement && mAccessKeys.IndexOf(aElement) == -1)
|
||||
mAccessKeys.AppendObject(aElement);
|
||||
}
|
||||
|
||||
void
|
||||
EventStateManager::UnregisterAccessKey(nsIContent* aContent, uint32_t aKey)
|
||||
EventStateManager::UnregisterAccessKey(Element* aElement, uint32_t aKey)
|
||||
{
|
||||
if (aContent)
|
||||
mAccessKeys.RemoveObject(aContent);
|
||||
if (aElement)
|
||||
mAccessKeys.RemoveObject(aElement);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
EventStateManager::GetRegisteredAccessKey(nsIContent* aContent)
|
||||
EventStateManager::GetRegisteredAccessKey(Element* aElement)
|
||||
{
|
||||
MOZ_ASSERT(aContent);
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
if (mAccessKeys.IndexOf(aContent) == -1)
|
||||
if (mAccessKeys.IndexOf(aElement) == -1)
|
||||
return 0;
|
||||
|
||||
nsAutoString accessKey;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, accessKey);
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, accessKey);
|
||||
return accessKey.First();
|
||||
}
|
||||
|
||||
|
|
|
@ -164,26 +164,26 @@ public:
|
|||
* Register accesskey on the given element. When accesskey is activated then
|
||||
* the element will be notified via nsIContent::PerformAccesskey() method.
|
||||
*
|
||||
* @param aContent the given element
|
||||
* @param aElement the given element
|
||||
* @param aKey accesskey
|
||||
*/
|
||||
void RegisterAccessKey(nsIContent* aContent, uint32_t aKey);
|
||||
void RegisterAccessKey(dom::Element* aElement, uint32_t aKey);
|
||||
|
||||
/**
|
||||
* Unregister accesskey for the given element.
|
||||
*
|
||||
* @param aContent the given element
|
||||
* @param aElement the given element
|
||||
* @param aKey accesskey
|
||||
*/
|
||||
void UnregisterAccessKey(nsIContent* aContent, uint32_t aKey);
|
||||
void UnregisterAccessKey(dom::Element* aElement, uint32_t aKey);
|
||||
|
||||
/**
|
||||
* Get accesskey registered on the given element or 0 if there is none.
|
||||
*
|
||||
* @param aContent the given element (must not be null)
|
||||
* @param aElement the given element (must not be null)
|
||||
* @return registered accesskey
|
||||
*/
|
||||
uint32_t GetRegisteredAccessKey(nsIContent* aContent);
|
||||
uint32_t GetRegisteredAccessKey(dom::Element* aContent);
|
||||
|
||||
static void GetAccessKeyLabelPrefix(dom::Element* aElement, nsAString& aPrefix);
|
||||
|
||||
|
|
|
@ -1293,17 +1293,17 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
|||
// that gets focus whenever anyone tries to focus the number control. We
|
||||
// need to check if aContent is one of those anonymous text controls and,
|
||||
// if so, use the number control instead:
|
||||
nsIContent* content = aContent;
|
||||
Element* element = aContent->AsElement();
|
||||
HTMLInputElement* inputElement =
|
||||
HTMLInputElement::FromContentOrNull(aContent);
|
||||
if (inputElement) {
|
||||
HTMLInputElement* ownerNumberControl =
|
||||
inputElement->GetOwnerNumberControl();
|
||||
if (ownerNumberControl) {
|
||||
content = ownerNumberControl; // an <input type=number>
|
||||
element = ownerNumberControl; // an <input type=number>
|
||||
}
|
||||
}
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::type,
|
||||
element->GetAttr(kNameSpaceID_None, nsGkAtoms::type,
|
||||
context.mHTMLInputType);
|
||||
} else {
|
||||
context.mHTMLInputType.Assign(nsGkAtoms::textarea->GetUTF16String());
|
||||
|
@ -1311,8 +1311,8 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
|||
|
||||
if (sInputModeSupported ||
|
||||
nsContentUtils::IsChromeDoc(aContent->OwnerDoc())) {
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::inputmode,
|
||||
context.mHTMLInputInputmode);
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::inputmode,
|
||||
context.mHTMLInputInputmode);
|
||||
if (context.mHTMLInputInputmode.EqualsLiteral("mozAwesomebar") &&
|
||||
!nsContentUtils::IsChromeDoc(aContent->OwnerDoc())) {
|
||||
// mozAwesomebar should be allowed only in chrome
|
||||
|
@ -1320,8 +1320,9 @@ IMEStateManager::SetIMEState(const IMEState& aState,
|
|||
}
|
||||
}
|
||||
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::moz_action_hint,
|
||||
context.mActionHint);
|
||||
aContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::moz_action_hint,
|
||||
context.mActionHint);
|
||||
|
||||
// Get the input content corresponding to the focused node,
|
||||
// which may be an anonymous child of the input content.
|
||||
|
|
|
@ -695,7 +695,7 @@ nsresult
|
|||
HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIContent* originatingElement = aFormSubmission->GetOriginatingElement();
|
||||
Element* originatingElement = aFormSubmission->GetOriginatingElement();
|
||||
|
||||
//
|
||||
// Get the action and target
|
||||
|
@ -1545,7 +1545,7 @@ HTMLFormElement::DoResolveName(const nsAString& aName,
|
|||
}
|
||||
|
||||
void
|
||||
HTMLFormElement::OnSubmitClickBegin(nsIContent* aOriginatingElement)
|
||||
HTMLFormElement::OnSubmitClickBegin(Element* aOriginatingElement)
|
||||
{
|
||||
mDeferSubmission = true;
|
||||
|
||||
|
@ -1613,7 +1613,7 @@ HTMLFormElement::GetAction(nsString& aValue)
|
|||
|
||||
nsresult
|
||||
HTMLFormElement::GetActionURL(nsIURI** aActionURL,
|
||||
nsIContent* aOriginatingElement)
|
||||
Element* aOriginatingElement)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -2262,9 +2262,9 @@ HTMLFormElement::WalkRadioGroup(const nsAString& aName,
|
|||
for (uint32_t i = 0; i < len; i++) {
|
||||
control = GetElementAt(i);
|
||||
if (control->ControlType() == NS_FORM_INPUT_RADIO) {
|
||||
nsCOMPtr<nsIContent> controlContent = do_QueryInterface(control);
|
||||
if (controlContent &&
|
||||
controlContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nsCOMPtr<Element> controlElement = do_QueryInterface(control);
|
||||
if (controlElement &&
|
||||
controlElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
EmptyString(), eCaseMatters) &&
|
||||
!aVisitor->Visit(control)) {
|
||||
break;
|
||||
|
@ -2461,7 +2461,8 @@ HTMLFormElement::AddElementToTableInternal(
|
|||
|
||||
// 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(content->HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
|
||||
NS_ASSERTION((content->IsElement() &&
|
||||
content->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::form)) ||
|
||||
content->GetParent(), "Item in list without parent");
|
||||
|
||||
// Determine the ordering between the new and old element.
|
||||
|
|
|
@ -242,7 +242,7 @@ public:
|
|||
* submission. In that case the form will defer the submission until the
|
||||
* script handler returns and the return value is known.
|
||||
*/
|
||||
void OnSubmitClickBegin(nsIContent* aOriginatingElement);
|
||||
void OnSubmitClickBegin(Element* aOriginatingElement);
|
||||
void OnSubmitClickEnd();
|
||||
|
||||
/**
|
||||
|
@ -520,7 +520,7 @@ protected:
|
|||
* @param aActionURL the full, unadulterated URL you'll be submitting to [OUT]
|
||||
* @param aOriginatingElement the originating element of the form submission [IN]
|
||||
*/
|
||||
nsresult GetActionURL(nsIURI** aActionURL, nsIContent* aOriginatingElement);
|
||||
nsresult GetActionURL(nsIURI** aActionURL, Element* aOriginatingElement);
|
||||
|
||||
/**
|
||||
* Check the form validity following this algorithm:
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
FSURLEncoded(NotNull<const Encoding*> aEncoding,
|
||||
int32_t aMethod,
|
||||
nsIDocument* aDocument,
|
||||
nsIContent* aOriginatingElement)
|
||||
Element* aOriginatingElement)
|
||||
: EncodingFormSubmission(aEncoding, aOriginatingElement)
|
||||
, mMethod(aMethod)
|
||||
, mDocument(aDocument)
|
||||
|
@ -396,7 +396,7 @@ FSURLEncoded::URLEncode(const nsAString& aStr, nsACString& aEncoded)
|
|||
// --------------------------------------------------------------------------
|
||||
|
||||
FSMultipartFormData::FSMultipartFormData(NotNull<const Encoding*> aEncoding,
|
||||
nsIContent* aOriginatingElement)
|
||||
Element* aOriginatingElement)
|
||||
: EncodingFormSubmission(aEncoding, aOriginatingElement)
|
||||
{
|
||||
mPostData =
|
||||
|
@ -670,7 +670,7 @@ class FSTextPlain : public EncodingFormSubmission
|
|||
{
|
||||
public:
|
||||
FSTextPlain(NotNull<const Encoding*> aEncoding,
|
||||
nsIContent* aOriginatingElement)
|
||||
Element* aOriginatingElement)
|
||||
: EncodingFormSubmission(aEncoding, aOriginatingElement)
|
||||
{
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ FSTextPlain::GetEncodedSubmission(nsIURI* aURI,
|
|||
|
||||
EncodingFormSubmission::EncodingFormSubmission(
|
||||
NotNull<const Encoding*> aEncoding,
|
||||
nsIContent* aOriginatingElement)
|
||||
Element* aOriginatingElement)
|
||||
: HTMLFormSubmission(aEncoding, aOriginatingElement)
|
||||
{
|
||||
if (!aEncoding->CanEncodeEverything()) {
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#define mozilla_dom_HTMLFormSubmission_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
#include "nsString.h"
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
*/
|
||||
void GetCharset(nsACString& aCharset) { mEncoding->Name(aCharset); }
|
||||
|
||||
nsIContent* GetOriginatingElement() const
|
||||
Element* GetOriginatingElement() const
|
||||
{
|
||||
return mOriginatingElement.get();
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ protected:
|
|||
* @param aOriginatingElement the originating element (can be null)
|
||||
*/
|
||||
HTMLFormSubmission(mozilla::NotNull<const mozilla::Encoding*> aEncoding,
|
||||
nsIContent* aOriginatingElement)
|
||||
Element* aOriginatingElement)
|
||||
: mEncoding(aEncoding)
|
||||
, mOriginatingElement(aOriginatingElement)
|
||||
{
|
||||
|
@ -119,14 +119,14 @@ protected:
|
|||
mozilla::NotNull<const mozilla::Encoding*> mEncoding;
|
||||
|
||||
// Originating element.
|
||||
nsCOMPtr<nsIContent> mOriginatingElement;
|
||||
RefPtr<Element> mOriginatingElement;
|
||||
};
|
||||
|
||||
class EncodingFormSubmission : public HTMLFormSubmission
|
||||
{
|
||||
public:
|
||||
EncodingFormSubmission(mozilla::NotNull<const mozilla::Encoding*> aEncoding,
|
||||
nsIContent* aOriginatingElement);
|
||||
Element* aOriginatingElement);
|
||||
|
||||
virtual ~EncodingFormSubmission();
|
||||
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
* @param aEncoding the character encoding of the form
|
||||
*/
|
||||
FSMultipartFormData(mozilla::NotNull<const mozilla::Encoding*> aEncoding,
|
||||
nsIContent* aOriginatingElement);
|
||||
Element* aOriginatingElement);
|
||||
~FSMultipartFormData();
|
||||
|
||||
virtual nsresult
|
||||
|
|
|
@ -1145,7 +1145,7 @@ HTMLImageElement::UpdateResponsiveSource()
|
|||
// an otherwise-usable source element may still have a media query that may not
|
||||
// match any more.
|
||||
if (candidateSource->IsHTMLElement(nsGkAtoms::source) &&
|
||||
!SourceElementMatches(candidateSource->AsContent())) {
|
||||
!SourceElementMatches(candidateSource->AsElement())) {
|
||||
isUsableCandidate = false;
|
||||
}
|
||||
|
||||
|
@ -1162,13 +1162,13 @@ HTMLImageElement::UpdateResponsiveSource()
|
|||
}
|
||||
} else if (candidateSource == this) {
|
||||
// We are the last possible source
|
||||
if (!TryCreateResponsiveSelector(candidateSource->AsContent())) {
|
||||
if (!TryCreateResponsiveSelector(candidateSource->AsElement())) {
|
||||
// Failed to find any source
|
||||
mResponsiveSelector = nullptr;
|
||||
}
|
||||
break;
|
||||
} else if (candidateSource->IsHTMLElement(nsGkAtoms::source) &&
|
||||
TryCreateResponsiveSelector(candidateSource->AsContent())) {
|
||||
TryCreateResponsiveSelector(candidateSource->AsElement())) {
|
||||
// This led to a valid source, stop
|
||||
break;
|
||||
}
|
||||
|
@ -1205,22 +1205,22 @@ HTMLImageElement::SupportedPictureSourceType(const nsAString& aType)
|
|||
}
|
||||
|
||||
bool
|
||||
HTMLImageElement::SourceElementMatches(nsIContent* aSourceNode)
|
||||
HTMLImageElement::SourceElementMatches(Element* aSourceElement)
|
||||
{
|
||||
MOZ_ASSERT(aSourceNode->IsHTMLElement(nsGkAtoms::source));
|
||||
MOZ_ASSERT(aSourceElement->IsHTMLElement(nsGkAtoms::source));
|
||||
|
||||
DebugOnly<Element *> parent(nsINode::GetParentElement());
|
||||
MOZ_ASSERT(parent && parent->IsHTMLElement(nsGkAtoms::picture));
|
||||
MOZ_ASSERT(IsPreviousSibling(aSourceNode, this));
|
||||
MOZ_ASSERT(IsPreviousSibling(aSourceElement, this));
|
||||
|
||||
// Check media and type
|
||||
HTMLSourceElement *src = static_cast<HTMLSourceElement*>(aSourceNode);
|
||||
auto* src = static_cast<HTMLSourceElement*>(aSourceElement);
|
||||
if (!src->MatchesCurrentMedia()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString type;
|
||||
if (aSourceNode->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) &&
|
||||
if (src->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) &&
|
||||
!SupportedPictureSourceType(type)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1229,27 +1229,27 @@ HTMLImageElement::SourceElementMatches(nsIContent* aSourceNode)
|
|||
}
|
||||
|
||||
bool
|
||||
HTMLImageElement::TryCreateResponsiveSelector(nsIContent *aSourceNode)
|
||||
HTMLImageElement::TryCreateResponsiveSelector(Element* aSourceElement)
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
|
||||
// Skip if this is not a <source> with matching media query
|
||||
bool isSourceTag = aSourceNode->IsHTMLElement(nsGkAtoms::source);
|
||||
bool isSourceTag = aSourceElement->IsHTMLElement(nsGkAtoms::source);
|
||||
if (isSourceTag) {
|
||||
if (!SourceElementMatches(aSourceNode)) {
|
||||
if (!SourceElementMatches(aSourceElement)) {
|
||||
return false;
|
||||
}
|
||||
auto* source = HTMLSourceElement::FromContent(aSourceNode);
|
||||
auto* source = HTMLSourceElement::FromContent(aSourceElement);
|
||||
principal = source->GetSrcsetTriggeringPrincipal();
|
||||
} else if (aSourceNode->IsHTMLElement(nsGkAtoms::img)) {
|
||||
} else if (aSourceElement->IsHTMLElement(nsGkAtoms::img)) {
|
||||
// Otherwise this is the <img> tag itself
|
||||
MOZ_ASSERT(aSourceNode == this);
|
||||
MOZ_ASSERT(aSourceElement == this);
|
||||
principal = mSrcsetTriggeringPrincipal;
|
||||
}
|
||||
|
||||
// Skip if has no srcset or an empty srcset
|
||||
nsString srcset;
|
||||
if (!aSourceNode->GetAttr(kNameSpaceID_None, nsGkAtoms::srcset, srcset)) {
|
||||
if (!aSourceElement->GetAttr(kNameSpaceID_None, nsGkAtoms::srcset, srcset)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1259,19 +1259,20 @@ HTMLImageElement::TryCreateResponsiveSelector(nsIContent *aSourceNode)
|
|||
|
||||
|
||||
// Try to parse
|
||||
RefPtr<ResponsiveImageSelector> sel = new ResponsiveImageSelector(aSourceNode);
|
||||
RefPtr<ResponsiveImageSelector> sel =
|
||||
new ResponsiveImageSelector(aSourceElement);
|
||||
if (!sel->SetCandidatesFromSourceSet(srcset, principal)) {
|
||||
// No possible candidates, don't need to bother parsing sizes
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString sizes;
|
||||
aSourceNode->GetAttr(kNameSpaceID_None, nsGkAtoms::sizes, sizes);
|
||||
aSourceElement->GetAttr(kNameSpaceID_None, nsGkAtoms::sizes, sizes);
|
||||
sel->SetSizesFromDescriptor(sizes);
|
||||
|
||||
// If this is the <img> tag, also pull in src as the default source
|
||||
if (!isSourceTag) {
|
||||
MOZ_ASSERT(aSourceNode == this);
|
||||
MOZ_ASSERT(aSourceElement == this);
|
||||
nsAutoString src;
|
||||
if (GetAttr(kNameSpaceID_None, nsGkAtoms::src, src) && !src.IsEmpty()) {
|
||||
sel->SetDefaultSource(src, mSrcTriggeringPrincipal);
|
||||
|
|
|
@ -370,7 +370,7 @@ protected:
|
|||
// If the node's srcset/sizes make for an invalid selector, returns
|
||||
// false. This does not guarantee the resulting selector matches an image,
|
||||
// only that it is valid.
|
||||
bool TryCreateResponsiveSelector(nsIContent *aSourceNode);
|
||||
bool TryCreateResponsiveSelector(Element* aSourceElement);
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT CSSIntPoint GetXY();
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
@ -400,7 +400,7 @@ protected:
|
|||
RefPtr<ResponsiveImageSelector> mResponsiveSelector;
|
||||
|
||||
private:
|
||||
bool SourceElementMatches(nsIContent* aSourceNode);
|
||||
bool SourceElementMatches(Element* aSourceElement);
|
||||
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
|
|
|
@ -4135,7 +4135,7 @@ HTMLInputElement::ShouldPreventDOMActivateDispatch(EventTarget* aOriginalTarget)
|
|||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> target = do_QueryInterface(aOriginalTarget);
|
||||
nsCOMPtr<Element> target = do_QueryInterface(aOriginalTarget);
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ HTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc,
|
|||
// this should never actually happen and the performance hit is minimal,
|
||||
// doing the "right" thing costs virtually nothing here, even if it doesn't
|
||||
// make much sense.
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::_empty, &nsGkAtoms::stylesheet, nullptr};
|
||||
|
||||
if (!nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None,
|
||||
|
|
|
@ -2361,7 +2361,7 @@ void HTMLMediaElement::LoadFromSourceChildren()
|
|||
AddMutationObserverUnlessExists(this);
|
||||
|
||||
while (true) {
|
||||
nsIContent* child = GetNextSource();
|
||||
Element* child = GetNextSource();
|
||||
if (!child) {
|
||||
// Exhausted candidates, wait for more candidates to be appended to
|
||||
// the media element.
|
||||
|
@ -6769,7 +6769,8 @@ void HTMLMediaElement::NotifyAddedSource()
|
|||
}
|
||||
}
|
||||
|
||||
nsIContent* HTMLMediaElement::GetNextSource()
|
||||
Element*
|
||||
HTMLMediaElement::GetNextSource()
|
||||
{
|
||||
mSourceLoadCandidate = nullptr;
|
||||
|
||||
|
@ -6788,7 +6789,7 @@ nsIContent* HTMLMediaElement::GetNextSource()
|
|||
// If child is a <source> element, it is the next candidate.
|
||||
if (child && child->IsHTMLElement(nsGkAtoms::source)) {
|
||||
mSourceLoadCandidate = child;
|
||||
return child;
|
||||
return child->AsElement();
|
||||
}
|
||||
}
|
||||
NS_NOTREACHED("Execution should not reach here!");
|
||||
|
|
|
@ -1070,7 +1070,7 @@ protected:
|
|||
* during the resource selection algorithm. Stores the return value in
|
||||
* mSourceLoadCandidate before returning.
|
||||
*/
|
||||
nsIContent* GetNextSource();
|
||||
Element* GetNextSource();
|
||||
|
||||
/**
|
||||
* Changes mDelayingLoadEvent, and will call BlockOnLoad()/UnblockOnLoad()
|
||||
|
|
|
@ -215,9 +215,9 @@ HTMLMenuElement::TraverseContent(nsIContent* aContent,
|
|||
} else if (child->IsHTMLElement(nsGkAtoms::hr)) {
|
||||
aBuilder->AddSeparator();
|
||||
} else if (child->IsHTMLElement(nsGkAtoms::menu) && !element->IsHidden()) {
|
||||
if (child->HasAttr(kNameSpaceID_None, nsGkAtoms::label)) {
|
||||
if (child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::label)) {
|
||||
nsAutoString label;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::label, label);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, label);
|
||||
|
||||
BuildSubmenu(label, child, aBuilder);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
|
|||
for (nsIContent* child = aDocument->GetFirstChild(); child;
|
||||
child = child->GetNextNode()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::base) &&
|
||||
child->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||
if (aMustMatch && child != aMustMatch) {
|
||||
return;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
|
|||
// Resolve the <base> element's href relative to our document's
|
||||
// fallback base URI.
|
||||
nsAutoString href;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
||||
|
||||
nsCOMPtr<nsIURI> newBaseURI;
|
||||
nsContentUtils::NewURIWithDocumentCharset(
|
||||
|
@ -180,13 +180,13 @@ SetBaseTargetUsingFirstBaseWithTarget(nsIDocument* aDocument,
|
|||
for (nsIContent* child = aDocument->GetFirstChild(); child;
|
||||
child = child->GetNextNode()) {
|
||||
if (child->IsHTMLElement(nsGkAtoms::base) &&
|
||||
child->HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
||||
child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
||||
if (aMustMatch && child != aMustMatch) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsString target;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::target, target);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::target, target);
|
||||
aDocument->SetBaseTarget(target);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -247,10 +247,10 @@ TableRowsCollection::GetFirstNamedElement(const nsAString& aName, bool& aFound)
|
|||
NS_ENSURE_TRUE(nameAtom, nullptr);
|
||||
|
||||
for (auto& node : mRows) {
|
||||
if (node->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nameAtom, eCaseMatters) ||
|
||||
node->AttrValueIs(kNameSpaceID_None, nsGkAtoms::id,
|
||||
nameAtom, eCaseMatters)) {
|
||||
if (node->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
|
||||
nameAtom, eCaseMatters) ||
|
||||
node->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::id,
|
||||
nameAtom, eCaseMatters)) {
|
||||
aFound = true;
|
||||
return node->AsElement();
|
||||
}
|
||||
|
|
|
@ -381,10 +381,11 @@ nsGenericHTMLElement::Spellcheck()
|
|||
nsIContent* node;
|
||||
for (node = this; node; node = node->GetParent()) {
|
||||
if (node->IsHTMLElement()) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::_true, &nsGkAtoms::_false, nullptr};
|
||||
switch (node->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::spellcheck,
|
||||
strings, eCaseMatters)) {
|
||||
switch (node->AsElement()->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::spellcheck, strings,
|
||||
eCaseMatters)) {
|
||||
case 0: // spellcheck = "true"
|
||||
return true;
|
||||
case 1: // spellcheck = "false"
|
||||
|
@ -2786,7 +2787,9 @@ MakeContentDescendantsEditable(nsIContent *aContent, nsIDocument *aDocument)
|
|||
for (nsIContent *child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (!child->HasAttr(kNameSpaceID_None, nsGkAtoms::contenteditable)) {
|
||||
if (!child->IsElement() ||
|
||||
!child->AsElement()->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::contenteditable)) {
|
||||
MakeContentDescendantsEditable(child, aDocument);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -963,7 +963,7 @@ protected:
|
|||
*/
|
||||
ContentEditableTristate GetContentEditableValue() const
|
||||
{
|
||||
static const nsIContent::AttrValuesArray values[] =
|
||||
static const Element::AttrValuesArray values[] =
|
||||
{ &nsGkAtoms::_false, &nsGkAtoms::_true, &nsGkAtoms::_empty, nullptr };
|
||||
|
||||
if (!MayHaveContentEditableAttr())
|
||||
|
|
|
@ -62,11 +62,11 @@ nsIConstraintValidation::GetValidationMessage(nsAString& aValidationMessage,
|
|||
aValidationMessage.Truncate();
|
||||
|
||||
if (IsCandidateForConstraintValidation() && !IsValid()) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(this);
|
||||
NS_ASSERTION(content, "This class should be inherited by HTML elements only!");
|
||||
nsCOMPtr<Element> element = do_QueryInterface(this);
|
||||
NS_ASSERTION(element, "This class should be inherited by HTML elements only!");
|
||||
|
||||
nsAutoString authorMessage;
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::x_moz_errormessage,
|
||||
element->GetAttr(kNameSpaceID_None, nsGkAtoms::x_moz_errormessage,
|
||||
authorMessage);
|
||||
|
||||
if (!authorMessage.IsEmpty()) {
|
||||
|
@ -187,9 +187,7 @@ nsIConstraintValidation::ReportValidity()
|
|||
|
||||
if (content->IsHTMLElement(nsGkAtoms::input) &&
|
||||
nsContentUtils::IsFocusedContent(content)) {
|
||||
HTMLInputElement* inputElement =
|
||||
HTMLInputElement::FromContentOrNull(content);
|
||||
|
||||
HTMLInputElement* inputElement = HTMLInputElement::FromContent(content);
|
||||
inputElement->UpdateValidityUIBits(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -206,11 +206,12 @@ nsITextControlElement::GetWrapPropertyEnum(nsIContent* aContent,
|
|||
|
||||
nsAutoString wrap;
|
||||
if (aContent->IsHTMLElement()) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::HARD, &nsGkAtoms::OFF, nullptr};
|
||||
|
||||
switch (aContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::wrap,
|
||||
strings, eIgnoreCase)) {
|
||||
switch (aContent->AsElement()->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::wrap, strings,
|
||||
eIgnoreCase)) {
|
||||
case 0: aWrapProp = eHTMLTextWrap_Hard; break;
|
||||
case 1: aWrapProp = eHTMLTextWrap_Off; break;
|
||||
}
|
||||
|
@ -1555,17 +1556,16 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
|
|||
// Set max text field length
|
||||
newTextEditor->SetMaxTextLength(GetMaxLength());
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
|
||||
if (content) {
|
||||
if (nsCOMPtr<Element> element = do_QueryInterface(mTextCtrlElement)) {
|
||||
editorFlags = newTextEditor->Flags();
|
||||
|
||||
// Check if the readonly attribute is set.
|
||||
if (content->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly))
|
||||
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly))
|
||||
editorFlags |= nsIPlaintextEditor::eEditorReadonlyMask;
|
||||
|
||||
// Check if the disabled attribute is set.
|
||||
// TODO: call IsDisabled() here!
|
||||
if (content->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled))
|
||||
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled))
|
||||
editorFlags |= nsIPlaintextEditor::eEditorDisabledMask;
|
||||
|
||||
// Disable the selection if necessary.
|
||||
|
|
|
@ -1011,13 +1011,13 @@ nsMathMLElement::IsLink(nsIURI** aURI) const
|
|||
// For any other values, we're either not a *clickable* XLink, or the end
|
||||
// result is poorly specified. Either way, we return false.
|
||||
|
||||
static nsIContent::AttrValuesArray sTypeVals[] =
|
||||
static Element::AttrValuesArray sTypeVals[] =
|
||||
{ &nsGkAtoms::_empty, &nsGkAtoms::simple, nullptr };
|
||||
|
||||
static nsIContent::AttrValuesArray sShowVals[] =
|
||||
static Element::AttrValuesArray sShowVals[] =
|
||||
{ &nsGkAtoms::_empty, &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr };
|
||||
|
||||
static nsIContent::AttrValuesArray sActuateVals[] =
|
||||
static Element::AttrValuesArray sActuateVals[] =
|
||||
{ &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nullptr };
|
||||
|
||||
// Optimization: check for href first for early return
|
||||
|
@ -1026,13 +1026,13 @@ nsMathMLElement::IsLink(nsIURI** aURI) const
|
|||
if (href &&
|
||||
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
sTypeVals, eCaseMatters) !=
|
||||
nsIContent::ATTR_VALUE_NO_MATCH &&
|
||||
Element::ATTR_VALUE_NO_MATCH &&
|
||||
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show,
|
||||
sShowVals, eCaseMatters) !=
|
||||
nsIContent::ATTR_VALUE_NO_MATCH &&
|
||||
Element::ATTR_VALUE_NO_MATCH &&
|
||||
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate,
|
||||
sActuateVals, eCaseMatters) !=
|
||||
nsIContent::ATTR_VALUE_NO_MATCH) {
|
||||
Element::ATTR_VALUE_NO_MATCH) {
|
||||
hasHref = true;
|
||||
}
|
||||
}
|
||||
|
@ -1063,7 +1063,7 @@ nsMathMLElement::GetLinkTarget(nsAString& aTarget)
|
|||
|
||||
if (aTarget.IsEmpty()) {
|
||||
|
||||
static nsIContent::AttrValuesArray sShowVals[] =
|
||||
static Element::AttrValuesArray sShowVals[] =
|
||||
{ &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr };
|
||||
|
||||
switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show,
|
||||
|
|
|
@ -255,8 +255,12 @@ IsScriptEventHandler(ScriptKind kind, nsIContent* aScriptElement)
|
|||
}
|
||||
|
||||
nsAutoString forAttr, eventAttr;
|
||||
if (!aScriptElement->GetAttr(kNameSpaceID_None, nsGkAtoms::_for, forAttr) ||
|
||||
!aScriptElement->GetAttr(kNameSpaceID_None, nsGkAtoms::event, eventAttr)) {
|
||||
if (!aScriptElement->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::_for,
|
||||
forAttr) ||
|
||||
!aScriptElement->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::event,
|
||||
eventAttr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1248,7 +1252,7 @@ CSPAllowsInlineScript(nsIScriptElement* aElement, nsIDocument* aDocument)
|
|||
}
|
||||
|
||||
// query the nonce
|
||||
nsCOMPtr<nsIContent> scriptContent = do_QueryInterface(aElement);
|
||||
nsCOMPtr<Element> scriptContent = do_QueryInterface(aElement);
|
||||
nsAutoString nonce;
|
||||
scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::nonce, nonce);
|
||||
bool parserCreated = aElement->GetParserCreated() != mozilla::dom::NOT_FROM_PARSER;
|
||||
|
@ -1328,7 +1332,9 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||
// HTML script elements.
|
||||
if (scriptContent->IsHTMLElement()) {
|
||||
nsAutoString language;
|
||||
scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::language, language);
|
||||
scriptContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::language,
|
||||
language);
|
||||
if (!language.IsEmpty()) {
|
||||
if (!nsContentUtils::IsJavaScriptLanguage(language)) {
|
||||
return false;
|
||||
|
@ -1345,7 +1351,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||
if (ModuleScriptsEnabled() &&
|
||||
scriptKind == ScriptKind::Classic &&
|
||||
scriptContent->IsHTMLElement() &&
|
||||
scriptContent->HasAttr(kNameSpaceID_None, nsGkAtoms::nomodule)) {
|
||||
scriptContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::nomodule)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1404,8 +1410,9 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||
SRIMetadata sriMetadata;
|
||||
{
|
||||
nsAutoString integrity;
|
||||
scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::integrity,
|
||||
integrity);
|
||||
scriptContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::integrity,
|
||||
integrity);
|
||||
if (!integrity.IsEmpty()) {
|
||||
MOZ_LOG(SRILogHelper::GetSriLog(), mozilla::LogLevel::Debug,
|
||||
("ScriptLoader::ProcessScriptElement, integrity=%s",
|
||||
|
|
|
@ -266,13 +266,13 @@ SVGAElement::IsLink(nsIURI** aURI) const
|
|||
// For any other values, we're either not a *clickable* XLink, or the end
|
||||
// result is poorly specified. Either way, we return false.
|
||||
|
||||
static nsIContent::AttrValuesArray sTypeVals[] =
|
||||
static Element::AttrValuesArray sTypeVals[] =
|
||||
{ &nsGkAtoms::_empty, &nsGkAtoms::simple, nullptr };
|
||||
|
||||
static nsIContent::AttrValuesArray sShowVals[] =
|
||||
static Element::AttrValuesArray sShowVals[] =
|
||||
{ &nsGkAtoms::_empty, &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr };
|
||||
|
||||
static nsIContent::AttrValuesArray sActuateVals[] =
|
||||
static Element::AttrValuesArray sActuateVals[] =
|
||||
{ &nsGkAtoms::_empty, &nsGkAtoms::onRequest, nullptr };
|
||||
|
||||
// Optimization: check for href first for early return
|
||||
|
@ -281,13 +281,13 @@ SVGAElement::IsLink(nsIURI** aURI) const
|
|||
if ((useBareHref || mStringAttributes[XLINK_HREF].IsExplicitlySet()) &&
|
||||
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::type,
|
||||
sTypeVals, eCaseMatters) !=
|
||||
nsIContent::ATTR_VALUE_NO_MATCH &&
|
||||
Element::ATTR_VALUE_NO_MATCH &&
|
||||
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show,
|
||||
sShowVals, eCaseMatters) !=
|
||||
nsIContent::ATTR_VALUE_NO_MATCH &&
|
||||
Element::ATTR_VALUE_NO_MATCH &&
|
||||
FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::actuate,
|
||||
sActuateVals, eCaseMatters) !=
|
||||
nsIContent::ATTR_VALUE_NO_MATCH) {
|
||||
Element::ATTR_VALUE_NO_MATCH) {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
// Get absolute URI
|
||||
nsAutoString str;
|
||||
|
@ -308,7 +308,7 @@ SVGAElement::GetLinkTarget(nsAString& aTarget)
|
|||
mStringAttributes[TARGET].GetAnimValue(aTarget, this);
|
||||
if (aTarget.IsEmpty()) {
|
||||
|
||||
static nsIContent::AttrValuesArray sShowVals[] =
|
||||
static Element::AttrValuesArray sShowVals[] =
|
||||
{ &nsGkAtoms::_new, &nsGkAtoms::replace, nullptr };
|
||||
|
||||
switch (FindAttrValueIn(kNameSpaceID_XLink, nsGkAtoms::show,
|
||||
|
|
|
@ -1546,7 +1546,7 @@ nsXBLPrototypeBinding::WriteNamespace(nsIObjectOutputStream* aStream,
|
|||
|
||||
bool CheckTagNameWhiteList(int32_t aNameSpaceID, nsAtom *aTagName)
|
||||
{
|
||||
static nsIContent::AttrValuesArray kValidXULTagNames[] = {
|
||||
static Element::AttrValuesArray kValidXULTagNames[] = {
|
||||
&nsGkAtoms::autorepeatbutton, &nsGkAtoms::box, &nsGkAtoms::browser,
|
||||
&nsGkAtoms::button, &nsGkAtoms::hbox, &nsGkAtoms::image, &nsGkAtoms::menu,
|
||||
&nsGkAtoms::menubar, &nsGkAtoms::menuitem, &nsGkAtoms::menupopup,
|
||||
|
|
|
@ -104,7 +104,7 @@ nsXBLPrototypeHandler::nsXBLPrototypeHandler(const char16_t* aEvent,
|
|||
aGroup, aPreventDefault, aAllowUntrusted);
|
||||
}
|
||||
|
||||
nsXBLPrototypeHandler::nsXBLPrototypeHandler(nsIContent* aHandlerElement, XBLReservedKey aReserved)
|
||||
nsXBLPrototypeHandler::nsXBLPrototypeHandler(Element* aHandlerElement, XBLReservedKey aReserved)
|
||||
: mHandlerElement(nullptr),
|
||||
mLineNumber(0),
|
||||
mReserved(aReserved),
|
||||
|
@ -200,11 +200,11 @@ nsXBLPrototypeHandler::TryConvertToKeyboardShortcut(
|
|||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIContent>
|
||||
already_AddRefed<Element>
|
||||
nsXBLPrototypeHandler::GetHandlerElement()
|
||||
{
|
||||
if (mType & NS_HANDLER_TYPE_XUL) {
|
||||
nsCOMPtr<nsIContent> element = do_QueryReferent(mHandlerElement);
|
||||
nsCOMPtr<Element> element = do_QueryReferent(mHandlerElement);
|
||||
return element.forget();
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
|
|||
nsresult
|
||||
nsXBLPrototypeHandler::DispatchXULKeyCommand(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> handlerElement = GetHandlerElement();
|
||||
nsCOMPtr<Element> handlerElement = GetHandlerElement();
|
||||
NS_ENSURE_STATE(handlerElement);
|
||||
if (handlerElement->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::disabled,
|
||||
|
@ -836,7 +836,7 @@ nsXBLPrototypeHandler::AccelKeyMask()
|
|||
void
|
||||
nsXBLPrototypeHandler::GetEventType(nsAString& aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> handlerElement = GetHandlerElement();
|
||||
nsCOMPtr<Element> handlerElement = GetHandlerElement();
|
||||
if (!handlerElement) {
|
||||
aEvent.Truncate();
|
||||
return;
|
||||
|
@ -849,7 +849,7 @@ nsXBLPrototypeHandler::GetEventType(nsAString& aEvent)
|
|||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
||||
nsXBLPrototypeHandler::ConstructPrototype(Element* aKeyElement,
|
||||
const char16_t* aEvent,
|
||||
const char16_t* aPhase,
|
||||
const char16_t* aAction,
|
||||
|
@ -1010,7 +1010,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
|||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeHandler::ReportKeyConflict(const char16_t* aKey, const char16_t* aModifiers, nsIContent* aKeyElement, const char *aMessageName)
|
||||
nsXBLPrototypeHandler::ReportKeyConflict(const char16_t* aKey, const char16_t* aModifiers, Element* aKeyElement, const char *aMessageName)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (mPrototypeBinding) {
|
||||
|
|
|
@ -64,6 +64,12 @@ enum XBLReservedKey : uint8_t
|
|||
XBLReservedKey_Unset = 2,
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
}
|
||||
}
|
||||
|
||||
class nsXBLPrototypeHandler
|
||||
{
|
||||
typedef mozilla::IgnoreModifierState IgnoreModifierState;
|
||||
|
@ -83,7 +89,7 @@ public:
|
|||
uint32_t aLineNumber);
|
||||
|
||||
// This constructor is used only by XUL key handlers (e.g., <key>)
|
||||
explicit nsXBLPrototypeHandler(nsIContent* aKeyElement, XBLReservedKey aReserved);
|
||||
explicit nsXBLPrototypeHandler(mozilla::dom::Element* aKeyElement, XBLReservedKey aReserved);
|
||||
|
||||
// This constructor is used for handlers loaded from the cache
|
||||
explicit nsXBLPrototypeHandler(nsXBLPrototypeBinding* aBinding);
|
||||
|
@ -121,7 +127,7 @@ public:
|
|||
return MouseEventMatched(aEvent);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIContent> GetHandlerElement();
|
||||
already_AddRefed<mozilla::dom::Element> GetHandlerElement();
|
||||
|
||||
void AppendHandlerText(const nsAString& aText);
|
||||
|
||||
|
@ -180,7 +186,7 @@ protected:
|
|||
already_AddRefed<nsIController> GetController(mozilla::dom::EventTarget* aTarget);
|
||||
|
||||
inline int32_t GetMatchingKeyCode(const nsAString& aKeyName);
|
||||
void ConstructPrototype(nsIContent* aKeyElement,
|
||||
void ConstructPrototype(mozilla::dom::Element* aKeyElement,
|
||||
const char16_t* aEvent=nullptr, const char16_t* aPhase=nullptr,
|
||||
const char16_t* aAction=nullptr, const char16_t* aCommand=nullptr,
|
||||
const char16_t* aKeyCode=nullptr, const char16_t* aCharCode=nullptr,
|
||||
|
@ -189,7 +195,7 @@ protected:
|
|||
const char16_t* aPreventDefault=nullptr,
|
||||
const char16_t* aAllowUntrusted=nullptr);
|
||||
|
||||
void ReportKeyConflict(const char16_t* aKey, const char16_t* aModifiers, nsIContent* aElement, const char *aMessageName);
|
||||
void ReportKeyConflict(const char16_t* aKey, const char16_t* aModifiers, mozilla::dom::Element* aElement, const char *aMessageName);
|
||||
void GetEventType(nsAString& type);
|
||||
bool ModifiersMatchMask(nsIDOMUIEvent* aEvent,
|
||||
const IgnoreModifierState& aIgnoreModifierState);
|
||||
|
|
|
@ -197,35 +197,39 @@ BuildHandlerChain(nsIContent* aContent, nsXBLPrototypeHandler** aResult)
|
|||
for (nsIContent* key = aContent->GetLastChild();
|
||||
key;
|
||||
key = key->GetPreviousSibling()) {
|
||||
|
||||
if (key->NodeInfo()->Equals(nsGkAtoms::key, kNameSpaceID_XUL)) {
|
||||
// Check whether the key element has empty value at key/char attribute.
|
||||
// Such element is used by localizers for alternative shortcut key
|
||||
// definition on the locale. See bug 426501.
|
||||
nsAutoString valKey, valCharCode, valKeyCode;
|
||||
bool attrExists =
|
||||
key->GetAttr(kNameSpaceID_None, nsGkAtoms::key, valKey) ||
|
||||
key->GetAttr(kNameSpaceID_None, nsGkAtoms::charcode, valCharCode) ||
|
||||
key->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, valKeyCode);
|
||||
if (attrExists &&
|
||||
valKey.IsEmpty() && valCharCode.IsEmpty() && valKeyCode.IsEmpty())
|
||||
continue;
|
||||
|
||||
// reserved="pref" is the default for <key> elements.
|
||||
XBLReservedKey reserved = XBLReservedKey_Unset;
|
||||
if (key->AttrValueIs(kNameSpaceID_None, nsGkAtoms::reserved,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
reserved = XBLReservedKey_True;
|
||||
} else if (key->AttrValueIs(kNameSpaceID_None, nsGkAtoms::reserved,
|
||||
nsGkAtoms::_false, eCaseMatters)) {
|
||||
reserved = XBLReservedKey_False;
|
||||
}
|
||||
|
||||
nsXBLPrototypeHandler* handler = new nsXBLPrototypeHandler(key, reserved);
|
||||
|
||||
handler->SetNextHandler(*aResult);
|
||||
*aResult = handler;
|
||||
if (!key->NodeInfo()->Equals(nsGkAtoms::key, kNameSpaceID_XUL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Element* keyElement = key->AsElement();
|
||||
// Check whether the key element has empty value at key/char attribute.
|
||||
// Such element is used by localizers for alternative shortcut key
|
||||
// definition on the locale. See bug 426501.
|
||||
nsAutoString valKey, valCharCode, valKeyCode;
|
||||
bool attrExists =
|
||||
keyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::key, valKey) ||
|
||||
keyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::charcode, valCharCode) ||
|
||||
keyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, valKeyCode);
|
||||
if (attrExists &&
|
||||
valKey.IsEmpty() && valCharCode.IsEmpty() && valKeyCode.IsEmpty())
|
||||
continue;
|
||||
|
||||
// reserved="pref" is the default for <key> elements.
|
||||
XBLReservedKey reserved = XBLReservedKey_Unset;
|
||||
if (keyElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::reserved,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
reserved = XBLReservedKey_True;
|
||||
} else if (keyElement->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::reserved,
|
||||
nsGkAtoms::_false, eCaseMatters)) {
|
||||
reserved = XBLReservedKey_False;
|
||||
}
|
||||
|
||||
nsXBLPrototypeHandler* handler =
|
||||
new nsXBLPrototypeHandler(keyElement, reserved);
|
||||
|
||||
handler->SetNextHandler(*aResult);
|
||||
*aResult = handler;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -870,7 +874,7 @@ nsXBLWindowKeyHandler::GetElementForHandler(nsXBLPrototypeHandler* aHandler,
|
|||
MOZ_ASSERT(aElementForHandler);
|
||||
*aElementForHandler = nullptr;
|
||||
|
||||
nsCOMPtr<nsIContent> keyContent = aHandler->GetHandlerElement();
|
||||
RefPtr<Element> keyContent = aHandler->GetHandlerElement();
|
||||
if (!keyContent) {
|
||||
return true; // XXX Even though no key element?
|
||||
}
|
||||
|
|
|
@ -284,11 +284,12 @@ bool
|
|||
txXPathNodeUtils::getAttr(const txXPathNode& aNode, nsAtom* aLocalName,
|
||||
int32_t aNSID, nsAString& aValue)
|
||||
{
|
||||
if (aNode.isDocument() || aNode.isAttribute()) {
|
||||
if (aNode.isDocument() || aNode.isAttribute() ||
|
||||
!aNode.Content()->IsElement()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return aNode.Content()->GetAttr(aNSID, aLocalName, aValue);
|
||||
return aNode.Content()->AsElement()->GetAttr(aNSID, aLocalName, aValue);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -452,13 +453,14 @@ txXPathNodeUtils::appendNodeValue(const txXPathNode& aNode, nsAString& aResult)
|
|||
const nsAttrName* name = aNode.Content()->AsElement()->GetAttrNameAt(aNode.mIndex);
|
||||
|
||||
if (aResult.IsEmpty()) {
|
||||
aNode.Content()->GetAttr(name->NamespaceID(), name->LocalName(),
|
||||
aResult);
|
||||
}
|
||||
else {
|
||||
aNode.Content()->AsElement()->GetAttr(name->NamespaceID(),
|
||||
name->LocalName(),
|
||||
aResult);
|
||||
} else {
|
||||
nsAutoString result;
|
||||
aNode.Content()->GetAttr(name->NamespaceID(), name->LocalName(),
|
||||
result);
|
||||
aNode.Content()->AsElement()->GetAttr(name->NamespaceID(),
|
||||
name->LocalName(),
|
||||
result);
|
||||
aResult.Append(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -752,10 +752,10 @@ txMozillaXMLOutput::endHTMLElement(nsIContent* aElement)
|
|||
else if (mCreatingNewDocument && aElement->IsHTMLElement(nsGkAtoms::meta)) {
|
||||
// handle HTTP-EQUIV data
|
||||
nsAutoString httpEquiv;
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, httpEquiv);
|
||||
aElement->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, httpEquiv);
|
||||
if (!httpEquiv.IsEmpty()) {
|
||||
nsAutoString value;
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::content, value);
|
||||
aElement->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::content, value);
|
||||
if (!value.IsEmpty()) {
|
||||
nsContentUtils::ASCIIToLower(httpEquiv);
|
||||
RefPtr<nsAtom> header = NS_Atomize(httpEquiv);
|
||||
|
|
|
@ -870,12 +870,12 @@ XULDocument::ExecuteOnBroadcastHandlerFor(Element* aBroadcaster,
|
|||
// ought to have an |element| attribute that refers to
|
||||
// aBroadcaster, and an |attribute| element that tells us what
|
||||
// attriubtes we're listening for.
|
||||
if (!child->NodeInfo()->Equals(nsGkAtoms::observes, kNameSpaceID_XUL))
|
||||
if (!child->IsXULElement(nsGkAtoms::observes))
|
||||
continue;
|
||||
|
||||
// Is this the element that was listening to us?
|
||||
nsAutoString listeningToID;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::element, listeningToID);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::element, listeningToID);
|
||||
|
||||
nsAutoString broadcasterID;
|
||||
aBroadcaster->GetAttr(kNameSpaceID_None, nsGkAtoms::id, broadcasterID);
|
||||
|
@ -886,8 +886,8 @@ XULDocument::ExecuteOnBroadcastHandlerFor(Element* aBroadcaster,
|
|||
// We are observing the broadcaster, but is this the right
|
||||
// attribute?
|
||||
nsAutoString listeningToAttribute;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::attribute,
|
||||
listeningToAttribute);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::attribute,
|
||||
listeningToAttribute);
|
||||
|
||||
if (!aAttr->Equals(listeningToAttribute) &&
|
||||
!listeningToAttribute.EqualsLiteral("*")) {
|
||||
|
@ -1036,7 +1036,7 @@ XULDocument::AttributeChanged(nsIDocument* aDocument,
|
|||
// XXXldb This should check that it's a token, not just a substring.
|
||||
persist.Find(nsDependentAtomString(aAttribute)) >= 0) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NewRunnableMethod<nsIContent*, int32_t, nsAtom*>(
|
||||
NewRunnableMethod<Element*, int32_t, nsAtom*>(
|
||||
"dom::XULDocument::DoPersist",
|
||||
this,
|
||||
&XULDocument::DoPersist,
|
||||
|
@ -1308,7 +1308,7 @@ XULDocument::Persist(const nsAString& aID,
|
|||
}
|
||||
|
||||
nsresult
|
||||
XULDocument::Persist(nsIContent* aElement, int32_t aNameSpaceID,
|
||||
XULDocument::Persist(Element* aElement, int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute)
|
||||
{
|
||||
// For non-chrome documents, persistance is simply broken
|
||||
|
@ -3631,7 +3631,7 @@ XULDocument::AddAttributes(nsXULPrototypeElement* aPrototype,
|
|||
|
||||
|
||||
nsresult
|
||||
XULDocument::CheckTemplateBuilderHookup(nsIContent* aElement,
|
||||
XULDocument::CheckTemplateBuilderHookup(Element* aElement,
|
||||
bool* aNeedsHookup)
|
||||
{
|
||||
// See if the element already has a `database' attribute. If it
|
||||
|
@ -4260,11 +4260,15 @@ XULDocument::InsertElement(nsINode* aParent, nsIContent* aChild, bool aNotify)
|
|||
bool wasInserted = false;
|
||||
|
||||
// insert after an element of a given id
|
||||
aChild->GetAttr(kNameSpaceID_None, nsGkAtoms::insertafter, posStr);
|
||||
bool isInsertAfter = true;
|
||||
if (aChild->IsElement()) {
|
||||
aChild->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::insertafter, posStr);
|
||||
}
|
||||
|
||||
bool isInsertAfter = true;
|
||||
if (posStr.IsEmpty()) {
|
||||
aChild->GetAttr(kNameSpaceID_None, nsGkAtoms::insertbefore, posStr);
|
||||
if (aChild->IsElement()) {
|
||||
aChild->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::insertbefore, posStr);
|
||||
}
|
||||
isInsertAfter = false;
|
||||
}
|
||||
|
||||
|
@ -4301,8 +4305,9 @@ XULDocument::InsertElement(nsINode* aParent, nsIContent* aChild, bool aNotify)
|
|||
}
|
||||
|
||||
if (!wasInserted) {
|
||||
aChild->GetAttr(kNameSpaceID_None, nsGkAtoms::position, posStr);
|
||||
if (!posStr.IsEmpty()) {
|
||||
if (aChild->IsElement() &&
|
||||
aChild->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::position, posStr) &&
|
||||
!posStr.IsEmpty()) {
|
||||
nsresult rv;
|
||||
// Positions are one-indexed.
|
||||
int32_t pos = posStr.ToInteger(&rv);
|
||||
|
@ -4478,7 +4483,7 @@ XULDocument::IsDocumentRightToLeft()
|
|||
// specific direction for the document.
|
||||
Element* element = GetRootElement();
|
||||
if (element) {
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::ltr, &nsGkAtoms::rtl, nullptr};
|
||||
switch (element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::localedir,
|
||||
strings, eCaseMatters)) {
|
||||
|
|
|
@ -298,10 +298,14 @@ protected:
|
|||
static LazyLogModule gXULLog;
|
||||
|
||||
nsresult
|
||||
Persist(nsIContent* aElement, int32_t aNameSpaceID, nsAtom* aAttribute);
|
||||
Persist(mozilla::dom::Element* aElement,
|
||||
int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute);
|
||||
// Just like Persist but ignores the return value so we can use it
|
||||
// as a runnable method.
|
||||
void DoPersist(nsIContent* aElement, int32_t aNameSpaceID, nsAtom* aAttribute)
|
||||
void DoPersist(mozilla::dom::Element* aElement,
|
||||
int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute)
|
||||
{
|
||||
Persist(aElement, aNameSpaceID, aAttribute);
|
||||
}
|
||||
|
@ -468,7 +472,7 @@ protected:
|
|||
* Check if a XUL template builder has already been hooked up.
|
||||
*/
|
||||
static nsresult
|
||||
CheckTemplateBuilderHookup(nsIContent* aElement, bool* aNeedsHookup);
|
||||
CheckTemplateBuilderHookup(mozilla::dom::Element* aElement, bool* aNeedsHookup);
|
||||
|
||||
/**
|
||||
* Create a XUL template builder on the specified node.
|
||||
|
|
|
@ -972,19 +972,20 @@ nsXULElement::UnregisterAccessKey(const nsAString& aOldValue)
|
|||
nsIPresShell *shell = doc->GetShell();
|
||||
|
||||
if (shell) {
|
||||
nsIContent *content = this;
|
||||
Element* element = this;
|
||||
|
||||
// find out what type of content node this is
|
||||
if (mNodeInfo->Equals(nsGkAtoms::label)) {
|
||||
// For anonymous labels the unregistering must
|
||||
// occur on the binding parent control.
|
||||
// XXXldb: And what if the binding parent is null?
|
||||
content = GetBindingParent();
|
||||
nsIContent* bindingParent = GetBindingParent();
|
||||
element = bindingParent ? bindingParent->AsElement() : nullptr;
|
||||
}
|
||||
|
||||
if (content) {
|
||||
if (element) {
|
||||
shell->GetPresContext()->EventStateManager()->
|
||||
UnregisterAccessKey(content, aOldValue.First());
|
||||
UnregisterAccessKey(element, aOldValue.First());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,14 +309,14 @@ nsXULPopupListener::ClosePopup()
|
|||
}
|
||||
} // ClosePopup
|
||||
|
||||
static already_AddRefed<nsIContent>
|
||||
static already_AddRefed<Element>
|
||||
GetImmediateChild(nsIContent* aContent, nsAtom *aTag)
|
||||
{
|
||||
for (nsIContent* child = aContent->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsXULElement(aTag)) {
|
||||
nsCOMPtr<nsIContent> ret = child;
|
||||
RefPtr<Element> ret = child->AsElement();
|
||||
return ret.forget();
|
||||
}
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
|||
}
|
||||
|
||||
// Handle the _child case for popups and context menus
|
||||
nsCOMPtr<nsIContent> popup;
|
||||
RefPtr<Element> popup;
|
||||
if (identifier.EqualsLiteral("_child")) {
|
||||
popup = GetImmediateChild(mElement, nsGkAtoms::menupopup);
|
||||
if (!popup) {
|
||||
|
@ -388,7 +388,7 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
|||
|
||||
if (childContent->NodeInfo()->Equals(nsGkAtoms::menupopup,
|
||||
kNameSpaceID_XUL)) {
|
||||
popup.swap(childContent);
|
||||
popup = childContent->AsElement();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,10 +49,10 @@ private:
|
|||
#endif
|
||||
|
||||
// |mElement| is the node to which this listener is attached.
|
||||
nsCOMPtr<mozilla::dom::Element> mElement;
|
||||
RefPtr<mozilla::dom::Element> mElement;
|
||||
|
||||
// The popup that is getting shown on top of mElement.
|
||||
nsCOMPtr<nsIContent> mPopupContent;
|
||||
RefPtr<mozilla::dom::Element> mPopupContent;
|
||||
|
||||
// true if a context popup
|
||||
bool mIsContext;
|
||||
|
|
|
@ -503,7 +503,9 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
|
|||
// We identify the resource element by presence of a
|
||||
// "uri='rdf:*'" attribute. (We also support the older
|
||||
// "uri='...'" syntax.)
|
||||
if (tmplKid->HasAttr(kNameSpaceID_None, nsGkAtoms::uri) && aMatch->IsActive()) {
|
||||
if (tmplKid->IsElement() &&
|
||||
tmplKid->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::uri) &&
|
||||
aMatch->IsActive()) {
|
||||
isGenerationElement = true;
|
||||
isUnique = false;
|
||||
}
|
||||
|
@ -610,7 +612,8 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
|
|||
// SynchronizeUsingTemplate contains code used to update textnodes,
|
||||
// so make sure to modify both when changing this
|
||||
nsAutoString attrValue;
|
||||
tmplKid->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
|
||||
tmplKid->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
attrValue);
|
||||
if (!attrValue.IsEmpty()) {
|
||||
nsAutoString value;
|
||||
rv = SubstituteText(aChild, attrValue, value);
|
||||
|
@ -885,7 +888,8 @@ nsXULContentBuilder::SynchronizeUsingTemplate(nsIContent* aTemplateNode,
|
|||
if (tmplKid->NodeInfo()->Equals(nsGkAtoms::textnode,
|
||||
kNameSpaceID_XUL)) {
|
||||
nsAutoString attrValue;
|
||||
tmplKid->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
|
||||
tmplKid->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
|
||||
attrValue);
|
||||
if (!attrValue.IsEmpty()) {
|
||||
nsAutoString value;
|
||||
rv = SubstituteText(aResult, attrValue, value);
|
||||
|
@ -1257,8 +1261,8 @@ nsXULContentBuilder::IsOpen(nsIContent* aElement)
|
|||
nsGkAtoms::toolbarbutton,
|
||||
nsGkAtoms::button,
|
||||
nsGkAtoms::treeitem))
|
||||
return aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
return aElement->AsElement()->AttrValueIs(
|
||||
kNameSpaceID_None, nsGkAtoms::open, nsGkAtoms::_true, eCaseMatters);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ nsXULContentUtils::GetResource(int32_t aNameSpaceID, const nsAString& aAttribute
|
|||
|
||||
|
||||
nsresult
|
||||
nsXULContentUtils::SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElement)
|
||||
nsXULContentUtils::SetCommandUpdater(nsIDocument* aDocument, Element* aElement)
|
||||
{
|
||||
// Deal with setting up a 'commandupdater'. Pulls the 'events' and
|
||||
// 'targets' attributes off of aElement, and adds it to the
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
GetResource(int32_t aNameSpaceID, const nsAString& aAttribute, nsIRDFResource** aResult);
|
||||
|
||||
static nsresult
|
||||
SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElement);
|
||||
SetCommandUpdater(nsIDocument* aDocument, mozilla::dom::Element* aElement);
|
||||
|
||||
/**
|
||||
* Log a message to the error console
|
||||
|
|
|
@ -66,10 +66,10 @@ XULSortServiceImpl::SetSortColumnHints(nsIContent *content,
|
|||
SetSortColumnHints(child, sortResource, sortDirection);
|
||||
} else if (child->IsXULElement(nsGkAtoms::treecol)) {
|
||||
nsAutoString value;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::sort, value);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::sort, value);
|
||||
// also check the resource attribute for older code
|
||||
if (value.IsEmpty())
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::resource, value);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::resource, value);
|
||||
if (value == sortResource) {
|
||||
child->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::sortActive,
|
||||
NS_LITERAL_STRING("true"), true);
|
||||
|
@ -194,12 +194,18 @@ testSortCallback(const void *data1, const void *data2, void *privateData)
|
|||
sortState->sortHints, &sortOrder);
|
||||
if (sortOrder)
|
||||
break;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// no template, so just compare attributes. Ignore namespaces for now.
|
||||
nsAutoString leftstr, rightstr;
|
||||
left->content->GetAttr(kNameSpaceID_None, sortState->sortKeys[t], leftstr);
|
||||
right->content->GetAttr(kNameSpaceID_None, sortState->sortKeys[t], rightstr);
|
||||
if (left->content->IsElement()) {
|
||||
left->content->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
sortState->sortKeys[t],
|
||||
leftstr);
|
||||
}
|
||||
if (right->content->IsElement()) {
|
||||
right->content->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
sortState->sortKeys[t], rightstr);
|
||||
}
|
||||
|
||||
sortOrder = XULSortServiceImpl::CompareValues(leftstr, rightstr, sortState->sortHints);
|
||||
}
|
||||
|
@ -286,8 +292,10 @@ XULSortServiceImpl::SortContainer(nsIContent *aContainer, nsSortState* aSortStat
|
|||
|
||||
// if it's a container in a tree or menu, find its children,
|
||||
// and sort those also
|
||||
if (!child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
if (!child->IsElement() ||
|
||||
!child->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::container,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
continue;
|
||||
|
||||
for (nsIContent* grandchild = child->GetFirstChild();
|
||||
|
|
|
@ -2157,7 +2157,9 @@ nsXULTemplateBuilder::DetermineMemberVariable(nsIContent* aElement)
|
|||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
nsAutoString uri;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::uri, uri);
|
||||
if (child->IsElement()) {
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::uri, uri);
|
||||
}
|
||||
if (!uri.IsEmpty() && uri[0] == char16_t('?')) {
|
||||
return NS_Atomize(uri);
|
||||
}
|
||||
|
@ -2254,7 +2256,7 @@ nsXULTemplateBuilder::CompileSimpleQuery(Element* aRuleElement,
|
|||
|
||||
nsresult
|
||||
nsXULTemplateBuilder::CompileConditions(nsTemplateRule* aRule,
|
||||
nsIContent* aCondition)
|
||||
Element* aCondition)
|
||||
{
|
||||
nsAutoString tag;
|
||||
aCondition->GetAttr(kNameSpaceID_None, nsGkAtoms::parent, tag);
|
||||
|
@ -2271,7 +2273,8 @@ nsXULTemplateBuilder::CompileConditions(nsTemplateRule* aRule,
|
|||
node = node->GetNextSibling()) {
|
||||
|
||||
if (node->NodeInfo()->Equals(nsGkAtoms::where, kNameSpaceID_XUL)) {
|
||||
nsresult rv = CompileWhereCondition(aRule, node, ¤tCondition);
|
||||
nsresult rv =
|
||||
CompileWhereCondition(aRule, node->AsElement(), ¤tCondition);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
@ -2282,7 +2285,7 @@ nsXULTemplateBuilder::CompileConditions(nsTemplateRule* aRule,
|
|||
|
||||
nsresult
|
||||
nsXULTemplateBuilder::CompileWhereCondition(nsTemplateRule* aRule,
|
||||
nsIContent* aCondition,
|
||||
Element* aCondition,
|
||||
nsTemplateCondition** aCurrentCondition)
|
||||
{
|
||||
// Compile a <where> condition, which must be of the form:
|
||||
|
@ -2389,7 +2392,7 @@ nsXULTemplateBuilder::CompileBindings(nsTemplateRule* aRule, nsIContent* aBindin
|
|||
|
||||
if (binding->NodeInfo()->Equals(nsGkAtoms::binding,
|
||||
kNameSpaceID_XUL)) {
|
||||
rv = CompileBinding(aRule, binding);
|
||||
rv = CompileBinding(aRule, binding->AsElement());
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
@ -2403,7 +2406,7 @@ nsXULTemplateBuilder::CompileBindings(nsTemplateRule* aRule, nsIContent* aBindin
|
|||
|
||||
nsresult
|
||||
nsXULTemplateBuilder::CompileBinding(nsTemplateRule* aRule,
|
||||
nsIContent* aBinding)
|
||||
Element* aBinding)
|
||||
{
|
||||
// Compile a <binding> "condition", which must be of the form:
|
||||
//
|
||||
|
|
|
@ -271,7 +271,7 @@ public:
|
|||
* @param aConditions <conditions> element
|
||||
*/
|
||||
nsresult
|
||||
CompileConditions(nsTemplateRule* aRule, nsIContent* aConditions);
|
||||
CompileConditions(nsTemplateRule* aRule, Element* aConditions);
|
||||
|
||||
/**
|
||||
* Compile a <where> tag in a condition. The caller should set
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
*/
|
||||
nsresult
|
||||
CompileWhereCondition(nsTemplateRule* aRule,
|
||||
nsIContent* aCondition,
|
||||
Element* aCondition,
|
||||
nsTemplateCondition** aCurrentCondition);
|
||||
|
||||
/**
|
||||
|
@ -298,7 +298,7 @@ public:
|
|||
* Compile a single binding for an extended template syntax rule.
|
||||
*/
|
||||
nsresult
|
||||
CompileBinding(nsTemplateRule* aRule, nsIContent* aBinding);
|
||||
CompileBinding(nsTemplateRule* aRule, Element* aBinding);
|
||||
|
||||
/**
|
||||
* Add automatic bindings for simple rules
|
||||
|
|
|
@ -160,7 +160,7 @@ nsXULTemplateQueryProcessorRDF::GetDatasource(nsIArray* aDataSources,
|
|||
nsISupports** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> compDB;
|
||||
nsCOMPtr<nsIContent> root = do_QueryInterface(aRootNode);
|
||||
nsCOMPtr<Element> root = do_QueryInterface(aRootNode);
|
||||
nsresult rv;
|
||||
|
||||
*aResult = nullptr;
|
||||
|
@ -1110,7 +1110,9 @@ nsXULTemplateQueryProcessorRDF::ComputeContainmentProperties(nsIDOMNode* aRootNo
|
|||
nsCOMPtr<nsIContent> content = do_QueryInterface(aRootNode);
|
||||
|
||||
nsAutoString containment;
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::containment, containment);
|
||||
if (content->IsElement()) {
|
||||
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::containment, containment);
|
||||
}
|
||||
|
||||
uint32_t len = containment.Length();
|
||||
uint32_t offset = 0;
|
||||
|
@ -1184,7 +1186,7 @@ nsXULTemplateQueryProcessorRDF::CompileExtendedQuery(nsRDFQuery* aQuery,
|
|||
// check for <content tag='tag'/> which indicates that matches
|
||||
// should only be generated for items inside content with that tag
|
||||
nsAutoString tagstr;
|
||||
condition->GetAttr(kNameSpaceID_None, nsGkAtoms::tag, tagstr);
|
||||
condition->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tag, tagstr);
|
||||
|
||||
RefPtr<nsAtom> tag;
|
||||
if (! tagstr.IsEmpty()) {
|
||||
|
@ -1228,11 +1230,10 @@ nsXULTemplateQueryProcessorRDF::CompileQueryChild(nsAtom* aTag,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (aTag == nsGkAtoms::triple) {
|
||||
rv = CompileTripleCondition(aQuery, aCondition, aParentNode, aResult);
|
||||
}
|
||||
else if (aTag == nsGkAtoms::member) {
|
||||
rv = CompileMemberCondition(aQuery, aCondition, aParentNode, aResult);
|
||||
if (aCondition->IsElement() && aTag == nsGkAtoms::triple) {
|
||||
rv = CompileTripleCondition(aQuery, aCondition->AsElement(), aParentNode, aResult);
|
||||
} else if (aCondition->IsElement() && aTag == nsGkAtoms::member) {
|
||||
rv = CompileMemberCondition(aQuery, aCondition->AsElement(), aParentNode, aResult);
|
||||
}
|
||||
else if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Info)) {
|
||||
nsAutoString tagstr;
|
||||
|
@ -1279,7 +1280,7 @@ nsXULTemplateQueryProcessorRDF::ParseLiteral(const nsString& aParseType,
|
|||
|
||||
nsresult
|
||||
nsXULTemplateQueryProcessorRDF::CompileTripleCondition(nsRDFQuery* aQuery,
|
||||
nsIContent* aCondition,
|
||||
Element* aCondition,
|
||||
TestNode* aParentNode,
|
||||
TestNode** aResult)
|
||||
{
|
||||
|
@ -1381,7 +1382,7 @@ nsXULTemplateQueryProcessorRDF::CompileTripleCondition(nsRDFQuery* aQuery,
|
|||
|
||||
nsresult
|
||||
nsXULTemplateQueryProcessorRDF::CompileMemberCondition(nsRDFQuery* aQuery,
|
||||
nsIContent* aCondition,
|
||||
Element* aCondition,
|
||||
TestNode* aParentNode,
|
||||
TestNode** aResult)
|
||||
{
|
||||
|
@ -1526,7 +1527,7 @@ nsXULTemplateQueryProcessorRDF::CompileSimpleQuery(nsRDFQuery* aQuery,
|
|||
nsRDFConInstanceTestNode::Test iscontainer =
|
||||
nsRDFConInstanceTestNode::eDontCare;
|
||||
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::_true, &nsGkAtoms::_false, nullptr};
|
||||
switch (aQueryElement->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::iscontainer,
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
*/
|
||||
nsresult
|
||||
CompileTripleCondition(nsRDFQuery* aQuery,
|
||||
nsIContent* aCondition,
|
||||
Element* aCondition,
|
||||
TestNode* aParentNode,
|
||||
TestNode** aResult);
|
||||
|
||||
|
@ -167,7 +167,7 @@ public:
|
|||
*/
|
||||
nsresult
|
||||
CompileMemberCondition(nsRDFQuery* aQuery,
|
||||
nsIContent* aCondition,
|
||||
Element* aCondition,
|
||||
TestNode* aParentNode,
|
||||
TestNode** aResult);
|
||||
|
||||
|
|
|
@ -313,7 +313,9 @@ nsXULTemplateQueryProcessorStorage::CompileQuery(nsIXULTemplateBuilder* aBuilder
|
|||
uint32_t index = parameterCount;
|
||||
nsAutoString name, indexValue;
|
||||
|
||||
if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
|
||||
if (child->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::name,
|
||||
name)) {
|
||||
rv = statement->GetParameterIndex(NS_ConvertUTF16toUTF8(name),
|
||||
&index);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -321,8 +323,9 @@ nsXULTemplateQueryProcessorStorage::CompileQuery(nsIXULTemplateBuilder* aBuilder
|
|||
return rv;
|
||||
}
|
||||
parameterCount++;
|
||||
}
|
||||
else if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::index, indexValue)) {
|
||||
} else if (child->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::index,
|
||||
indexValue)) {
|
||||
PR_sscanf(NS_ConvertUTF16toUTF8(indexValue).get(),"%d",&index);
|
||||
if (index > 0)
|
||||
index--;
|
||||
|
@ -331,13 +334,14 @@ nsXULTemplateQueryProcessorStorage::CompileQuery(nsIXULTemplateBuilder* aBuilder
|
|||
parameterCount++;
|
||||
}
|
||||
|
||||
static nsIContent::AttrValuesArray sTypeValues[] =
|
||||
static Element::AttrValuesArray sTypeValues[] =
|
||||
{ &nsGkAtoms::int32, &nsGkAtoms::integer, &nsGkAtoms::int64,
|
||||
&nsGkAtoms::null, &nsGkAtoms::double_, &nsGkAtoms::string, nullptr };
|
||||
|
||||
int32_t typeError = 1;
|
||||
int32_t typeValue = child->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type,
|
||||
sTypeValues, eCaseMatters);
|
||||
int32_t typeValue = child->AsElement()->
|
||||
FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, sTypeValues,
|
||||
eCaseMatters);
|
||||
rv = NS_ERROR_ILLEGAL_VALUE;
|
||||
int32_t valInt32 = 0;
|
||||
int64_t valInt64 = 0;
|
||||
|
@ -364,7 +368,7 @@ nsXULTemplateQueryProcessorStorage::CompileQuery(nsIXULTemplateBuilder* aBuilder
|
|||
rv = statement->BindDoubleByIndex(index, valFloat);
|
||||
break;
|
||||
case 5:
|
||||
case nsIContent::ATTR_MISSING:
|
||||
case Element::ATTR_MISSING:
|
||||
rv = statement->BindStringByIndex(index, value);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -234,7 +234,9 @@ nsXULTemplateQueryProcessorXML::CompileQuery(nsIXULTemplateBuilder* aBuilder,
|
|||
nsCOMPtr<nsIContent> content = do_QueryInterface(aQueryNode);
|
||||
|
||||
nsAutoString expr;
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::expr, expr);
|
||||
if (content->IsElement()) {
|
||||
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::expr, expr);
|
||||
}
|
||||
|
||||
// if an expression is not specified, then the default is to
|
||||
// just take all of the children
|
||||
|
@ -259,10 +261,10 @@ nsXULTemplateQueryProcessorXML::CompileQuery(nsIXULTemplateBuilder* aBuilder,
|
|||
if (condition->NodeInfo()->Equals(nsGkAtoms::assign,
|
||||
kNameSpaceID_XUL)) {
|
||||
nsAutoString var;
|
||||
condition->GetAttr(kNameSpaceID_None, nsGkAtoms::var, var);
|
||||
condition->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::var, var);
|
||||
|
||||
nsAutoString expr;
|
||||
condition->GetAttr(kNameSpaceID_None, nsGkAtoms::expr, expr);
|
||||
condition->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::expr, expr);
|
||||
|
||||
// ignore assignments without a variable or an expression
|
||||
if (!var.IsEmpty() && !expr.IsEmpty()) {
|
||||
|
|
|
@ -309,7 +309,7 @@ nsXULTreeBuilder::GetCellProperties(int32_t aRow, nsTreeColumn& aColumn,
|
|||
return;
|
||||
}
|
||||
|
||||
nsIContent* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
Element* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
if (cell) {
|
||||
nsAutoString raw;
|
||||
cell->GetAttr(kNameSpaceID_None, nsGkAtoms::properties, raw);
|
||||
|
@ -551,7 +551,7 @@ nsXULTreeBuilder::GetImageSrc(int32_t aRow, nsTreeColumn& aColumn,
|
|||
}
|
||||
|
||||
// Find the <cell> that corresponds to the column we want.
|
||||
nsIContent* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
Element* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
if (cell) {
|
||||
nsAutoString raw;
|
||||
cell->GetAttr(kNameSpaceID_None, nsGkAtoms::src, raw);
|
||||
|
@ -583,7 +583,7 @@ nsXULTreeBuilder::GetProgressMode(int32_t aRow, nsTreeColumn& aColumn,
|
|||
}
|
||||
|
||||
// Find the <cell> that corresponds to the column we want.
|
||||
nsIContent* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
Element* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
if (cell) {
|
||||
nsAutoString raw;
|
||||
cell->GetAttr(kNameSpaceID_None, nsGkAtoms::mode, raw);
|
||||
|
@ -624,7 +624,7 @@ nsXULTreeBuilder::GetCellValue(int32_t aRow, nsTreeColumn& aColumn,
|
|||
}
|
||||
|
||||
// Find the <cell> that corresponds to the column we want.
|
||||
nsIContent* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
Element* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
if (cell) {
|
||||
nsAutoString raw;
|
||||
cell->GetAttr(kNameSpaceID_None, nsGkAtoms::value, raw);
|
||||
|
@ -656,7 +656,7 @@ nsXULTreeBuilder::GetCellText(int32_t aRow, nsTreeColumn& aColumn,
|
|||
}
|
||||
|
||||
// Find the <cell> that corresponds to the column we want.
|
||||
nsIContent* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
Element* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
if (cell) {
|
||||
nsAutoString raw;
|
||||
cell->GetAttr(kNameSpaceID_None, nsGkAtoms::label, raw);
|
||||
|
@ -869,7 +869,7 @@ nsXULTreeBuilder::IsEditable(int32_t aRow, nsTreeColumn& aColumn,
|
|||
}
|
||||
|
||||
// Find the <cell> that corresponds to the column we want.
|
||||
nsIContent* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
Element* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
if (!cell) {
|
||||
return true;
|
||||
}
|
||||
|
@ -904,7 +904,7 @@ nsXULTreeBuilder::IsSelectable(int32_t aRow, nsTreeColumn& aColumn,
|
|||
}
|
||||
|
||||
// Find the <cell> that corresponds to the column we want.
|
||||
nsIContent* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
Element* cell = GetTemplateActionCellFor(aRow, aColumn);
|
||||
if (!cell) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1265,18 +1265,19 @@ nsXULTreeBuilder::EnsureSortVariables()
|
|||
|
||||
if (child->NodeInfo()->Equals(nsGkAtoms::treecol,
|
||||
kNameSpaceID_XUL)) {
|
||||
if (child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::sortActive,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
if (child->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::sortActive,
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
nsAutoString sort;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::sort, sort);
|
||||
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::sort, sort);
|
||||
if (! sort.IsEmpty()) {
|
||||
mSortVariable = NS_Atomize(sort);
|
||||
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
static Element::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::ascending, &nsGkAtoms::descending, nullptr};
|
||||
switch (child->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::sortDirection,
|
||||
strings, eCaseMatters)) {
|
||||
switch (child->AsElement()->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::sortDirection,
|
||||
strings, eCaseMatters)) {
|
||||
case 0: mSortDirection = eDirection_Ascending; break;
|
||||
case 1: mSortDirection = eDirection_Descending; break;
|
||||
default: mSortDirection = eDirection_Natural; break;
|
||||
|
@ -1380,7 +1381,7 @@ nsXULTreeBuilder::GetTemplateActionRowFor(int32_t aRow, Element** aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
Element*
|
||||
nsXULTreeBuilder::GetTemplateActionCellFor(int32_t aRow, nsTreeColumn& aCol)
|
||||
{
|
||||
RefPtr<Element> row;
|
||||
|
@ -1392,20 +1393,21 @@ nsXULTreeBuilder::GetTemplateActionCellFor(int32_t aRow, nsTreeColumn& aCol)
|
|||
RefPtr<nsAtom> colAtom(aCol.GetAtom());
|
||||
int32_t colIndex(aCol.GetIndex());
|
||||
|
||||
nsIContent* result = nullptr;
|
||||
Element* result = nullptr;
|
||||
uint32_t j = 0;
|
||||
for (nsIContent* child = row->GetFirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->NodeInfo()->Equals(nsGkAtoms::treecell, kNameSpaceID_XUL)) {
|
||||
if (colAtom &&
|
||||
child->AttrValueIs(kNameSpaceID_None, nsGkAtoms::ref, colAtom,
|
||||
eCaseMatters)) {
|
||||
return child;
|
||||
child->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::ref, colAtom,
|
||||
eCaseMatters)) {
|
||||
return child->AsElement();
|
||||
}
|
||||
|
||||
if (j == (uint32_t)colIndex) {
|
||||
result = child;
|
||||
result = child->AsElement();
|
||||
}
|
||||
++j;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ protected:
|
|||
* Given a row and a column ID, use the row's match to figure out
|
||||
* the appropriate <treecell> in the rule's <action>.
|
||||
*/
|
||||
nsIContent*
|
||||
mozilla::dom::Element*
|
||||
GetTemplateActionCellFor(int32_t aRow, nsTreeColumn& aCol);
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsNameSpaceManager.h" // for kNameSpaceID_None
|
||||
#include "nsLiteralString.h" // for NS_LITERAL_STRING
|
||||
#include "nscore.h" // for NS_IMETHODIMP
|
||||
#include "mozilla/dom/Element.h" // for nsIContent
|
||||
|
||||
nsComposeTxtSrvFilter::nsComposeTxtSrvFilter() :
|
||||
mIsForMail(false)
|
||||
|
@ -30,16 +31,22 @@ nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, bool *_retval)
|
|||
if (content) {
|
||||
if (content->IsHTMLElement(nsGkAtoms::blockquote)) {
|
||||
if (mIsForMail) {
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::cite, eIgnoreCase);
|
||||
*_retval = content->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::cite,
|
||||
eIgnoreCase);
|
||||
}
|
||||
} else if (content->IsHTMLElement(nsGkAtoms::span)) {
|
||||
if (mIsForMail) {
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozquote,
|
||||
nsGkAtoms::_true, eIgnoreCase);
|
||||
*_retval = content->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::mozquote,
|
||||
nsGkAtoms::_true,
|
||||
eIgnoreCase);
|
||||
if (!*_retval) {
|
||||
*_retval = content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
nsGkAtoms::mozsignature, eCaseMatters);
|
||||
*_retval = content->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::_class,
|
||||
nsGkAtoms::mozsignature,
|
||||
eCaseMatters);
|
||||
}
|
||||
}
|
||||
} else if (content->IsAnyOfHTMLElements(nsGkAtoms::script,
|
||||
|
@ -51,9 +58,10 @@ nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, bool *_retval)
|
|||
} else if (content->IsHTMLElement(nsGkAtoms::table)) {
|
||||
if (mIsForMail) {
|
||||
*_retval =
|
||||
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
NS_LITERAL_STRING("moz-email-headers-table"),
|
||||
eCaseMatters);
|
||||
content->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::_class,
|
||||
NS_LITERAL_STRING("moz-email-headers-table"),
|
||||
eCaseMatters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -712,8 +712,12 @@ HTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
|||
// if we weren't passed an attribute, then we want to
|
||||
// remove any matching inlinestyles entirely
|
||||
if (!aAttribute || aAttribute->IsEmpty()) {
|
||||
bool hasStyleAttr = aNode.HasAttr(kNameSpaceID_None, nsGkAtoms::style);
|
||||
bool hasClassAttr = aNode.HasAttr(kNameSpaceID_None, nsGkAtoms::_class);
|
||||
bool hasStyleAttr =
|
||||
aNode.IsElement() &&
|
||||
aNode.AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::style);
|
||||
bool hasClassAttr =
|
||||
aNode.IsElement() &&
|
||||
aNode.AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_class);
|
||||
if (aProperty && (hasStyleAttr || hasClassAttr)) {
|
||||
// aNode carries inline styles or a class attribute so we can't
|
||||
// just remove the element... We need to create above the element
|
||||
|
|
|
@ -283,7 +283,8 @@ TextEditor::UpdateMetaCharset(nsIDocument& aDocument,
|
|||
}
|
||||
|
||||
nsAutoString currentValue;
|
||||
metaNode->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv, currentValue);
|
||||
metaNode->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::httpEquiv,
|
||||
currentValue);
|
||||
|
||||
if (!FindInReadable(NS_LITERAL_STRING("content-type"),
|
||||
currentValue,
|
||||
|
@ -291,7 +292,8 @@ TextEditor::UpdateMetaCharset(nsIDocument& aDocument,
|
|||
continue;
|
||||
}
|
||||
|
||||
metaNode->GetAttr(kNameSpaceID_None, nsGkAtoms::content, currentValue);
|
||||
metaNode->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::content,
|
||||
currentValue);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(charsetEquals, "charset=");
|
||||
nsAString::const_iterator originalStart, start, end;
|
||||
|
|
|
@ -1252,17 +1252,17 @@ mozInlineSpellChecker::ShouldSpellCheckNode(TextEditor* aTextEditor,
|
|||
nsIContent *parent = content->GetParent();
|
||||
while (parent) {
|
||||
if (parent->IsHTMLElement(nsGkAtoms::blockquote) &&
|
||||
parent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::cite,
|
||||
eIgnoreCase)) {
|
||||
parent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::cite,
|
||||
eIgnoreCase)) {
|
||||
return false;
|
||||
}
|
||||
if (parent->IsHTMLElement(nsGkAtoms::pre) &&
|
||||
parent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::_class,
|
||||
nsGkAtoms::mozsignature,
|
||||
eIgnoreCase)) {
|
||||
parent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::_class,
|
||||
nsGkAtoms::mozsignature,
|
||||
eIgnoreCase)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,8 @@ IsDescendant(nsIFrame* aFrame, nsIContent* aAncestor, nsAutoString* aLabelTarget
|
|||
for (nsIContent* content = aFrame->GetContent(); content;
|
||||
content = content->GetFlattenedTreeParent()) {
|
||||
if (aLabelTargetId && content->IsHTMLElement(nsGkAtoms::label)) {
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::_for, *aLabelTargetId);
|
||||
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::_for,
|
||||
*aLabelTargetId);
|
||||
}
|
||||
if (content == aAncestor) {
|
||||
return true;
|
||||
|
@ -212,7 +213,8 @@ GetClickableAncestor(nsIFrame* aFrame, nsAtom* stopAt = nullptr, nsAutoString* a
|
|||
}
|
||||
if (content->IsHTMLElement(nsGkAtoms::label)) {
|
||||
if (aLabelTargetId) {
|
||||
content->GetAttr(kNameSpaceID_None, nsGkAtoms::_for, *aLabelTargetId);
|
||||
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::_for,
|
||||
*aLabelTargetId);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
@ -221,10 +223,10 @@ GetClickableAncestor(nsIFrame* aFrame, nsAtom* stopAt = nullptr, nsAutoString* a
|
|||
// So fluffing won't go there. We do an optimistic assumption here:
|
||||
// that the content of the remote iframe needs to be a target.
|
||||
if (content->IsHTMLElement(nsGkAtoms::iframe) &&
|
||||
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozbrowser,
|
||||
nsGkAtoms::_true, eIgnoreCase) &&
|
||||
content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::Remote,
|
||||
nsGkAtoms::_true, eIgnoreCase)) {
|
||||
content->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mozbrowser,
|
||||
nsGkAtoms::_true, eIgnoreCase) &&
|
||||
content->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::Remote,
|
||||
nsGkAtoms::_true, eIgnoreCase)) {
|
||||
return content;
|
||||
}
|
||||
|
||||
|
@ -243,10 +245,11 @@ GetClickableAncestor(nsIFrame* aFrame, nsAtom* stopAt = nullptr, nsAutoString* a
|
|||
return content;
|
||||
}
|
||||
|
||||
static nsIContent::AttrValuesArray clickableRoles[] =
|
||||
static Element::AttrValuesArray clickableRoles[] =
|
||||
{ &nsGkAtoms::button, &nsGkAtoms::key, nullptr };
|
||||
if (content->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::role,
|
||||
clickableRoles, eIgnoreCase) >= 0) {
|
||||
if (content->IsElement() &&
|
||||
content->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::role,
|
||||
clickableRoles, eIgnoreCase) >= 0) {
|
||||
return content;
|
||||
}
|
||||
if (content->IsEditable()) {
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче