mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
73 lines
2.2 KiB
Plaintext
73 lines
2.2 KiB
Plaintext
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
[DartPackage="sky_services"]
|
|
module semantics;
|
|
|
|
struct SemanticsNode {
|
|
uint32 id;
|
|
|
|
// A null field means "unchanged since last time".
|
|
SemanticFlags? flags;
|
|
SemanticStrings? strings;
|
|
SemanticGeometry? geometry;
|
|
array<SemanticsNode>? children;
|
|
};
|
|
|
|
struct SemanticFlags {
|
|
// This is intended to just be booleans, so that it can be extended
|
|
// over time yet still be packed tightly.
|
|
bool canBeTapped = false;
|
|
bool canBeLongPressed = false;
|
|
bool canBeScrolledHorizontally = false;
|
|
bool canBeScrolledVertically = false;
|
|
bool hasCheckedState = false; // whether isChecked is relevant
|
|
bool isChecked = false;
|
|
};
|
|
|
|
struct SemanticStrings {
|
|
// This is intended to just be Strings.
|
|
string label;
|
|
};
|
|
|
|
struct SemanticGeometry {
|
|
// A SemanticsNode defines a rectangle in a cartesian coordinate
|
|
// space within which it is potentially interactive.
|
|
|
|
// The transform from the coordinate space of the parent
|
|
// SemanticsNode (or the application's display area, if this is the
|
|
// root node) to this SemanticsNode's coordinate space, described as
|
|
// a 4x4 matrix, with values in column-major order. The array must
|
|
// have exactly 16 values.
|
|
// This can be left unset to imply the identity matrix.
|
|
array<float, 16>? transform;
|
|
|
|
// The position and size of the potentially interactive rectangle in the
|
|
// SemanticsNode's coordinate space.
|
|
// If the width or height are zero, then the node should be treated
|
|
// as absent for most purposes. The node may, however, have further
|
|
// children.
|
|
float left;
|
|
float top;
|
|
float width;
|
|
float height;
|
|
};
|
|
|
|
interface SemanticsListener {
|
|
// The OS side, invoked from the app.
|
|
UpdateSemanticsTree(array<SemanticsNode> nodes);
|
|
};
|
|
|
|
[ServiceName="semantics::SemanticsServer"]
|
|
interface SemanticsServer {
|
|
// The app side, invoked from the engine.
|
|
AddSemanticsListener(SemanticsListener listener);
|
|
Tap(uint32 nodeID);
|
|
LongPress(uint32 nodeID);
|
|
ScrollLeft(uint32 nodeID);
|
|
ScrollRight(uint32 nodeID);
|
|
ScrollUp(uint32 nodeID);
|
|
ScrollDown(uint32 nodeID);
|
|
};
|