-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Adds the semantic node traversal order API. #14060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
454428c to
f51562a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If sortOrder is null can we just hide it from the printed tree? Seems like there is no value in showing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(unrelated to your PR) Looks like this one is missing a few other members as well. Filed #14072.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably include some examples of how an app developer can use the sortOrder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. Hopefully that's clear. I'm also going to be adding an example app to the catalog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why print just the if of child instead of the entire child node, which should contain the id plus more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it was just really verbose. I reverted it (except for the English fix).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I know it's a private class, but the next person looking at this would probably appreciate a short doc comment explaining what this class is :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like the name default traversal. I don't have a better idea of the top of my head either. Can we maybe make this describe more what the default is, e.g. something like topLeftToBottomRightTraversal?
Also, can you add a description to the comment what traversal order would look like when sort nodes are ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geometricOrder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visualOrder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like geometricOrder. Changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TranversalSortOrder probably needs to be renamed to its new name here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure about our style guide here, but should key and keys be in `?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this needs a new line after See also to render correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit: everywhere else in this file we seem to be using * instead of -.
8f3187a to
c74ffac
Compare
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change traversal here as well? Also, can you change the help text that shows up when you press 'h' during a hot run to reflect the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think I got that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, the changed files were maybe not added to the PR? This is the place I was talking about:
| printStatus('For layers (debugDumpLayerTree), use "L"; accessibility (debugDumpSemantics), "S" (traversal order) or "U" (inverse hit test order).'); |
Pressing "S" no longer gives you traversal order, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct. I forgot to upload to the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be "## Sample code". That way, travis will run the analyzer over this code snippet and we have some kind of guarantee that it doesn't go out of date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still seems to show up as "Example usage" instead of "## Sample code"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to the comprehensive documentation with example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still feel a little uncomfortable about sending over an index for a global order. When you have a parent node with a 100 child nodes all specifying an order and you add a node at the very beginning, we will have to send all 100 child nodes over again, decode them on the engine side, translate them into platform-specific nodes, etc (we would even tell the OS that these 100 nodes have changed even though they didn't really).
The only thing that has changed is that after the parent node we now need to traverse to the new node instead of the old node 1.
I'd much prefer to just send that minimal diff. Or we should create a benchmark verifying that doing the ordering like this doesn't have a performance impact (the benchmark could maybe measure the performance of adding a child node to an existing list of n child nodes with and without an order set).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done. I now push down the nextNodeId instead of the traversal index, and only mark those nodes where the next node has changed as dirty. I'm not sure what impact this will have on implementing it for iOS yet, however.
3d69c3e to
1a01692
Compare
|
CLAs look good, thanks! |
ceed5a1 to
3717bd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debugDumpSemanticsTreeInTraversalOrder -> debugDumpSemanticsTreeInGeometricOrder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I did that, but forgot to upload the changes...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: [sortOrder]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, the changed files were maybe not added to the PR? This is the place I was talking about:
| printStatus('For layers (debugDumpLayerTree), use "L"; accessibility (debugDumpSemantics), "S" (traversal order) or "U" (inverse hit test order).'); |
Pressing "S" no longer gives you traversal order, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the doc comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this paragraph hard to understand. Maybe add an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or add an "See also" entry linking to SemanticsSortOrder, which seems to explain this in more detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the See also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove duplicated sentence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this include the nextNodeId if set? I imagine it might be useful when you debug traversal order. And this is what gets printed out when you hit "S" during a hot run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression that the accompanying engine PR completely removed geometric comparison from the platform side? What's left to move?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And without that, what is actually now breaking ties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, nothing is breaking ties. The order of a tie is currently arbitrary, until I've implemented the geometric comparison again on the framework side. It doesn't help to continue to compare geometry on the engine side, since they're all assigned nextNodeIds already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we document somewhere around the setter/getter for nextNodeId (or for _updateNextNodeId) what setting this to -1 means? Especially, does it mean: Not followed by any node? Or the order of the next node has not been defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. It means not followed by another node, and is the value that the last node in the list gets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still seems to show up as "Example usage" instead of "## Sample code"?
8b7220b to
6e112a1
Compare
This adds support for semantics traversal ordering. It is a companion to flutter/flutter#14060, adding support for a sortIndex in the semantics data passed to the engine. Addresses flutter/flutter#12187
e018478 to
245a637
Compare
fa5f42e to
408ed84
Compare
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
408ed84 to
2848f83
Compare
This adds an API for defining the semantic node traversal order. It adds a sortOrder argument to the Semantics widget, which is a class that can define a list of sort keys to sort on. The keys are sorted globally so that an order that doesn't have to do with the current widget hierarchy may be defined. It also adds a shortcut sortKey argument to the Semantics widget that simply sets the sortOrder to just contain that key. The platform side (flutter/engine#4540) gets an additional member in the SemanticsData object that is an integer describing where in the overall order each semantics node belongs. There is an associated engine-side change that takes this integer and uses it to order widgets for the platform's accessibility services.
This adds an API for defining the semantic node traversal order.
It adds a
sortOrderargument to theSemanticswidget, which is a class that can define a list of sort keys to sort on. The keys are sorted globally so that an order that doesn't have to do with the current widget hierarchy may be defined.It also adds a shortcut
sortKeyargument to theSemanticswidget that simply sets thesortOrderto just contain that key.The platform side (flutter/engine#4540) gets an additional member in the
SemanticsDataobject that is an integer describing where in the overall order each semantics node belongs. There is an associated engine-side change that takes this integer and uses it to order widgets for the platform's accessibility services.