Bump euclid to 0.22

- Also updates raqote to latest with an upgrade of font-kit to 0.11
  applied on as a patch
- Update lyon_geom to the latest version

Major change:

- All matrices are now stored in row major order. This means that
  parameters to rotation functions no longer should be negated.
- `post_...()` functions are now named `then()`. `pre_transform()` is removed,
  so `then()` is used and the order of operations changed.
This commit is contained in:
Martin Robinson 2023-01-16 17:46:27 +01:00
parent 4f355f5877
commit 423cc34cb0
56 changed files with 233 additions and 220 deletions

View file

@ -18,7 +18,7 @@ atomic_refcell = "0.1"
bitflags = "1.0"
canvas_traits = { path = "../canvas_traits" }
embedder_traits = { path = "../embedder_traits" }
euclid = "0.20"
euclid = "0.22"
fnv = "1.0"
gfx = { path = "../gfx" }
gfx_traits = { path = "../gfx_traits" }

View file

@ -834,7 +834,7 @@ impl Fragment {
index,
);
if placement.tile_size.is_empty_or_negative() {
if placement.tile_size.is_empty() {
return;
}
@ -2321,7 +2321,7 @@ impl BlockFlow {
.fragment
.perspective_matrix(&border_box)
.unwrap_or(LayoutTransform::identity());
let transform = transform.pre_transform(&perspective).inverse();
let transform = perspective.then(&transform).inverse();
let origin = border_box.origin;
let transform_clip = |clip: Rect<Au>| {
@ -2346,7 +2346,7 @@ impl BlockFlow {
clip.size.height.to_f32_px(),
);
let clip = transform.transform_rect(&clip).unwrap();
let clip = transform.outer_transformed_rect(&clip).unwrap();
rect(
Au::from_f32_px(clip.origin.x),

View file

@ -204,7 +204,7 @@ impl DisplayItem {
),
(Some(t), None) => (t, ReferenceFrameKind::Transform),
(Some(t), Some(p)) => (
t.pre_transform(&p),
p.then(&t),
ReferenceFrameKind::Perspective {
scrolling_relative_to: None,
},

View file

@ -355,10 +355,10 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
.to_untyped();
let transformed_overflow = Overflow {
paint: f32_rect_to_au_rect(
transform_2d.transform_rect(&au_rect_to_f32_rect(overflow.paint)),
transform_2d.outer_transformed_rect(&au_rect_to_f32_rect(overflow.paint)),
),
scroll: f32_rect_to_au_rect(
transform_2d.transform_rect(&au_rect_to_f32_rect(overflow.scroll)),
transform_2d.outer_transformed_rect(&au_rect_to_f32_rect(overflow.scroll)),
),
};

View file

@ -3205,22 +3205,18 @@ impl Fragment {
.to_f32_px();
let transform_origin_z = transform_origin.depth.px();
let pre_transform = LayoutTransform::create_translation(
let pre_transform = LayoutTransform::translation(
transform_origin_x,
transform_origin_y,
transform_origin_z,
);
let post_transform = LayoutTransform::create_translation(
let post_transform = LayoutTransform::translation(
-transform_origin_x,
-transform_origin_y,
-transform_origin_z,
);
Some(
pre_transform
.pre_transform(&transform)
.pre_transform(&post_transform),
)
Some(post_transform.then(&transform).then(&pre_transform))
}
/// Returns the 4D matrix representing this fragment's perspective.
@ -3241,25 +3237,19 @@ impl Fragment {
)
.to_layout();
let pre_transform = LayoutTransform::create_translation(
perspective_origin.x,
perspective_origin.y,
0.0,
);
let post_transform = LayoutTransform::create_translation(
-perspective_origin.x,
-perspective_origin.y,
0.0,
);
let pre_transform =
LayoutTransform::translation(perspective_origin.x, perspective_origin.y, 0.0);
let post_transform =
LayoutTransform::translation(-perspective_origin.x, -perspective_origin.y, 0.0);
let perspective_matrix = LayoutTransform::from_untyped(
&transform::create_perspective_matrix(length.px()),
);
Some(
pre_transform
.pre_transform(&perspective_matrix)
.pre_transform(&post_transform),
post_transform
.then(&perspective_matrix)
.then(&pre_transform),
)
},
Perspective::None => None,

View file

@ -15,7 +15,7 @@ use crate::opaque_node::OpaqueNodeMethods;
use crate::sequential;
use crate::wrapper::LayoutNodeLayoutData;
use app_units::Au;
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
use euclid::default::{Box2D, Point2D, Rect, Size2D, Vector2D};
use euclid::Size2D as TypedSize2D;
use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
@ -532,7 +532,35 @@ impl FragmentBorderBoxIterator for UnioningFragmentScrollAreaIterator {
Point2D::new(left_margin, top_margin),
Size2D::new(right_margin, bottom_margin),
);
self.union_rect = self.union_rect.union(&margin).union(&padding);
// This is a workaround because euclid does not support unioning empty
// rectangles.
// TODO: The way that this iterator is calculating scroll area is very
// suspect and the code below is a workaround until it can be written
// in a better way.
self.union_rect = Box2D::new(
Point2D::new(
min(
padding.min_x(),
min(margin.min_x(), self.union_rect.min_x()),
),
min(
padding.min_y(),
min(margin.min_y(), self.union_rect.min_y()),
),
),
Point2D::new(
max(
padding.max_x(),
max(margin.max_x(), self.union_rect.max_x()),
),
max(
padding.max_y(),
max(margin.max_y(), self.union_rect.max_y()),
),
),
)
.to_rect();
},
None => {
self.level = Some(level);