mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00
LibWeb: Support translate3d
This commit is contained in:
parent
f099e2aa12
commit
e4db71c88b
Notes:
sideshowbarker
2024-07-18 04:46:35 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: e4db71c88b
Pull-request: https://github.com/SerenityOS/serenity/pull/15807
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/gmta
4 changed files with 36 additions and 1 deletions
|
@ -209,7 +209,11 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati
|
|||
auto value = [this, transformation](size_t index, Optional<CSS::Length const&> reference_length = {}) -> float {
|
||||
return transformation.values[index].visit(
|
||||
[this, reference_length](CSS::LengthPercentage const& value) {
|
||||
return value.resolved(m_box, reference_length.value()).to_px(m_box);
|
||||
if (reference_length.has_value()) {
|
||||
return value.resolved(m_box, reference_length.value()).to_px(m_box);
|
||||
}
|
||||
|
||||
return value.length().to_px(m_box);
|
||||
},
|
||||
[](CSS::Angle const& value) {
|
||||
return value.to_degrees() * static_cast<float>(M_DEG2RAD);
|
||||
|
@ -250,6 +254,12 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati
|
|||
0, 0, 1, 0,
|
||||
0, 0, 0, 1);
|
||||
break;
|
||||
case CSS::TransformFunction::Translate3d:
|
||||
return Gfx::FloatMatrix4x4(1, 0, 0, value(0, width),
|
||||
0, 1, 0, value(1, height),
|
||||
0, 0, 1, value(2),
|
||||
0, 0, 0, 1);
|
||||
break;
|
||||
case CSS::TransformFunction::TranslateX:
|
||||
if (count == 1)
|
||||
return Gfx::FloatMatrix4x4(1, 0, 0, value(0, width),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue