| Index: mojo/dart/packages/mojo_services/lib/mojo/ui/layouts.mojom.dart
|
| diff --git a/mojo/dart/packages/mojo_services/lib/mojo/ui/layouts.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/ui/layouts.mojom.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bc16ff7cd94f445a127443f083ca65e40020ef84
|
| --- /dev/null
|
| +++ b/mojo/dart/packages/mojo_services/lib/mojo/ui/layouts.mojom.dart
|
| @@ -0,0 +1,264 @@
|
| +// Copyright 2014 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.
|
| +
|
| +library layouts_mojom;
|
| +
|
| +import 'dart:async';
|
| +
|
| +import 'package:mojo/bindings.dart' as bindings;
|
| +import 'package:mojo/core.dart' as core;
|
| +import 'package:mojo_services/mojo/geometry.mojom.dart' as geometry_mojom;
|
| +import 'package:mojo_services/mojo/surface_id.mojom.dart' as surface_id_mojom;
|
| +
|
| +
|
| +
|
| +class BoxConstraints extends bindings.Struct {
|
| + static const List<bindings.StructDataHeader> kVersions = const [
|
| + const bindings.StructDataHeader(24, 0)
|
| + ];
|
| + int minWidth = 0;
|
| + int maxWidth = 0;
|
| + int minHeight = 0;
|
| + int maxHeight = 0;
|
| +
|
| + BoxConstraints() : super(kVersions.last.size);
|
| +
|
| + static BoxConstraints deserialize(bindings.Message message) {
|
| + var decoder = new bindings.Decoder(message);
|
| + var result = decode(decoder);
|
| + if (decoder.excessHandles != null) {
|
| + decoder.excessHandles.forEach((h) => h.close());
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + static BoxConstraints decode(bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + BoxConstraints result = new BoxConstraints();
|
| +
|
| + var mainDataHeader = decoder0.decodeStructDataHeader();
|
| + if (mainDataHeader.version <= kVersions.last.version) {
|
| + // Scan in reverse order to optimize for more recent versions.
|
| + for (int i = kVersions.length - 1; i >= 0; --i) {
|
| + if (mainDataHeader.version >= kVersions[i].version) {
|
| + if (mainDataHeader.size == kVersions[i].size) {
|
| + // Found a match.
|
| + break;
|
| + }
|
| + throw new bindings.MojoCodecError(
|
| + 'Header size doesn\'t correspond to known version size.');
|
| + }
|
| + }
|
| + } else if (mainDataHeader.size < kVersions.last.size) {
|
| + throw new bindings.MojoCodecError(
|
| + 'Message newer than the last known version cannot be shorter than '
|
| + 'required by the last known version.');
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + result.minWidth = decoder0.decodeInt32(8);
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + result.maxWidth = decoder0.decodeInt32(12);
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + result.minHeight = decoder0.decodeInt32(16);
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + result.maxHeight = decoder0.decodeInt32(20);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + void encode(bindings.Encoder encoder) {
|
| + var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
|
| +
|
| + encoder0.encodeInt32(minWidth, 8);
|
| +
|
| + encoder0.encodeInt32(maxWidth, 12);
|
| +
|
| + encoder0.encodeInt32(minHeight, 16);
|
| +
|
| + encoder0.encodeInt32(maxHeight, 20);
|
| + }
|
| +
|
| + String toString() {
|
| + return "BoxConstraints("
|
| + "minWidth: $minWidth" ", "
|
| + "maxWidth: $maxWidth" ", "
|
| + "minHeight: $minHeight" ", "
|
| + "maxHeight: $maxHeight" ")";
|
| + }
|
| +
|
| + Map toJson() {
|
| + Map map = new Map();
|
| + map["minWidth"] = minWidth;
|
| + map["maxWidth"] = maxWidth;
|
| + map["minHeight"] = minHeight;
|
| + map["maxHeight"] = maxHeight;
|
| + return map;
|
| + }
|
| +}
|
| +
|
| +
|
| +class ViewLayoutParams extends bindings.Struct {
|
| + static const List<bindings.StructDataHeader> kVersions = const [
|
| + const bindings.StructDataHeader(24, 0)
|
| + ];
|
| + BoxConstraints constraints = null;
|
| + double devicePixelRatio = 1.0;
|
| +
|
| + ViewLayoutParams() : super(kVersions.last.size);
|
| +
|
| + static ViewLayoutParams deserialize(bindings.Message message) {
|
| + var decoder = new bindings.Decoder(message);
|
| + var result = decode(decoder);
|
| + if (decoder.excessHandles != null) {
|
| + decoder.excessHandles.forEach((h) => h.close());
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + static ViewLayoutParams decode(bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ViewLayoutParams result = new ViewLayoutParams();
|
| +
|
| + var mainDataHeader = decoder0.decodeStructDataHeader();
|
| + if (mainDataHeader.version <= kVersions.last.version) {
|
| + // Scan in reverse order to optimize for more recent versions.
|
| + for (int i = kVersions.length - 1; i >= 0; --i) {
|
| + if (mainDataHeader.version >= kVersions[i].version) {
|
| + if (mainDataHeader.size == kVersions[i].size) {
|
| + // Found a match.
|
| + break;
|
| + }
|
| + throw new bindings.MojoCodecError(
|
| + 'Header size doesn\'t correspond to known version size.');
|
| + }
|
| + }
|
| + } else if (mainDataHeader.size < kVersions.last.size) {
|
| + throw new bindings.MojoCodecError(
|
| + 'Message newer than the last known version cannot be shorter than '
|
| + 'required by the last known version.');
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + var decoder1 = decoder0.decodePointer(8, false);
|
| + result.constraints = BoxConstraints.decode(decoder1);
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + result.devicePixelRatio = decoder0.decodeFloat(16);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + void encode(bindings.Encoder encoder) {
|
| + var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
|
| +
|
| + encoder0.encodeStruct(constraints, 8, false);
|
| +
|
| + encoder0.encodeFloat(devicePixelRatio, 16);
|
| + }
|
| +
|
| + String toString() {
|
| + return "ViewLayoutParams("
|
| + "constraints: $constraints" ", "
|
| + "devicePixelRatio: $devicePixelRatio" ")";
|
| + }
|
| +
|
| + Map toJson() {
|
| + Map map = new Map();
|
| + map["constraints"] = constraints;
|
| + map["devicePixelRatio"] = devicePixelRatio;
|
| + return map;
|
| + }
|
| +}
|
| +
|
| +
|
| +class ViewLayoutInfo extends bindings.Struct {
|
| + static const List<bindings.StructDataHeader> kVersions = const [
|
| + const bindings.StructDataHeader(24, 0)
|
| + ];
|
| + surface_id_mojom.SurfaceId surfaceId = null;
|
| + geometry_mojom.Size size = null;
|
| +
|
| + ViewLayoutInfo() : super(kVersions.last.size);
|
| +
|
| + static ViewLayoutInfo deserialize(bindings.Message message) {
|
| + var decoder = new bindings.Decoder(message);
|
| + var result = decode(decoder);
|
| + if (decoder.excessHandles != null) {
|
| + decoder.excessHandles.forEach((h) => h.close());
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + static ViewLayoutInfo decode(bindings.Decoder decoder0) {
|
| + if (decoder0 == null) {
|
| + return null;
|
| + }
|
| + ViewLayoutInfo result = new ViewLayoutInfo();
|
| +
|
| + var mainDataHeader = decoder0.decodeStructDataHeader();
|
| + if (mainDataHeader.version <= kVersions.last.version) {
|
| + // Scan in reverse order to optimize for more recent versions.
|
| + for (int i = kVersions.length - 1; i >= 0; --i) {
|
| + if (mainDataHeader.version >= kVersions[i].version) {
|
| + if (mainDataHeader.size == kVersions[i].size) {
|
| + // Found a match.
|
| + break;
|
| + }
|
| + throw new bindings.MojoCodecError(
|
| + 'Header size doesn\'t correspond to known version size.');
|
| + }
|
| + }
|
| + } else if (mainDataHeader.size < kVersions.last.size) {
|
| + throw new bindings.MojoCodecError(
|
| + 'Message newer than the last known version cannot be shorter than '
|
| + 'required by the last known version.');
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + var decoder1 = decoder0.decodePointer(8, false);
|
| + result.surfaceId = surface_id_mojom.SurfaceId.decode(decoder1);
|
| + }
|
| + if (mainDataHeader.version >= 0) {
|
| +
|
| + var decoder1 = decoder0.decodePointer(16, false);
|
| + result.size = geometry_mojom.Size.decode(decoder1);
|
| + }
|
| + return result;
|
| + }
|
| +
|
| + void encode(bindings.Encoder encoder) {
|
| + var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
|
| +
|
| + encoder0.encodeStruct(surfaceId, 8, false);
|
| +
|
| + encoder0.encodeStruct(size, 16, false);
|
| + }
|
| +
|
| + String toString() {
|
| + return "ViewLayoutInfo("
|
| + "surfaceId: $surfaceId" ", "
|
| + "size: $size" ")";
|
| + }
|
| +
|
| + Map toJson() {
|
| + Map map = new Map();
|
| + map["surfaceId"] = surfaceId;
|
| + map["size"] = size;
|
| + return map;
|
| + }
|
| +}
|
| +
|
| +
|
|
|