Changeset 68680 in webkit


Ignore:
Timestamp:
Sep 29, 2010 12:59:56 PM (14 years ago)
Author:
Chris Fleizach
Message:

AX: implement CSS3 Speech "speak"
https://bugs.webkit.org/show_bug.cgi?id=46827

Reviewed by Darin Adler.

WebCore:

Support the "speak" style as defined in
http://www.w3.org/TR/css3-speech/#speak

This puts all the pieces in place for a platform to support this ability, but there's no platform implementation yet.

Test: platform/mac/accessibility/css-speech-speak.html

  • accessibility/AccessibilityObject.h:

(WebCore::AccessibilityObject::speakProperty):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::speakProperty):

  • accessibility/AccessibilityRenderObject.h:
  • accessibility/mac/AccessibilityObjectWrapper.mm:

(-[AccessibilityObjectWrapper accessibilityAttributeValue:]):

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator ESpeak):

  • css/CSSPropertyNames.in:
  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty):

  • css/CSSValueKeywords.in:
  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::speak):
(WebCore::InheritedFlags::setSpeak):
(WebCore::InheritedFlags::initialSpeak):

  • rendering/style/RenderStyleConstants.h:
  • rendering/style/StyleRareInheritedData.cpp:

(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):

  • rendering/style/StyleRareInheritedData.h:

WebKitTools:

  • DumpRenderTree/AccessibilityUIElement.cpp:

(speakCallback):
(AccessibilityUIElement::speak):
(AccessibilityUIElement::getJSClass):

  • DumpRenderTree/AccessibilityUIElement.h:
  • DumpRenderTree/mac/AccessibilityUIElementMac.mm:

(AccessibilityUIElement::speak):

LayoutTests:

  • platform/mac/accessibility/css-speech-speak-expected.txt: Added.
  • platform/mac/accessibility/css-speech-speak.html: Added.
Location:
trunk
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r68678 r68680  
     12010-09-29  Chris Fleizach  <cfleizach@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        AX: implement CSS3 Speech "speak"
     6        https://bugs.webkit.org/show_bug.cgi?id=46827
     7
     8        * platform/mac/accessibility/css-speech-speak-expected.txt: Added.
     9        * platform/mac/accessibility/css-speech-speak.html: Added.
     10
    1112010-09-29  David Hyatt  <hyatt@apple.com>
    212
  • trunk/WebCore/ChangeLog

    r68679 r68680  
     12010-09-29  Chris Fleizach  <cfleizach@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        AX: implement CSS3 Speech "speak"
     6        https://bugs.webkit.org/show_bug.cgi?id=46827
     7
     8        Support the "speak" style as defined in
     9        http://www.w3.org/TR/css3-speech/#speak
     10
     11        This puts all the pieces in place for a platform to support this ability, but there's no platform implementation yet.
     12
     13        Test: platform/mac/accessibility/css-speech-speak.html
     14
     15        * accessibility/AccessibilityObject.h:
     16        (WebCore::AccessibilityObject::speakProperty):
     17        * accessibility/AccessibilityRenderObject.cpp:
     18        (WebCore::AccessibilityRenderObject::speakProperty):
     19        * accessibility/AccessibilityRenderObject.h:
     20        * accessibility/mac/AccessibilityObjectWrapper.mm:
     21        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
     22        * css/CSSComputedStyleDeclaration.cpp:
     23        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     24        * css/CSSPrimitiveValueMappings.h:
     25        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     26        (WebCore::CSSPrimitiveValue::operator ESpeak):
     27        * css/CSSPropertyNames.in:
     28        * css/CSSStyleSelector.cpp:
     29        (WebCore::CSSStyleSelector::applyProperty):
     30        * css/CSSValueKeywords.in:
     31        * rendering/style/RenderStyle.h:
     32        (WebCore::InheritedFlags::speak):
     33        (WebCore::InheritedFlags::setSpeak):
     34        (WebCore::InheritedFlags::initialSpeak):
     35        * rendering/style/RenderStyleConstants.h:
     36        * rendering/style/StyleRareInheritedData.cpp:
     37        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
     38        (WebCore::StyleRareInheritedData::operator==):
     39        * rendering/style/StyleRareInheritedData.h:
     40
    1412010-09-29  João Paulo Rechi Vita  <jprvita@profusion.mobi>
    242
  • trunk/WebCore/accessibility/AccessibilityObject.h

    r67383 r68680  
    537537    bool supportsARIAAttributes() const;
    538538   
     539    // CSS3 Speech properties.
     540    virtual ESpeak speakProperty() const { return SpeakNormal; }
     541   
    539542#if HAVE(ACCESSIBILITY)
    540543#if PLATFORM(GTK)
  • trunk/WebCore/accessibility/AccessibilityRenderObject.cpp

    r67653 r68680  
    14881488}
    14891489
     1490ESpeak AccessibilityRenderObject::speakProperty() const
     1491{
     1492    if (!m_renderer)
     1493        return AccessibilityObject::speakProperty();
     1494   
     1495    return m_renderer->style()->speak();
     1496}
     1497   
    14901498void AccessibilityRenderObject::addRadioButtonGroupMembers(AccessibilityChildrenVector& linkedUIElements) const
    14911499{
  • trunk/WebCore/accessibility/AccessibilityRenderObject.h

    r68078 r68680  
    302302    void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName& name) const;
    303303   
     304    virtual ESpeak speakProperty() const;
     305   
    304306    virtual const AtomicString& ariaLiveRegionStatus() const;
    305307    virtual const AtomicString& ariaLiveRegionRelevant() const;
  • trunk/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm

    r68541 r68680  
    19091909        return [NSValue valueWithPoint:m_object->clickPoint()];
    19101910   
     1911    // This is used by DRT to verify CSS3 speech works.
     1912    if ([attributeName isEqualToString:@"AXDRTSpeechAttribute"]) {
     1913        ESpeak speakProperty = m_object->speakProperty();
     1914        switch (speakProperty) {
     1915        case SpeakNone:
     1916            return @"none";
     1917        case SpeakSpellOut:
     1918            return @"spell-out";
     1919        case SpeakDigits:
     1920            return @"digits";
     1921        case SpeakLiteralPunctuation:
     1922            return @"literal-punctuation";
     1923        case SpeakNoPunctuation:
     1924            return @"no-punctuation";
     1925        default:
     1926        case SpeakNormal:
     1927            return @"normal";
     1928        }
     1929    }
     1930   
    19111931    return nil;
    19121932}
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r68561 r68680  
    124124    CSSPropertyResize,
    125125    CSSPropertyRight,
     126    CSSPropertySpeak,
    126127    CSSPropertyTableLayout,
    127128    CSSPropertyTextAlign,
     
    14101411            return CSSPrimitiveValue::create(rect.release());
    14111412        }
     1413        case CSSPropertySpeak:
     1414            return CSSPrimitiveValue::create(style->speak());
    14121415        case CSSPropertyWebkitTransform:
    14131416            return computedTransform(renderer, style.get());
  • trunk/WebCore/css/CSSPrimitiveValueMappings.h

    r68640 r68680  
    27312731}
    27322732
     2733template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ESpeak e)
     2734    : m_type(CSS_IDENT)
     2735    , m_hasCachedCSSText(false)
     2736{
     2737    switch (e) {
     2738    case SpeakNone:
     2739        m_value.ident = CSSValueNone;
     2740        break;
     2741    case SpeakNormal:
     2742        m_value.ident = CSSValueNormal;
     2743        break;
     2744    case SpeakSpellOut:
     2745        m_value.ident = CSSValueSpellOut;
     2746        break;
     2747    case SpeakDigits:
     2748        m_value.ident = CSSValueDigits;
     2749        break;
     2750    case SpeakLiteralPunctuation:
     2751        m_value.ident = CSSValueLiteralPunctuation;
     2752        break;
     2753    case SpeakNoPunctuation:
     2754        m_value.ident = CSSValueNoPunctuation;
     2755        break;
     2756    }
     2757}
     2758   
     2759template<> inline CSSPrimitiveValue::operator ESpeak() const
     2760{
     2761    switch (m_value.ident) {
     2762    case CSSValueNone:
     2763        return SpeakNone;
     2764    case CSSValueNormal:
     2765        return SpeakNormal;
     2766    case CSSValueSpellOut:
     2767        return SpeakSpellOut;
     2768    case CSSValueDigits:
     2769        return SpeakDigits;
     2770    case CSSValueLiteralPunctuation:
     2771        return SpeakLiteralPunctuation;
     2772    case CSSValueNoPunctuation:
     2773        return SpeakNoPunctuation;
     2774    default:
     2775        ASSERT_NOT_REACHED();
     2776        return SpeakNormal;
     2777    }
     2778}
     2779   
    27332780#endif
    27342781
  • trunk/WebCore/css/CSSPropertyNames.in

    r68561 r68680  
    124124size
    125125src
     126speak
    126127table-layout
    127128text-align
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r68561 r68680  
    54845484        applyPageSizeProperty(value);
    54855485        return;
     5486   
     5487    case CSSPropertySpeak:
     5488        HANDLE_INHERIT_AND_INITIAL(speak, Speak);
     5489        m_style->setSpeak(*primitiveValue);
     5490        return;
     5491           
    54865492    case CSSPropertyInvalid:
    54875493        return;
  • trunk/WebCore/css/CSSValueKeywords.in

    r68640 r68680  
    715715
    716716#
     717# CSS_PROP_SPEECH
     718#
     719spell-out
     720digits
     721literal-punctuation
     722no-punctuation
     723
     724#
    717725# -webkit-font-smoothing
    718726#
  • trunk/WebCore/rendering/style/RenderStyle.h

    r68561 r68680  
    746746    bool isVerticalBlockFlow() const { return blockFlow() == TopToBottomBlockFlow || blockFlow() == BottomToTopBlockFlow; }
    747747
     748    ESpeak speak() { return static_cast<ESpeak>(rareInheritedData->speak); }
     749       
    748750// attribute setter methods
    749751
     
    10381040    void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
    10391041    void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
     1042    void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
    10401043    // End CSS3 Setters
    10411044
     
    12271230    static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; }
    12281231    static const AtomicString& initialHighlight() { return nullAtom; }
     1232    static ESpeak initialSpeak() { return SpeakNormal; }
    12291233    static Hyphens initialHyphens() { return HyphensManual; }
    12301234    static const AtomicString& initialHyphenationString() { return nullAtom; }
  • trunk/WebCore/rendering/style/RenderStyleConstants.h

    r67667 r68680  
    416416enum Hyphens { HyphensNone, HyphensManual, HyphensAuto };
    417417
     418enum ESpeak { SpeakNone, SpeakNormal, SpeakSpellOut, SpeakDigits, SpeakLiteralPunctuation, SpeakNoPunctuation };
     419   
    418420} // namespace WebCore
    419421
  • trunk/WebCore/rendering/style/StyleRareInheritedData.cpp

    r64677 r68680  
    4545    , userSelect(RenderStyle::initialUserSelect())
    4646    , colorSpace(DeviceColorSpace)
     47    , speak(SpeakNormal)
    4748    , hyphens(HyphensManual)
    4849{
     
    7172    , userSelect(o.userSelect)
    7273    , colorSpace(o.colorSpace)
     74    , speak(o.speak)
    7375    , hyphens(o.hyphens)
    7476    , hyphenationString(o.hyphenationString)
     
    113115        && userSelect == o.userSelect
    114116        && colorSpace == o.colorSpace
     117        && speak == o.speak
    115118        && hyphens == o.hyphens
    116119        && hyphenationString == o.hyphenationString
  • trunk/WebCore/rendering/style/StyleRareInheritedData.h

    r65077 r68680  
    7878    unsigned userSelect : 1;  // EUserSelect
    7979    unsigned colorSpace : 1; // ColorSpace
     80    unsigned speak : 3; // ESpeak
    8081    unsigned hyphens : 2; // Hyphens
    8182
  • trunk/WebKitTools/ChangeLog

    r68673 r68680  
     12010-09-29  Chris Fleizach  <cfleizach@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        AX: implement CSS3 Speech "speak"
     6        https://bugs.webkit.org/show_bug.cgi?id=46827
     7
     8        * DumpRenderTree/AccessibilityUIElement.cpp:
     9        (speakCallback):
     10        (AccessibilityUIElement::speak):
     11        (AccessibilityUIElement::getJSClass):
     12        * DumpRenderTree/AccessibilityUIElement.h:
     13        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
     14        (AccessibilityUIElement::speak):
     15
    1162010-09-29  Mihai Parparita  <mihaip@chromium.org>
    217
  • trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp

    r67408 r68680  
    680680}
    681681
     682static JSValueRef speakCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
     683{
     684    JSRetainPtr<JSStringRef> speakString(Adopt, toAXElement(thisObject)->speak());
     685    return JSValueMakeString(context, speakString.get());
     686}
     687
    682688static JSValueRef getHasPopupCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
    683689{
     
    737743
    738744// Implementation
     745
     746// Unsupported methods on various platforms.
     747#if !PLATFORM(MAC)
     748JSStringRef AccessibilityUIElement::speak() { return 0; }
     749#endif
    739750
    740751#if !SUPPORTS_AX_TEXTMARKERS
     
    838849        { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    839850        { "isIgnored", isIgnoredCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     851        { "speak", speakCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    840852        { 0, 0, 0, 0 }
    841853    };
  • trunk/WebKitTools/DumpRenderTree/AccessibilityUIElement.h

    r67408 r68680  
    148148    JSStringRef url();
    149149
     150    // CSS3-speech properties.
     151    JSStringRef speak();
     152   
    150153    // Table-specific attributes
    151154    JSStringRef attributesOfColumnHeaders();
  • trunk/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

    r67408 r68680  
    781781}
    782782
     783JSStringRef AccessibilityUIElement::speak()
     784{
     785    BEGIN_AX_OBJC_EXCEPTIONS
     786    id value = [m_element accessibilityAttributeValue:@"AXDRTSpeechAttribute"];
     787    if ([value isKindOfClass:[NSString class]])
     788        return [value createJSStringRef];
     789    END_AX_OBJC_EXCEPTIONS
     790       
     791    return 0;
     792}
     793
    783794bool AccessibilityUIElement::ariaIsGrabbed() const
    784795{
Note: See TracChangeset for help on using the changeset viewer.