Bug 144489 - AX: setting focus via accessibility object needs to set isSynchronizing in resulting selection intent
Summary: AX: setting focus via accessibility object needs to set isSynchronizing in re...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-05-01 01:13 PDT by Doug Russell
Modified: 2015-05-04 17:17 PDT (History)
12 users (show)

See Also:


Attachments
patch (15.03 KB, patch)
2015-05-01 01:26 PDT, Doug Russell
no flags Details | Formatted Diff | Diff
patch (15.33 KB, patch)
2015-05-01 16:29 PDT, Doug Russell
cfleizach: review+
Details | Formatted Diff | Diff
patch (15.96 KB, patch)
2015-05-01 16:51 PDT, Doug Russell
darin: review+
Details | Formatted Diff | Diff
patch (16.09 KB, patch)
2015-05-02 08:15 PDT, Doug Russell
no flags Details | Formatted Diff | Diff
patch (24.27 KB, patch)
2015-05-02 10:15 PDT, Doug Russell
no flags Details | Formatted Diff | Diff
patch (24.27 KB, patch)
2015-05-02 10:27 PDT, Doug Russell
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-mavericks (596.64 KB, application/zip)
2015-05-02 10:52 PDT, Build Bot
no flags Details
patch (28.46 KB, patch)
2015-05-02 14:52 PDT, Doug Russell
no flags Details | Formatted Diff | Diff
patch (28.46 KB, patch)
2015-05-02 18:13 PDT, Doug Russell
cfleizach: review+
Details | Formatted Diff | Diff
patch (28.55 KB, patch)
2015-05-04 16:23 PDT, Doug Russell
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Russell 2015-05-01 01:13:37 PDT
Setting focus on an AccessibilityRenderObject via accessibility API can result in a selection change, which doesn't currently set the isSynchronizing flag on the associated AXTextStateChangeIntent so that the assistive technology that set focus can reliably know that the selection change is the result of the focus call.
Comment 1 Radar WebKit Bug Importer 2015-05-01 01:14:14 PDT
<rdar://problem/20776565>
Comment 2 Doug Russell 2015-05-01 01:26:00 PDT
Created attachment 252138 [details]
patch
Comment 3 chris fleizach 2015-05-01 16:20:34 PDT
Comment on attachment 252138 [details]
patch

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

> Source/WebCore/ChangeLog:10
> +        Call new AXTextStateChangeIntent helper from AccessibilityRenderObject::setFocus().

i think what's missing from this description is why do we need to make these changes
Comment 4 Doug Russell 2015-05-01 16:29:41 PDT
Created attachment 252192 [details]
patch

update changelog
Comment 5 Darin Adler 2015-05-01 16:33:30 PDT
Comment on attachment 252192 [details]
patch

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

> Source/WebCore/accessibility/AXObjectCache.h:202
> -    void setTextSelectionIntent(AXTextStateChangeIntent);
> +    void setTextSelectionIntent(AXTextStateChangeIntent, bool isSynchronizing = false);

When callers are all passing constants to a boolean in a case like this, the WebKit project tradition is to either use two functions (which seems like the right solution in this case) so the names of the functions can make it clear what the difference is, or to use an enum so the names of the constants can make that clear.

Since every single caller uses a boolean, I suggest two separate named functions rather than a function with an optional boolean argument.

I also suggest changing this function to take const AXStateChangeIntent& since that would be slightly more efficient; not sure why this passes by value instead.
Comment 6 Doug Russell 2015-05-01 16:51:22 PDT
Created attachment 252198 [details]
patch

split isSynchronizing into it's own method
Comment 7 Darin Adler 2015-05-02 07:41:50 PDT
Comment on attachment 252198 [details]
patch

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

> Source/WebCore/accessibility/AXObjectCache.h:203
> +    void setIsSynchronizingSelection(bool);

Oh, I think you misunderstood. This second function both set the intent and set “is synchronizing” to true. It just needs a name that makes that clear. Something like this would do:

    void setTextSelectionIntentWhileSynchronizing(const AXTextStateChangeIntent&);

I must admit I don’t understand the concepts here well enough to understand what a good name for this would be.

Your original idea that when setting intent we also want to set m_isSynchronizingSelection each time still probably makes sense and makes the class a bit more foolproof.

> Source/WebCore/accessibility/AccessibilityRenderObject.cpp:1491
> +static void setTextSelectionIntent(const AccessibilityRenderObject* renderObject, bool isRange)

Since the caller is always passing “this” it can never be null, so this should take a reference rather than a pointer and the callers should pass *this.

> Source/WebCore/accessibility/AccessibilityRenderObject.cpp:1669
> +    setTextSelectionIntent(this, false);

The "false" here is a bit mysterious.
Comment 8 Doug Russell 2015-05-02 08:15:10 PDT
Created attachment 252229 [details]
patch

Updates from review.
setTextSelectionIntent was wrong in setSelectedVisiblePositionRange.
Comment 9 Doug Russell 2015-05-02 10:15:00 PDT
Created attachment 252235 [details]
patch

Added test support for setSelectedVisibleTextRange()
Comment 10 Doug Russell 2015-05-02 10:27:28 PDT
Created attachment 252236 [details]
patch

fix gtk builds
Comment 11 Build Bot 2015-05-02 10:52:54 PDT
Comment on attachment 252236 [details]
patch

Attachment 252236 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5598598444089344

New failing tests:
platform/mac/accessibility/selection-sync.html
Comment 12 Build Bot 2015-05-02 10:52:59 PDT
Created attachment 252238 [details]
Archive of layout-test-results from ews102 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 13 Doug Russell 2015-05-02 14:52:51 PDT
Created attachment 252248 [details]
patch

fix dump render tree
Comment 14 Darin Adler 2015-05-02 16:51:08 PDT
Comment on attachment 252248 [details]
patch

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

> Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:1915
> +bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange*);

The extra semicolon on the end of this line is why GTK and EFL are failing to compile.
Comment 15 Doug Russell 2015-05-02 18:13:53 PDT
Created attachment 252254 [details]
patch

fix selection sync take 2
Comment 16 Doug Russell 2015-05-02 18:14:21 PDT
correction: fix gtk take 2
Comment 17 chris fleizach 2015-05-04 15:30:24 PDT
Comment on attachment 252254 [details]
patch

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

> Tools/DumpRenderTree/AccessibilityUIElement.cpp:912
> +        uiElement->setSelectedVisibleTextRange(textMarkerRange);

we should use the return value of this when making the JSValueMakeBoolean result
Comment 18 chris fleizach 2015-05-04 16:09:29 PDT
(In reply to comment #17)
> Comment on attachment 252254 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=252254&action=review
> 
> > Tools/DumpRenderTree/AccessibilityUIElement.cpp:912
> > +        uiElement->setSelectedVisibleTextRange(textMarkerRange);
> 
> we should use the return value of this when making the JSValueMakeBoolean
> result

please upload patch to address my last comment. thanks
Comment 19 Doug Russell 2015-05-04 16:23:28 PDT
Created attachment 252349 [details]
patch

update from review
Comment 20 WebKit Commit Bot 2015-05-04 17:17:21 PDT
Comment on attachment 252349 [details]
patch

Clearing flags on attachment: 252349

Committed r183783: <http://trac.webkit.org/changeset/183783>
Comment 21 WebKit Commit Bot 2015-05-04 17:17:26 PDT
All reviewed patches have been landed.  Closing bug.