mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Semantics (Accessibility, Indexability)
This commit is contained in:
parent
a41dd9a890
commit
00f18ccc96
@ -29,6 +29,7 @@ dart_pkg("sky_services") {
|
||||
"//sky/services/media:interfaces",
|
||||
"//sky/services/pointer:interfaces",
|
||||
"//sky/services/raw_keyboard:interfaces",
|
||||
"//sky/services/semantics:interfaces",
|
||||
"//sky/services/updater:interfaces",
|
||||
]
|
||||
}
|
||||
|
||||
19
sky/services/semantics/BUILD.gn
Normal file
19
sky/services/semantics/BUILD.gn
Normal file
@ -0,0 +1,19 @@
|
||||
# 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.
|
||||
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
|
||||
group("semantics") {
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":interfaces",
|
||||
]
|
||||
}
|
||||
|
||||
mojom("interfaces") {
|
||||
sources = [
|
||||
"semantics.mojom",
|
||||
]
|
||||
}
|
||||
69
sky/services/semantics/semantics.mojom
Normal file
69
sky/services/semantics/semantics.mojom
Normal file
@ -0,0 +1,69 @@
|
||||
// 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;
|
||||
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.
|
||||
array<float> 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;
|
||||
};
|
||||
|
||||
[ServiceName="semantics::SemanticsClient"]
|
||||
interface SemanticsClient {
|
||||
// The OS side, invoked from the app.
|
||||
UpdateSemanticsTree(array<SemanticsNode> nodes);
|
||||
};
|
||||
|
||||
[ServiceName="semantics::SemanticsServer"]
|
||||
interface SemanticsServer {
|
||||
// The app side, invoked from the engine.
|
||||
Tap(uint32 nodeID);
|
||||
LongPress(uint32 nodeID);
|
||||
ScrollLeft(uint32 nodeID);
|
||||
ScrollRight(uint32 nodeID);
|
||||
ScrollUp(uint32 nodeID);
|
||||
ScrollDown(uint32 nodeID);
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user