Bug 163610 - AX: [Mac] Meter element should use AXValueDescription to descrbe the status of the value
Summary: AX: [Mac] Meter element should use AXValueDescription to descrbe the status o...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-10-18 12:31 PDT by Nan Wang
Modified: 2016-10-19 09:51 PDT (History)
11 users (show)

See Also:


Attachments
patch (11.83 KB, patch)
2016-10-18 13:00 PDT, Nan Wang
no flags Details | Formatted Diff | Diff
patch (12.34 KB, patch)
2016-10-18 13:54 PDT, Nan Wang
no flags Details | Formatted Diff | Diff
patch (12.35 KB, patch)
2016-10-18 19:24 PDT, Nan Wang
no flags Details | Formatted Diff | Diff
patch (12.53 KB, patch)
2016-10-19 09:12 PDT, Nan Wang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Wang 2016-10-18 12:31:02 PDT
Use AXValueDescription to describe the status of the value using “Optimal”, “Suboptimal” and “Critical” by aligning with UIA and MSAA see http://www.w3.org/TR/html51/semantics.html#the-meter-element

<rdar://problem/26638677>
Comment 1 Nan Wang 2016-10-18 13:00:18 PDT
Created attachment 291976 [details]
patch
Comment 2 chris fleizach 2016-10-18 13:04:51 PDT
Comment on attachment 291976 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291976&action=review

> Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp:176
> +    // Only expose this when the author has explicitly specified following attributes.

specified "the" following

> Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp:184
> +            description = "optimum";

I think we can return directly from this switch statement instead of setting a value

> Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp:190
> +            description = "less good";

I think either this method should return the enum or it should return the localized string itself

right now it returns an intermediary form which still needs to be processed further
Comment 3 Nan Wang 2016-10-18 13:54:53 PDT
Created attachment 291982 [details]
patch

updated from review and should've fixed the build failure.
Comment 4 chris fleizach 2016-10-18 15:05:10 PDT
Comment on attachment 291982 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291982&action=review

> Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp:175
> +    if (!m_renderer || !m_renderer->isMeter())

why do we only want this on COCOA? (does COCOA also mean iOS?)
Comment 5 Nan Wang 2016-10-18 15:23:58 PDT
Comment on attachment 291982 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291982&action=review

>> Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp:175
>> +    if (!m_renderer || !m_renderer->isMeter())
> 
> why do we only want this on COCOA? (does COCOA also mean iOS?)

Because the localized string is in cocoa, I followed other mac only descriptions. I think it's both mac and iOS. But Meter is not currently supported on iOS. Should we wrap with platform(mac)?
Comment 6 chris fleizach 2016-10-18 15:28:50 PDT
Comment on attachment 291982 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291982&action=review

>>> Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp:175
>>> +    if (!m_renderer || !m_renderer->isMeter())
>> 
>> why do we only want this on COCOA? (does COCOA also mean iOS?)
> 
> Because the localized string is in cocoa, I followed other mac only descriptions. I think it's both mac and iOS. But Meter is not currently supported on iOS. Should we wrap with platform(mac)?

I think the #if FEATURE(METER) flag would handle that. so maybe we use COCOA and METER

> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2620
> +        if (builder.length())

is there no better way to do this? does stringBuilder have methods for this kind of scenario?

> Source/WebCore/platform/LocalizedStrings.cpp:786
> +    if (value == "optimum")

I don't think we need to use strings here for the value. It seems like using an enum would be better. less copying required
Comment 7 Nan Wang 2016-10-18 17:08:20 PDT
Comment on attachment 291982 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291982&action=review

Will address other issues.

>> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2620
>> +        if (builder.length())
> 
> is there no better way to do this? does stringBuilder have methods for this kind of scenario?

I don't think so. I've searched the code, we have static function shouldAddSpaceBeforeAppendingNextElement in AccessibilityNodeObject doing the length check. I think it's easier here than try to expose that function.
Comment 8 Nan Wang 2016-10-18 18:22:45 PDT
Comment on attachment 291982 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=291982&action=review

>>>> Source/WebCore/accessibility/AccessibilityProgressIndicator.cpp:175
>>>> +    if (!m_renderer || !m_renderer->isMeter())
>>> 
>>> why do we only want this on COCOA? (does COCOA also mean iOS?)
>> 
>> Because the localized string is in cocoa, I followed other mac only descriptions. I think it's both mac and iOS. But Meter is not currently supported on iOS. Should we wrap with platform(mac)?
> 
> I think the #if FEATURE(METER) flag would handle that. so maybe we use COCOA and METER

This #if PLATFORM(COCOA) is already in the #if ENABLE(METER_ELEMENT) wrap
Comment 9 Nan Wang 2016-10-18 19:24:27 PDT
Created attachment 292028 [details]
patch

updated the function to take enum instead
Comment 10 chris fleizach 2016-10-19 00:00:02 PDT
Comment on attachment 292028 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=292028&action=review

> Source/WebCore/platform/LocalizedStrings.cpp:788
> +String AXMeterGaugeRegionValueText(int value)

shouldn't int -> GaugeRegion
Comment 11 Nan Wang 2016-10-19 00:02:59 PDT
Comment on attachment 292028 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=292028&action=review

>> Source/WebCore/platform/LocalizedStrings.cpp:788
>> +String AXMeterGaugeRegionValueText(int value)
> 
> shouldn't int -> GaugeRegion

I tried to include HTMLMeterElement.h in LocalizedStrings.h but it always gave me file not found error.
Comment 12 Nan Wang 2016-10-19 09:12:07 PDT
Created attachment 292072 [details]
patch

Split the function so that we don't need to deal with enum and includes in LocalizedString.h
Comment 13 WebKit Commit Bot 2016-10-19 09:51:25 PDT
Comment on attachment 292072 [details]
patch

Clearing flags on attachment: 292072

Committed r207540: <http://trac.webkit.org/changeset/207540>
Comment 14 WebKit Commit Bot 2016-10-19 09:51:30 PDT
All reviewed patches have been landed.  Closing bug.