Skip to content

Commit

Permalink
replace nextNodeId/previousNodeId with hitTestPosition (flutter#5066)
Browse files Browse the repository at this point in the history
  • Loading branch information
yjbanov authored Apr 23, 2018
1 parent 2970c09 commit ec61147
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 22 deletions.
9 changes: 3 additions & 6 deletions lib/ui/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
String increasedValue,
String decreasedValue,
TextDirection textDirection,
int nextNodeId,
int previousNodeId,
int hitTestPosition,
Float64List transform,
Int32List children,
}) {
Expand All @@ -513,8 +512,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
increasedValue,
decreasedValue,
textDirection != null ? textDirection.index + 1 : 0,
nextNodeId ?? -1,
previousNodeId ?? -1,
hitTestPosition,
transform,
children,);
}
Expand All @@ -537,8 +535,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
String increasedValue,
String decreasedValue,
int textDirection,
int nextNodeId,
int previousNodeId,
int hitTestPosition,
Float64List transform,
Int32List children,
) native 'SemanticsUpdateBuilder_updateNode';
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/semantics/semantics_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ struct SemanticsNode {
std::string increasedValue;
std::string decreasedValue;
int32_t textDirection = 0; // 0=unknown, 1=rtl, 2=ltr
int32_t nextNodeId = -1;
int32_t previousNodeId = -1;
int32_t hitTestPosition = -1;

SkRect rect = SkRect::MakeEmpty();
SkMatrix44 transform = SkMatrix44(SkMatrix44::kIdentity_Constructor);
Expand Down
6 changes: 2 additions & 4 deletions lib/ui/semantics/semantics_update_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ void SemanticsUpdateBuilder::updateNode(int id,
std::string increasedValue,
std::string decreasedValue,
int textDirection,
int nextNodeId,
int previousNodeId,
int hitTestPosition,
const tonic::Float64List& transform,
const tonic::Int32List& children) {
SemanticsNode node;
Expand All @@ -72,8 +71,7 @@ void SemanticsUpdateBuilder::updateNode(int id,
node.increasedValue = increasedValue;
node.decreasedValue = decreasedValue;
node.textDirection = textDirection;
node.nextNodeId = nextNodeId;
node.previousNodeId = previousNodeId;
node.hitTestPosition = hitTestPosition;
node.transform.setColMajord(transform.data());
node.children = std::vector<int32_t>(
children.data(), children.data() + children.num_elements());
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/semantics/semantics_update_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ class SemanticsUpdateBuilder
std::string increasedValue,
std::string decreasedValue,
int textDirection,
int nextNodeId,
int previousNodeId,
int hitTestPosition,
const tonic::Float64List& transform,
const tonic::Int32List& children);

Expand Down
10 changes: 3 additions & 7 deletions shell/platform/android/io/flutter/view/AccessibilityBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {

result.setSelected(object.hasFlag(Flag.IS_SELECTED));
result.setText(object.getValueLabelHint());
if (object.previousNodeId != -1
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
result.setTraversalAfter(mOwner, object.previousNodeId);
}

// Accessibility Focus
if (mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) {
Expand Down Expand Up @@ -744,7 +740,7 @@ private class SemanticsObject {
String decreasedValue;
String hint;
TextDirection textDirection;
int previousNodeId;
int hitTestPosition;

boolean hadPreviousConfig = false;
int previousFlags;
Expand Down Expand Up @@ -797,7 +793,7 @@ boolean didScroll() {
void log(String indent, boolean recursive) {
Log.i(TAG, indent + "SemanticsObject id=" + id + " label=" + label + " actions=" + actions + " flags=" + flags + "\n" +
indent + " +-- textDirection=" + textDirection + "\n"+
indent + " +-- previousNodeId=" + previousNodeId + "\n"+
indent + " +-- hitTestPosition=" + hitTestPosition + "\n"+
indent + " +-- rect.ltrb=(" + left + ", " + top + ", " + right + ", " + bottom + ")\n" +
indent + " +-- transform=" + Arrays.toString(transform) + "\n");
if (children != null && recursive) {
Expand Down Expand Up @@ -844,7 +840,7 @@ void updateWith(ByteBuffer buffer, String[] strings) {

textDirection = TextDirection.fromInt(buffer.getInt());

previousNodeId = buffer.getInt();
hitTestPosition = buffer.getInt();

left = buffer.getFloat();
top = buffer.getFloat();
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/platform_view_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void PlatformViewAndroid::UpdateSemantics(blink::SemanticsNodeUpdates update) {
strings.push_back(node.hint);
}
buffer_int32[position++] = node.textDirection;
buffer_int32[position++] = node.previousNodeId;
buffer_int32[position++] = node.hitTestPosition;
buffer_float32[position++] = node.rect.left();
buffer_float32[position++] = node.rect.top();
buffer_float32[position++] = node.rect.right();
Expand Down

0 comments on commit ec61147

Please sign in to comment.