mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 23:59:49 +00:00
LibWeb: Parse and propagate touch-action CSS property
Co-authored-by: Sam Atkins <sam@ladybird.org>
This commit is contained in:
parent
b3713db4ab
commit
6cbb5d2785
Notes:
github-actions[bot]
2025-05-06 11:23:01 +00:00
Author: https://github.com/stravant 🔰
Commit: 6cbb5d2785
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3837
Reviewed-by: https://github.com/AtkinsSJ ✅
21 changed files with 364 additions and 19 deletions
|
@ -1580,6 +1580,54 @@ Isolation ComputedProperties::isolation() const
|
|||
return keyword_to_isolation(value.to_keyword()).release_value();
|
||||
}
|
||||
|
||||
TouchActionData ComputedProperties::touch_action() const
|
||||
{
|
||||
auto const& touch_action = property(PropertyID::TouchAction);
|
||||
if (touch_action.is_keyword()) {
|
||||
switch (touch_action.to_keyword()) {
|
||||
case Keyword::Auto:
|
||||
return TouchActionData {};
|
||||
case Keyword::None:
|
||||
return TouchActionData::none();
|
||||
case Keyword::Manipulation:
|
||||
return TouchActionData { .allow_other = false };
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
if (touch_action.is_value_list()) {
|
||||
TouchActionData touch_action_data = TouchActionData::none();
|
||||
for (auto const& value : touch_action.as_value_list().values()) {
|
||||
switch (value->as_keyword().keyword()) {
|
||||
case Keyword::PanX:
|
||||
touch_action_data.allow_right = true;
|
||||
touch_action_data.allow_left = true;
|
||||
break;
|
||||
case Keyword::PanLeft:
|
||||
touch_action_data.allow_left = true;
|
||||
break;
|
||||
case Keyword::PanRight:
|
||||
touch_action_data.allow_right = true;
|
||||
break;
|
||||
case Keyword::PanY:
|
||||
touch_action_data.allow_up = true;
|
||||
touch_action_data.allow_down = true;
|
||||
break;
|
||||
case Keyword::PanUp:
|
||||
touch_action_data.allow_up = true;
|
||||
break;
|
||||
case Keyword::PanDown:
|
||||
touch_action_data.allow_down = true;
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
return touch_action_data;
|
||||
}
|
||||
return TouchActionData {};
|
||||
}
|
||||
|
||||
Containment ComputedProperties::contain() const
|
||||
{
|
||||
Containment containment = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue