dymokomi/luce-browser-css
Source of release 0.5.1
0.5.1 / src / css_data / generated_media_feature_id.lucb
#==============================================================================================
#
# generated_media_feature_id - the CSS media features
#
# DESCRIPTION:
# Generated by tools/gen_css from data/css; do not edit. The C++ it stands for, at
# Ladybird 47c82b38d0, is written by Meta/Generators/generate_libweb_css_media_feature_id.py
# from MediaFeatures.json:
#
# Build/Libraries/LibWeb/CSS/MediaFeatureID.h
# Build/Libraries/LibWeb/CSS/MediaFeatureID.cpp
#
# Copyright (c) 2018-2026, the Ladybird developers.
# Copyright (c) 2026 the luce-browser authors.
# SPDX-License-Identifier: BSD-2-Clause (see LICENSE)
#
#==============================================================================================
## Web::CSS::MediaFeatureValueType (Build/Libraries/LibWeb/CSS/MediaFeatureID.h).
pub enum MediaFeatureValueType as i32:
boolean = 0
integer = 1
length = 2
ratio = 3
resolution = 4
## Web::CSS::MediaFeatureID (Build/Libraries/LibWeb/CSS/MediaFeatureID.h).
pub enum MediaFeatureId as u8:
any_hover = 0
any_pointer = 1
aspect_ratio = 2
color = 3
color_gamut = 4
color_index = 5
device_aspect_ratio = 6
device_height = 7
device_width = 8
display_mode = 9
dynamic_range = 10
environment_blending = 11
forced_colors = 12
grid = 13
height = 14
horizontal_viewport_segments = 15
hover = 16
inverted_colors = 17
monochrome = 18
nav_controls = 19
orientation = 20
overflow_block = 21
overflow_inline = 22
pointer = 23
prefers_color_scheme = 24
prefers_contrast = 25
prefers_reduced_data = 26
prefers_reduced_motion = 27
prefers_reduced_transparency = 28
resolution = 29
scan = 30
scripting = 31
update = 32
vertical_viewport_segments = 33
video_color_gamut = 34
video_dynamic_range = 35
width = 36
## Ported from Build/Libraries/LibWeb/CSS/MediaFeatureID.cpp Web::CSS::media_feature_id_from_string.
pub func media_feature_id_from_string(string: ak.StringView) -> MediaFeatureId?:
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("any-hover")):
return MediaFeatureId.any_hover
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("any-pointer")):
return MediaFeatureId.any_pointer
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("aspect-ratio")):
return MediaFeatureId.aspect_ratio
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("color")):
return MediaFeatureId.color
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("color-gamut")):
return MediaFeatureId.color_gamut
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("color-index")):
return MediaFeatureId.color_index
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("device-aspect-ratio")):
return MediaFeatureId.device_aspect_ratio
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("device-height")):
return MediaFeatureId.device_height
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("device-width")):
return MediaFeatureId.device_width
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("display-mode")):
return MediaFeatureId.display_mode
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("dynamic-range")):
return MediaFeatureId.dynamic_range
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("environment-blending")):
return MediaFeatureId.environment_blending
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("forced-colors")):
return MediaFeatureId.forced_colors
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("grid")):
return MediaFeatureId.grid
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("height")):
return MediaFeatureId.height
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("horizontal-viewport-segments")):
return MediaFeatureId.horizontal_viewport_segments
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("hover")):
return MediaFeatureId.hover
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("inverted-colors")):
return MediaFeatureId.inverted_colors
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("monochrome")):
return MediaFeatureId.monochrome
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("nav-controls")):
return MediaFeatureId.nav_controls
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("orientation")):
return MediaFeatureId.orientation
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("overflow-block")):
return MediaFeatureId.overflow_block
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("overflow-inline")):
return MediaFeatureId.overflow_inline
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("pointer")):
return MediaFeatureId.pointer
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("prefers-color-scheme")):
return MediaFeatureId.prefers_color_scheme
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("prefers-contrast")):
return MediaFeatureId.prefers_contrast
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("prefers-reduced-data")):
return MediaFeatureId.prefers_reduced_data
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("prefers-reduced-motion")):
return MediaFeatureId.prefers_reduced_motion
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("prefers-reduced-transparency")):
return MediaFeatureId.prefers_reduced_transparency
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("resolution")):
return MediaFeatureId.resolution
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("scan")):
return MediaFeatureId.scan
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("scripting")):
return MediaFeatureId.scripting
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("update")):
return MediaFeatureId.update
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("vertical-viewport-segments")):
return MediaFeatureId.vertical_viewport_segments
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("video-color-gamut")):
return MediaFeatureId.video_color_gamut
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("video-dynamic-range")):
return MediaFeatureId.video_dynamic_range
if ak.string_view_equals_ignoring_ascii_case(&string, ak.sv("width")):
return MediaFeatureId.width
return none
## Ported from Build/Libraries/LibWeb/CSS/MediaFeatureID.cpp Web::CSS::string_from_media_feature_id.
pub func string_from_media_feature_id(media_feature_id: MediaFeatureId) -> ak.StringView:
match media_feature_id:
.any_hover: return ak.sv("any-hover")
.any_pointer: return ak.sv("any-pointer")
.aspect_ratio: return ak.sv("aspect-ratio")
.color: return ak.sv("color")
.color_gamut: return ak.sv("color-gamut")
.color_index: return ak.sv("color-index")
.device_aspect_ratio: return ak.sv("device-aspect-ratio")
.device_height: return ak.sv("device-height")
.device_width: return ak.sv("device-width")
.display_mode: return ak.sv("display-mode")
.dynamic_range: return ak.sv("dynamic-range")
.environment_blending: return ak.sv("environment-blending")
.forced_colors: return ak.sv("forced-colors")
.grid: return ak.sv("grid")
.height: return ak.sv("height")
.horizontal_viewport_segments: return ak.sv("horizontal-viewport-segments")
.hover: return ak.sv("hover")
.inverted_colors: return ak.sv("inverted-colors")
.monochrome: return ak.sv("monochrome")
.nav_controls: return ak.sv("nav-controls")
.orientation: return ak.sv("orientation")
.overflow_block: return ak.sv("overflow-block")
.overflow_inline: return ak.sv("overflow-inline")
.pointer: return ak.sv("pointer")
.prefers_color_scheme: return ak.sv("prefers-color-scheme")
.prefers_contrast: return ak.sv("prefers-contrast")
.prefers_reduced_data: return ak.sv("prefers-reduced-data")
.prefers_reduced_motion: return ak.sv("prefers-reduced-motion")
.prefers_reduced_transparency: return ak.sv("prefers-reduced-transparency")
.resolution: return ak.sv("resolution")
.scan: return ak.sv("scan")
.scripting: return ak.sv("scripting")
.update: return ak.sv("update")
.vertical_viewport_segments: return ak.sv("vertical-viewport-segments")
.video_color_gamut: return ak.sv("video-color-gamut")
.video_dynamic_range: return ak.sv("video-dynamic-range")
.width: return ak.sv("width")
_: trap("VERIFY_NOT_REACHED")
## Ported from Build/Libraries/LibWeb/CSS/MediaFeatureID.cpp Web::CSS::media_feature_type_is_range.
pub func media_feature_type_is_range(media_feature_id: MediaFeatureId) -> bool:
match media_feature_id:
.any_hover: return false
.any_pointer: return false
.aspect_ratio: return true
.color: return true
.color_gamut: return false
.color_index: return true
.device_aspect_ratio: return true
.device_height: return true
.device_width: return true
.display_mode: return false
.dynamic_range: return false
.environment_blending: return false
.forced_colors: return false
.grid: return false
.height: return true
.horizontal_viewport_segments: return true
.hover: return false
.inverted_colors: return false
.monochrome: return true
.nav_controls: return false
.orientation: return false
.overflow_block: return false
.overflow_inline: return false
.pointer: return false
.prefers_color_scheme: return false
.prefers_contrast: return false
.prefers_reduced_data: return false
.prefers_reduced_motion: return false
.prefers_reduced_transparency: return false
.resolution: return true
.scan: return false
.scripting: return false
.update: return false
.vertical_viewport_segments: return true
.video_color_gamut: return false
.video_dynamic_range: return false
.width: return true
_: trap("VERIFY_NOT_REACHED")
## Ported from Build/Libraries/LibWeb/CSS/MediaFeatureID.cpp Web::CSS::media_feature_accepts_type.
pub func media_feature_accepts_type(media_feature_id: MediaFeatureId, value_type: MediaFeatureValueType) -> bool:
match media_feature_id:
.any_hover:
return false
.any_pointer:
return false
.aspect_ratio:
match value_type:
.ratio: return true
_: return false
.color:
match value_type:
.integer: return true
_: return false
.color_gamut:
return false
.color_index:
match value_type:
.integer: return true
_: return false
.device_aspect_ratio:
match value_type:
.ratio: return true
_: return false
.device_height:
match value_type:
.length: return true
_: return false
.device_width:
match value_type:
.length: return true
_: return false
.display_mode:
return false
.dynamic_range:
return false
.environment_blending:
return false
.forced_colors:
return false
.grid:
match value_type:
.boolean: return true
_: return false
.height:
match value_type:
.length: return true
_: return false
.horizontal_viewport_segments:
match value_type:
.integer: return true
_: return false
.hover:
return false
.inverted_colors:
return false
.monochrome:
match value_type:
.integer: return true
_: return false
.nav_controls:
return false
.orientation:
return false
.overflow_block:
return false
.overflow_inline:
return false
.pointer:
return false
.prefers_color_scheme:
return false
.prefers_contrast:
return false
.prefers_reduced_data:
return false
.prefers_reduced_motion:
return false
.prefers_reduced_transparency:
return false
.resolution:
match value_type:
.resolution: return true
_: return false
.scan:
return false
.scripting:
return false
.update:
return false
.vertical_viewport_segments:
match value_type:
.integer: return true
_: return false
.video_color_gamut:
return false
.video_dynamic_range:
return false
.width:
match value_type:
.length: return true
_: return false
_: trap("VERIFY_NOT_REACHED")
## Ported from Build/Libraries/LibWeb/CSS/MediaFeatureID.cpp Web::CSS::media_feature_accepts_keyword.
pub func media_feature_accepts_keyword(media_feature_id: MediaFeatureId, keyword: Keyword) -> bool:
match media_feature_id:
.any_hover:
match keyword:
.none_: return true
.hover: return true
_: return false
.any_pointer:
match keyword:
.none_: return true
.coarse: return true
.fine: return true
_: return false
.aspect_ratio:
return false
.color:
return false
.color_gamut:
match keyword:
.srgb: return true
.p3: return true
.rec2020: return true
_: return false
.color_index:
return false
.device_aspect_ratio:
return false
.device_height:
return false
.device_width:
return false
.display_mode:
match keyword:
.fullscreen: return true
.standalone: return true
.minimal_ui: return true
.browser: return true
.picture_in_picture: return true
_: return false
.dynamic_range:
match keyword:
.standard: return true
.high: return true
_: return false
.environment_blending:
match keyword:
.opaque: return true
.additive: return true
.subtractive: return true
_: return false
.forced_colors:
match keyword:
.none_: return true
.active: return true
_: return false
.grid:
return false
.height:
return false
.horizontal_viewport_segments:
return false
.hover:
match keyword:
.none_: return true
.hover: return true
_: return false
.inverted_colors:
match keyword:
.none_: return true
.inverted: return true
_: return false
.monochrome:
return false
.nav_controls:
match keyword:
.none_: return true
.back: return true
_: return false
.orientation:
match keyword:
.portrait: return true
.landscape: return true
_: return false
.overflow_block:
match keyword:
.none_: return true
.scroll: return true
.paged: return true
_: return false
.overflow_inline:
match keyword:
.none_: return true
.scroll: return true
_: return false
.pointer:
match keyword:
.none_: return true
.coarse: return true
.fine: return true
_: return false
.prefers_color_scheme:
match keyword:
.light: return true
.dark: return true
_: return false
.prefers_contrast:
match keyword:
.no_preference: return true
.less: return true
.more: return true
.custom: return true
_: return false
.prefers_reduced_data:
match keyword:
.no_preference: return true
.reduce: return true
_: return false
.prefers_reduced_motion:
match keyword:
.no_preference: return true
.reduce: return true
_: return false
.prefers_reduced_transparency:
match keyword:
.no_preference: return true
.reduce: return true
_: return false
.resolution:
match keyword:
.infinite: return true
_: return false
.scan:
match keyword:
.interlace: return true
.progressive: return true
_: return false
.scripting:
match keyword:
.none_: return true
.initial_only: return true
.enabled: return true
_: return false
.update:
match keyword:
.none_: return true
.slow: return true
.fast: return true
_: return false
.vertical_viewport_segments:
return false
.video_color_gamut:
match keyword:
.srgb: return true
.p3: return true
.rec2020: return true
_: return false
.video_dynamic_range:
match keyword:
.standard: return true
.high: return true
_: return false
.width:
return false
_: trap("VERIFY_NOT_REACHED")
## Ported from Build/Libraries/LibWeb/CSS/MediaFeatureID.cpp Web::CSS::media_feature_keyword_is_falsey.
pub func media_feature_keyword_is_falsey(media_feature_id: MediaFeatureId, keyword: Keyword) -> bool:
match media_feature_id:
.any_hover:
match keyword:
.none_: return true
_: return false
.any_pointer:
match keyword:
.none_: return true
_: return false
.dynamic_range:
match keyword:
.standard: return true
.high: return true
_: return false
.forced_colors:
match keyword:
.none_: return true
_: return false
.hover:
match keyword:
.none_: return true
_: return false
.inverted_colors:
match keyword:
.none_: return true
_: return false
.nav_controls:
match keyword:
.none_: return true
_: return false
.overflow_block:
match keyword:
.none_: return true
_: return false
.overflow_inline:
match keyword:
.none_: return true
_: return false
.pointer:
match keyword:
.none_: return true
_: return false
.prefers_contrast:
match keyword:
.no_preference: return true
_: return false
.prefers_reduced_data:
match keyword:
.no_preference: return true
_: return false
.prefers_reduced_motion:
match keyword:
.no_preference: return true
_: return false
.prefers_reduced_transparency:
match keyword:
.no_preference: return true
_: return false
.scan:
match keyword:
.none_: return true
_: return false
.scripting:
match keyword:
.none_: return true
_: return false
.update:
match keyword:
.none_: return true
_: return false
.video_dynamic_range:
match keyword:
.standard: return true
.high: return true
_: return false
_: return false