Bug 1734282 - Remove some unused scroll frame APIs and code r=gfx-reviewers,jrmuizel

ScrollSensitivity is not used by Gecko. Also remove some remnants
of the old code to combine scroll frames when display lists swap.

Differential Revision: https://phabricator.services.mozilla.com/D127609
This commit is contained in:
Glenn Watson 2021-10-06 06:43:03 +00:00
parent 615e9f60a7
commit a9ef6ad97d
10 changed files with 3 additions and 80 deletions

View File

@ -2776,7 +2776,6 @@ pub extern "C" fn wr_dp_define_scroll_layer(
ExternalScrollId(external_scroll_id, state.pipeline_id),
content_rect,
clip_rect,
ScrollSensitivity::Script,
// TODO(gw): We should also update the Gecko-side APIs to provide
// this as a vector rather than a point.
scroll_offset.to_vector(),

View File

@ -279,7 +279,6 @@ fn build_display_list(
scroll_id,
LayoutRect::from_size(layout_size),
LayoutRect::from_size(layout_size),
ScrollSensitivity::Script,
LayoutVector2D::zero(),
SpatialTreeItemKey::new(0, 1),
);

View File

@ -59,7 +59,6 @@ impl Example for App {
ExternalScrollId(EXT_SCROLL_ID_ROOT, PipelineId::dummy()),
(0, 0).by(1000, 1000),
scrollbox,
ScrollSensitivity::ScriptAndInputEvents,
LayoutVector2D::zero(),
SpatialTreeItemKey::new(0, 0),
);
@ -96,7 +95,6 @@ impl Example for App {
ExternalScrollId(EXT_SCROLL_ID_CONTENT, PipelineId::dummy()),
(0, 100).to(300, 1000),
(0, 100).to(200, 300),
ScrollSensitivity::ScriptAndInputEvents,
LayoutVector2D::zero(),
SpatialTreeItemKey::new(0, 1),
);

View File

@ -41,7 +41,7 @@ use api::{DisplayItem, DisplayItemRef, ExtendMode, ExternalScrollId, FilterData,
use api::{FilterOp, FilterPrimitive, FontInstanceKey, FontSize, GlyphInstance, GlyphOptions, GradientStop};
use api::{IframeDisplayItem, ImageKey, ImageRendering, ItemRange, ColorDepth, QualitySettings};
use api::{LineOrientation, LineStyle, NinePatchBorderSource, PipelineId, MixBlendMode, StackingContextFlags};
use api::{PropertyBinding, ReferenceFrameKind, ScrollFrameDescriptor, ScrollSensitivity, ReferenceFrameMapper};
use api::{PropertyBinding, ReferenceFrameKind, ScrollFrameDescriptor, ReferenceFrameMapper};
use api::{Shadow, SpaceAndClipInfo, SpatialId, StickyFrameDescriptor, ImageMask, ItemTag};
use api::{ClipMode, PrimitiveKeyKind, TransformStyle, YuvColorSpace, ColorRange, YuvData, TempFilterData};
use api::{ReferenceTransformBinding, Rotation, FillRule, SpatialTreeItem, ReferenceFrameDescriptor};
@ -875,7 +875,6 @@ impl<'a> SceneBuilder<'a> {
pipeline_id,
&info.frame_rect,
&content_size,
info.scroll_sensitivity,
ScrollFrameKind::Explicit,
info.external_scroll_offset,
SpatialNodeUid::external(info.key),
@ -936,7 +935,6 @@ impl<'a> SceneBuilder<'a> {
iframe_pipeline_id,
&iframe_rect,
&bounds.size(),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::PipelineRoot {
is_root_pipeline,
},
@ -2371,7 +2369,6 @@ impl<'a> SceneBuilder<'a> {
pipeline_id,
&viewport_rect,
&viewport_rect.size(),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::PipelineRoot {
is_root_pipeline: true,
},
@ -2520,7 +2517,6 @@ impl<'a> SceneBuilder<'a> {
pipeline_id: PipelineId,
frame_rect: &LayoutRect,
content_size: &LayoutSize,
scroll_sensitivity: ScrollSensitivity,
frame_kind: ScrollFrameKind,
external_scroll_offset: LayoutVector2D,
uid: SpatialNodeUid,
@ -2531,7 +2527,6 @@ impl<'a> SceneBuilder<'a> {
pipeline_id,
frame_rect,
content_size,
scroll_sensitivity,
frame_kind,
external_scroll_offset,
uid,

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{ExternalScrollId, PipelineId, PropertyBinding, PropertyBindingId, ReferenceFrameKind, ScrollClamping, ScrollLocation};
use api::{TransformStyle, ScrollSensitivity, StickyOffsetBounds, SpatialTreeItemKey};
use api::{TransformStyle, StickyOffsetBounds, SpatialTreeItemKey};
use api::units::*;
use crate::spatial_tree::{CoordinateSystem, SpatialNodeIndex, TransformUpdateState};
use crate::spatial_tree::{CoordinateSystemId};
@ -177,14 +177,12 @@ impl SceneSpatialNode {
external_id: ExternalScrollId,
frame_rect: &LayoutRect,
content_size: &LayoutSize,
scroll_sensitivity: ScrollSensitivity,
frame_kind: ScrollFrameKind,
external_scroll_offset: LayoutVector2D,
is_root_coord_system: bool,
) -> Self {
let node_type = SpatialNodeType::ScrollFrame(ScrollFrameInfo::new(
*frame_rect,
scroll_sensitivity,
LayoutSize::new(
(content_size.width - frame_rect.width()).max(0.0),
(content_size.height - frame_rect.height()).max(0.0)
@ -384,18 +382,6 @@ fn snap_offset<OffsetUnits, ScaleUnits>(
}
impl SpatialNode {
pub fn apply_old_scrolling_state(&mut self, old_scroll_info: &ScrollFrameInfo) {
match self.node_type {
SpatialNodeType::ScrollFrame(ref mut scrolling) => {
*scrolling = scrolling.combine_with_old_scroll_info(old_scroll_info);
}
_ if old_scroll_info.offset != LayoutVector2D::zero() => {
warn!("Tried to scroll a non-scroll node.")
}
_ => {}
}
}
pub fn set_scroll_origin(&mut self, origin: &LayoutPoint, clamp: ScrollClamping) -> bool {
let scrolling = match self.node_type {
SpatialNodeType::ScrollFrame(ref mut scrolling) => scrolling,
@ -909,8 +895,6 @@ pub struct ScrollFrameInfo {
/// positioning of items inside child StickyFrames.
pub viewport_rect: LayoutRect,
pub scroll_sensitivity: ScrollSensitivity,
/// Amount that this ScrollFrame can scroll in both directions.
pub scrollable_size: LayoutSize,
@ -947,7 +931,6 @@ pub struct ScrollFrameInfo {
impl ScrollFrameInfo {
pub fn new(
viewport_rect: LayoutRect,
scroll_sensitivity: ScrollSensitivity,
scrollable_size: LayoutSize,
external_id: ExternalScrollId,
frame_kind: ScrollFrameKind,
@ -956,35 +939,12 @@ impl ScrollFrameInfo {
ScrollFrameInfo {
viewport_rect,
offset: -external_scroll_offset,
scroll_sensitivity,
scrollable_size,
external_id,
frame_kind,
external_scroll_offset,
}
}
pub fn sensitive_to_input_events(&self) -> bool {
match self.scroll_sensitivity {
ScrollSensitivity::ScriptAndInputEvents => true,
ScrollSensitivity::Script => false,
}
}
pub fn combine_with_old_scroll_info(
self,
old_scroll_info: &ScrollFrameInfo
) -> ScrollFrameInfo {
ScrollFrameInfo {
viewport_rect: self.viewport_rect,
offset: old_scroll_info.offset,
scroll_sensitivity: self.scroll_sensitivity,
scrollable_size: self.scrollable_size,
external_id: self.external_id,
frame_kind: self.frame_kind,
external_scroll_offset: self.external_scroll_offset,
}
}
}
/// Contains information about reference frames.
@ -1078,7 +1038,6 @@ fn test_cst_perspective_relative_scroll() {
pipeline_id,
&LayoutRect::from_size(LayoutSize::new(100.0, 100.0)),
&LayoutSize::new(100.0, 500.0),
ScrollSensitivity::Script,
ScrollFrameKind::Explicit,
LayoutVector2D::zero(),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 1)),
@ -1090,7 +1049,6 @@ fn test_cst_perspective_relative_scroll() {
pipeline_id,
&LayoutRect::from_size(LayoutSize::new(100.0, 100.0)),
&LayoutSize::new(100.0, 500.0),
ScrollSensitivity::Script,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 50.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 3)),

View File

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{ExternalScrollId, PropertyBinding, ReferenceFrameKind, TransformStyle, PropertyBindingId};
use api::{PipelineId, ScrollClamping, ScrollSensitivity, SpatialTreeItemKey};
use api::{PipelineId, ScrollClamping, SpatialTreeItemKey};
use api::units::*;
use euclid::Transform3D;
use crate::gpu_types::TransformPalette;
@ -377,7 +377,6 @@ impl SceneSpatialTree {
pipeline_id: PipelineId,
frame_rect: &LayoutRect,
content_size: &LayoutSize,
scroll_sensitivity: ScrollSensitivity,
frame_kind: ScrollFrameKind,
external_scroll_offset: LayoutVector2D,
uid: SpatialNodeUid,
@ -391,7 +390,6 @@ impl SceneSpatialTree {
external_id,
frame_rect,
content_size,
scroll_sensitivity,
frame_kind,
external_scroll_offset,
is_root_coord_system,
@ -1275,7 +1273,6 @@ fn test_find_scroll_root_simple() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(800.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 1)),
@ -1308,7 +1305,6 @@ fn test_find_scroll_root_sub_scroll_frame() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(800.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 1)),
@ -1320,7 +1316,6 @@ fn test_find_scroll_root_sub_scroll_frame() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(800.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 2)),
@ -1353,7 +1348,6 @@ fn test_find_scroll_root_not_scrollable() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(400.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 1)),
@ -1365,7 +1359,6 @@ fn test_find_scroll_root_not_scrollable() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(800.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 2)),
@ -1398,7 +1391,6 @@ fn test_find_scroll_root_too_small() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(MIN_SCROLL_ROOT_SIZE, MIN_SCROLL_ROOT_SIZE)),
&LayoutSize::new(1000.0, 1000.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 1)),
@ -1410,7 +1402,6 @@ fn test_find_scroll_root_too_small() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(800.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 2)),
@ -1444,7 +1435,6 @@ fn test_find_scroll_root_perspective() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(400.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 1)),
@ -1468,7 +1458,6 @@ fn test_find_scroll_root_perspective() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(800.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 3)),
@ -1502,7 +1491,6 @@ fn test_find_scroll_root_2d_scale() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(400.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 1)),
@ -1527,7 +1515,6 @@ fn test_find_scroll_root_2d_scale() {
PipelineId::dummy(),
&LayoutRect::from_size(LayoutSize::new(400.0, 400.0)),
&LayoutSize::new(800.0, 400.0),
ScrollSensitivity::ScriptAndInputEvents,
ScrollFrameKind::Explicit,
LayoutVector2D::new(0.0, 0.0),
SpatialNodeUid::external(SpatialTreeItemKey::new(0, 3)),

View File

@ -318,12 +318,6 @@ pub struct StickyFrameDescriptor {
pub key: SpatialTreeItemKey,
}
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize, PeekPoke)]
pub enum ScrollSensitivity {
ScriptAndInputEvents,
Script,
}
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)]
pub struct ScrollFrameDescriptor {
/// The id of the space this scroll frame creates
@ -334,7 +328,6 @@ pub struct ScrollFrameDescriptor {
pub frame_rect: LayoutRect,
pub parent_space: SpatialId,
pub external_id: ExternalScrollId,
pub scroll_sensitivity: ScrollSensitivity,
/// The amount this scrollframe has already been scrolled by, in the caller.
/// This means that all the display items that are inside the scrollframe
/// will have their coordinates shifted by this amount, and this offset
@ -1770,7 +1763,6 @@ macro_rules! impl_default_for_enums {
impl_default_for_enums! {
DisplayItem => PopStackingContext,
ScrollSensitivity => ScriptAndInputEvents,
LineOrientation => Vertical,
LineStyle => Solid,
RepeatMode => Stretch,

View File

@ -1881,7 +1881,6 @@ impl DisplayListBuilder {
external_id: di::ExternalScrollId,
content_rect: LayoutRect,
frame_rect: LayoutRect,
scroll_sensitivity: di::ScrollSensitivity,
external_scroll_offset: LayoutVector2D,
key: di::SpatialTreeItemKey,
) -> di::SpatialId {
@ -1901,7 +1900,6 @@ impl DisplayListBuilder {
parent_space,
scroll_frame_id,
external_id,
scroll_sensitivity,
external_scroll_offset,
key,
});

View File

@ -1849,7 +1849,6 @@ impl YamlFrameReader {
external_id,
content_rect,
clip_rect,
ScrollSensitivity::ScriptAndInputEvents,
external_scroll_offset,
self.next_spatial_key(),
);

View File

@ -896,8 +896,6 @@ malloc_size_of_is_0!(webrender_api::NormalBorder);
#[cfg(feature = "webrender_api")]
malloc_size_of_is_0!(webrender_api::RepeatMode);
#[cfg(feature = "webrender_api")]
malloc_size_of_is_0!(webrender_api::ScrollSensitivity);
#[cfg(feature = "webrender_api")]
malloc_size_of_is_0!(webrender_api::StickyOffsetBounds);
#[cfg(feature = "webrender_api")]
malloc_size_of_is_0!(webrender_api::TransformStyle);