| Index: mojo/services/ui/views/interfaces/layouts.mojom
|
| diff --git a/mojo/services/ui/views/interfaces/layouts.mojom b/mojo/services/ui/views/interfaces/layouts.mojom
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7a6a1779604fc2424cc50fd5d89d21f98462cadc
|
| --- /dev/null
|
| +++ b/mojo/services/ui/views/interfaces/layouts.mojom
|
| @@ -0,0 +1,73 @@
|
| +// 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="mojo_services"]
|
| +module mojo.ui;
|
| +
|
| +import "mojo/services/geometry/interfaces/geometry.mojom";
|
| +import "mojo/services/surfaces/interfaces/surface_id.mojom";
|
| +
|
| +// Box constraints for layout.
|
| +//
|
| +// A box constraint allows a parent view to determine the size of its child
|
| +// by constraining its width and height. Each dimension is considered
|
| +// independently. If a constraint only admits a single value in one or both
|
| +// dimensions (because the minimum and maximum values are equal) then it is
|
| +// said to be "tight" in those dimension.
|
| +//
|
| +// A |Size| respects this constraint if, and only if, all of the following
|
| +// relations hold:
|
| +//
|
| +// size.width >= constraints.min_width
|
| +// size.width <= constraints.max_width
|
| +// size.height >= constraints.min_height
|
| +// size.height <= constraints.max_height
|
| +//
|
| +// The view manager validates all constraints before delivering them to a
|
| +// child view; it will close its connection if the parent view supplies
|
| +// constraints which are ill-formed.
|
| +struct BoxConstraints {
|
| + // The minimum width of the view in device pixels.
|
| + // Must be >= 0.
|
| + int32 min_width;
|
| +
|
| + // The maximum width of the view in device pixels.
|
| + // Must be >= |min_width|.
|
| + int32 max_width;
|
| +
|
| + // The minimum height of the view in device pixels.
|
| + // Must be >= 0.
|
| + int32 min_height;
|
| +
|
| + // The maximum height of the view in device pixels.
|
| + // Must be >= |min_height|.
|
| + int32 max_height;
|
| +};
|
| +
|
| +// Layout parameters provided by a parent view to one of its children.
|
| +//
|
| +// TODO(jeffbrown): We will eventually need to pass a bunch more information
|
| +// such as theme colors, virtual light sources for shadows, elevation, and
|
| +// more. It is unclear whether we'll want to put that information here
|
| +// or somewhere else but it may be convenient to stash it here because we
|
| +// will already have an invalidation mechanism in place.
|
| +struct ViewLayoutParams {
|
| + // The size constraints for the child.
|
| + mojo.ui.BoxConstraints constraints;
|
| +
|
| + // The ratio between the size of one display device pixel to the size
|
| + // of one logical pixel, assuming pixels are square. This value changes
|
| + // in relation to display density and zoom level.
|
| + // Must be > 0.
|
| + float device_pixel_ratio = 1.0;
|
| +};
|
| +
|
| +// Layout information for a view.
|
| +struct ViewLayoutInfo {
|
| + // The view's surface id for composition by the parent.
|
| + mojo.SurfaceId surface_id;
|
| +
|
| + // The actual size of the view in device pixels.
|
| + mojo.Size size;
|
| +};
|
|
|