mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Bump euclid to 0.14.
This commit is contained in:
parent
5dce166266
commit
8617320500
88 changed files with 349 additions and 381 deletions
|
@ -14,7 +14,7 @@ app_units = "0.4.1"
|
|||
atomic_refcell = "0.1"
|
||||
bitflags = "0.7"
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
euclid = "0.13"
|
||||
euclid = "0.14.4"
|
||||
fnv = "1.0"
|
||||
gfx = {path = "../gfx"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
|
|
|
@ -1967,7 +1967,7 @@ impl Flow for BlockFlow {
|
|||
// flow w.r.t. the containing block.
|
||||
self.base
|
||||
.late_absolute_position_info
|
||||
.stacking_relative_position_of_absolute_containing_block + position_start
|
||||
.stacking_relative_position_of_absolute_containing_block + position_start.to_vector()
|
||||
};
|
||||
|
||||
if !self.base.writing_mode.is_vertical() {
|
||||
|
@ -2002,7 +2002,7 @@ impl Flow for BlockFlow {
|
|||
.stacking_relative_position_of_absolute_containing_block =
|
||||
self.base.stacking_relative_position +
|
||||
(border_box_origin + relative_offset).to_physical(self.base.writing_mode,
|
||||
container_size)
|
||||
container_size).to_vector()
|
||||
}
|
||||
|
||||
// Compute absolute position info for children.
|
||||
|
@ -2021,7 +2021,7 @@ impl Flow for BlockFlow {
|
|||
// `transform` set.) In this case, absolutely-positioned children will not be
|
||||
// positioned relative to us but will instead be positioned relative to our
|
||||
// containing block.
|
||||
position - self.base.stacking_relative_position
|
||||
position - self.base.stacking_relative_position.to_vector()
|
||||
}
|
||||
} else {
|
||||
self.base
|
||||
|
@ -2171,7 +2171,7 @@ impl Flow for BlockFlow {
|
|||
.early_absolute_position_info
|
||||
.relative_containing_block_mode,
|
||||
CoordinateSystem::Own)
|
||||
.translate(stacking_context_position));
|
||||
.translate(&stacking_context_position.to_vector()));
|
||||
}
|
||||
|
||||
fn mutate_fragments(&mut self, mutator: &mut FnMut(&mut Fragment)) {
|
||||
|
|
|
@ -14,7 +14,7 @@ use app_units::{AU_PER_PX, Au};
|
|||
use block::{BlockFlow, BlockStackingContextType};
|
||||
use canvas_traits::{CanvasData, CanvasMsg, FromLayoutMsg};
|
||||
use context::LayoutContext;
|
||||
use euclid::{Matrix4D, Point2D, Rect, SideOffsets2D, Size2D, TypedSize2D};
|
||||
use euclid::{Transform3D, Point2D, Vector2D, Rect, SideOffsets2D, Size2D, TypedSize2D};
|
||||
use flex::FlexFlow;
|
||||
use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
|
||||
use flow_ref::FlowRef;
|
||||
|
@ -1223,8 +1223,8 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
|
||||
// This is the vector between the center and the ending point; i.e. half
|
||||
// of the distance between the starting point and the ending point.
|
||||
let delta = Point2D::new(Au::from_f32_px(dir.x * inv_dir_length * line_length / 2.0),
|
||||
Au::from_f32_px(dir.y * inv_dir_length * line_length / 2.0));
|
||||
let delta = Vector2D::new(Au::from_f32_px(dir.x * inv_dir_length * line_length / 2.0),
|
||||
Au::from_f32_px(dir.y * inv_dir_length * line_length / 2.0));
|
||||
|
||||
// This is the length of the gradient line.
|
||||
let length = Au::from_f32_px(
|
||||
|
@ -1347,8 +1347,8 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
// NB: According to CSS-BACKGROUNDS, box shadows render in *reverse* order (front to back).
|
||||
for box_shadow in style.get_effects().box_shadow.0.iter().rev() {
|
||||
let bounds =
|
||||
shadow_bounds(&absolute_bounds.translate(&Point2D::new(box_shadow.offset_x,
|
||||
box_shadow.offset_y)),
|
||||
shadow_bounds(&absolute_bounds.translate(&Vector2D::new(box_shadow.offset_x,
|
||||
box_shadow.offset_y)),
|
||||
box_shadow.blur_radius,
|
||||
box_shadow.spread_radius);
|
||||
|
||||
|
@ -1362,7 +1362,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
base: base,
|
||||
box_bounds: *absolute_bounds,
|
||||
color: style.resolve_color(box_shadow.color).to_gfx_color(),
|
||||
offset: Point2D::new(box_shadow.offset_x, box_shadow.offset_y),
|
||||
offset: Vector2D::new(box_shadow.offset_x, box_shadow.offset_y),
|
||||
blur_radius: box_shadow.blur_radius,
|
||||
spread_radius: box_shadow.spread_radius,
|
||||
border_radius: model::specified_border_radius(style.get_border()
|
||||
|
@ -1999,9 +1999,9 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
// First, compute the offset of our border box (including relative positioning)
|
||||
// from our flow origin, since that is what `BaseFlow::overflow` is relative to.
|
||||
let border_box_offset =
|
||||
border_box.translate(&-base_flow.stacking_relative_position).origin;
|
||||
border_box.translate(&-base_flow.stacking_relative_position.to_vector()).origin;
|
||||
// Then, using that, compute our overflow region relative to our border box.
|
||||
let overflow = base_flow.overflow.paint.translate(&-border_box_offset);
|
||||
let overflow = base_flow.overflow.paint.translate(&-border_box_offset.to_vector());
|
||||
|
||||
// Create the filter pipeline.
|
||||
let effects = self.style().get_effects();
|
||||
|
@ -2046,7 +2046,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
} else {
|
||||
self.style().get_color().color
|
||||
};
|
||||
let offset = text_shadow.map(|s| Point2D::new(s.offset_x, s.offset_y)).unwrap_or_else(Point2D::zero);
|
||||
let offset = text_shadow.map(|s| Vector2D::new(s.offset_x, s.offset_y)).unwrap_or_else(Vector2D::zero);
|
||||
let shadow_blur_radius = text_shadow.map(|s| s.blur_radius).unwrap_or(Au(0));
|
||||
|
||||
// Determine the orientation and cursor to use.
|
||||
|
@ -2068,7 +2068,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
LogicalPoint::new(self.style.writing_mode,
|
||||
Au(0),
|
||||
metrics.ascent).to_physical(self.style.writing_mode,
|
||||
container_size);
|
||||
container_size).to_vector();
|
||||
|
||||
// Create the text display item.
|
||||
let base = state.create_base_display_item(&stacking_relative_content_box,
|
||||
|
@ -2158,7 +2158,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
base: base,
|
||||
box_bounds: stacking_relative_box,
|
||||
color: color.to_gfx_color(),
|
||||
offset: Point2D::zero(),
|
||||
offset: Vector2D::zero(),
|
||||
blur_radius: blur_radius,
|
||||
spread_radius: Au(0),
|
||||
border_radius: Au(0),
|
||||
|
@ -2300,7 +2300,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
};
|
||||
|
||||
let perspective = self.fragment.perspective_matrix(&border_box)
|
||||
.unwrap_or_else(Matrix4D::identity);
|
||||
.unwrap_or_else(Transform3D::identity);
|
||||
let transform = transform.pre_mul(&perspective).inverse();
|
||||
|
||||
let origin = &border_box.origin;
|
||||
|
|
|
@ -29,7 +29,7 @@ use app_units::Au;
|
|||
use block::{BlockFlow, FormattingContextType};
|
||||
use context::LayoutContext;
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use euclid::{Matrix4D, Point2D, Rect, Size2D};
|
||||
use euclid::{Transform3D, Point2D, Rect, Size2D};
|
||||
use flex::FlexFlow;
|
||||
use floats::{Floats, SpeculatedFloatPlacement};
|
||||
use flow_list::{FlowList, MutFlowListIterator};
|
||||
|
@ -260,7 +260,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
|||
match self.class() {
|
||||
FlowClass::Block | FlowClass::TableCaption | FlowClass::TableCell => {}
|
||||
_ => {
|
||||
overflow.translate(&position.origin);
|
||||
overflow.translate(&position.origin.to_vector());
|
||||
return overflow;
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
|||
|
||||
if !self.as_block().fragment.establishes_stacking_context() ||
|
||||
self.as_block().fragment.style.get_box().transform.0.is_none() {
|
||||
overflow.translate(&position.origin);
|
||||
overflow.translate(&position.origin.to_vector());
|
||||
return overflow;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
|||
let transform_2d = self.as_block()
|
||||
.fragment
|
||||
.transform_matrix(&position)
|
||||
.unwrap_or(Matrix4D::identity())
|
||||
.unwrap_or(Transform3D::identity())
|
||||
.to_2d();
|
||||
let transformed_overflow = Overflow {
|
||||
paint: f32_rect_to_au_rect(transform_2d.transform_rect(
|
||||
|
@ -308,7 +308,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
|||
// unnecessary once we are taking into account 3D transformations above.
|
||||
overflow.union(&transformed_overflow);
|
||||
|
||||
overflow.translate(&position.origin);
|
||||
overflow.translate(&position.origin.to_vector());
|
||||
overflow
|
||||
}
|
||||
|
||||
|
@ -917,7 +917,7 @@ pub struct BaseFlow {
|
|||
|
||||
/// The position of this flow relative to the start of the nearest ancestor stacking context.
|
||||
/// This is computed during the top-down pass of display list construction.
|
||||
pub stacking_relative_position: Point2D<Au>,
|
||||
pub stacking_relative_position: Point2D<Au>, // TODO: this should be a Vector2D<Au>
|
||||
|
||||
/// Details about descendants with position 'absolute' or 'fixed' for which we are the
|
||||
/// containing block. This is in tree order. This includes any direct children.
|
||||
|
|
|
@ -10,7 +10,7 @@ use StyleArc;
|
|||
use app_units::Au;
|
||||
use canvas_traits::CanvasMsg;
|
||||
use context::{LayoutContext, with_thread_local_font_context};
|
||||
use euclid::{Matrix4D, Point2D, Radians, Rect, Size2D};
|
||||
use euclid::{Transform3D, Point2D, Vector2D, Radians, Rect, Size2D};
|
||||
use floats::ClearType;
|
||||
use flow::{self, ImmutableFlowUtils};
|
||||
use flow_ref::FlowRef;
|
||||
|
@ -2440,7 +2440,7 @@ impl Fragment {
|
|||
// this.
|
||||
let relative_position = self.relative_position(relative_containing_block_size);
|
||||
border_box.translate_by_size(&relative_position.to_physical(self.style.writing_mode))
|
||||
.translate(stacking_relative_flow_origin)
|
||||
.translate(&stacking_relative_flow_origin.to_vector())
|
||||
}
|
||||
|
||||
/// Given the stacking-context-relative border box, returns the stacking-context-relative
|
||||
|
@ -2551,7 +2551,7 @@ impl Fragment {
|
|||
|
||||
// Box shadows cause us to draw outside our border box.
|
||||
for box_shadow in &self.style().get_effects().box_shadow.0 {
|
||||
let offset = Point2D::new(box_shadow.offset_x, box_shadow.offset_y);
|
||||
let offset = Vector2D::new(box_shadow.offset_x, box_shadow.offset_y);
|
||||
let inflation = box_shadow.spread_radius + box_shadow.blur_radius *
|
||||
BLUR_INFLATION_FACTOR;
|
||||
overflow.paint = overflow.paint.union(&border_box.translate(&offset)
|
||||
|
@ -2842,13 +2842,13 @@ impl Fragment {
|
|||
}
|
||||
|
||||
/// Returns the 4D matrix representing this fragment's transform.
|
||||
pub fn transform_matrix(&self, stacking_relative_border_box: &Rect<Au>) -> Option<Matrix4D<f32>> {
|
||||
pub fn transform_matrix(&self, stacking_relative_border_box: &Rect<Au>) -> Option<Transform3D<f32>> {
|
||||
let operations = match self.style.get_box().transform.0 {
|
||||
None => return None,
|
||||
Some(ref operations) => operations,
|
||||
};
|
||||
|
||||
let mut transform = Matrix4D::identity();
|
||||
let mut transform = Transform3D::identity();
|
||||
let transform_origin = &self.style.get_box().transform_origin;
|
||||
let transform_origin_x =
|
||||
transform_origin.horizontal
|
||||
|
@ -2860,30 +2860,30 @@ impl Fragment {
|
|||
.to_f32_px();
|
||||
let transform_origin_z = transform_origin.depth.to_f32_px();
|
||||
|
||||
let pre_transform = Matrix4D::create_translation(transform_origin_x,
|
||||
transform_origin_y,
|
||||
transform_origin_z);
|
||||
let post_transform = Matrix4D::create_translation(-transform_origin_x,
|
||||
-transform_origin_y,
|
||||
-transform_origin_z);
|
||||
let pre_transform = Transform3D::create_translation(transform_origin_x,
|
||||
transform_origin_y,
|
||||
transform_origin_z);
|
||||
let post_transform = Transform3D::create_translation(-transform_origin_x,
|
||||
-transform_origin_y,
|
||||
-transform_origin_z);
|
||||
|
||||
for operation in operations {
|
||||
let matrix = match *operation {
|
||||
transform::ComputedOperation::Rotate(ax, ay, az, theta) => {
|
||||
let theta = 2.0f32 * f32::consts::PI - theta.radians();
|
||||
Matrix4D::create_rotation(ax, ay, az, Radians::new(theta))
|
||||
Transform3D::create_rotation(ax, ay, az, Radians::new(theta))
|
||||
}
|
||||
transform::ComputedOperation::Perspective(d) => {
|
||||
create_perspective_matrix(d)
|
||||
}
|
||||
transform::ComputedOperation::Scale(sx, sy, sz) => {
|
||||
Matrix4D::create_scale(sx, sy, sz)
|
||||
Transform3D::create_scale(sx, sy, sz)
|
||||
}
|
||||
transform::ComputedOperation::Translate(tx, ty, tz) => {
|
||||
let tx = tx.to_used_value(stacking_relative_border_box.size.width).to_f32_px();
|
||||
let ty = ty.to_used_value(stacking_relative_border_box.size.height).to_f32_px();
|
||||
let tz = tz.to_f32_px();
|
||||
Matrix4D::create_translation(tx, ty, tz)
|
||||
Transform3D::create_translation(tx, ty, tz)
|
||||
}
|
||||
transform::ComputedOperation::Matrix(m) => {
|
||||
m.to_gfx_matrix()
|
||||
|
@ -2893,14 +2893,14 @@ impl Fragment {
|
|||
unreachable!()
|
||||
}
|
||||
transform::ComputedOperation::Skew(theta_x, theta_y) => {
|
||||
Matrix4D::create_skew(Radians::new(theta_x.radians()),
|
||||
Transform3D::create_skew(Radians::new(theta_x.radians()),
|
||||
Radians::new(theta_y.radians()))
|
||||
}
|
||||
transform::ComputedOperation::InterpolateMatrix { .. } |
|
||||
transform::ComputedOperation::AccumulateMatrix { .. } => {
|
||||
// TODO: Convert InterpolateMatrix/AccmulateMatrix into a valid Matrix4D by
|
||||
// TODO: Convert InterpolateMatrix/AccmulateMatrix into a valid Transform3D by
|
||||
// the reference box.
|
||||
Matrix4D::identity()
|
||||
Transform3D::identity()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2911,7 +2911,7 @@ impl Fragment {
|
|||
}
|
||||
|
||||
/// Returns the 4D matrix representing this fragment's perspective.
|
||||
pub fn perspective_matrix(&self, stacking_relative_border_box: &Rect<Au>) -> Option<Matrix4D<f32>> {
|
||||
pub fn perspective_matrix(&self, stacking_relative_border_box: &Rect<Au>) -> Option<Transform3D<f32>> {
|
||||
match self.style().get_box().perspective {
|
||||
Either::First(length) => {
|
||||
let perspective_origin = self.style().get_box().perspective_origin;
|
||||
|
@ -2924,12 +2924,12 @@ impl Fragment {
|
|||
.to_used_value(stacking_relative_border_box.size.height)
|
||||
.to_f32_px());
|
||||
|
||||
let pre_transform = Matrix4D::create_translation(perspective_origin.x,
|
||||
perspective_origin.y,
|
||||
0.0);
|
||||
let post_transform = Matrix4D::create_translation(-perspective_origin.x,
|
||||
-perspective_origin.y,
|
||||
0.0);
|
||||
let pre_transform = Transform3D::create_translation(perspective_origin.x,
|
||||
perspective_origin.y,
|
||||
0.0);
|
||||
let post_transform = Transform3D::create_translation(-perspective_origin.x,
|
||||
-perspective_origin.y,
|
||||
0.0);
|
||||
|
||||
let perspective_matrix = create_perspective_matrix(length);
|
||||
|
||||
|
@ -3099,9 +3099,9 @@ impl Overflow {
|
|||
self.paint = self.paint.union(&other.paint);
|
||||
}
|
||||
|
||||
pub fn translate(&mut self, point: &Point2D<Au>) {
|
||||
self.scroll = self.scroll.translate(point);
|
||||
self.paint = self.paint.translate(point);
|
||||
pub fn translate(&mut self, by: &Vector2D<Au>) {
|
||||
self.scroll = self.scroll.translate(by);
|
||||
self.paint = self.paint.translate(by);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3184,11 +3184,11 @@ impl Serialize for DebugId {
|
|||
// and behaves as it does in other browsers.
|
||||
// See https://lists.w3.org/Archives/Public/www-style/2016Jan/0020.html for more details.
|
||||
#[inline]
|
||||
fn create_perspective_matrix(d: Au) -> Matrix4D<f32> {
|
||||
fn create_perspective_matrix(d: Au) -> Transform3D<f32> {
|
||||
let d = d.to_f32_px();
|
||||
if d <= 0.0 {
|
||||
Matrix4D::identity()
|
||||
Transform3D::identity()
|
||||
} else {
|
||||
Matrix4D::create_perspective(d)
|
||||
Transform3D::create_perspective(d)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1600,7 +1600,7 @@ impl Flow for InlineFlow {
|
|||
block_flow.base
|
||||
.late_absolute_position_info
|
||||
.stacking_relative_position_of_absolute_containing_block =
|
||||
stacking_relative_position + *padding_box_origin;
|
||||
stacking_relative_position + padding_box_origin.to_vector();
|
||||
}
|
||||
|
||||
block_flow.base.stacking_relative_position =
|
||||
|
@ -1633,7 +1633,7 @@ impl Flow for InlineFlow {
|
|||
block_flow.base
|
||||
.late_absolute_position_info
|
||||
.stacking_relative_position_of_absolute_containing_block =
|
||||
stacking_relative_position + *padding_box_origin;
|
||||
stacking_relative_position + padding_box_origin.to_vector();
|
||||
|
||||
block_flow.base.stacking_relative_position =
|
||||
stacking_relative_border_box.origin;
|
||||
|
@ -1694,7 +1694,7 @@ impl Flow for InlineFlow {
|
|||
relative_containing_block_size,
|
||||
relative_containing_block_mode,
|
||||
CoordinateSystem::Own)
|
||||
.translate(stacking_context_position))
|
||||
.translate(&stacking_context_position.to_vector()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ impl Flow for ListItemFlow {
|
|||
.early_absolute_position_info
|
||||
.relative_containing_block_mode,
|
||||
CoordinateSystem::Own)
|
||||
.translate(stacking_context_position));
|
||||
.translate(&stacking_context_position.to_vector()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#![deny(unsafe_code)]
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::{Matrix4D, SideOffsets2D, Size2D};
|
||||
use euclid::{Transform3D, SideOffsets2D, Size2D};
|
||||
use fragment::Fragment;
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
|
@ -509,12 +509,12 @@ pub fn specified_margin_from_style(style: &ServoComputedValues,
|
|||
}
|
||||
|
||||
pub trait ToGfxMatrix {
|
||||
fn to_gfx_matrix(&self) -> Matrix4D<f32>;
|
||||
fn to_gfx_matrix(&self) -> Transform3D<f32>;
|
||||
}
|
||||
|
||||
impl ToGfxMatrix for ComputedMatrix {
|
||||
fn to_gfx_matrix(&self) -> Matrix4D<f32> {
|
||||
Matrix4D::row_major(
|
||||
fn to_gfx_matrix(&self) -> Transform3D<f32> {
|
||||
Transform3D::row_major(
|
||||
self.m11 as f32, self.m12 as f32, self.m13 as f32, self.m14 as f32,
|
||||
self.m21 as f32, self.m22 as f32, self.m23 as f32, self.m24 as f32,
|
||||
self.m31 as f32, self.m32 as f32, self.m33 as f32, self.m34 as f32,
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
use app_units::Au;
|
||||
use construct::ConstructionResult;
|
||||
use context::LayoutContext;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
use euclid::size::Size2D;
|
||||
use euclid::{Point2D, Vector2D, Rect, Size2D};
|
||||
use flow::{self, Flow};
|
||||
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
|
||||
use gfx::display_list::{DisplayItemMetadata, DisplayList, OpaqueNode, ScrollOffsetMap};
|
||||
|
@ -613,7 +611,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
|
|||
|
||||
Some(ParentBorderBoxInfo {
|
||||
node_address: fragment.node,
|
||||
origin: border_box.origin + Point2D::new(border_width.left, border_width.top),
|
||||
origin: border_box.origin + Vector2D::new(border_width.left, border_width.top),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
@ -852,7 +850,7 @@ pub fn process_offset_parent_query<N: LayoutNode>(requested_node: N, layout_root
|
|||
let parent_info = iterator.parent_nodes.into_iter().rev().filter_map(|info| info).next();
|
||||
match (node_offset_box, parent_info) {
|
||||
(Some(node_offset_box), Some(parent_info)) => {
|
||||
let origin = node_offset_box.offset - parent_info.origin;
|
||||
let origin = node_offset_box.offset - parent_info.origin.to_vector();
|
||||
let size = node_offset_box.rectangle.size;
|
||||
OffsetParentResponse {
|
||||
node_address: Some(parent_info.node_address.to_untrusted_node_address()),
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use app_units::Au;
|
||||
use context::LayoutContext;
|
||||
use display_list_builder::DisplayListBuildState;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::{Point2D, Vector2D};
|
||||
use floats::SpeculatedFloatPlacement;
|
||||
use flow::{self, Flow, ImmutableFlowUtils, InorderFlowTraversal, MutableFlowUtils};
|
||||
use flow::{PostorderFlowTraversal, PreorderFlowTraversal};
|
||||
|
@ -108,17 +108,17 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow, iterator
|
|||
let mut stacking_context_position = *stacking_context_position;
|
||||
if kid.is_block_flow() && kid.as_block().fragment.establishes_stacking_context() {
|
||||
stacking_context_position = Point2D::new(kid.as_block().fragment.margin.inline_start, Au(0)) +
|
||||
flow::base(kid).stacking_relative_position +
|
||||
stacking_context_position;
|
||||
flow::base(kid).stacking_relative_position.to_vector() +
|
||||
stacking_context_position.to_vector();
|
||||
let relative_position = kid.as_block()
|
||||
.stacking_relative_position(CoordinateSystem::Own);
|
||||
if let Some(matrix) = kid.as_block()
|
||||
.fragment
|
||||
.transform_matrix(&relative_position) {
|
||||
let transform_matrix = matrix.transform_point(&Point2D::zero());
|
||||
let transform_matrix = matrix.transform_point2d(&Point2D::zero());
|
||||
stacking_context_position = stacking_context_position +
|
||||
Point2D::new(Au::from_f32_px(transform_matrix.x),
|
||||
Au::from_f32_px(transform_matrix.y))
|
||||
Vector2D::new(Au::from_f32_px(transform_matrix.x),
|
||||
Au::from_f32_px(transform_matrix.y))
|
||||
}
|
||||
}
|
||||
doit(kid, level + 1, iterator, &stacking_context_position);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// completely converting layout to directly generate WebRender display lists, for example.
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use euclid::{Point2D, Vector2D, Rect, SideOffsets2D, Size2D};
|
||||
use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClippingRegion};
|
||||
use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal, StackingContextType};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -86,12 +86,22 @@ trait ToPointF {
|
|||
fn to_pointf(&self) -> webrender_traits::LayoutPoint;
|
||||
}
|
||||
|
||||
trait ToVectorF {
|
||||
fn to_vectorf(&self) -> webrender_traits::LayoutVector2D;
|
||||
}
|
||||
|
||||
impl ToPointF for Point2D<Au> {
|
||||
fn to_pointf(&self) -> webrender_traits::LayoutPoint {
|
||||
webrender_traits::LayoutPoint::new(self.x.to_f32_px(), self.y.to_f32_px())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToVectorF for Vector2D<Au> {
|
||||
fn to_vectorf(&self) -> webrender_traits::LayoutVector2D {
|
||||
webrender_traits::LayoutVector2D::new(self.x.to_f32_px(), self.y.to_f32_px())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToSizeF for Size2D<Au> {
|
||||
fn to_sizef(&self) -> webrender_traits::LayoutSize {
|
||||
webrender_traits::LayoutSize::new(self.width.to_f32_px(), self.height.to_f32_px())
|
||||
|
@ -450,7 +460,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
builder.push_box_shadow(rect,
|
||||
clip,
|
||||
box_bounds,
|
||||
item.offset.to_pointf(),
|
||||
item.offset.to_vectorf(),
|
||||
item.color,
|
||||
item.blur_radius.to_f32_px(),
|
||||
item.spread_radius.to_f32_px(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue