1// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto2";
6
7package components.feed.core.proto.ui.piet;
8
9option optimize_for = LITE_RUNTIME;
10
11option java_package = "org.chromium.components.feed.core.proto.ui.piet";
12option java_outer_classname = "ShadowsProto";
13option cc_enable_arenas = true;
14
15// Defines a shadow for a given element. This message has sub-messages that
16// correspond to different methods that define shadows. Each client might
17// support a subset of the methodologies, will ignore the ones it does not
18// support, and may have a priority order for which type is used when multiple
19// shadow messages are defined (probably defaulting to the most descriptive
20// shadow type supported by the platform).
21// See [INTERNAL LINK]
22message Shadow {
23  // BoxShadow definition. Supported by the web and iOS clients.
24  optional BoxShadow box_shadow = 1;
25
26  // Simple elevation-based shadow. Supported by Android.
27  optional ElevationShadow elevation_shadow = 2;
28}
29
30// Defines a box shadow, as described in the CSS spec:
31// https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow.
32message BoxShadow {
33  // Defines the horizontal offset of the shadow.
34  //  * A positive value puts the shadow on the right side of the box (does not
35  //    flip in RTL presentation).
36  //  * A negative value puts the shadow on the left side of the box.
37  optional int32 offset_x = 1;
38
39  // Defines the vertical offset of the shadow.
40  //  * A positive value puts the shadow below the box.
41  //  * A negative value puts the shadow above the box.
42  optional int32 offset_y = 2;
43
44  // The blur radius of the shadow. The higher the number, the more blurred the
45  // shadow will be.
46  optional int32 blur_radius = 3;
47
48  // The spread radius of the shadow. A positive value increases the size of the
49  // shadow, a negative value decreases the size of the shadow.
50  // Not supported by iOS.
51  optional int32 spread_radius = 4;
52
53  // Defines whether the shadow should appear on the inside (is_inset == true),
54  // or the outside (is_inset == false).
55  // Not supported by iOS.
56  optional bool is_inset = 5;
57
58  // The color of the shadow.
59  optional fixed32 color = 6;
60}
61
62// Defines a simple elevation-based shadow, as described in Material Design:
63// https://developer.android.com/training/material/shadows-clipping
64message ElevationShadow {
65  // Elevation of the view in dp; higher elevation creates larger shadows.
66  optional int32 elevation = 1;
67}
68