зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1530915 - Change external scroll offset to be a vector. r=emilio
Change the external scroll offset to be a vector, rather than a point. This can also be updated gecko-side in future, but for now is converted to a vector at the API boundary. Also plumb through the external scroll offset so that it is stored inside the ScrollFrameInfo in a spatial node. This will allow modifying the transforms that the clip-scroll tree creates to take into account the external scroll offset in future. Differential Revision: https://phabricator.services.mozilla.com/D21319 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f6085c16d6
Коммит
fde9185d49
|
@ -2220,7 +2220,9 @@ pub extern "C" fn wr_dp_define_scroll_layer(state: &mut WrState,
|
|||
vec![],
|
||||
None,
|
||||
ScrollSensitivity::Script,
|
||||
scroll_offset,
|
||||
// TODO(gw): We should also update the Gecko-side APIs to provide
|
||||
// this as a vector rather than a point.
|
||||
scroll_offset.to_vector(),
|
||||
);
|
||||
|
||||
WrSpaceAndClip::from_webrender(space_and_clip)
|
||||
|
|
|
@ -56,7 +56,7 @@ impl Example for App {
|
|||
vec![],
|
||||
None,
|
||||
ScrollSensitivity::ScriptAndInputEvents,
|
||||
LayoutPoint::zero(),
|
||||
LayoutVector2D::zero(),
|
||||
);
|
||||
|
||||
// now put some content into it.
|
||||
|
@ -88,7 +88,7 @@ impl Example for App {
|
|||
vec![],
|
||||
None,
|
||||
ScrollSensitivity::ScriptAndInputEvents,
|
||||
LayoutPoint::zero(),
|
||||
LayoutVector2D::zero(),
|
||||
);
|
||||
|
||||
// give it a giant gray background just to distinguish it and to easily
|
||||
|
|
|
@ -433,6 +433,7 @@ impl ClipScrollTree {
|
|||
content_size: &LayoutSize,
|
||||
scroll_sensitivity: ScrollSensitivity,
|
||||
frame_kind: ScrollFrameKind,
|
||||
external_scroll_offset: LayoutVector2D,
|
||||
) -> SpatialNodeIndex {
|
||||
let node = SpatialNode::new_scroll_frame(
|
||||
pipeline_id,
|
||||
|
@ -442,6 +443,7 @@ impl ClipScrollTree {
|
|||
content_size,
|
||||
scroll_sensitivity,
|
||||
frame_kind,
|
||||
external_scroll_offset,
|
||||
);
|
||||
self.add_spatial_node(node)
|
||||
}
|
||||
|
|
|
@ -631,6 +631,7 @@ impl<'a> DisplayListFlattener<'a> {
|
|||
&content_size,
|
||||
info.scroll_sensitivity,
|
||||
ScrollFrameKind::Explicit,
|
||||
info.external_scroll_offset,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -786,6 +787,7 @@ impl<'a> DisplayListFlattener<'a> {
|
|||
&pipeline.content_size,
|
||||
ScrollSensitivity::ScriptAndInputEvents,
|
||||
ScrollFrameKind::PipelineRoot,
|
||||
LayoutVector2D::zero(),
|
||||
);
|
||||
|
||||
self.rf_mapper.push_scope();
|
||||
|
@ -1803,6 +1805,7 @@ impl<'a> DisplayListFlattener<'a> {
|
|||
content_size,
|
||||
ScrollSensitivity::ScriptAndInputEvents,
|
||||
ScrollFrameKind::PipelineRoot,
|
||||
LayoutVector2D::zero(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1900,6 +1903,7 @@ impl<'a> DisplayListFlattener<'a> {
|
|||
content_size: &LayoutSize,
|
||||
scroll_sensitivity: ScrollSensitivity,
|
||||
frame_kind: ScrollFrameKind,
|
||||
external_scroll_offset: LayoutVector2D,
|
||||
) -> SpatialNodeIndex {
|
||||
let node_index = self.clip_scroll_tree.add_scroll_frame(
|
||||
parent_node_index,
|
||||
|
@ -1909,6 +1913,7 @@ impl<'a> DisplayListFlattener<'a> {
|
|||
content_size,
|
||||
scroll_sensitivity,
|
||||
frame_kind,
|
||||
external_scroll_offset,
|
||||
);
|
||||
self.id_to_index_mapper.map_spatial_node(new_node_id, node_index);
|
||||
node_index
|
||||
|
|
|
@ -125,6 +125,7 @@ impl SpatialNode {
|
|||
content_size: &LayoutSize,
|
||||
scroll_sensitivity: ScrollSensitivity,
|
||||
frame_kind: ScrollFrameKind,
|
||||
external_scroll_offset: LayoutVector2D,
|
||||
) -> Self {
|
||||
let node_type = SpatialNodeType::ScrollFrame(ScrollFrameInfo::new(
|
||||
*frame_rect,
|
||||
|
@ -135,6 +136,7 @@ impl SpatialNode {
|
|||
),
|
||||
external_id,
|
||||
frame_kind,
|
||||
external_scroll_offset,
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -655,6 +657,10 @@ pub struct ScrollFrameInfo {
|
|||
/// to define scroll frames. However, that involves API changes
|
||||
/// so we will use this as a temporary hack!
|
||||
pub frame_kind: ScrollFrameKind,
|
||||
|
||||
/// Amount that visual components attached to this scroll node have been
|
||||
/// pre-scrolled in their local coordinates.
|
||||
pub external_scroll_offset: LayoutVector2D,
|
||||
}
|
||||
|
||||
/// Manages scrolling offset.
|
||||
|
@ -665,6 +671,7 @@ impl ScrollFrameInfo {
|
|||
scrollable_size: LayoutSize,
|
||||
external_id: Option<ExternalScrollId>,
|
||||
frame_kind: ScrollFrameKind,
|
||||
external_scroll_offset: LayoutVector2D,
|
||||
) -> ScrollFrameInfo {
|
||||
ScrollFrameInfo {
|
||||
viewport_rect,
|
||||
|
@ -673,6 +680,7 @@ impl ScrollFrameInfo {
|
|||
scrollable_size,
|
||||
external_id,
|
||||
frame_kind,
|
||||
external_scroll_offset,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -694,6 +702,7 @@ impl ScrollFrameInfo {
|
|||
scrollable_size: self.scrollable_size,
|
||||
external_id: self.external_id,
|
||||
frame_kind: self.frame_kind,
|
||||
external_scroll_offset: self.external_scroll_offset,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ pub struct ScrollFrameDisplayItem {
|
|||
/// will have their coordinates shifted by this amount, and this offset
|
||||
/// should be added to those display item coordinates in order to get a
|
||||
/// normalized value that is consistent across display lists.
|
||||
pub external_scroll_offset: LayoutPoint,
|
||||
pub external_scroll_offset: LayoutVector2D,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||
|
|
|
@ -1468,7 +1468,7 @@ impl DisplayListBuilder {
|
|||
complex_clips: I,
|
||||
image_mask: Option<di::ImageMask>,
|
||||
scroll_sensitivity: di::ScrollSensitivity,
|
||||
external_scroll_offset: LayoutPoint,
|
||||
external_scroll_offset: LayoutVector2D,
|
||||
) -> di::SpaceAndClipInfo
|
||||
where
|
||||
I: IntoIterator<Item = di::ComplexClipRegion>,
|
||||
|
|
|
@ -1505,7 +1505,7 @@ impl YamlFrameReader {
|
|||
.expect("scroll frame must have a bounds");
|
||||
let content_size = yaml["content-size"].as_size().unwrap_or(clip_rect.size);
|
||||
let content_rect = LayoutRect::new(clip_rect.origin, content_size);
|
||||
let external_scroll_offset = yaml["external-scroll-offset"].as_point().unwrap_or(LayoutPoint::zero());
|
||||
let external_scroll_offset = yaml["external-scroll-offset"].as_vector().unwrap_or(LayoutVector2D::zero());
|
||||
|
||||
let numeric_id = yaml["id"].as_i64().map(|id| id as u64);
|
||||
|
||||
|
|
|
@ -1135,7 +1135,7 @@ impl YamlFrameWriter {
|
|||
usize_node(&mut v, "id", clip_id_mapper.add_spatial_id(item.scroll_frame_id));
|
||||
size_node(&mut v, "content-size", &base.rect().size);
|
||||
rect_node(&mut v, "bounds", &base.clip_rect());
|
||||
point_node(&mut v, "external-scroll-offset", &item.external_scroll_offset);
|
||||
vector_node(&mut v, "external-scroll-offset", &item.external_scroll_offset);
|
||||
|
||||
let (complex_clips, complex_clip_count) = base.complex_clip();
|
||||
if let Some(complex) = self.make_complex_clips_node(
|
||||
|
|
Загрузка…
Ссылка в новой задаче