Bug 179497 - AX: AOM: Implement number type properties
Summary: AX: AOM: Implement number type properties
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: 179255
  Show dependency treegraph
 
Reported: 2017-11-09 11:33 PST by Nan Wang
Modified: 2017-11-20 16:38 PST (History)
14 users (show)

See Also:


Attachments
patch (76.65 KB, patch)
2017-11-17 18:54 PST, Nan Wang
no flags Details | Formatted Diff | Diff
patch (79.30 KB, patch)
2017-11-17 21:22 PST, Nan Wang
no flags Details | Formatted Diff | Diff
patch (84.01 KB, patch)
2017-11-18 12:57 PST, Nan Wang
no flags Details | Formatted Diff | Diff
patch (84.02 KB, patch)
2017-11-18 13:20 PST, Nan Wang
cfleizach: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Wang 2017-11-09 11:33:17 PST
AOM Phase 1:
Implement number type properties

Spec: https://wicg.github.io/aom/spec/

<rdar://problem/35077947>
Comment 1 Nan Wang 2017-11-17 18:54:36 PST
Created attachment 327295 [details]
patch
Comment 2 Nan Wang 2017-11-17 21:22:35 PST
Created attachment 327302 [details]
patch

Fix GTK build
Comment 3 chris fleizach 2017-11-17 23:46:39 PST
Comment on attachment 327302 [details]
patch

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

> Source/WebCore/accessibility/AccessibleNode.cpp:203
> +void AccessibleNode::setProperty(bool shouldRemove, PropertyValueVariant&& value, AXPropertyName propertyName)

can we remove the first argument and just check if value.has_value inside the method?

It seems more natural to have the PropertyName be the first argument, and the value be the second?

> Source/WebCore/accessibility/AccessibleNode.cpp:279
> +        return element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName)).toInt();

toUnsigned()

> Source/WebCore/accessibility/AccessibleNode.h:39
> +typedef Variant<std::nullptr_t, String, bool, int, unsigned, double> PropertyValueVariant;

should this be float instead of double?
Comment 4 Nan Wang 2017-11-18 12:54:52 PST
Comment on attachment 327302 [details]
patch

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

>> Source/WebCore/accessibility/AccessibleNode.cpp:203
>> +void AccessibleNode::setProperty(bool shouldRemove, PropertyValueVariant&& value, AXPropertyName propertyName)
> 
> can we remove the first argument and just check if value.has_value inside the method?
> 
> It seems more natural to have the PropertyName be the first argument, and the value be the second?

Ok I added a template function to cover the optional values
template<typename T> void setOptionalProperty(AXPropertyName, std::optional<T>);
And also setStringProperty()

>> Source/WebCore/accessibility/AccessibleNode.cpp:279
>> +        return element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName)).toInt();
> 
> toUnsigned()

There's no toUnsigned() on AtomicString, so I cast it to String and use toUInt()

>> Source/WebCore/accessibility/AccessibleNode.h:39
>> +typedef Variant<std::nullptr_t, String, bool, int, unsigned, double> PropertyValueVariant;
> 
> should this be float instead of double?

This is to match the JS API interface:
attribute double?
Comment 5 Nan Wang 2017-11-18 12:57:37 PST
Created attachment 327318 [details]
patch

Update from review and use auto if possible
Comment 6 chris fleizach 2017-11-18 13:00:18 PST
Comment on attachment 327318 [details]
patch

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

> Source/WebCore/accessibility/AccessibilityObject.cpp:2183
> +float AccessibilityObject::floatValueForProperty(AXPropertyName propertyKey) const

this is dealing with floatValues not double though
Comment 7 Nan Wang 2017-11-18 13:08:19 PST
(In reply to chris fleizach from comment #6)
> Comment on attachment 327318 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=327318&action=review
> 
> > Source/WebCore/accessibility/AccessibilityObject.cpp:2183
> > +float AccessibilityObject::floatValueForProperty(AXPropertyName propertyKey) const
> 
> this is dealing with floatValues not double though

I can change this to double too?
Comment 8 Nan Wang 2017-11-18 13:20:29 PST
Created attachment 327320 [details]
patch

update
Comment 9 chris fleizach 2017-11-18 22:03:23 PST
Comment on attachment 327320 [details]
patch

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

> Source/WebCore/accessibility/AccessibleNode.cpp:290
> +        const String& value =  element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName));

extra space after =

> Source/WebCore/accessibility/AccessibleNode.cpp:304
> +        return element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName)).toFloat();

toDouble() ?
Comment 10 Nan Wang 2017-11-18 22:58:03 PST
(In reply to chris fleizach from comment #9)
> Comment on attachment 327320 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=327320&action=review
> 
> > Source/WebCore/accessibility/AccessibleNode.cpp:290
> > +        const String& value =  element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName));
> 
> extra space after =
> 
> > Source/WebCore/accessibility/AccessibleNode.cpp:304
> > +        return element.attributeWithoutSynchronization(ariaAttributeMap().get(propertyName)).toFloat();
> 
> toDouble() ?

Ok, updated
Comment 11 Nan Wang 2017-11-18 23:00:01 PST
Committed r225030: <https://trac.webkit.org/changeset/225030>
Comment 12 Ryosuke Niwa 2017-11-20 16:38:57 PST
Comment on attachment 327320 [details]
patch

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

> Source/WebCore/accessibility/AccessibilityObject.cpp:2171
> +    if (Element* element = this->element())

Use auto in these cases.

> Source/WebCore/accessibility/AccessibilityObject.cpp:2178
> +    if (Element* element = this->element())

Ditto.

> Source/WebCore/accessibility/AccessibilityObject.cpp:2185
> +    if (Element* element = this->element())

Ditto.