Commit 54784338 authored by Jacques Newman's avatar Jacques Newman Committed by Commit Bot

Ignore images with an explicitly empty alt attribute.

Images with an explicitly empty alt attribute should be ignored.
Images that do not have the alt attribute explicitly empty will have
automatic image annotation done when possible, so we shouldn't ignore
them.

Bug: 1018853
Change-Id: If8f95d8ed7376797e24707047b5b291bde1555bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881124
Commit-Queue: Jacques Newman <janewman@microsoft.com>
Reviewed-by: default avatarAlice Boxhall <aboxhall@chromium.org>
Reviewed-by: default avatarKurt Catti-Schmidt <kschmi@microsoft.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713564}
parent 662f40fc
android.webkit.WebView focusable focused scrollable android.webkit.WebView focusable focused scrollable
++android.view.View ++android.view.View
++++android.widget.Image role_description='graphic'
++++android.widget.Image role_description='graphic'
++++android.widget.Image role_description='graphic' name='read' ++++android.widget.Image role_description='graphic' name='read'
++++android.widget.Image role_description='graphic' name='full' ++++android.widget.Image role_description='graphic' name='full'
[document web] [document web]
++[section] ++[section]
++++[image] name=''
++++[image] name=''
++++[image] ++++[image]
++++[image] name='full' ++++[image] name='full'
rootWebArea rootWebArea
++genericContainer ++genericContainer
++++presentational ignored name='' ++++presentational ignored name=''
++++image name='' ++++image ignored name=''
++++image name='' ++++image ignored name=''
++++image ++++image
++++image name='full' ++++image name='full'
AXWebArea AXWebArea
++AXGroup ++AXGroup
++++AXUnknown
++++AXUnknown
++++AXImage AXDescription='/read.jpg' ++++AXImage AXDescription='/read.jpg'
++++AXImage AXDescription='full' ++++AXImage AXDescription='full'
document document
++group ++group
++++img ++++img
++++img
++++img
++++img Name='full' ++++img Name='full'
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++IA2_ROLE_SECTION ++IA2_ROLE_SECTION
++++ROLE_SYSTEM_GRAPHIC name='' READONLY
++++ROLE_SYSTEM_GRAPHIC name='' READONLY
++++ROLE_SYSTEM_GRAPHIC READONLY ++++ROLE_SYSTEM_GRAPHIC READONLY
++++ROLE_SYSTEM_GRAPHIC name='full' READONLY ++++ROLE_SYSTEM_GRAPHIC name='full' READONLY
...@@ -2,6 +2,5 @@ android.webkit.WebView focusable focused has_image scrollable ...@@ -2,6 +2,5 @@ android.webkit.WebView focusable focused has_image scrollable
++android.view.View has_image ++android.view.View has_image
++++android.widget.Image role_description='graphic' has_image name='pipe' ++++android.widget.Image role_description='graphic' has_image name='pipe'
++++android.view.View name=' ' ++++android.view.View name=' '
++++android.widget.Image role_description='graphic' has_image
++++android.view.View name=' ' ++++android.view.View name=' '
++++android.widget.Image role_description='graphic' has_image name=' ' ++++android.widget.Image role_description='graphic' has_image name=' '
...@@ -2,6 +2,5 @@ ...@@ -2,6 +2,5 @@
++[section] ++[section]
++++[image] name='pipe' xml-roles:img ++++[image] name='pipe' xml-roles:img
++++[static] name=' ' ++++[static] name=' '
++++[image] name='' xml-roles:img
++++[static] name=' ' ++++[static] name=' '
++++[image] name=' ' xml-roles:img ++++[image] name=' ' xml-roles:img
\ No newline at end of file
...@@ -3,7 +3,6 @@ rootWebArea ...@@ -3,7 +3,6 @@ rootWebArea
++++image name='pipe' ++++image name='pipe'
++++staticText name=' ' ++++staticText name=' '
++++++inlineTextBox name=' ' ++++++inlineTextBox name=' '
++++image name=''
++++staticText name=' ' ++++staticText name=' '
++++++inlineTextBox name=' ' ++++++inlineTextBox name=' '
++++image name=' ' ++++image name=' '
...@@ -2,6 +2,5 @@ AXWebArea ...@@ -2,6 +2,5 @@ AXWebArea
++AXGroup ++AXGroup
++++AXImage AXRoleDescription='image' AXDescription='pipe' ++++AXImage AXRoleDescription='image' AXDescription='pipe'
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXUnknown
++++AXStaticText AXValue=' ' ++++AXStaticText AXValue=' '
++++AXImage AXRoleDescription='image' AXDescription=' ' ++++AXImage AXRoleDescription='image' AXDescription=' '
\ No newline at end of file
...@@ -2,6 +2,5 @@ document ...@@ -2,6 +2,5 @@ document
++group ++group
++++img Name='pipe' ++++img Name='pipe'
++++description Name=' ' ++++description Name=' '
++++img
++++description Name=' ' ++++description Name=' '
++++img Name=' ' ++++img Name=' '
...@@ -2,6 +2,5 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ...@@ -2,6 +2,5 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++IA2_ROLE_SECTION ++IA2_ROLE_SECTION
++++ROLE_SYSTEM_GRAPHIC name='pipe' READONLY xml-roles:img ++++ROLE_SYSTEM_GRAPHIC name='pipe' READONLY xml-roles:img
++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_STATICTEXT name=' '
++++ROLE_SYSTEM_GRAPHIC name='' READONLY xml-roles:img
++++ROLE_SYSTEM_STATICTEXT name=' ' ++++ROLE_SYSTEM_STATICTEXT name=' '
++++ROLE_SYSTEM_GRAPHIC name=' ' READONLY xml-roles:img ++++ROLE_SYSTEM_GRAPHIC name=' ' READONLY xml-roles:img
...@@ -3,11 +3,9 @@ ...@@ -3,11 +3,9 @@
++++[link] name='unread ' ++++[link] name='unread '
++++++[static] name='unread ' ++++++[static] name='unread '
++++[link] name='read ' ++++[link] name='read '
++++++[image] name=''
++++++[static] name='read ' ++++++[static] name='read '
++++[link] name='read ' ++++[link] name='read '
++++++[image] name=''
++++++[static] name='read ' ++++++[static] name='read '
++++[link] name='read' ++++[link] name='read'
++++++[image] ++++++[image]
++++++[static] name='read' ++++++[static] name='read'
\ No newline at end of file
...@@ -5,11 +5,11 @@ rootWebArea ...@@ -5,11 +5,11 @@ rootWebArea
++++++staticText name='unread ' ++++++staticText name='unread '
++++++++inlineTextBox name='unread ' ++++++++inlineTextBox name='unread '
++++link name='read ' ++++link name='read '
++++++image name='' ++++++image ignored name=''
++++++staticText name='read ' ++++++staticText name='read '
++++++++inlineTextBox name='read ' ++++++++inlineTextBox name='read '
++++link name='read ' ++++link name='read '
++++++image name='' ++++++image ignored name=''
++++++staticText name='read ' ++++++staticText name='read '
++++++++inlineTextBox name='read ' ++++++++inlineTextBox name='read '
++++link name='read' ++++link name='read'
......
...@@ -3,10 +3,8 @@ AXWebArea ...@@ -3,10 +3,8 @@ AXWebArea
++++AXLink AXTitle='unread ' ++++AXLink AXTitle='unread '
++++++AXStaticText AXValue='unread ' ++++++AXStaticText AXValue='unread '
++++AXLink AXTitle='read ' ++++AXLink AXTitle='read '
++++++AXUnknown
++++++AXStaticText AXValue='read ' ++++++AXStaticText AXValue='read '
++++AXLink AXTitle='read ' ++++AXLink AXTitle='read '
++++++AXUnknown
++++++AXStaticText AXValue='read ' ++++++AXStaticText AXValue='read '
++++AXLink AXTitle='read' ++++AXLink AXTitle='read'
++++++AXImage AXDescription='/read.jpg' ++++++AXImage AXDescription='/read.jpg'
......
...@@ -2,8 +2,6 @@ document ...@@ -2,8 +2,6 @@ document
++group ++group
++++link Name='unread ' ++++link Name='unread '
++++link Name='read ' ++++link Name='read '
++++++img
++++link Name='read ' ++++link Name='read '
++++++img
++++link Name='read' ++++link Name='read'
++++++img ++++++img
...@@ -3,10 +3,8 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ...@@ -3,10 +3,8 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++++ROLE_SYSTEM_LINK name='unread ' FOCUSABLE ++++ROLE_SYSTEM_LINK name='unread ' FOCUSABLE
++++++ROLE_SYSTEM_STATICTEXT name='unread ' ++++++ROLE_SYSTEM_STATICTEXT name='unread '
++++ROLE_SYSTEM_LINK name='read ' FOCUSABLE ++++ROLE_SYSTEM_LINK name='read ' FOCUSABLE
++++++ROLE_SYSTEM_GRAPHIC name='' READONLY
++++++ROLE_SYSTEM_STATICTEXT name='read ' ++++++ROLE_SYSTEM_STATICTEXT name='read '
++++ROLE_SYSTEM_LINK name='read ' FOCUSABLE ++++ROLE_SYSTEM_LINK name='read ' FOCUSABLE
++++++ROLE_SYSTEM_GRAPHIC name='' READONLY
++++++ROLE_SYSTEM_STATICTEXT name='read ' ++++++ROLE_SYSTEM_STATICTEXT name='read '
++++ROLE_SYSTEM_LINK name='read' FOCUSABLE ++++ROLE_SYSTEM_LINK name='read' FOCUSABLE
++++++ROLE_SYSTEM_GRAPHIC READONLY ++++++ROLE_SYSTEM_GRAPHIC READONLY
......
...@@ -287,9 +287,14 @@ AXObjectInclusion AXNodeObject::ShouldIncludeBasedOnSemantics( ...@@ -287,9 +287,14 @@ AXObjectInclusion AXNodeObject::ShouldIncludeBasedOnSemantics(
if (HasGlobalARIAAttribute()) if (HasGlobalARIAAttribute())
return kIncludeObject; return kIncludeObject;
if (IsImage()) bool has_non_empty_alt_attribute = !GetAttribute(kAltAttr).IsEmpty();
return kIncludeObject; if (IsImage()) {
if (has_non_empty_alt_attribute || GetAttribute(kAltAttr).IsNull())
return kIncludeObject;
else if (ignored_reasons)
ignored_reasons->push_back(IgnoredReason(kAXEmptyAlt));
return kIgnoreObject;
}
// Using the title or accessibility description (so we // Using the title or accessibility description (so we
// check if there's some kind of accessible name for the element) // check if there's some kind of accessible name for the element)
// to decide an element's visibility is not as definitive as // to decide an element's visibility is not as definitive as
...@@ -298,8 +303,8 @@ AXObjectInclusion AXNodeObject::ShouldIncludeBasedOnSemantics( ...@@ -298,8 +303,8 @@ AXObjectInclusion AXNodeObject::ShouldIncludeBasedOnSemantics(
// These checks are simplified in the interest of execution speed; // These checks are simplified in the interest of execution speed;
// for example, any element having an alt attribute will make it // for example, any element having an alt attribute will make it
// not ignored, rather than just images. // not ignored, rather than just images.
if (HasAriaAttribute(GetElement()) || !GetAttribute(kAltAttr).IsEmpty() || if (HasAriaAttribute(GetElement()) || !GetAttribute(kTitleAttr).IsEmpty() ||
!GetAttribute(kTitleAttr).IsEmpty()) has_non_empty_alt_attribute)
return kIncludeObject; return kIncludeObject;
// <span> tags are inline tags and not meant to convey information if they // <span> tags are inline tags and not meant to convey information if they
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment