diff --git a/sky/packages/sky_services/BUILD.gn b/sky/packages/sky_services/BUILD.gn index add15dc074f..69007ec819f 100644 --- a/sky/packages/sky_services/BUILD.gn +++ b/sky/packages/sky_services/BUILD.gn @@ -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", ] } diff --git a/sky/services/semantics/BUILD.gn b/sky/services/semantics/BUILD.gn new file mode 100644 index 00000000000..41d83dd7495 --- /dev/null +++ b/sky/services/semantics/BUILD.gn @@ -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", + ] +} diff --git a/sky/services/semantics/semantics.mojom b/sky/services/semantics/semantics.mojom new file mode 100644 index 00000000000..6ef1a89b1a9 --- /dev/null +++ b/sky/services/semantics/semantics.mojom @@ -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 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 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 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); +};