AX: Implement CSS -webkit-alt property (text alternative for generated content pseudo...
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Nov 2013 00:28:14 +0000 (00:28 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Nov 2013 00:28:14 +0000 (00:28 +0000)
commit373a50e44ab0f1906faa2fe29b96138567dd4b4a
treef7d94d41b1da44850101b3119409d38e38240f5e
parentefc2499053a514c017de3cd75fc16d178674b9e5
AX: Implement CSS -webkit-alt property (text alternative for generated content pseudo-elements ::before and ::after)
https://bugs.webkit.org/show_bug.cgi?id=120188

Reviewed by Dean Jackson.

Source/WebCore:

Add a -webkit-alt CSS property that can be used to label Image content or Text content for accessibility clients.

To accomplish this, it sets the string in the RenderStyle. Then when the ContentData creates an anonymous renderer,
it sets that string on the TextFragment or RenderImage, which can be queried by accessibility code.

Test: platform/mac/accessibility/webkit-alt-for-css-content.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::alternativeText):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textUnderElement):
(WebCore::objectInclusionFromAltText):
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::altTextToCSSValue):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseAlt):
* css/CSSParser.h:
* css/CSSPropertyNames.in:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
* rendering/RenderImage.h:
(WebCore::RenderImage::altText):
(WebCore::RenderImage::setAltText):
* rendering/RenderTextFragment.h:
* rendering/style/ContentData.cpp:
(WebCore::ImageContentData::createRenderer):
(WebCore::TextContentData::createRenderer):
* rendering/style/ContentData.h:
(WebCore::ContentData::setAltText):
(WebCore::ContentData::altText):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setContent):
(WebCore::RenderStyle::setContentAltText):
(WebCore::RenderStyle::contentAltText):
* rendering/style/RenderStyle.h:
* rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

* platform/mac/accessibility/webkit-alt-for-css-content-expected.txt: Added.
* platform/mac/accessibility/webkit-alt-for-css-content.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/webkit-alt-for-css-content-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/webkit-alt-for-css-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/RenderImage.h
Source/WebCore/rendering/RenderTextFragment.h
Source/WebCore/rendering/style/ContentData.cpp
Source/WebCore/rendering/style/ContentData.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.h