Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: Source/core/accessibility/AXRenderObject.cpp

Issue 481753002: Use Shadow DOM to display fallback content for images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/accessibility/AXRenderObject.cpp
diff --git a/Source/core/accessibility/AXRenderObject.cpp b/Source/core/accessibility/AXRenderObject.cpp
index 58639de6792676352a73b738ad13d6ba8cc117b5..af0955a5a3d4f12403540b3a45ca0b4024f5be01 100644
--- a/Source/core/accessibility/AXRenderObject.cpp
+++ b/Source/core/accessibility/AXRenderObject.cpp
@@ -253,6 +253,17 @@ ScrollableArea* AXRenderObject::getScrollableAreaIfScrollable() const
return box->scrollableArea();
}
+static bool isImageOrAltText(RenderBoxModelObject* box, Node* node)
+{
+ if (box && box->isImage())
+ return true;
+ if (isHTMLImageElement(node))
+ return true;
+ if (isHTMLInputElement(node) && toHTMLInputElement(node)->hasFallbackContent())
esprehn 2014/11/11 19:06:06 Why is an input with fallback content an image? Do
rhogan 2014/11/11 19:43:06 Yes, that's correct.
+ return true;
+ return false;
+}
+
AccessibilityRole AXRenderObject::determineAccessibilityRole()
{
if (!m_renderer)
@@ -268,7 +279,7 @@ AccessibilityRole AXRenderObject::determineAccessibilityRole()
RenderBoxModelObject* cssBox = renderBoxModelObject();
if (node && node->isLink()) {
- if (cssBox && cssBox->isImage())
+ if (isImageOrAltText(cssBox, node))
return ImageMapRole;
return LinkRole;
}
@@ -289,7 +300,7 @@ AccessibilityRole AXRenderObject::determineAccessibilityRole()
return LegendRole;
if (m_renderer->isText())
return StaticTextRole;
- if (cssBox && cssBox->isImage()) {
+ if (isImageOrAltText(cssBox, node)) {
if (isHTMLInputElement(node))
return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
if (isSVGImage())
@@ -768,7 +779,7 @@ bool AXRenderObject::computeAccessibilityIsIgnored() const
return true;
}
- if (isNativeImage() && m_renderer->isImage()) {
+ if (isNativeImage() && isImageOrAltText(toRenderBoxModelObject(m_renderer), node)) {
// check for one-dimensional image
RenderImage* image = toRenderImage(m_renderer);
if (image->height() <= 1 || image->width() <= 1)

Powered by Google App Engine
This is Rietveld 408576698