mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibWeb: Add Contrast preference
This commit is contained in:
parent
7ac6fd2746
commit
ee64684565
Notes:
sideshowbarker
2024-07-17 16:42:19 +09:00
Author: https://github.com/lukewarlow 🔰
Commit: ee64684565
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/146
Reviewed-by: https://github.com/AtkinsSJ
26 changed files with 274 additions and 13 deletions
37
Userland/Libraries/LibWeb/CSS/PreferredContrast.cpp
Normal file
37
Userland/Libraries/LibWeb/CSS/PreferredContrast.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2024, the Ladybird developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/CSS/PreferredContrast.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
PreferredContrast preferred_contrast_from_string(StringView value)
|
||||
{
|
||||
if (value.equals_ignoring_ascii_case("less"sv))
|
||||
return PreferredContrast::Less;
|
||||
if (value.equals_ignoring_ascii_case("more"sv))
|
||||
return PreferredContrast::More;
|
||||
if (value.equals_ignoring_ascii_case("no-preference"sv))
|
||||
return PreferredContrast::NoPreference;
|
||||
return PreferredContrast::Auto;
|
||||
}
|
||||
|
||||
StringView preferred_contrast_to_string(PreferredContrast value)
|
||||
{
|
||||
switch (value) {
|
||||
case PreferredContrast::Auto:
|
||||
return "auto"sv;
|
||||
case PreferredContrast::Less:
|
||||
return "less"sv;
|
||||
case PreferredContrast::More:
|
||||
return "more"sv;
|
||||
case PreferredContrast::NoPreference:
|
||||
return "no-preference"sv;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue