Repository navigation
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. /cc @dnfield |
goderbauer
left a comment
There was a problem hiding this comment.
It may be worthwhile to write a little design document for this to reflect on what the goals for this API are and to answer some of the open questions.
There was a problem hiding this comment.
Why only block tap and longPress? I think a RenderIgnorePointer also blocks scrolling and other gestures, no?
There was a problem hiding this comment.
We will probably want to block more, This is more like a place holder for now
There was a problem hiding this comment.
Do we have a use case were we only need to block selective actions? Or is it all-or-nothing?
There was a problem hiding this comment.
If we go the down the selective route - how do we deal with newly added semantics actions that people didn't know about when writing their render objects that use this functionality?
There was a problem hiding this comment.
I believe we might want to do selective route for example we are not likely to block
SemanticsAction.showOnScreen in ignoring pointer widget.
For newly added semantics actions, I really can't think of a comprehensive way to improve this. we can try to group the actions into different subgroup, for example, we can have a subgroup called PointerActions that will include all the pointer related semantics action, and the the renderobject can directly mute the subgroup instead individual actions. The person who add the new semantics action need to also include the action into the correct subgroup.
There was a problem hiding this comment.
showOnScreen is kind of a special SemanticsAction since it is not directly user-triggered. It would probably be good to have a way to block all user-initiated actions.
Having said that, showOnScreen as a semantics action is really only relevant if the node is scrollable. And scrolling is one of the actions we are blocking, with ignorepointer, right?
There was a problem hiding this comment.
I wonder if RenderIgnorePointer could set "blockedActions" on the SemanticsConfiguration it returns from describeSemanticsConfiguration instead of adding this API here. The semantics compiler would than have to resolve this as it rebuilds the tree based on that changed configuration...
There was a problem hiding this comment.
Is this possible? We can do this if we calculate the subtree's blockedActions without any caching. If we want to use cache, we need a way to invalidate subtree's caches. I can't think of good way to do that if we didn't do it in renderobject level.
There was a problem hiding this comment.
It may make more sense to cache these things on the SemanticsNode itself. We already do this for other things, like the elevation imposed by a parent on its children or the parent paint clip:
https://master-api.flutter.dev/flutter/semantics/SemanticsNode/elevationAdjustment.html
https://master-api.flutter.dev/flutter/semantics/SemanticsNode/parentPaintClipRect.html
It would probably be more idiomatic to have specify the blocked actions on the SemanticsConfiguration and cache things on the SemanticsNode.
There was a problem hiding this comment.
those case are setting semantics configuration for compilechildren to finalize the value. However, the blocked action I did here is blocking during semantics configuration setup. The biggest difference is that make node dirty will re compile its children SemanticsFragment but it does keep the old cache of semantics configuration. in the case of elevationAdjustment or parentPainterClipRect, it is ok because the subtree semantics configuration did not change. it just need to recompile. However, in my case it will break because the subtree need to reconfig semantics configuration. I think if we don't want to recursively mark subtree dirty, we can try to strip out blocked semanticsactions during compilechildren. I am not sure if there is any side effect tho.
There was a problem hiding this comment.
Just the parent? Or all ancestors?
There was a problem hiding this comment.
All ancestors, sorry for the confusing
There was a problem hiding this comment.
How is the cache invalidated if the parent's _inheritedMutedSemanticsActions change?
There was a problem hiding this comment.
the recursive markRenderObjectNeedsSemanticsUpdate should invalidate all the subtree cache.
There was a problem hiding this comment.
That is a departure from how SemanticsUpdate marking works right now. Right now, if node A is marked as needing an update, all its children will also be updated without requiring to be marked as needing an update.
The subtree could potentially be very large (think about a modal dialog that blocks interactions with everything in the route below it), so performance-wise it may not be a good idea to walk everything.
There was a problem hiding this comment.
How is it guaranteed that the parent's _inheritedMutedSemanticsActions are up-to-date at this point?
There was a problem hiding this comment.
if any ancestor has change, its subtree should have all their _cachedMutedSemanticsActions set to null
There was a problem hiding this comment.
I believe you do not need to walk down to the leaves. If you mark a node as needing semantics update, the entire subtree gets re-build anyways starting with the marked node.
There was a problem hiding this comment.
its subtree already cached both _cachedMutedSemanticsActions and _cachedSemanticsConfiguration which will need to be removed by calling markNeedsSemanticsUpdate. I feel a bit scared to manually remove the cache without going through markNeedsSemanticsUpdate.
There was a problem hiding this comment.
I think you could do .containsAll. Same thing either way though.
75ee4f7 to
4903c0e
Compare
|
Refactored @goderbauer |
There was a problem hiding this comment.
readOnly in EditableText will make it not an ediablebox
|
@goderbauer finalize the prototype, and updated design doc. Test will be added after we decide this is the route we want to pursue. |
|
closed for now until i have time to get back to it |
Description
This is a prototype.
expects behavior as following
Related Issues
#37162
Tests
I added the following tests:
Replace this with a list of the tests that you added as part of this PR. A change in behaviour with no test covering it
will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See [Test Coverage].
Design doc https://docs.google.com/document/d/1WuVBc58_wV6__ZCe1NgYsnvTJtSdOtVcwSzPwM_YT74/edit?usp=sharing