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

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 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 e9a15a9bf1d5e10290a6c202060b99575b8d8a82..8195422eeb378cd47c359806ff33fb370d1ff998 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)
@@ -272,7 +283,7 @@ AccessibilityRole AXRenderObject::determineAccessibilityRole()
return LegendRole;
if (m_renderer->isText())
return StaticTextRole;
- if (cssBox && cssBox->isImage()) {
+ if (cssBox && isImageOrAltText(cssBox, node)) {
if (node && node->isLink())
return ImageMapRole;
if (isHTMLInputElement(node))
@@ -683,7 +694,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->size().height() <= 1 || image->size().width() <= 1)
« Source/core/paint/ImagePainter.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