Skip to content

SemanticsDebugger should use SemanticsNodes directly #6252

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

Merged
merged 1 commit into from
Oct 8, 2016

Conversation

abarth
Copy link
Contributor

@abarth abarth commented Oct 7, 2016

Instead of reading the mojom serialization and re-inflating it, the
SemanticsDebugger now shows the SemanticsNode objects directly.

@abarth
Copy link
Contributor Author

abarth commented Oct 7, 2016

@Hixie

///
/// Typically obtained from [SemanticsNode.getSemanticsData].
class SemanticsData {
/// Creates a semantics data object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-evident doc. though i'm not sure what we could add.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can say the fields must not be null.

@required this.actions,
@required this.label,
@required this.rect,
@required this.transform
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transform is required here but the doc lower down says it has a default

flags |= node._flags;
actions |= node._actions;
if (label.isEmpty)
label = node._label;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we merge the strings? I thought I merged the strings separated by newlines or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right.

@@ -497,6 +590,11 @@ class SemanticsOwner {

final List<SemanticsListener> _listeners = <SemanticsListener>[];

/// The root node of the semantics tree, if any.
///
/// The semantics tree is empty, returns null.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the...

@@ -597,12 +695,11 @@ class SemanticsOwner {
_dirtyNodes.clear();
}

SemanticsActionHandler _getSemanticsActionHandlerForId(int id, { @required SemanticsAction action }) {
assert(action != null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove the assert?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it because I made the argument positional, but I can add it back. I've moved it to the public API so that if it trips it will be more obvious where the fault lies.

SemanticsNode result = _nodes[id];
if (result != null && result._shouldMergeAllDescendantsIntoThisNode && !result._hasAction(action)) {
result._visitDescendants((SemanticsNode node) {
if (node._actionHandler != null && node._hasAction(action)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we want to match if there's no action handler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_hasAction does the node._actionHandler internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed this to _canPerformAction to make that more obvious.

@Hixie
Copy link
Contributor

Hixie commented Oct 7, 2016

LGTM.

Since you have the read-only SemanticsData structure already, it seems like it'd be worth going all the way and not exposing the mutable data structures at all. Then you could just expose the SemanticsData objects directly on the RenderObjects.

@abarth
Copy link
Contributor Author

abarth commented Oct 8, 2016

Since you have the read-only SemanticsData structure already, it seems like it'd be worth going all the way and not exposing the mutable data structures at all. Then you could just expose the SemanticsData objects directly on the RenderObjects.

I'd like to try getting rid of the SemanticsData objects by moving the merging logic into the semantics compiler. Having the merge operation still pending in SemanticsNode tree is pretty awkward.

Instead of reading the mojom serialization and re-inflating it, the
SemanticsDebugger now shows the SemanticsNode objects directly.
@abarth abarth force-pushed the semantics_debugger2 branch from 1e85099 to cfcc103 Compare October 8, 2016 02:37
@abarth abarth merged commit f11bb25 into flutter:master Oct 8, 2016
@abarth abarth deleted the semantics_debugger2 branch October 8, 2016 02:57
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants