mln-rs-style 0.0.21

Part of mln-rs, a MapLibre map renderer written in Rust. Depend on mln-rs instead.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
//! The style's JSON-text entry points, with the cases of maplibre-native-ffi's
//! style ABI tests (`tests/native/abi/style`), which reach them through the C
//! layer.

use std::sync::Arc;

use crate::StyleRegistry;
use crate::error::{Error, ErrorKind};
use crate::style::Style;

const EMPTY_GEOJSON_SOURCE: &str = r#"{"type":"geojson","data":{"type":"FeatureCollection","features":[]}}"#;
const DEM_SOURCE: &str = r#"{"type":"raster-dem","tiles":["https://example.com/dem/{z}/{x}/{y}.png"],"tileSize":256}"#;
const DOTS: &str = r#"{"id":"dots","type":"circle","source":"points"}"#;

fn loaded_style() -> Style {
    let mut style = Style::new(StyleRegistry::with_builtins());
    style.load_json(r#"{"version":8,"sources":{},"layers":[]}"#);
    style
}

/// A loaded style with the GeoJSON source `points` and the circle layer
/// `dots` on it.
fn style_with_dots() -> Style {
    let mut style = loaded_style();
    style.add_source_json("points", EMPTY_GEOJSON_SOURCE);
    style.add_layer_json(DOTS, None).unwrap();
    style
}

#[track_caller]
fn assert_fails(result: Result<impl std::fmt::Debug, Error>, kind: ErrorKind, message: &str) {
    let error = result.expect_err("the call should fail");
    assert_eq!(error.kind, kind, "{}", error.message);
    assert!(error.message.contains(message), "{:?} doesn't contain {message:?}", error.message);
}

fn property(style: &Style, layer_id: &str, name: &str) -> Option<String> {
    style.layer_property_json(layer_id, name).unwrap()
}

fn set_property(style: &mut Style, layer_id: &str, name: &str, json: &str) {
    style.set_layer_property_json(layer_id, name, json).unwrap();
}

#[test]
fn missing_style_ids_report_not_found() {
    let mut style = loaded_style();
    assert_fails(
        style.set_layer_property_json("absent-layer", "circle-radius", "4"),
        ErrorKind::NotFound,
        r#"layer "absent-layer" does not exist"#,
    );
    assert_fails(
        style.layer_property_json("absent-layer", "circle-radius"),
        ErrorKind::NotFound,
        r#"layer "absent-layer" does not exist"#,
    );
    assert_fails(
        style.add_layer_json(r#"{"id":"paper","type":"background"}"#, Some("absent-layer")),
        ErrorKind::NotFound,
        r#"before_layer_id "absent-layer" does not exist"#,
    );
    assert_fails(
        style.add_layer_json(r#"{"id":"hillshade","type":"hillshade","source":"absent-source"}"#, None),
        ErrorKind::NotFound,
        r#"layer "hillshade" uses source "absent-source", which does not exist"#,
    );
    assert_eq!(style.layers().len(), 0);
    assert_eq!(style.layer_json("absent-layer"), None);
}

#[test]
fn layers_go_below_the_before_layer() {
    let mut style = style_with_dots();
    style.add_layer_json(r#"{"id":"paper","type":"background"}"#, Some("dots")).unwrap();
    style.add_layer_json(r#"{"id":"top","type":"background"}"#, None).unwrap();
    let ids: Vec<String> = style.layers().map(|layer| layer.id().to_owned()).collect();
    assert_eq!(ids, ["paper", "dots", "top"]);
}

#[test]
fn malformed_layers_are_invalid_arguments() {
    let mut style = style_with_dots();
    assert_fails(style.add_layer_json(r#"{"id":"#, None), ErrorKind::InvalidArgument, "style layer is not valid JSON");
    assert_fails(
        style.add_layer_json(r#"{"id":"odd","type":"no-such-layer-type"}"#, None),
        ErrorKind::InvalidArgument,
        "style layer: ",
    );
    assert_eq!(style.layers().len(), 1);
}

// A hillshade layer requires a raster DEM source, and a circle layer can't
// draw one. A layer ID is taken once.
#[test]
fn a_layer_requires_a_source_that_supports_its_type() {
    let mut style = loaded_style();
    style.add_source_json("dem", DEM_SOURCE);
    style.add_source_json("points", EMPTY_GEOJSON_SOURCE);

    let hillshade = r#"{"id":"hillshade","type":"hillshade","source":"dem"}"#;
    style.add_layer_json(hillshade, None).unwrap();
    let layer = style.layer("hillshade").unwrap();
    assert_eq!(layer.info().name, "hillshade");
    assert_eq!(layer.source_id(), "dem");
    assert_fails(
        style.add_layer_json(hillshade, None),
        ErrorKind::AlreadyExists,
        r#"layer "hillshade" already exists"#,
    );

    assert_fails(
        style.add_layer_json(r#"{"id":"on-points","type":"hillshade","source":"points"}"#, None),
        ErrorKind::InvalidArgument,
        r#"source "points" does not support hillshade layer "on-points""#,
    );
    assert_fails(
        style.add_layer_json(r#"{"id":"dots","type":"circle","source":"dem"}"#, None),
        ErrorKind::InvalidArgument,
        r#"source "dem" does not support circle layer "dots""#,
    );
    assert_eq!(style.layers().len(), 1);
}

// A bad property name or value on a live layer is an invalid argument that
// leaves the layer as it was.
#[test]
fn layer_properties_and_filters_round_trip_through_json() {
    let mut style = style_with_dots();

    assert_eq!(property(&style, "dots", "circle-radius"), None);
    set_property(&mut style, "dots", "circle-radius", "4");
    assert_eq!(property(&style, "dots", "circle-radius").as_deref(), Some("4.0"));
    set_property(&mut style, "dots", "circle-color", r##""#ff0000""##);
    assert_eq!(property(&style, "dots", "circle-color").as_deref(), Some("[\"rgba\",255.0,0.0,0.0,1.0]"));

    assert_fails(
        style.set_layer_property_json("dots", "fill-color", r##""#00ff00""##),
        ErrorKind::InvalidArgument,
        r#"property "fill-color" of layer "dots""#,
    );
    assert_fails(
        style.set_layer_property_json("dots", "circle-radius", r#"{"radius":"#),
        ErrorKind::InvalidArgument,
        r#"property "circle-radius" of layer "dots" is not valid JSON"#,
    );
    assert_fails(
        style.set_layer_property_json("dots", "circle-radius", r#""big""#),
        ErrorKind::InvalidArgument,
        r#"property "circle-radius" of layer "dots": "#,
    );
    assert_eq!(property(&style, "dots", "circle-radius").as_deref(), Some("4.0"));
    // A name the layer type lacks reads as unset rather than failing.
    assert_eq!(property(&style, "dots", "fill-color"), None);

    assert_eq!(property(&style, "dots", "filter"), None);
    let filter = r#"["==",["get","kind"],"park"]"#;
    set_property(&mut style, "dots", "filter", filter);
    assert_eq!(property(&style, "dots", "filter").as_deref(), Some(filter));
    set_property(&mut style, "dots", "filter", "null");
    assert_eq!(property(&style, "dots", "filter"), None);

    set_property(&mut style, "dots", "circle-radius", "null");
    assert_eq!(property(&style, "dots", "circle-radius"), None);
}

#[test]
fn root_properties_match_serialization_and_null_resets_zoom() {
    let mut style = style_with_dots();
    assert_eq!(property(&style, "dots", "source").as_deref(), Some("\"points\""));
    assert_eq!(property(&style, "dots", "source-layer"), None);

    for name in ["minzoom", "maxzoom"] {
        assert_eq!(property(&style, "dots", name), None);
        set_property(&mut style, "dots", name, "4.5");
        assert_eq!(property(&style, "dots", name).as_deref(), Some("4.5"));
        set_property(&mut style, "dots", name, "null");
        assert_eq!(property(&style, "dots", name), None);
    }
    let layer = style.layer("dots").unwrap();
    assert_eq!(layer.min_zoom(), f64::NEG_INFINITY);
    assert_eq!(layer.max_zoom(), f64::INFINITY);
    let json = style.layer_json("dots").unwrap();
    assert!(!json.contains("minzoom") && !json.contains("maxzoom"), "{json}");
}

// The layer's JSON is the whole layer as it stands after later edits, and adds
// back as the same layer.
#[test]
fn layer_json_serializes_the_current_layer() {
    let mut style = loaded_style();
    style
        .add_layer_json(r##"{"id":"paper","type":"background","paint":{"background-color":"#ff0000"}}"##, None)
        .unwrap();
    set_property(&mut style, "paper", "minzoom", "2.0");

    let json = style.layer_json("paper").unwrap();
    for part in [
        r#""id":"paper""#,
        r#""type":"background""#,
        r#""background-color":["rgba",255.0,0.0,0.0,1.0]"#,
        r#""minzoom":2.0"#,
    ] {
        assert!(json.contains(part), "{json} doesn't contain {part}");
    }

    style.apply(crate::Edit::RemoveLayer("paper".to_owned())).unwrap();
    style.add_layer_json(&json, None).unwrap();
    assert_eq!(style.layer_json("paper").unwrap(), json);
}

// A layer's source and source layer change only on layer types that take a
// source. The source need not exist yet, and an empty source layer clears it.
#[test]
fn source_bindings_change_only_on_layers_that_take_a_source() {
    let mut style = style_with_dots();
    style.add_layer_json(r#"{"id":"paper","type":"background"}"#, None).unwrap();

    set_property(&mut style, "dots", "source", r#""not-yet-added""#);
    assert_eq!(style.layer("dots").unwrap().source_id(), "not-yet-added");
    assert_eq!(property(&style, "dots", "source").as_deref(), Some("\"not-yet-added\""));
    set_property(&mut style, "dots", "source-layer", r#""pois""#);
    assert_eq!(property(&style, "dots", "source-layer").as_deref(), Some("\"pois\""));
    set_property(&mut style, "dots", "source-layer", r#""""#);
    assert_eq!(property(&style, "dots", "source-layer"), None);

    assert_fails(
        style.set_layer_property_json("paper", "source", r#""points""#),
        ErrorKind::InvalidArgument,
        r#"background layer "paper" does not take a source"#,
    );
    assert_fails(
        style.set_layer_property_json("paper", "source-layer", r#""pois""#),
        ErrorKind::InvalidArgument,
        r#"background layer "paper" does not take a source-layer"#,
    );
    assert_eq!(property(&style, "paper", "source"), None);
    assert_eq!(property(&style, "paper", "source-layer"), None);
}

// The light has no ID to miss, so every bad input is an invalid argument.
#[test]
fn the_style_light_round_trips_through_json() {
    let mut style = loaded_style();
    style.set_root_property_json("light", r#"{"anchor":"viewport","intensity":0.5}"#).unwrap();
    assert_eq!(style.light_property_json("anchor").as_deref(), Some("\"viewport\""));
    assert_eq!(style.light_property_json("intensity").as_deref(), Some("0.5"));

    style.set_light_property_json("intensity", "0.75").unwrap();
    assert_eq!(style.light_property_json("intensity").as_deref(), Some("0.75"));

    assert_fails(
        style.set_light_property_json("intensity", r#""bright""#),
        ErrorKind::InvalidArgument,
        r#"style light property "intensity""#,
    );
    assert_fails(
        style.set_light_property_json("intensity", "{"),
        ErrorKind::InvalidArgument,
        r#"style light property "intensity" is not valid JSON"#,
    );
    assert_fails(
        style.set_root_property_json("light", r#"{"anchor":7}"#),
        ErrorKind::InvalidArgument,
        r#"style root property "light""#,
    );
    assert_eq!(style.light_property_json("intensity").as_deref(), Some("0.75"));
    assert_eq!(style.light_property_json("anchor").as_deref(), Some("\"viewport\""));
    assert_eq!(style.light_property_json("color"), None);

    style.set_light_property_json("intensity", "null").unwrap();
    assert_eq!(style.light_property_json("intensity"), None);
}

#[test]
fn global_state_reads_back_defaults_and_set_properties() {
    let mut style = Style::new(StyleRegistry::with_builtins());
    style.load_json(r#"{"version":8,"sources":{},"layers":[],"state":{"theme":{"default":"light"}}}"#);
    assert_eq!(style.global_state_json(), r#"{"theme":"light"}"#);

    style.set_global_state_property_json("theme", r#"["dark",{"enabled":true}]"#).unwrap();
    assert_eq!(style.global_state_json(), r#"{"theme":["dark",{"enabled":true}]}"#);
    assert_fails(
        style.set_global_state_property_json("theme", "{not json"),
        ErrorKind::InvalidArgument,
        "not valid JSON",
    );
    assert_eq!(style.global_state_json(), r#"{"theme":["dark",{"enabled":true}]}"#);
    style.set_global_state_property_json("theme", "null").unwrap();
    assert_eq!(style.global_state_json(), r#"{"theme":"light"}"#);
}

fn root_property(style: &Style, name: &str) -> Option<String> {
    style.root_property_json(name).unwrap()
}

#[test]
fn the_light_and_the_transition_change_and_reset() {
    let mut style = loaded_style();
    assert_eq!(root_property(&style, "light"), None);
    // A style without a transition gets the default duration.
    assert_eq!(root_property(&style, "transition").as_deref(), Some(r#"{"duration":300}"#));

    style.set_root_property_json("light", r#"{"intensity":0.5,"anchor":"viewport"}"#).unwrap();
    assert_eq!(root_property(&style, "light").as_deref(), Some(r#"{"anchor":"viewport","intensity":0.5}"#));

    let mut no_placement = style.transition_options();
    no_placement.enable_placement_transitions = false;
    style.apply(crate::Edit::SetTransition(no_placement)).unwrap();
    style.set_root_property_json("transition", r#"{"delay":50,"duration":300}"#).unwrap();
    assert_eq!(root_property(&style, "transition").as_deref(), Some(r#"{"duration":300,"delay":50}"#));
    assert!(!style.transition_options().enable_placement_transitions);
    assert_fails(style.set_root_property_json("transition", "{"), ErrorKind::InvalidArgument, "not valid JSON");

    style.set_root_property_json("light", "null").unwrap();
    style.set_root_property_json("transition", "null").unwrap();
    assert_eq!(root_property(&style, "light"), None);
    assert_eq!(root_property(&style, "transition").as_deref(), Some(r#"{"duration":300}"#));
    assert!(!style.transition_options().enable_placement_transitions);
}

#[test]
fn the_sky_and_the_projection_change_and_reset() {
    let mut style = loaded_style();
    assert_eq!(root_property(&style, "sky"), None);
    assert_eq!(root_property(&style, "projection"), None);

    style.set_root_property_json("sky", r##"{"sky-color":"#ff0000","atmosphere-blend":0.5}"##).unwrap();
    assert_eq!(
        root_property(&style, "sky").as_deref(),
        Some(r#"{"sky-color":["rgba",255.0,0.0,0.0,1.0],"atmosphere-blend":0.5}"#)
    );
    style.set_root_property_json("projection", r#"{"type":"globe"}"#).unwrap();
    assert_eq!(root_property(&style, "projection").as_deref(), Some(r#"{"type":"globe"}"#));
    assert_eq!(
        style.projection().evaluate(0.0),
        crate::types::ProjectionDefinition::new(crate::types::ProjectionType::VerticalPerspective)
    );

    assert_fails(
        style.set_root_property_json("projection", r#"{"type":"cylinder"}"#),
        ErrorKind::InvalidArgument,
        r#"style root property "projection""#,
    );
    assert_fails(
        style.set_root_property_json("sky", r#"{"sky-color":7}"#),
        ErrorKind::InvalidArgument,
        r#"style root property "sky""#,
    );
    assert_eq!(root_property(&style, "projection").as_deref(), Some(r#"{"type":"globe"}"#));

    style.set_root_property_json("sky", "null").unwrap();
    style.set_root_property_json("projection", "null").unwrap();
    assert!(style.sky().is_none());
    assert_eq!(root_property(&style, "projection"), None);
}

#[test]
fn a_registered_projection_reads_back_by_its_name() {
    let mut style = loaded_style();
    style.set_root_property_json("projection", r#"{"type":"EPSG:3413"}"#).unwrap();
    assert_eq!(root_property(&style, "projection").as_deref(), Some(r#"{"type":"EPSG:3413"}"#));
    assert_eq!(style.projection().registered_name(), Some("EPSG:3413"));

    style.set_root_property_json("projection", r#"{"type":"mercator"}"#).unwrap();
    assert_eq!(root_property(&style, "projection").as_deref(), Some(r#"{"type":"mercator"}"#));
    assert_eq!(style.projection().registered_name(), None);
}

#[test]
fn the_projection_reads_the_global_state() {
    use crate::types::{ProjectionDefinition, ProjectionType};
    let globe = ProjectionDefinition::new(ProjectionType::VerticalPerspective);
    let mercator = ProjectionDefinition::new(ProjectionType::Mercator);
    let mut style = Style::new(StyleRegistry::with_builtins());
    style.load_json(
        r#"{"version":8,"sources":{},"layers":[],
            "state":{"projectionType":{"default":"vertical-perspective"},"theme":{"default":"light"}},
            "projection":{"type":["global-state","projectionType"]}}"#,
    );
    assert_eq!(style.projection().evaluate(0.0), globe);

    let before = Arc::clone(style.projection());
    style.set_global_state_property_json("projectionType", r#""mercator""#).unwrap();
    assert_eq!(style.projection().evaluate(0.0), mercator);
    assert!(!Arc::ptr_eq(&before, style.projection()), "a new projection, for the map to notice");

    let before = Arc::clone(style.projection());
    style.set_global_state_property_json("theme", r#""dark""#).unwrap();
    assert!(Arc::ptr_eq(&before, style.projection()), "a property the projection doesn't read");

    style.set_global_state_property_json("projectionType", "null").unwrap();
    assert_eq!(style.projection().evaluate(0.0), globe);

    style.set_global_state_property_json("projectionType", r#""mercator""#).unwrap();
    style.set_root_property_json("projection", r#"{"type":["global-state","projectionType"]}"#).unwrap();
    assert_eq!(style.projection().evaluate(0.0), mercator);

    style.set_root_property_json("state", r#"{"projectionType":{"default":"vertical-perspective"}}"#).unwrap();
    assert_eq!(style.projection().evaluate(0.0), globe);
}

#[test]
fn the_terrain_changes_resets_and_reads_back() {
    let dem_style = |terrain: &str| {
        format!(
            r#"{{"version":8,"sources":{{"dem":{DEM_SOURCE},"points":{EMPTY_GEOJSON_SOURCE}}},"layers":[],"terrain":{terrain}}}"#
        )
    };
    let mut style = Style::new(StyleRegistry::with_builtins());
    style.load_json(&dem_style(r#"{"source":"dem"}"#));
    assert_eq!(root_property(&style, "terrain").as_deref(), Some(r#"{"source":"dem","exaggeration":1.0}"#));
    style.load_json(&dem_style(r#"{"source":"dem","exaggeration":0.3}"#));
    assert_eq!(root_property(&style, "terrain").as_deref(), Some(r#"{"source":"dem","exaggeration":0.3}"#));

    style.set_root_property_json("terrain", r#"{"source":"dem","exaggeration":2.5}"#).unwrap();
    assert_eq!(root_property(&style, "terrain").as_deref(), Some(r#"{"source":"dem","exaggeration":2.5}"#));
    for (json, message) in [
        (r#"{"source":"points"}"#, "not a raster-dem source"),
        (r#"{"exaggeration":2}"#, "must have a source"),
        (r#"{"source":3}"#, "source must be a string"),
        (r#"{"source":"dem","exaggeration":"high"}"#, "exaggeration must be a number"),
        (r#"{"source":"dem","exaggeration":-1}"#, "exaggeration must be at least 0"),
        ("[]", "terrain must be an object"),
    ] {
        assert_fails(style.set_root_property_json("terrain", json), ErrorKind::InvalidArgument, message);
    }
    assert_eq!(root_property(&style, "terrain").as_deref(), Some(r#"{"source":"dem","exaggeration":2.5}"#));

    style.set_root_property_json("terrain", "null").unwrap();
    assert_eq!(root_property(&style, "terrain"), None);

    // A terrain that the style dropped as it loaded doesn't read back.
    style.load_json(&dem_style(r#"{"source":"points"}"#));
    assert_eq!(root_property(&style, "terrain"), None);
}

#[test]
fn a_new_state_resets_every_global_state_property() {
    let mut style = Style::new(StyleRegistry::with_builtins());
    style.load_json(r#"{"version":8,"sources":{},"layers":[],"state":{"theme":{"default":"light"}}}"#);
    assert_eq!(root_property(&style, "state").as_deref(), Some(r#"{"theme":{"default":"light"}}"#));
    style.set_global_state_property_json("theme", r#""dark""#).unwrap();

    style.set_root_property_json("state", r#"{"theme":{"default":"sepia"},"scale":{"default":2}}"#).unwrap();
    assert_eq!(style.global_state_json(), r#"{"scale":2,"theme":"sepia"}"#);
    assert_eq!(
        root_property(&style, "state").as_deref(),
        Some(r#"{"scale":{"default":2},"theme":{"default":"sepia"}}"#)
    );
    assert_fails(
        style.set_root_property_json("state", r#"{"theme":"sepia"}"#),
        ErrorKind::InvalidArgument,
        r#"state property "theme" must be an object"#,
    );

    style.set_root_property_json("state", "null").unwrap();
    assert_eq!(root_property(&style, "state"), None);
    assert_eq!(style.global_state_json(), "{}");
}

#[test]
fn other_root_properties_read_as_loaded_and_reject_changes() {
    let mut style = Style::new(StyleRegistry::with_builtins());
    style.load_json(r#"{"version":8,"name":"plain","sources":{},"layers":[],"zoom":3}"#);
    assert_eq!(root_property(&style, "version").as_deref(), Some("8"));
    assert_eq!(root_property(&style, "name").as_deref(), Some(r#""plain""#));
    assert_eq!(root_property(&style, "zoom").as_deref(), Some("3"));
    assert_eq!(root_property(&style, "sprite"), None);

    for (name, value) in [("zoom", "4"), ("sprite", r#""sprite""#), ("glyphs", r#""{fontstack}""#)] {
        assert_fails(style.set_root_property_json(name, value), ErrorKind::Unsupported, &format!("\"{name}\""));
    }
    assert_eq!(root_property(&style, "zoom").as_deref(), Some("3"));

    for name in ["layers", "sources", "Light", "fog"] {
        assert_fails(style.set_root_property_json(name, "{}"), ErrorKind::InvalidArgument, "not a style root property");
        assert_fails(style.root_property_json(name), ErrorKind::InvalidArgument, "not a style root property");
    }
}