Bug 1520851 - Make a reference frame's transform not optional. r=kvark

No good reason for it to be an option.

Differential Revision: https://phabricator.services.mozilla.com/D16876
This commit is contained in:
Emilio Cobos Álvarez 2019-01-17 18:37:48 +01:00
Родитель 4a8ff157a5
Коммит 2c1aaa2304
6 изменённых файлов: 9 добавлений и 11 удалений

Просмотреть файл

@ -1958,13 +1958,12 @@ pub extern "C" fn wr_dp_push_stacking_context(
let mut wr_spatial_id = spatial_id.to_webrender(state.pipeline_id);
let wr_clip_id = clip.to_webrender(state.pipeline_id);
let is_reference_frame = transform_binding.is_some();
// Note: 0 has special meaning in WR land, standing for ROOT_REFERENCE_FRAME.
// However, it is never returned by `push_reference_frame`, and we need to return
// an option here across FFI, so we take that 0 value for the None semantics.
// This is resolved into proper `Maybe<WrSpatialId>` inside `WebRenderAPI::PushStackingContext`.
let mut result = WrSpatialId { id: 0 };
if is_reference_frame {
if let Some(transform_binding) = transform_binding {
wr_spatial_id = state.frame_builder.dl_builder.push_reference_frame(
&bounds,
wr_spatial_id,

Просмотреть файл

@ -352,7 +352,7 @@ impl ClipScrollTree {
&mut self,
parent_index: Option<SpatialNodeIndex>,
transform_style: TransformStyle,
source_transform: Option<PropertyBinding<LayoutTransform>>,
source_transform: PropertyBinding<LayoutTransform>,
kind: ReferenceFrameKind,
origin_in_parent_reference_frame: LayoutVector2D,
pipeline_id: PipelineId,

Просмотреть файл

@ -690,7 +690,7 @@ impl<'a> DisplayListFlattener<'a> {
Some(spatial_node_index),
iframe_pipeline_id,
TransformStyle::Flat,
None,
PropertyBinding::Value(LayoutTransform::identity()),
ReferenceFrameKind::Transform,
origin,
);
@ -1584,7 +1584,7 @@ impl<'a> DisplayListFlattener<'a> {
parent_index: Option<SpatialNodeIndex>,
pipeline_id: PipelineId,
transform_style: TransformStyle,
source_transform: Option<PropertyBinding<LayoutTransform>>,
source_transform: PropertyBinding<LayoutTransform>,
kind: ReferenceFrameKind,
origin_in_parent_reference_frame: LayoutVector2D,
) -> SpatialNodeIndex {
@ -1619,7 +1619,7 @@ impl<'a> DisplayListFlattener<'a> {
None,
pipeline_id,
TransformStyle::Flat,
None,
PropertyBinding::Value(LayoutTransform::identity()),
ReferenceFrameKind::Transform,
LayoutVector2D::zero(),
);

Просмотреть файл

@ -116,15 +116,14 @@ impl SpatialNode {
pub fn new_reference_frame(
parent_index: Option<SpatialNodeIndex>,
transform_style: TransformStyle,
source_transform: Option<PropertyBinding<LayoutTransform>>,
source_transform: PropertyBinding<LayoutTransform>,
kind: ReferenceFrameKind,
origin_in_parent_reference_frame: LayoutVector2D,
pipeline_id: PipelineId,
) -> Self {
let identity = LayoutTransform::identity();
let info = ReferenceFrameInfo {
transform_style,
source_transform: source_transform.unwrap_or(PropertyBinding::Value(identity)),
source_transform,
kind,
origin_in_parent_reference_frame,
invertible: true,

Просмотреть файл

@ -537,7 +537,7 @@ pub struct ReferenceFrame {
pub transform_style: TransformStyle,
/// The transform matrix, either the perspective matrix or the transform
/// matrix.
pub transform: Option<PropertyBinding<LayoutTransform>>,
pub transform: PropertyBinding<LayoutTransform>,
pub id: SpatialId,
}

Просмотреть файл

@ -1256,7 +1256,7 @@ impl DisplayListBuilder {
rect: &LayoutRect,
parent: SpatialId,
transform_style: TransformStyle,
transform: Option<PropertyBinding<LayoutTransform>>,
transform: PropertyBinding<LayoutTransform>,
kind: ReferenceFrameKind,
) -> SpatialId {
let id = self.generate_spatial_index();