mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
Revert "backout bug 1134280 for fixing yandex search "Read more" link"
This reverts commit 980f33daef.
This commit is contained in:
@@ -59,34 +59,34 @@ NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessible, Accessible)
|
||||
role
|
||||
HyperTextAccessible::NativeRole()
|
||||
{
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
|
||||
if (tag == nsGkAtoms::dd)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::dd))
|
||||
return roles::DEFINITION;
|
||||
|
||||
if (tag == nsGkAtoms::form)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::form))
|
||||
return roles::FORM;
|
||||
|
||||
if (tag == nsGkAtoms::blockquote || tag == nsGkAtoms::div ||
|
||||
tag == nsGkAtoms::section || tag == nsGkAtoms::nav)
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::blockquote,
|
||||
nsGkAtoms::div,
|
||||
nsGkAtoms::section,
|
||||
nsGkAtoms::nav))
|
||||
return roles::SECTION;
|
||||
|
||||
if (tag == nsGkAtoms::h1 || tag == nsGkAtoms::h2 ||
|
||||
tag == nsGkAtoms::h3 || tag == nsGkAtoms::h4 ||
|
||||
tag == nsGkAtoms::h5 || tag == nsGkAtoms::h6)
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::h1, nsGkAtoms::h2,
|
||||
nsGkAtoms::h3, nsGkAtoms::h4,
|
||||
nsGkAtoms::h5, nsGkAtoms::h6))
|
||||
return roles::HEADING;
|
||||
|
||||
if (tag == nsGkAtoms::article)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::article))
|
||||
return roles::DOCUMENT;
|
||||
|
||||
// Deal with html landmark elements
|
||||
if (tag == nsGkAtoms::header)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::header))
|
||||
return roles::HEADER;
|
||||
|
||||
if (tag == nsGkAtoms::footer)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::footer))
|
||||
return roles::FOOTER;
|
||||
|
||||
if (tag == nsGkAtoms::aside)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::aside))
|
||||
return roles::NOTE;
|
||||
|
||||
// Treat block frames as paragraphs
|
||||
@@ -105,7 +105,7 @@ HyperTextAccessible::NativeState()
|
||||
if (mContent->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
|
||||
states |= states::EDITABLE;
|
||||
|
||||
} else if (mContent->Tag() == nsGkAtoms::article) {
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::article)) {
|
||||
// We want <article> to behave like a document in terms of readonly state.
|
||||
states |= states::READONLY;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ HyperTextAccessible::DOMPointToOffset(nsINode* aNode, int32_t aNodeOffset,
|
||||
Accessible* descendant = nullptr;
|
||||
if (findNode) {
|
||||
nsCOMPtr<nsIContent> findContent(do_QueryInterface(findNode));
|
||||
if (findContent && findContent->IsHTML() &&
|
||||
if (findContent && findContent->IsHTMLElement() &&
|
||||
findContent->NodeInfo()->Equals(nsGkAtoms::br) &&
|
||||
findContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::mozeditorbogusnode,
|
||||
@@ -900,18 +900,17 @@ HyperTextAccessible::DefaultTextAttributes()
|
||||
int32_t
|
||||
HyperTextAccessible::GetLevelInternal()
|
||||
{
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::h1)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h1))
|
||||
return 1;
|
||||
if (tag == nsGkAtoms::h2)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h2))
|
||||
return 2;
|
||||
if (tag == nsGkAtoms::h3)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h3))
|
||||
return 3;
|
||||
if (tag == nsGkAtoms::h4)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h4))
|
||||
return 4;
|
||||
if (tag == nsGkAtoms::h5)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h5))
|
||||
return 5;
|
||||
if (tag == nsGkAtoms::h6)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h6))
|
||||
return 6;
|
||||
|
||||
return AccessibleWrap::GetLevelInternal();
|
||||
@@ -944,14 +943,13 @@ HyperTextAccessible::NativeAttributes()
|
||||
if (!HasOwnContent())
|
||||
return attributes.forget();
|
||||
|
||||
nsIAtom* tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::section) {
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::section)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("region"));
|
||||
} else if (tag == nsGkAtoms::article) {
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::article)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("article"));
|
||||
} else if (tag == nsGkAtoms::time) {
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::time)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("time"));
|
||||
|
||||
@@ -970,38 +968,42 @@ HyperTextAccessible::LandmarkRole() const
|
||||
{
|
||||
// For the html landmark elements we expose them like we do ARIA landmarks to
|
||||
// make AT navigation schemes "just work".
|
||||
nsIAtom* tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::nav)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::nav)) {
|
||||
return nsGkAtoms::navigation;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::header || tag == nsGkAtoms::footer) {
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::header,
|
||||
nsGkAtoms::footer)) {
|
||||
// Only map header and footer if they are not descendants of an article
|
||||
// or section tag.
|
||||
nsIContent* parent = mContent->GetParent();
|
||||
while (parent) {
|
||||
if (parent->Tag() == nsGkAtoms::article ||
|
||||
parent->Tag() == nsGkAtoms::section)
|
||||
if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::section)) {
|
||||
break;
|
||||
}
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
// No article or section elements found.
|
||||
if (!parent) {
|
||||
if (tag == nsGkAtoms::header)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::header)) {
|
||||
return nsGkAtoms::banner;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::footer) {
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::footer)) {
|
||||
return nsGkAtoms::contentinfo;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::aside)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::aside)) {
|
||||
return nsGkAtoms::complementary;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::main)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::main)) {
|
||||
return nsGkAtoms::main;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1692,7 +1694,7 @@ HyperTextAccessible::NativeName(nsString& aName)
|
||||
{
|
||||
// Check @alt attribute for invalid img elements.
|
||||
bool hasImgAlt = false;
|
||||
if (mContent->IsHTML(nsGkAtoms::img)) {
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::img)) {
|
||||
hasImgAlt = mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return eNameOK;
|
||||
|
||||
Reference in New Issue
Block a user