Loading accessible/base/MarkupMap.h +4 −4 Original line number Diff line number Diff line Loading @@ -64,12 +64,12 @@ MARKUPMAP(form, roles::FORM) MARKUPMAP(footer, New_HyperText, roles::FOOTER) New_HTMLHeaderOrFooter, 0) MARKUPMAP(header, New_HyperText, roles::HEADER) New_HTMLHeaderOrFooter, 0) MARKUPMAP(h1, New_HyperText, Loading accessible/base/nsAccessibilityService.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,9 @@ static Accessible* New_HTMLFigcaption(nsIContent* aContent, Accessible* aContext static Accessible* New_HTMLFigure(nsIContent* aContent, Accessible* aContext) { return new HTMLFigureAccessible(aContent, aContext->Document()); } static Accessible* New_HTMLHeaderOrFooter(nsIContent* aContent, Accessible* aContext) { return new HTMLHeaderOrFooterAccessible(aContent, aContext->Document()); } static Accessible* New_HTMLLegend(nsIContent* aContent, Accessible* aContext) { return new HTMLLegendAccessible(aContent, aContext->Document()); } Loading accessible/generic/HyperTextAccessible.cpp +0 −25 Original line number Diff line number Diff line Loading @@ -1142,31 +1142,6 @@ HyperTextAccessible::LandmarkRole() const return nsGkAtoms::navigation; } 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->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::section)) { break; } parent = parent->GetParent(); } // No article or section elements found. if (!parent) { if (mContent->IsHTMLElement(nsGkAtoms::header)) { return nsGkAtoms::banner; } if (mContent->IsHTMLElement(nsGkAtoms::footer)) { return nsGkAtoms::contentinfo; } } return nullptr; } if (mContent->IsHTMLElement(nsGkAtoms::aside)) { return nsGkAtoms::complementary; } Loading accessible/html/HTMLElementAccessibles.cpp +56 −0 Original line number Diff line number Diff line Loading @@ -202,3 +202,59 @@ HTMLSummaryAccessible::IsWidget() const { return true; } //////////////////////////////////////////////////////////////////////////////// // HTMLHeaderOrFooterAccessible //////////////////////////////////////////////////////////////////////////////// NS_IMPL_ISUPPORTS_INHERITED0(HTMLHeaderOrFooterAccessible, HyperTextAccessible) role HTMLHeaderOrFooterAccessible::NativeRole() { // Only map header and footer if they are direct descendants of the body tag. // If other sectioning or sectioning root elements, they become sections. nsIContent* parent = mContent->GetParent(); while (parent) { if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::aside, nsGkAtoms::nav, nsGkAtoms::section, nsGkAtoms::blockquote, nsGkAtoms::details, nsGkAtoms::dialog, nsGkAtoms::fieldset, nsGkAtoms::figure, nsGkAtoms::td)) { break; } parent = parent->GetParent(); } // No sectioning or sectioning root elements found. if (!parent) { if (mContent->IsHTMLElement(nsGkAtoms::header)) { return roles::HEADER; } if (mContent->IsHTMLElement(nsGkAtoms::footer)) { return roles::FOOTER; } } return roles::SECTION; } nsIAtom* HTMLHeaderOrFooterAccessible::LandmarkRole() const { if (!HasOwnContent()) return nullptr; a11y::role r = const_cast<HTMLHeaderOrFooterAccessible*>(this)->Role(); if (r == roles::HEADER) { return nsGkAtoms::banner; } if (r == roles::FOOTER) { return nsGkAtoms::contentinfo; } return nullptr; } accessible/html/HTMLElementAccessibles.h +20 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,26 @@ public: virtual bool IsWidget() const override; }; /** * Used for HTML header and footer elements. */ class HTMLHeaderOrFooterAccessible : public HyperTextAccessibleWrap { public: HTMLHeaderOrFooterAccessible(nsIContent* aContent, DocAccessible* aDoc) : HyperTextAccessibleWrap(aContent, aDoc) {} NS_DECL_ISUPPORTS_INHERITED // Accessible virtual nsIAtom* LandmarkRole() const override; virtual a11y::role NativeRole() override; protected: virtual ~HTMLHeaderOrFooterAccessible() {} }; } // namespace a11y } // namespace mozilla Loading Loading
accessible/base/MarkupMap.h +4 −4 Original line number Diff line number Diff line Loading @@ -64,12 +64,12 @@ MARKUPMAP(form, roles::FORM) MARKUPMAP(footer, New_HyperText, roles::FOOTER) New_HTMLHeaderOrFooter, 0) MARKUPMAP(header, New_HyperText, roles::HEADER) New_HTMLHeaderOrFooter, 0) MARKUPMAP(h1, New_HyperText, Loading
accessible/base/nsAccessibilityService.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,9 @@ static Accessible* New_HTMLFigcaption(nsIContent* aContent, Accessible* aContext static Accessible* New_HTMLFigure(nsIContent* aContent, Accessible* aContext) { return new HTMLFigureAccessible(aContent, aContext->Document()); } static Accessible* New_HTMLHeaderOrFooter(nsIContent* aContent, Accessible* aContext) { return new HTMLHeaderOrFooterAccessible(aContent, aContext->Document()); } static Accessible* New_HTMLLegend(nsIContent* aContent, Accessible* aContext) { return new HTMLLegendAccessible(aContent, aContext->Document()); } Loading
accessible/generic/HyperTextAccessible.cpp +0 −25 Original line number Diff line number Diff line Loading @@ -1142,31 +1142,6 @@ HyperTextAccessible::LandmarkRole() const return nsGkAtoms::navigation; } 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->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::section)) { break; } parent = parent->GetParent(); } // No article or section elements found. if (!parent) { if (mContent->IsHTMLElement(nsGkAtoms::header)) { return nsGkAtoms::banner; } if (mContent->IsHTMLElement(nsGkAtoms::footer)) { return nsGkAtoms::contentinfo; } } return nullptr; } if (mContent->IsHTMLElement(nsGkAtoms::aside)) { return nsGkAtoms::complementary; } Loading
accessible/html/HTMLElementAccessibles.cpp +56 −0 Original line number Diff line number Diff line Loading @@ -202,3 +202,59 @@ HTMLSummaryAccessible::IsWidget() const { return true; } //////////////////////////////////////////////////////////////////////////////// // HTMLHeaderOrFooterAccessible //////////////////////////////////////////////////////////////////////////////// NS_IMPL_ISUPPORTS_INHERITED0(HTMLHeaderOrFooterAccessible, HyperTextAccessible) role HTMLHeaderOrFooterAccessible::NativeRole() { // Only map header and footer if they are direct descendants of the body tag. // If other sectioning or sectioning root elements, they become sections. nsIContent* parent = mContent->GetParent(); while (parent) { if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::aside, nsGkAtoms::nav, nsGkAtoms::section, nsGkAtoms::blockquote, nsGkAtoms::details, nsGkAtoms::dialog, nsGkAtoms::fieldset, nsGkAtoms::figure, nsGkAtoms::td)) { break; } parent = parent->GetParent(); } // No sectioning or sectioning root elements found. if (!parent) { if (mContent->IsHTMLElement(nsGkAtoms::header)) { return roles::HEADER; } if (mContent->IsHTMLElement(nsGkAtoms::footer)) { return roles::FOOTER; } } return roles::SECTION; } nsIAtom* HTMLHeaderOrFooterAccessible::LandmarkRole() const { if (!HasOwnContent()) return nullptr; a11y::role r = const_cast<HTMLHeaderOrFooterAccessible*>(this)->Role(); if (r == roles::HEADER) { return nsGkAtoms::banner; } if (r == roles::FOOTER) { return nsGkAtoms::contentinfo; } return nullptr; }
accessible/html/HTMLElementAccessibles.h +20 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,26 @@ public: virtual bool IsWidget() const override; }; /** * Used for HTML header and footer elements. */ class HTMLHeaderOrFooterAccessible : public HyperTextAccessibleWrap { public: HTMLHeaderOrFooterAccessible(nsIContent* aContent, DocAccessible* aDoc) : HyperTextAccessibleWrap(aContent, aDoc) {} NS_DECL_ISUPPORTS_INHERITED // Accessible virtual nsIAtom* LandmarkRole() const override; virtual a11y::role NativeRole() override; protected: virtual ~HTMLHeaderOrFooterAccessible() {} }; } // namespace a11y } // namespace mozilla Loading