AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jan 2018 00:32:53 +0000 (00:32 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jan 2018 00:32:53 +0000 (00:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180361

Reviewed by Zalan Bujtas.

Source/WebCore:

Change speak -> speakAs, and allow a combination of properties.

Tests: Updated accessibility/mac/css-speech-speak.html

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::speakAsProperty const):
(WebCore::AccessibilityObject::speakProperty const): Deleted.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::speakAsProperty const):
(WebCore::AccessibilityRenderObject::speakProperty const): Deleted.
* accessibility/AccessibilityRenderObject.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilitySpeechHint]):
* accessibility/mac/WebAccessibilityObjectWrapperBase.h:
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::speakAsToCSSValue):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ESpeakAs const):
(WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted.
* css/CSSProperties.json:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertSpeakAs):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeSpeakAs):
(WebCore::CSSPropertyParser::parseSingleValue):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::speakAs const):
(WebCore::RenderStyle::setSpeakAs):
(WebCore::RenderStyle::initialSpeakAs):
(WebCore::RenderStyle::speak const): Deleted.
(WebCore::RenderStyle::setSpeak): Deleted.
(WebCore::RenderStyle::initialSpeak): Deleted.
* rendering/style/RenderStyleConstants.h:
(WebCore::operator| ):
(WebCore::operator|= ):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* rendering/style/StyleRareInheritedData.h:

Tools:

* DumpRenderTree/AccessibilityUIElement.cpp:
(speakAsCallback):
(AccessibilityUIElement::speakAs):
(AccessibilityUIElement::getJSClass):
(speakCallback): Deleted.
(AccessibilityUIElement::speak): Deleted.
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::speakAs):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::speakAs):
(AccessibilityUIElement::speak): Deleted.
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::speakAs):
(WTR::AccessibilityUIElement::speak): Deleted.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::speakAs):
(WTR::AccessibilityUIElement::speak): Deleted.

LayoutTests:

* accessibility/mac/css-speech-speak-expected.txt:
* accessibility/mac/css-speech-speak.html:
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/ios/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/ios/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac-sierra/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/mac-sierra/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac-sierra/svg/css/getComputedStyle-basic-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
* platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/mac/svg/css/getComputedStyle-basic-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226432 268f45cc-cd09-0410-ab3c-d52691b4dbfc

42 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/mac/css-speech-speak-expected.txt
LayoutTests/accessibility/mac/css-speech-speak.html
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/platform/ios/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/platform/ios/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/platform/mac-sierra/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/platform/mac-sierra/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/platform/mac-sierra/svg/css/getComputedStyle-basic-expected.txt
LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
LayoutTests/platform/mac/svg/css/getComputedStyle-basic-expected.txt
LayoutTests/svg/css/getComputedStyle-basic-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.h
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSProperties.json
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/parser/CSSParserFastPaths.cpp
Source/WebCore/css/parser/CSSPropertyParser.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h
Tools/ChangeLog
Tools/DumpRenderTree/AccessibilityUIElement.cpp
Tools/DumpRenderTree/AccessibilityUIElement.h
Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm
Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

index 5083f096978ee91396816cabab7a3a5f870b395e..3264e715d93696ab2c267e7f26b1a1ab6e134655 100644 (file)
@@ -1,3 +1,24 @@
+2018-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
+        https://bugs.webkit.org/show_bug.cgi?id=180361
+
+        Reviewed by Zalan Bujtas.
+
+        * accessibility/mac/css-speech-speak-expected.txt:
+        * accessibility/mac/css-speech-speak.html:
+        * fast/css/getComputedStyle/computed-style-expected.txt:
+        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * platform/ios/fast/css/getComputedStyle/computed-style-expected.txt:
+        * platform/ios/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * platform/mac-sierra/fast/css/getComputedStyle/computed-style-expected.txt:
+        * platform/mac-sierra/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * platform/mac-sierra/svg/css/getComputedStyle-basic-expected.txt:
+        * platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
+        * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * platform/mac/svg/css/getComputedStyle-basic-expected.txt:
+        * svg/css/getComputedStyle-basic-expected.txt:
+
 2018-01-04  Brian Burg  <bburg@apple.com>
 
         Web Inspector: Capture Element Screenshot looks fuzzy
index 943a65235d89ed54dab2503200b488ddce4fc740..80a387dd70fd5480e12551c112116946a40be4c6 100644 (file)
@@ -1,24 +1,26 @@
 Initial
-No speech
 Normal
 Spellout
 Digits
 Literal
 No punctuation
+Digits and Literal
+Spell and Literal
 test
-This tests that using the CSS3-speech property 'speak' works as from a WebCore level (not a platform level, that is up to the platforms)
+This tests that using the CSS3-speech property 'speak-as' works as from a WebCore level (not a platform level, that is up to the platforms)
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS accessibilityController.focusedElement.childAtIndex(0).speak is 'normal'
-PASS accessibilityController.focusedElement.childAtIndex(0).speak is 'none'
-PASS accessibilityController.focusedElement.childAtIndex(0).speak is 'normal'
-PASS accessibilityController.focusedElement.childAtIndex(0).speak is 'spell-out'
-PASS accessibilityController.focusedElement.childAtIndex(0).speak is 'digits'
-PASS accessibilityController.focusedElement.childAtIndex(0).speak is 'literal-punctuation'
-PASS accessibilityController.focusedElement.childAtIndex(0).speak is 'no-punctuation'
-PASS accessibilityController.focusedElement.childAtIndex(0).speak is 'digits'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'spell-out'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, literal-punctuation'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, no-punctuation'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits, literal-punctuation'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'spell-out, literal-punctuation'
+PASS accessibilityController.focusedElement.childAtIndex(0).speakAs is 'normal, digits'
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 7496a7de80938850d10dea39e77af75b5a4d3dfe..9f41e21ec9191f4f6077fa1114e1166df7a8aae1 100644 (file)
@@ -3,26 +3,28 @@
 <head>
 <script src="../../resources/js-test-pre.js"></script>
 <style>
-div.speech-none { speak: none; }
-div.speech-normal { speak: normal; }
-div.speech-spellout { speak: spell-out; }
-div.speech-digits { speak: digits; }
-div.speech-literalpunc { speak: literal-punctuation; }
-div.speech-nopunc { speak: no-punctuation; }
+div.speech-normal { speak-as: normal; }
+div.speech-spellout { speak-as: spell-out; }
+div.speech-digits { speak-as: digits; }
+div.speech-literalpunc { speak-as: literal-punctuation; }
+div.speech-nopunc { speak-as: no-punctuation; }
+div.digits-and-literal { speak-as: digits literal-punctuation; }
+div.spell-and-literal { speak-as: spell-out literal-punctuation; }
 </style>
 </head>
 <body id="body">
 
 
 <div tabindex="0" id="initial" >Initial</div>
-<div tabindex="0" id="speech-none" class="speech-none">No speech</div>
 <div tabindex="0" id="speech-normal" class="speech-normal">Normal</div>
 <div tabindex="0" id="speech-spellout" class="speech-spellout">Spellout</div>
 <div tabindex="0" id="speech-digits" class="speech-digits">Digits</div>
 <div tabindex="0" id="speech-literalpunc" class="speech-literalpunc">Literal</div>
 <div tabindex="0" id="speech-nopunc" class="speech-nopunc">No punctuation</div>
+<div tabindex="0" id="speech-digits-and-literal" class="digits-and-literal">Digits and Literal</div>
+<div tabindex="0" id="speech-spell-and-literal" class="spell-and-literal">Spell and Literal</div>
 
-<div style='speak: digits;'>
+<div style='speak-as: digits;'>
  <div>
   <div>
     <a id="testlink" tabindex="0" href="#">test</a>
@@ -35,33 +37,36 @@ div.speech-nopunc { speak: no-punctuation; }
 
 <script>
 
-    description("This tests that using the CSS3-speech property 'speak' works as from a WebCore level (not a platform level, that is up to the platforms)");
+    description("This tests that using the CSS3-speech property 'speak-as' works as from a WebCore level (not a platform level, that is up to the platforms)");
 
     if (window.accessibilityController) {
 
           document.getElementById("initial").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speak", "'normal'");
-
-          document.getElementById("speech-none").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speak", "'none'");
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal'");
 
           document.getElementById("speech-normal").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speak", "'normal'");
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal'");
 
           document.getElementById("speech-spellout").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speak", "'spell-out'");
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'spell-out'");
 
           document.getElementById("speech-digits").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speak", "'digits'");
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits'");
 
           document.getElementById("speech-literalpunc").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speak", "'literal-punctuation'");
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, literal-punctuation'");
 
           document.getElementById("speech-nopunc").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speak", "'no-punctuation'");
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, no-punctuation'");
+
+          document.getElementById("speech-digits-and-literal").focus();
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits, literal-punctuation'");
+
+          document.getElementById("speech-spell-and-literal").focus();
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'spell-out, literal-punctuation'");
 
           document.getElementById("testlink").focus();
-          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speak", "'digits'");
+          shouldBe("accessibilityController.focusedElement.childAtIndex(0).speakAs", "'normal, digits'");
     }
 
 </script>
index 78efe47bbfad47ff710e63e8b867d56d8caf2e6f..8f964fce3d31f066037f3d553661b132e85b96eb 100644 (file)
@@ -89,7 +89,6 @@ pointer-events: auto;
 position: static;
 resize: none;
 right: auto;
-speak: normal;
 table-layout: auto;
 tab-size: 8;
 text-align: start;
index 0ba402f507ac1f1c961b5a62531b85c137ad97dd..776bc180c2a4d18eff75d73db40dc0888cc1ba34 100644 (file)
@@ -88,7 +88,6 @@ pointer-events: auto
 position: static
 resize: none
 right: auto
-speak: normal
 table-layout: auto
 tab-size: 8
 text-align: start
index 65064cd55b0158e92f90b38fb068d4d27630e632..77e568add42cc88e8cdb0a85ffea40d9247ce51a 100644 (file)
@@ -90,7 +90,6 @@ pointer-events: auto;
 position: static;
 resize: none;
 right: auto;
-speak: normal;
 table-layout: auto;
 tab-size: 8;
 text-align: start;
index d20d6dc56ce1324a6137b60ac07473aafa9d83bd..5ebca690136fb25a6b1060eb12d948773867999a 100644 (file)
@@ -89,7 +89,6 @@ pointer-events: auto
 position: static
 resize: none
 right: auto
-speak: normal
 table-layout: auto
 tab-size: 8
 text-align: start
index 78efe47bbfad47ff710e63e8b867d56d8caf2e6f..8f964fce3d31f066037f3d553661b132e85b96eb 100644 (file)
@@ -89,7 +89,6 @@ pointer-events: auto;
 position: static;
 resize: none;
 right: auto;
-speak: normal;
 table-layout: auto;
 tab-size: 8;
 text-align: start;
index 0ba402f507ac1f1c961b5a62531b85c137ad97dd..776bc180c2a4d18eff75d73db40dc0888cc1ba34 100644 (file)
@@ -88,7 +88,6 @@ pointer-events: auto
 position: static
 resize: none
 right: auto
-speak: normal
 table-layout: auto
 tab-size: 8
 text-align: start
index f771bc921f67a3a8fc8c951a0004d8122a232210..d0ee3d98e34e341d10224707399f7a75aee8b6e7 100644 (file)
@@ -176,8 +176,6 @@ rect: style.getPropertyValue(resize) : none
 rect: style.getPropertyCSSValue(resize) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(right) : auto
 rect: style.getPropertyCSSValue(right) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(speak) : normal
-rect: style.getPropertyCSSValue(speak) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(table-layout) : auto
 rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(tab-size) : 8
@@ -728,8 +726,6 @@ g: style.getPropertyValue(resize) : none
 g: style.getPropertyCSSValue(resize) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(right) : auto
 g: style.getPropertyCSSValue(right) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(speak) : normal
-g: style.getPropertyCSSValue(speak) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(table-layout) : auto
 g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(tab-size) : 8
index 883625f7625dcb11d8b4496c105c9a0384706338..7aab44dce1f1ce6b61a5f5cbc4c5fab4321bc5df 100644 (file)
@@ -90,7 +90,6 @@ pointer-events: auto;
 position: static;
 resize: none;
 right: auto;
-speak: normal;
 table-layout: auto;
 tab-size: 8;
 text-align: start;
index 3322bba8c2db262bd044c5ec83c7e21e4f046be1..768560ef0e0962685929294bb52ff0b0b594b04a 100644 (file)
@@ -89,7 +89,6 @@ pointer-events: auto
 position: static
 resize: none
 right: auto
-speak: normal
 table-layout: auto
 tab-size: 8
 text-align: start
index 25941556568759eccf3122d771e41097cb6e26a7..5080092208e6e7830e6636cc0cd958bb0d08b6ca 100644 (file)
@@ -178,8 +178,6 @@ rect: style.getPropertyValue(resize) : none
 rect: style.getPropertyCSSValue(resize) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(right) : auto
 rect: style.getPropertyCSSValue(right) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(speak) : normal
-rect: style.getPropertyCSSValue(speak) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(table-layout) : auto
 rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(tab-size) : 8
@@ -732,8 +730,6 @@ g: style.getPropertyValue(resize) : none
 g: style.getPropertyCSSValue(resize) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(right) : auto
 g: style.getPropertyCSSValue(right) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(speak) : normal
-g: style.getPropertyCSSValue(speak) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(table-layout) : auto
 g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(tab-size) : 8
index f771bc921f67a3a8fc8c951a0004d8122a232210..d0ee3d98e34e341d10224707399f7a75aee8b6e7 100644 (file)
@@ -176,8 +176,6 @@ rect: style.getPropertyValue(resize) : none
 rect: style.getPropertyCSSValue(resize) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(right) : auto
 rect: style.getPropertyCSSValue(right) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(speak) : normal
-rect: style.getPropertyCSSValue(speak) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(table-layout) : auto
 rect: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(tab-size) : 8
@@ -728,8 +726,6 @@ g: style.getPropertyValue(resize) : none
 g: style.getPropertyCSSValue(resize) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(right) : auto
 g: style.getPropertyCSSValue(right) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(speak) : normal
-g: style.getPropertyCSSValue(speak) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(table-layout) : auto
 g: style.getPropertyCSSValue(table-layout) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(tab-size) : 8
index 99cac8325ab3626e0c77ee99923f5e4f0ac5d0ee..af6cee884d679522f1f62c6fab557b1274c44fd3 100644 (file)
@@ -1,3 +1,59 @@
+2018-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
+        https://bugs.webkit.org/show_bug.cgi?id=180361
+
+        Reviewed by Zalan Bujtas.
+
+        Change speak -> speakAs, and allow a combination of properties.
+
+        Tests: Updated accessibility/mac/css-speech-speak.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::speakAsProperty const):
+        (WebCore::AccessibilityObject::speakProperty const): Deleted.
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::speakAsProperty const):
+        (WebCore::AccessibilityRenderObject::speakProperty const): Deleted.
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilitySpeechHint]):
+        * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
+        * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
+        (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::speakAsToCSSValue):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator ESpeakAs const):
+        (WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted.
+        * css/CSSProperties.json:
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertSpeakAs):
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeSpeakAs):
+        (WebCore::CSSPropertyParser::parseSingleValue):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::speakAs const):
+        (WebCore::RenderStyle::setSpeakAs):
+        (WebCore::RenderStyle::initialSpeakAs):
+        (WebCore::RenderStyle::speak const): Deleted.
+        (WebCore::RenderStyle::setSpeak): Deleted.
+        (WebCore::RenderStyle::initialSpeak): Deleted.
+        * rendering/style/RenderStyleConstants.h:
+        (WebCore::operator| ):
+        (WebCore::operator|= ):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+        (WebCore::StyleRareInheritedData::operator== const):
+        * rendering/style/StyleRareInheritedData.h:
+
 2018-01-04  Brian Burg  <bburg@apple.com>
 
         Web Inspector: Capture Element Screenshot looks fuzzy
index 1e46789354fabd56ceb62fc2e2c115390373d8fc..c60c8409de506f216238b1b2a0b34a9e3b7a81ec 100644 (file)
@@ -1004,7 +1004,7 @@ public:
     bool supportsARIAAttributes() const;
     
     // CSS3 Speech properties.
-    virtual ESpeak speakProperty() const { return SpeakNormal; }
+    virtual ESpeakAs speakAsProperty() const { return SpeakNormal; }
 
     // Make this object visible by scrolling as many nested scrollable views as needed.
     virtual void scrollToMakeVisible() const;
index 2df968243cf1bdad411bdc9347d7042249b06058..dfc4f79fbb735a51aa3299dbd67eba362a97e803 100644 (file)
@@ -944,12 +944,12 @@ AccessibilityObject* AccessibilityRenderObject::internalLinkElement() const
     return firstAccessibleObjectFromNode(linkedNode);
 }
 
-ESpeak AccessibilityRenderObject::speakProperty() const
+ESpeakAs AccessibilityRenderObject::speakAsProperty() const
 {
     if (!m_renderer)
-        return AccessibilityObject::speakProperty();
+        return AccessibilityObject::speakAsProperty();
     
-    return m_renderer->style().speak();
+    return m_renderer->style().speakAs();
 }
     
 void AccessibilityRenderObject::addRadioButtonGroupChildren(AccessibilityObject* parent, AccessibilityChildrenVector& linkedUIElements) const
index 1c6c54ccb43b40989b07e4071431caff29417de9..5ed42e78e9e7f0fde8562ecf29a5f8156fb30ffc 100644 (file)
@@ -274,7 +274,7 @@ private:
     bool elementAttributeValue(const QualifiedName&) const;
     void setElementAttributeValue(const QualifiedName&, bool);
     
-    ESpeak speakProperty() const override;
+    ESpeakAs speakAsProperty() const override;
     
     const String liveRegionStatus() const override;
     const String liveRegionRelevant() const override;
index 22bd12ebcd7e942555da85dd445fd3fe2da8b7ae..0537d95349b0f9df9ee205a47cb989a8564d86b1 100644 (file)
@@ -2843,28 +2843,12 @@ static void AXAttributedStringAppendText(NSMutableAttributedString* attrString,
     return m_object->getAttribute(HTMLNames::idAttr);
 }
 
-- (NSString *)accessibilitySpeechHint
+- (NSArray<NSString *> *)accessibilitySpeechHint
 {
     if (![self _prepareAccessibilityCall])
         return nil;
 
-    switch (m_object->speakProperty()) {
-    default:
-    case SpeakNormal:
-        return @"normal";
-    case SpeakNone:
-        return @"none";
-    case SpeakSpellOut:
-        return @"spell-out";
-    case SpeakDigits:
-        return @"digits";
-    case SpeakLiteralPunctuation:
-        return @"literal-punctuation";
-    case SpeakNoPunctuation:
-        return @"no-punctuation";
-    }
-    
-    return nil;
+    return [self baseAccessibilitySpeechHint];
 }
 
 - (BOOL)accessibilityARIAIsBusy
index 787149b1a5f1eda8f6fd421612ee358d520f0362..04749be1012e9be8d52e2d7630de891318d2e39f 100644 (file)
@@ -55,6 +55,7 @@ class VisiblePosition;
 - (NSString *)baseAccessibilityTitle;
 - (NSString *)baseAccessibilityDescription;
 - (NSString *)baseAccessibilityHelpText;
+- (NSArray<NSString *> *)baseAccessibilitySpeechHint;
 
 - (NSString *)ariaLandmarkRoleDescription;
 
index bd257dc7ef7c5e419f4d5c7ccfe35e06c44cb74e..d92873699d78468323fff309de7c39770dcfa44a 100644 (file)
@@ -403,6 +403,25 @@ NSArray *convertToNSArray(const AccessibilityObject::AccessibilityChildrenVector
     return returnText;
 }
 
+- (NSArray<NSString *> *)baseAccessibilitySpeechHint
+{
+    ESpeakAs speak = m_object->speakAsProperty();
+    NSMutableArray<NSString *> *hints = [NSMutableArray array];
+    if (speak & SpeakSpellOut)
+        [hints addObject:@"spell-out"];
+    else
+        [hints addObject:@"normal"];
+
+    if (speak & SpeakDigits)
+        [hints addObject:@"digits"];
+    if (speak & SpeakLiteralPunctuation)
+        [hints addObject:@"literal-punctuation"];
+    if (speak & SpeakNoPunctuation)
+        [hints addObject:@"no-punctuation"];
+    
+    return hints;
+}
+
 - (NSString *)baseAccessibilityHelpText
 {
     Vector<AccessibilityText> textOrder;
index f9135632d67d7738a63046642174e0b79d9ebe8a..93244843e0d2476178515bca4d518cc9a5860905 100644 (file)
@@ -3168,24 +3168,8 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return [NSValue valueWithPoint:m_object->clickPoint()];
     
     // This is used by DRT to verify CSS3 speech works.
-    if ([attributeName isEqualToString:@"AXDRTSpeechAttribute"]) {
-        ESpeak speakProperty = m_object->speakProperty();
-        switch (speakProperty) {
-            case SpeakNone:
-                return @"none";
-            case SpeakSpellOut:
-                return @"spell-out";
-            case SpeakDigits:
-                return @"digits";
-            case SpeakLiteralPunctuation:
-                return @"literal-punctuation";
-            case SpeakNoPunctuation:
-                return @"no-punctuation";
-            default:
-            case SpeakNormal:
-                return @"normal";
-        }
-    }
+    if ([attributeName isEqualToString:@"AXDRTSpeechAttribute"])
+        return [self baseAccessibilitySpeechHint];
     
     // Used by DRT to find an accessible node by its element id.
     if ([attributeName isEqualToString:@"AXDRTElementIdAttribute"])
index 23ed46a3329a705bbf94098b6dfa894bed107d5d..d6b421dd730838150e5b7f28c5bea52c66b57ce7 100644 (file)
@@ -205,7 +205,7 @@ static const CSSPropertyID computedProperties[] = {
     CSSPropertyPosition,
     CSSPropertyResize,
     CSSPropertyRight,
-    CSSPropertySpeak,
+    CSSPropertySpeakAs,
     CSSPropertyTableLayout,
     CSSPropertyTabSize,
     CSSPropertyTextAlign,
@@ -1827,6 +1827,25 @@ static Ref<CSSValue> renderEmphasisPositionFlagsToCSSValue(TextEmphasisPosition
     return WTFMove(list);
 }
 
+static Ref<CSSValue> speakAsToCSSValue(ESpeakAs speakAs)
+{
+    auto& cssValuePool = CSSValuePool::singleton();
+    auto list = CSSValueList::createSpaceSeparated();
+    if (speakAs & SpeakNormal)
+        list->append(cssValuePool.createIdentifierValue(CSSValueNormal));
+    if (speakAs & SpeakSpellOut)
+        list->append(cssValuePool.createIdentifierValue(CSSValueSpellOut));
+    if (speakAs & SpeakDigits)
+        list->append(cssValuePool.createIdentifierValue(CSSValueDigits));
+    if (speakAs & SpeakLiteralPunctuation)
+        list->append(cssValuePool.createIdentifierValue(CSSValueLiteralPunctuation));
+    if (speakAs & SpeakNoPunctuation)
+        list->append(cssValuePool.createIdentifierValue(CSSValueNoPunctuation));
+    if (!list->length())
+        return cssValuePool.createIdentifierValue(CSSValueNormal);
+    return WTFMove(list);
+}
+    
 static Ref<CSSValue> hangingPunctuationToCSSValue(HangingPunctuation hangingPunctuation)
 {
     auto& cssValuePool = CSSValuePool::singleton();
@@ -3694,8 +3713,8 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             rect->setLeft(autoOrZoomAdjustedValue(style->clip().left(), *style));
             return cssValuePool.createValue(WTFMove(rect));
         }
-        case CSSPropertySpeak:
-            return cssValuePool.createValue(style->speak());
+        case CSSPropertySpeakAs:
+            return speakAsToCSSValue(style->speakAs());
         case CSSPropertyTransform:
             return computedTransform(renderer, *style);
         case CSSPropertyTransformBox:
index 8571efcd3f30061ddc9204a6acdaf72beec65a5a..aa65ae7a5cc83274b7643ccda2805fc2adc46abb 100644 (file)
@@ -3819,14 +3819,11 @@ template<> inline CSSPrimitiveValue::operator LineAlign() const
     return LineAlignNone;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeak e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeakAs e)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (e) {
-    case SpeakNone:
-        m_value.valueID = CSSValueNone;
-        break;
     case SpeakNormal:
         m_value.valueID = CSSValueNormal;
         break;
@@ -3876,13 +3873,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Order e)
     }
 }
 
-template<> inline CSSPrimitiveValue::operator ESpeak() const
+template<> inline CSSPrimitiveValue::operator ESpeakAs() const
 {
     ASSERT(isValueID());
 
     switch (m_value.valueID) {
-    case CSSValueNone:
-        return SpeakNone;
     case CSSValueNormal:
         return SpeakNormal;
     case CSSValueSpellOut:
index 3df3987fc08a8230aab5018140845388e456d434..3ef44a02e6e1d08987b1070bae191bad7a8ac9aa 100644 (file)
                 "obsolete-url": "https://www.w3.org/TR/SVG11/painting.html#StrokeWidthProperty"
             }
         },
-        "speak": {
+        "speak-as": {
             "inherited": true,
-            "values": [
-                "none",
-                "normal",
-                "spell-out",
-                "digits",
-                "literal-punctuation",
-                "no-punctuation"
-            ],
+            "codegen-properties": {
+                "converter": "SpeakAs"
+            },
             "specification": {
                 "category": "css-speech",
-                "url": "https://www.w3.org/TR/css3-speech/#speak"
+                "url": "https://www.w3.org/TR/css3-speech/#speak-as"
             }
         },
         "table-layout": {
index f102386ed1e3b863a2465df3b0a96034ec69fbd2..be01086244ec42397c48734f06ddd8d337f2053a 100644 (file)
@@ -146,6 +146,8 @@ public:
 
     static HangingPunctuation convertHangingPunctuation(StyleResolver&, const CSSValue&);
 
+    static ESpeakAs convertSpeakAs(StyleResolver&, const CSSValue&);
+
     static Length convertPositionComponentX(StyleResolver&, const CSSValue&);
     static Length convertPositionComponentY(StyleResolver&, const CSSValue&);
     
@@ -1515,6 +1517,16 @@ inline BreakInside StyleBuilderConverter::convertColumnBreakInside(StyleResolver
         return AvoidColumnBreakInside;
     return primitiveValue;
 }
+    
+inline ESpeakAs StyleBuilderConverter::convertSpeakAs(StyleResolver&, const CSSValue& value)
+{
+    ESpeakAs result = RenderStyle::initialSpeakAs();
+    if (is<CSSValueList>(value)) {
+        for (auto& currentValue : downcast<CSSValueList>(value))
+            result |= downcast<CSSPrimitiveValue>(currentValue.get());
+    }
+    return result;
+}
 
 inline HangingPunctuation StyleBuilderConverter::convertHangingPunctuation(StyleResolver&, const CSSValue& value)
 {
index f2e258b1a55b652e9cbacdf738d8d8e7da159a17..5d76e7f0b982eec3ffe61a8fd5ddeab72a8d8d56 100644 (file)
@@ -630,8 +630,6 @@ bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId
     //   return valueID == CSSValueAuto || valueID == CSSValueSmooth;
     case CSSPropertyShapeRendering:
         return valueID == CSSValueAuto || valueID == CSSValueOptimizeSpeed || valueID == CSSValueCrispedges || valueID == CSSValueGeometricPrecision;
-    case CSSPropertySpeak: // none | normal | spell-out | digits | literal-punctuation | no-punctuation
-        return valueID == CSSValueNone || valueID == CSSValueNormal || valueID == CSSValueSpellOut || valueID == CSSValueDigits || valueID == CSSValueLiteralPunctuation || valueID == CSSValueNoPunctuation;
     case CSSPropertyStrokeLinejoin:
         return valueID == CSSValueMiter || valueID == CSSValueRound || valueID == CSSValueBevel;
     case CSSPropertyStrokeLinecap:
@@ -861,7 +859,6 @@ bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId)
     case CSSPropertyPointerEvents:
     case CSSPropertyPosition:
     case CSSPropertyResize:
-    case CSSPropertySpeak:
     case CSSPropertyTableLayout:
     case CSSPropertyTextAlign:
     case CSSPropertyTextOverflow:
index 99ceed4842790793e64fa2ac435343bf16f4db66..9f35c7d562013982c1f0a7e3420647b1dfa5e30e 100644 (file)
@@ -3567,6 +3567,52 @@ static RefPtr<CSSValue> consumeInitialLetter(CSSParserTokenRange& range)
     return createPrimitiveValuePair(position.releaseNonNull(), WTFMove(height));
 }
 
+static RefPtr<CSSValue> consumeSpeakAs(CSSParserTokenRange& range)
+{
+    if (range.peek().id() == CSSValueNone)
+        return consumeIdent(range);
+    
+    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    std::bitset<numCSSValueKeywords> seenValues;
+    
+    bool seenNormal = false;
+    bool seenSpellOut = false;
+    bool seenLiteralPunctuation = false;
+    bool seenNoPunctuation = false;
+
+    // normal | spell-out || digits || [ literal-punctuation | no-punctuation ]
+    while (!range.atEnd()) {
+        CSSValueID valueID = range.peek().id();
+        if ((valueID == CSSValueNormal && seenSpellOut)
+            || (valueID == CSSValueSpellOut && seenNormal)
+            || (valueID == CSSValueLiteralPunctuation && seenNoPunctuation)
+            || (valueID == CSSValueNoPunctuation && seenLiteralPunctuation))
+            return nullptr;
+        RefPtr<CSSValue> ident = consumeIdent<CSSValueNormal, CSSValueSpellOut, CSSValueDigits, CSSValueLiteralPunctuation, CSSValueNoPunctuation>(range);
+        if (!ident)
+            return nullptr;
+        switch (valueID) {
+        case CSSValueNormal:
+            seenNormal = true;
+            break;
+        case CSSValueSpellOut:
+            seenSpellOut = true;
+            break;
+        case CSSValueLiteralPunctuation:
+            seenLiteralPunctuation = true;
+            break;
+        case CSSValueNoPunctuation:
+            seenNoPunctuation = true;
+            break;
+        default:
+            break;
+        }
+        list->append(ident.releaseNonNull());
+    }
+    
+    return list->length() ? list : nullptr;
+}
+    
 static RefPtr<CSSValue> consumeHangingPunctuation(CSSParserTokenRange& range)
 {
     if (range.peek().id() == CSSValueNone)
@@ -4238,6 +4284,8 @@ RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSS
         return consumeLineGrid(m_range);
     case CSSPropertyWebkitInitialLetter:
         return consumeInitialLetter(m_range);
+    case CSSPropertySpeakAs:
+        return consumeSpeakAs(m_range);
     case CSSPropertyHangingPunctuation:
         return consumeHangingPunctuation(m_range);
     case CSSPropertyWebkitMarqueeIncrement:
index 05ff4691f6ecc7d443c08ef1a466d36f04ec347a..576e6d55cde96e4d6d6af71fbbc6c5fc74c71ae6 100644 (file)
@@ -745,7 +745,7 @@ public:
     float imageResolution() const { return m_rareInheritedData->imageResolution; }
 #endif
     
-    ESpeak speak() const { return static_cast<ESpeak>(m_rareInheritedData->speak); }
+    ESpeakAs speakAs() const { return static_cast<ESpeakAs>(m_rareInheritedData->speakAs); }
 
     FilterOperations& mutableFilter() { return m_rareNonInheritedData.access().filter.access().operations; }
     const FilterOperations& filter() const { return m_rareNonInheritedData->filter->operations; }
@@ -1142,7 +1142,7 @@ public:
     void setTransformOriginZ(float f) { SET_NESTED_VAR(m_rareNonInheritedData, transform, z, f); }
     void setTransformBox(TransformBox box) { SET_NESTED_VAR(m_rareNonInheritedData, transform, transformBox, box); }
 
-    void setSpeak(ESpeak s) { SET_VAR(m_rareInheritedData, speak, s); }
+    void setSpeakAs(ESpeakAs s) { SET_VAR(m_rareInheritedData, speakAs, s); }
     void setTextCombine(TextCombine v) { SET_VAR(m_rareNonInheritedData, textCombine, v); }
     void setTextDecorationColor(const Color& c) { SET_VAR(m_rareNonInheritedData, textDecorationColor, c); }
     void setTextEmphasisColor(const Color& c) { SET_VAR(m_rareInheritedData, textEmphasisColor, c); }
@@ -1514,7 +1514,7 @@ public:
     static EOverflowWrap initialOverflowWrap() { return NormalOverflowWrap; }
     static ENBSPMode initialNBSPMode() { return NBNORMAL; }
     static LineBreak initialLineBreak() { return LineBreakAuto; }
-    static ESpeak initialSpeak() { return SpeakNormal; }
+    static ESpeakAs initialSpeakAs() { return SpeakNormal; }
     static Hyphens initialHyphens() { return HyphensManual; }
     static short initialHyphenationLimitBefore() { return -1; }
     static short initialHyphenationLimitAfter() { return -1; }
index 1f45a08559007f9565e8ad0e33766cc1d324abe7..b8c781a84496d1421a36e1b0fe7bb41e979b038f 100644 (file)
@@ -596,7 +596,15 @@ enum ELineClampType { LineClampLineCount, LineClampPercentage };
 
 enum Hyphens { HyphensNone, HyphensManual, HyphensAuto };
 
-enum ESpeak { SpeakNone, SpeakNormal, SpeakSpellOut, SpeakDigits, SpeakLiteralPunctuation, SpeakNoPunctuation };
+enum ESpeakAs {
+    SpeakNormal = 0,
+    SpeakSpellOut = 1 << 0,
+    SpeakDigits = 1 << 1,
+    SpeakLiteralPunctuation = 1 << 2,
+    SpeakNoPunctuation = 1 << 3
+};
+inline ESpeakAs operator| (ESpeakAs a, ESpeakAs b) { return ESpeakAs(int(a) | int(b)); }
+inline ESpeakAs& operator|= (ESpeakAs& a, ESpeakAs b) { return a = a | b; }
 
 enum TextEmphasisFill { TextEmphasisFillFilled, TextEmphasisFillOpen };
 
index e9386c3565c6172e102b62464f269f0723a7ffc7..a0f19d65ba5a2f09e3ffc864182c2941a8875388 100644 (file)
@@ -86,7 +86,7 @@ StyleRareInheritedData::StyleRareInheritedData()
     , nbspMode(NBNORMAL)
     , lineBreak(LineBreakAuto)
     , userSelect(RenderStyle::initialUserSelect())
-    , speak(SpeakNormal)
+    , speakAs(SpeakNormal)
     , hyphens(HyphensManual)
     , textEmphasisFill(TextEmphasisFillFilled)
     , textEmphasisMark(TextEmphasisMarkNone)
@@ -178,7 +178,7 @@ inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedDa
     , nbspMode(o.nbspMode)
     , lineBreak(o.lineBreak)
     , userSelect(o.userSelect)
-    , speak(o.speak)
+    , speakAs(o.speakAs)
     , hyphens(o.hyphens)
     , textEmphasisFill(o.textEmphasisFill)
     , textEmphasisMark(o.textEmphasisMark)
@@ -287,7 +287,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
         && textSizeAdjust == o.textSizeAdjust
 #endif
         && userSelect == o.userSelect
-        && speak == o.speak
+        && speakAs == o.speakAs
         && hyphens == o.hyphens
         && hyphenationLimitBefore == o.hyphenationLimitBefore
         && hyphenationLimitAfter == o.hyphenationLimitAfter
index 24d47be319543b80a13e60d99a10defb05e9cac1..e1936e3f187695af56926a3a314d4323b9adf6a1 100644 (file)
@@ -95,7 +95,7 @@ public:
     unsigned lineBreak : 3; // LineBreak
     unsigned userSelect : 2; // EUserSelect
     unsigned colorSpace : 1; // ColorSpace
-    unsigned speak : 3; // ESpeak
+    unsigned speakAs : 4; // ESpeakAs
     unsigned hyphens : 2; // Hyphens
     unsigned textEmphasisFill : 1; // TextEmphasisFill
     unsigned textEmphasisMark : 3; // TextEmphasisMark
index bb99d01085fcc6b01ae7e24319779d1b9f4fd8e4..99c484c727674d801cc5de28475f12bb09367878 100644 (file)
@@ -1,3 +1,31 @@
+2018-01-04  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
+        https://bugs.webkit.org/show_bug.cgi?id=180361
+
+        Reviewed by Zalan Bujtas.
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (speakAsCallback):
+        (AccessibilityUIElement::speakAs):
+        (AccessibilityUIElement::getJSClass):
+        (speakCallback): Deleted.
+        (AccessibilityUIElement::speak): Deleted.
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+        (AccessibilityUIElement::speakAs):
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::speakAs):
+        (AccessibilityUIElement::speak): Deleted.
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::speakAs):
+        (WTR::AccessibilityUIElement::speak): Deleted.
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::speakAs):
+        (WTR::AccessibilityUIElement::speak): Deleted.
+
 2018-01-04  Jonathan Bedard  <jbedard@apple.com>
 
         REGRESSION (r226395): test-webkitperl test expectations incorrect
index 2cc472d5e8dd2a54658f8a9a3e66b54ef19abb42..cffd9cd933bf315b743f4b87586a3cd1285c100e 100644 (file)
@@ -1319,10 +1319,10 @@ static JSValueRef isIgnoredCallback(JSContextRef context, JSObjectRef thisObject
     return JSValueMakeBoolean(context, toAXElement(thisObject)->isIgnored());
 }
 
-static JSValueRef speakCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
+static JSValueRef speakAsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
 {
-    JSRetainPtr<JSStringRef> speakString(Adopt, toAXElement(thisObject)->speak());
-    return JSValueMakeString(context, speakString.get());
+    JSRetainPtr<JSStringRef> speakAsString(Adopt, toAXElement(thisObject)->speakAs());
+    return JSValueMakeString(context, speakAsString.get());
 }
 
 static JSValueRef selectedChildrenCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
@@ -1527,7 +1527,6 @@ static JSValueRef mathPrescriptsDescriptionCallback(JSContextRef context, JSObje
 
 // Unsupported methods on various platforms.
 #if !PLATFORM(MAC) || PLATFORM(IOS)
-JSStringRef AccessibilityUIElement::speak() { return 0; }
 JSStringRef AccessibilityUIElement::rangeForLine(int line) { return 0; }
 JSStringRef AccessibilityUIElement::rangeForPosition(int, int) { return 0; }
 void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement*) const { }
@@ -1557,6 +1556,7 @@ bool AccessibilityUIElement::isEqual(AccessibilityUIElement* otherElement)
 #endif
 
 #if !PLATFORM(MAC)
+JSStringRef AccessibilityUIElement::speakAs() { return nullptr; }
 void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
 #endif
 
@@ -1801,7 +1801,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "classList", getClassListCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
-        { "speak", speakCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "speakAs", speakAsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "selectedChildrenCount", selectedChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "horizontalScrollbar", horizontalScrollbarCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "verticalScrollbar", verticalScrollbarCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
index 879c0a6ba1f42a5afe00da7d70d38ca508f9982c..680b022e0db003fac67052f368b6b382642a654b 100644 (file)
@@ -173,7 +173,7 @@ public:
     JSStringRef classList() const;
 
     // CSS3-speech properties.
-    JSStringRef speak();
+    JSStringRef speakAs();
     
     // Table-specific attributes
     JSStringRef attributesOfColumnHeaders();
index dfaa60c8b9a0c8dcc4ca59183b5852f8f8619c61..4901adc8aa36f6940c64308c43cb316cea7586ce 100644 (file)
@@ -101,6 +101,7 @@ AccessibilityUIElement::~AccessibilityUIElement()
 - (BOOL)accessibilityIsExpanded;
 - (NSUInteger)accessibilityBlockquoteLevel;
 - (NSArray *)accessibilityFindMatchingObjects:(NSDictionary *)parameters;
+- (NSArray *)accessibilitySpeechHint;
 
 // TextMarker related
 - (NSArray *)textMarkerRange;
@@ -357,6 +358,11 @@ void AccessibilityUIElement::decreaseTextSelection()
     [m_element accessibilityModifySelection:WebCore::CharacterGranularity increase:NO];    
 }
 
+JSStringRef AccessibilityUIElement::speakAs()
+{
+    return [[[m_element accessibilitySpeechHint] componentsJoinedByString:@", "] createJSStringRef];
+}
+
 JSStringRef AccessibilityUIElement::stringForSelection() 
 { 
     NSString *stringForRange = [m_element selectionRangeString];
index 53c90f3e7ad01961b4cf336f1a3eb1b3b0287ffd..5e39821082986bb91696a319c54c5377d71e5912 100644 (file)
@@ -894,12 +894,12 @@ int AccessibilityUIElement::hierarchicalLevel() const
     return 0;
 }
 
-JSStringRef AccessibilityUIElement::speak()
+JSStringRef AccessibilityUIElement::speakAs()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id value = [m_element accessibilityAttributeValue:@"AXDRTSpeechAttribute"];
-    if ([value isKindOfClass:[NSString class]])
-        return [value createJSStringRef];
+    if ([value isKindOfClass:[NSArray class]])
+        return [[value componentsJoinedByString:@", "] createJSStringRef];
     END_AX_OBJC_EXCEPTIONS
         
     return nullptr;
index af2a12090ba0482b42c81f68475fe35b555da056..0cd537a9d0c0b825443c6f4e102ed4ced595c64a 100644 (file)
@@ -168,7 +168,7 @@ public:
     JSRetainPtr<JSStringRef> classList() const;
 
     // CSS3-speech properties.
-    JSRetainPtr<JSStringRef> speak();
+    JSRetainPtr<JSStringRef> speakAs();
     
     // Table-specific attributes
     JSRetainPtr<JSStringRef> attributesOfColumnHeaders();
index 8fa1bb9d6d86f935091ef0ebc921cf5df015a336..3ad5b45231a66dde21a5354a89f401974c04c964 100644 (file)
@@ -53,7 +53,7 @@ interface AccessibilityUIElement {
     readonly attribute DOMString helpText;
     readonly attribute DOMString valueDescription;
     readonly attribute DOMString url;
-    readonly attribute DOMString speak;
+    readonly attribute DOMString speakAs;
     readonly attribute DOMString orientation;
     readonly attribute long insertionPointLineNumber;
     readonly attribute DOMString selectedTextRange;
index 5bbc14c43dbfb51bd70308d5852c6f1ac06fbd46..c50ffb3e741fb54032362cb631e28e76eb349ebe 100644 (file)
@@ -1688,7 +1688,7 @@ int AccessibilityUIElement::hierarchicalLevel() const
     return 0;
 }
 
-JSRetainPtr<JSStringRef> AccessibilityUIElement::speak()
+JSRetainPtr<JSStringRef> AccessibilityUIElement::speakAs()
 {
     // FIXME: implement
     return JSStringCreateWithCharacters(0, 0);
index 06aea12e227c2f2696d7a678cd9ffe45511a64ea..b03e048ddc83843a594726c812eac41d82a16cd9 100644 (file)
@@ -79,6 +79,7 @@ typedef void (*AXPostedNotificationCallback)(id element, NSString* notification,
 - (BOOL)accessibilityIsExpanded;
 - (NSUInteger)accessibilityBlockquoteLevel;
 - (NSArray *)accessibilityFindMatchingObjects:(NSDictionary *)parameters;
+- (NSArray<NSString *> *)accessibilitySpeechHint;
 
 // TextMarker related
 - (NSArray *)textMarkerRange;
@@ -597,9 +598,9 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::classList() const
     return nullptr;
 }
 
-JSRetainPtr<JSStringRef> AccessibilityUIElement::speak()
+JSRetainPtr<JSStringRef> AccessibilityUIElement::speakAs()
 {
-    return nullptr;
+    return [[[m_element accessibilitySpeechHint] componentsJoinedByString:@", "] createJSStringRef];
 }
 
 bool AccessibilityUIElement::ariaIsGrabbed() const
index 0f770156d500a3b6c26dcaacd04f0580faacf106..0524134bc0e2c1ae08e8d2c122aae5d2e7c9e1a3 100644 (file)
@@ -1003,12 +1003,12 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::classList() const
     return nullptr;
 }
 
-JSRetainPtr<JSStringRef> AccessibilityUIElement::speak()
+JSRetainPtr<JSStringRef> AccessibilityUIElement::speakAs()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id value = [m_element accessibilityAttributeValue:@"AXDRTSpeechAttribute"];
-    if ([value isKindOfClass:[NSString class]])
-        return [value createJSStringRef];
+    if ([value isKindOfClass:[NSArray class]])
+        return [[(NSArray *)value componentsJoinedByString:@", "] createJSStringRef];
     END_AX_OBJC_EXCEPTIONS
         
     return nullptr;