#include "core/accessibility/AXRenderObject.h"
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
+#include "core/InputTypeNames.h"
#include "core/accessibility/AXImageMapLink.h"
#include "core/accessibility/AXInlineTextBox.h"
#include "core/accessibility/AXObjectCache.h"
#include "core/editing/VisibleUnits.h"
#include "core/editing/htmlediting.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLLabelElement.h"
#include "core/html/HTMLOptionElement.h"
return ListMarkerRole;
if (isHTMLButtonElement(node))
return buttonRoleType();
+ if (isHTMLDetailsElement(node))
+ return DetailsRole;
+ if (isHTMLSummaryElement(node)) {
+ if (node->parentElement() && isHTMLDetailsElement(node->parentElement()))
+ return DisclosureTriangleRole;
+ return UnknownRole;
+ }
if (isHTMLLegendElement(node))
return LegendRole;
if (m_renderer->isText())
if (isHTMLInputElement(node)) {
HTMLInputElement& input = toHTMLInputElement(*node);
- if (input.isCheckbox())
+ const AtomicString& type = input.type();
+ if (type == InputTypeNames::checkbox)
return CheckBoxRole;
- if (input.isRadioButton())
+ if (type == InputTypeNames::radio)
return RadioButtonRole;
if (input.isTextButton())
return buttonRoleType();
-
- const AtomicString& type = input.getAttribute(typeAttr);
- if (equalIgnoringCase(type, "color"))
+ if (type == InputTypeNames::color)
return ColorWellRole;
}
if (isEmbeddedObject())
return EmbeddedObjectRole;
+ if (node && node->hasTagName(figcaptionTag))
+ return FigcaptionRole;
+
+ if (node && node->hasTagName(figureTag))
+ return FigureRole;
+
// There should only be one banner/contentInfo per page. If header/footer are being used within an article or section
// then it should not be exposed as whole page's banner/contentInfo
if (node && node->hasTagName(headerTag) && !isDescendantOfElementType(articleTag) && !isDescendantOfElementType(sectionTag))
bool AXRenderObject::isFileUploadButton() const
{
- if (m_renderer && isHTMLInputElement(m_renderer->node())) {
- HTMLInputElement& input = toHTMLInputElement(*m_renderer->node());
- return input.isFileUpload();
- }
-
- return false;
+ return m_renderer && isHTMLInputElement(m_renderer->node()) && toHTMLInputElement(*m_renderer->node()).type() == InputTypeNames::file;
}
static bool isLinkable(const AXObject& object)
if (roleValue() == IgnoredRole)
return true;
- if (roleValue() == PresentationalRole || inheritsPresentationalRole())
+ if ((roleValue() == NoneRole || roleValue() == PresentationalRole) || inheritsPresentationalRole())
return true;
// An ARIA tree can only have tree items and static text as children.
if (roleValue() == DialogRole)
return false;
+ if (roleValue() == FigcaptionRole)
+ return false;
+
+ if (roleValue() == FigureRole)
+ return false;
+
+ if (roleValue() == DetailsRole)
+ return false;
+
// if this element has aria attributes on it, it should not be ignored.
if (supportsARIAAttributes())
return false;
addHiddenChildren();
addAttachmentChildren();
+ addPopupChildren();
addImageMapChildren();
addTextFieldChildren();
addCanvasChildren();
if (!m_renderer)
return;
- if (AXObjectCache::inlineTextBoxAccessibility() && roleValue() == StaticTextRole)
+ Settings* settings = document()->settings();
+ if (settings && settings->inlineTextBoxAccessibilityEnabled() && roleValue() == StaticTextRole)
childrenChanged();
// Do this last - AXNodeObject::textChanged posts live region announcements,
if (index <= 0)
return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM);
- RefPtrWillBeRawPtr<Range> range = Range::create(m_renderer->document());
- range->selectNodeContents(node, IGNORE_EXCEPTION);
- CharacterIterator it(range.get());
+ Position start, end;
+ bool selected = Range::selectNodeContents(node, start, end);
+ if (!selected)
+ return VisiblePosition();
+
+ CharacterIterator it(start, end);
it.advance(index - 1);
- return VisiblePosition(Position(it.range()->endContainer(), it.range()->endOffset(), Position::PositionIsOffsetInAnch\
-or), UPSTREAM);
+ return VisiblePosition(Position(it.endContainer(), it.endOffset(), Position::PositionIsOffsetInAnchor), UPSTREAM);
}
int AXRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const
void AXRenderObject::addInlineTextBoxChildren()
{
- if (!axObjectCache()->inlineTextBoxAccessibility())
+ Settings* settings = document()->settings();
+ if (!settings || !settings->inlineTextBoxAccessibilityEnabled())
return;
if (!renderer() || !renderer()->isText())
if (!doc || !doc->isSVGDocument())
return 0;
+ Settings* settings = doc->settings();
+ if (settings && !settings->accessibilityEnabled())
+ settings->setAccessibilityEnabled(true);
+
SVGSVGElement* rootElement = doc->accessSVGExtensions().rootElement();
if (!rootElement)
return 0;
m_children.append(axWidget);
}
+void AXRenderObject::addPopupChildren()
+{
+ if (!isHTMLInputElement(node()))
+ return;
+ if (AXObject* axPopup = toHTMLInputElement(node())->popupRootAXObject())
+ m_children.append(axPopup);
+}
+
void AXRenderObject::addRemoteSVGChildren()
{
AXSVGRoot* root = remoteSVGRootElement();
QualifiedName tagName = toElement(elementNode)->tagQName();
if (tagName == ulTag || tagName == olTag || tagName == dlTag)
- return parent->roleValue() == PresentationalRole;
+ return (parent->roleValue() == NoneRole || parent->roleValue() == PresentationalRole);
return false;
}
Document* document = this->document();
if (document && document->isSVGDocument())
offsetBoundingBoxForRemoteSVGElement(result);
+ if (document && document->frame() && document->frame()->pagePopupOwner()) {
+ IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).location();
+ IntPoint mainOrigin = axObjectCache()->rootObject()->documentFrameView()->contentsToScreen(IntRect()).location();
+ result.moveBy(IntPoint(popupOrigin - mainOrigin));
+ }
// The size of the web area should be the content size, not the clipped size.
if (isWebArea() && obj->frame()->view())