Adds a platfromViewId to SemanticsNode (flutter/engine#8055)

This commit is contained in:
Michael Goderbauer
2019-03-11 11:30:35 -07:00
committed by GitHub
parent 4c144fb29a
commit 40e0467f60
6 changed files with 16 additions and 1 deletions

View File

@@ -601,6 +601,11 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
/// The fields 'textSelectionBase' and 'textSelectionExtent' describe the
/// currently selected text within `value`.
///
/// The field `platformViewId` references the platform view, whose semantics
/// nodes will be added as children to this node. If a platform view is
/// specified, `childrenInHitTestOrder` and `childrenInTraversalOrder` must be
/// empty.
///
/// For scrollable nodes `scrollPosition` describes the current scroll
/// position in logical pixel. `scrollExtentMax` and `scrollExtentMin`
/// describe the maximum and minimum in-rage values that `scrollPosition` can
@@ -629,6 +634,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
int actions,
int textSelectionBase,
int textSelectionExtent,
int platformViewId,
int scrollChildren,
int scrollIndex,
double scrollPosition,
@@ -656,6 +662,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
actions,
textSelectionBase,
textSelectionExtent,
platformViewId,
scrollChildren,
scrollIndex,
scrollPosition,
@@ -685,6 +692,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
int actions,
int textSelectionBase,
int textSelectionExtent,
int platformViewId,
int scrollChildren,
int scrollIndex,
double scrollPosition,

View File

@@ -86,6 +86,7 @@ struct SemanticsNode {
int32_t actions = 0;
int32_t textSelectionBase = -1;
int32_t textSelectionExtent = -1;
int32_t platformViewId = -1;
int32_t scrollChildren = 0;
int32_t scrollIndex = 0;
double scrollPosition = std::nan("");

View File

@@ -41,6 +41,7 @@ void SemanticsUpdateBuilder::updateNode(
int actions,
int textSelectionBase,
int textSelectionExtent,
int platformViewId,
int scrollChildren,
int scrollIndex,
double scrollPosition,
@@ -68,6 +69,7 @@ void SemanticsUpdateBuilder::updateNode(
node.actions = actions;
node.textSelectionBase = textSelectionBase;
node.textSelectionExtent = textSelectionExtent;
node.platformViewId = platformViewId;
node.scrollChildren = scrollChildren;
node.scrollIndex = scrollIndex;
node.scrollPosition = scrollPosition;

View File

@@ -29,6 +29,7 @@ class SemanticsUpdateBuilder
int actions,
int textSelectionBase,
int textSelectionExtent,
int platformViewId,
int scrollChildren,
int scrollIndex,
double scrollPosition,

View File

@@ -1614,6 +1614,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
private int actions;
private int textSelectionBase;
private int textSelectionExtent;
private int platformViewId;
private int scrollChildren;
private int scrollIndex;
private float scrollPosition;
@@ -1748,6 +1749,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
actions = buffer.getInt();
textSelectionBase = buffer.getInt();
textSelectionExtent = buffer.getInt();
platformViewId = buffer.getInt();
scrollChildren = buffer.getInt();
scrollIndex = buffer.getInt();
scrollPosition = buffer.getFloat();

View File

@@ -208,7 +208,7 @@ void PlatformViewAndroid::DispatchSemanticsAction(JNIEnv* env,
void PlatformViewAndroid::UpdateSemantics(
blink::SemanticsNodeUpdates update,
blink::CustomAccessibilityActionUpdates actions) {
constexpr size_t kBytesPerNode = 38 * sizeof(int32_t);
constexpr size_t kBytesPerNode = 39 * sizeof(int32_t);
constexpr size_t kBytesPerChild = sizeof(int32_t);
constexpr size_t kBytesPerAction = 4 * sizeof(int32_t);
@@ -244,6 +244,7 @@ void PlatformViewAndroid::UpdateSemantics(
buffer_int32[position++] = node.actions;
buffer_int32[position++] = node.textSelectionBase;
buffer_int32[position++] = node.textSelectionExtent;
buffer_int32[position++] = node.platformViewId;
buffer_int32[position++] = node.scrollChildren;
buffer_int32[position++] = node.scrollIndex;
buffer_float32[position++] = (float)node.scrollPosition;