Title: [175654] trunk
Revision
175654
Author
cfleiz...@apple.com
Date
2014-11-05 18:16:09 -0800 (Wed, 05 Nov 2014)

Log Message

AX: add "alt" as an overriding synonym of "-webkit-alt" (now in the CSS4 spec)
https://bugs.webkit.org/show_bug.cgi?id=138393

Reviewed by Dean Jackson.

Source/WebCore:

Add official "alt" CSS keyword and map -webkit-alt to that.

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

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
* css/CSSPropertyNames.in:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (175653 => 175654)


--- trunk/LayoutTests/ChangeLog	2014-11-06 01:53:25 UTC (rev 175653)
+++ trunk/LayoutTests/ChangeLog	2014-11-06 02:16:09 UTC (rev 175654)
@@ -1,3 +1,13 @@
+2014-11-05  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: add "alt" as an overriding synonym of "-webkit-alt" (now in the CSS4 spec)
+        https://bugs.webkit.org/show_bug.cgi?id=138393
+
+        Reviewed by Dean Jackson.
+
+        * platform/mac/accessibility/alt-for-css-content-expected.txt: Added.
+        * platform/mac/accessibility/alt-for-css-content.html: Added.
+
 2014-11-05  Dan Bernstein  <m...@apple.com>
 
         Remove the unused deletion UI feature

Added: trunk/LayoutTests/platform/mac/accessibility/alt-for-css-content-expected.txt (0 => 175654)


--- trunk/LayoutTests/platform/mac/accessibility/alt-for-css-content-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/alt-for-css-content-expected.txt	2014-11-06 02:16:09 UTC (rev 175654)
@@ -0,0 +1,52 @@
+This tests that alt (formerly known as -webkit-alt) applies to text and image content in CSS styles, and that it makes it to accessibility.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test1 - alt on image content with attr() function
+AXRole: AXImage
+AXDescription: ALTERNATIVE CONTENT TEST1
+AXTitle: 
+AXValue: 
+
+Test2 - alt on image content that is a string
+AXRole: AXImage
+AXDescription: ALTERNATIVE CONTENT TEST2
+AXTitle: 
+AXValue: 
+
+Test3 - alt on image content that is an empty string - representing that it should be ignored.
+AXRole: 
+AXDescription: 
+AXTitle: 
+AXValue: 
+
+Test4 - alt on text content
+AXRole: AXStaticText
+AXDescription: 
+AXTitle: 
+AXValue: ALTERNATIVE CONTENT TEST4
+
+Test5 - alt on text content that is an empty string - representing that is should be ignored.
+AXRole: AXStaticText
+AXDescription: 
+AXTitle: 
+AXValue: test5
+
+Test6 - alt on text content that uses the attr() function.
+AXRole: AXStaticText
+AXDescription: 
+AXTitle: 
+AXValue: ALTERNATIVE CONTENT TEST6
+
+alt accessed through _javascript_: 'ALTERNATIVE CONTENT TEST2'
+Test7 - alt does not apply to DOM nodes.
+AXRole: AXImage
+AXDescription: This is the right text
+AXTitle: 
+AXValue: 
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/alt-for-css-content.html (0 => 175654)


--- trunk/LayoutTests/platform/mac/accessibility/alt-for-css-content.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/alt-for-css-content.html	2014-11-06 02:16:09 UTC (rev 175654)
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html>
+<title id="title">TITLE</title>
+<head>
+<script src=""
+</head>
+<body>
+
+<style>
+
+/* alt on image content with attr() function. */
+[test1]::after {
+    content: url(resources/cake.png);
+    alt: attr(test1);
+}
+
+/* alt on image content that is a string. */
+.test2::after {
+    content: url(resources/cake.png);
+    alt: "ALTERNATIVE CONTENT TEST2";
+}
+
+/* alt on image content that is an empty string - representing that it should be ignored. */
+.test3::after {
+    content: url(resources/cake.png);
+    alt: "";
+}
+
+/* alt on text content. */
+[aria-expanded="test4"]::before {
+    content: "\25BB";
+    alt: "ALTERNATIVE CONTENT TEST4";
+}
+
+/* alt on text content that is an empty string - representing that is should be ignored. */
+[aria-expanded="test5"]::before {
+    content: "\25BC";
+    alt: "";
+}
+
+/* alt on text content that uses the attr() function. */
+[aria-expanded="test6"]::before {
+    content: "\25BC";
+    alt: attr(test6);
+}
+</style>
+
+<div id="content">
+<div id="test1" test1="ALTERNATIVE CONTENT TEST1">test1</div>
+<div id="test2" class="test2">test2</div>
+<div id="test3" class="test3">test3</div>
+<div id="test4" aria-expanded="test4">test4</div>
+<div id="test5" test5="ALTERNATIVE CONTENT TEST5" aria-expanded="test5">test5</div>
+<div id="test6" test6="ALTERNATIVE CONTENT TEST6" aria-expanded="test6">test6</div>
+
+<img id="image1" src="" alt="This is the right text" style="width:100px; height:100px; -webkit-alt: 'this is the wrong text';">
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests that alt (formerly known as -webkit-alt) applies to text and image content in CSS styles, and that it makes it to accessibility.");
+    
+    function outputElement(element) {
+        var role = "AXRole: ";
+        var description = "AXDescription: ";
+        var title = "AXTitle: ";
+        var value = "AXValue: ";
+        if (element) {
+            role = element.role;
+            description = element.description;
+            title = element.title;
+            value = element.stringValue;
+        }
+        debug(role);
+        debug(description);
+        debug(title);
+        debug(value + "\n");
+    }
+
+    if (window.accessibilityController) {
+        debug("Test1 - alt on image content with attr() function");
+        outputElement(accessibilityController.accessibleElementById("test1").childAtIndex(1));
+
+        debug("Test2 - alt on image content that is a string");
+        outputElement(accessibilityController.accessibleElementById("test2").childAtIndex(1));
+
+        debug("Test3 - alt on image content that is an empty string - representing that it should be ignored.");
+        outputElement(accessibilityController.accessibleElementById("test3").childAtIndex(1));
+
+        debug("Test4 - alt on text content");
+        outputElement(accessibilityController.accessibleElementById("test4").childAtIndex(0));
+
+        debug("Test5 - alt on text content that is an empty string - representing that is should be ignored.");
+        outputElement(accessibilityController.accessibleElementById("test5").childAtIndex(0));
+
+        debug("Test6 - alt on text content that uses the attr() function.");
+        outputElement(accessibilityController.accessibleElementById("test6").childAtIndex(0));
+
+        debug("alt accessed through _javascript_: " + getComputedStyle(document.getElementById("test2"), ':after').alt);
+
+        debug("Test7 - alt does not apply to DOM nodes.");
+        outputElement(accessibilityController.accessibleElementById("image1"));
+
+        document.getElementById("content").style.visibility = "hidden";
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (175653 => 175654)


--- trunk/Source/WebCore/ChangeLog	2014-11-06 01:53:25 UTC (rev 175653)
+++ trunk/Source/WebCore/ChangeLog	2014-11-06 02:16:09 UTC (rev 175654)
@@ -1,3 +1,22 @@
+2014-11-05  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: add "alt" as an overriding synonym of "-webkit-alt" (now in the CSS4 spec)
+        https://bugs.webkit.org/show_bug.cgi?id=138393
+
+        Reviewed by Dean Jackson.
+
+        Add official "alt" CSS keyword and map -webkit-alt to that.
+
+        Test: platform/mac/accessibility/alt-for-css-content.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSPropertyNames.in:
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+
 2014-11-05  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         Unreviewed, EFL build fix since r175647

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (175653 => 175654)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-11-06 01:53:25 UTC (rev 175653)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-11-06 02:16:09 UTC (rev 175654)
@@ -91,6 +91,7 @@
 
 // List of all properties we know how to compute, omitting shorthands.
 static const CSSPropertyID computedProperties[] = {
+    CSSPropertyAlt,
     CSSPropertyBackgroundAttachment,
     CSSPropertyBackgroundBlendMode,
     CSSPropertyBackgroundClip,
@@ -224,7 +225,6 @@
     CSSPropertyZIndex,
     CSSPropertyZoom,
 
-    CSSPropertyWebkitAlt,
     CSSPropertyWebkitAnimationDelay,
     CSSPropertyWebkitAnimationDirection,
     CSSPropertyWebkitAnimationDuration,
@@ -2840,7 +2840,7 @@
             return CSSPrimitiveValue::create(style->textOrientation());
         case CSSPropertyWebkitLineBoxContain:
             return createLineBoxContainValue(style->lineBoxContain());
-        case CSSPropertyWebkitAlt:
+        case CSSPropertyAlt:
             return altTextToCSSValue(style.get());
         case CSSPropertyContent:
             return contentToCSSValue(style.get());

Modified: trunk/Source/WebCore/css/CSSParser.cpp (175653 => 175654)


--- trunk/Source/WebCore/css/CSSParser.cpp	2014-11-06 01:53:25 UTC (rev 175653)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2014-11-06 02:16:09 UTC (rev 175654)
@@ -1867,7 +1867,7 @@
         // close-quote | no-open-quote | no-close-quote ]+ | inherit
         return parseContent(propId, important);
 
-    case CSSPropertyWebkitAlt: // [ <string> | attr(X) ]
+    case CSSPropertyAlt: // [ <string> | attr(X) ]
         return parseAlt(propId, important);
             
     case CSSPropertyClip:                 // <shape> | auto | inherit

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (175653 => 175654)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-06 01:53:25 UTC (rev 175653)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2014-11-06 02:16:09 UTC (rev 175654)
@@ -256,7 +256,8 @@
 word-spacing [Inherited]
 word-wrap [Inherited, NewStyleBuilder=EOverflowWrap, NameForMethods=OverflowWrap]
 z-index
--webkit-alt
+alt
+-webkit-alt = alt
 -webkit-animation
 -webkit-animation-delay
 -webkit-animation-direction

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (175653 => 175654)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2014-11-06 01:53:25 UTC (rev 175653)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2014-11-06 02:16:09 UTC (rev 175654)
@@ -2230,7 +2230,7 @@
                 state.style()->clearContent();
             return;
         }
-    case CSSPropertyWebkitAlt:
+    case CSSPropertyAlt:
         {
             bool didSet = false;
             if (primitiveValue->isString()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to