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

Unified Diff: Source/modules/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/modules/accessibility/AXRenderObject.cpp
diff --git a/Source/modules/accessibility/AXRenderObject.cpp b/Source/modules/accessibility/AXRenderObject.cpp
index f262d7b35daa23ee55f6fa83987a6fff6de7a295..09f7a7d1be9d3c9cbbfbef2dfe6ac0da33ed524c 100644
--- a/Source/modules/accessibility/AXRenderObject.cpp
+++ b/Source/modules/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())
+ 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())
@@ -776,7 +787,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)
« Source/core/html/HTMLImageFallbackHelper.cpp ('K') | « Source/core/rendering/RenderImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698