mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #13957 - mrobinson:scroll_root, r=glennw
Track overflow:scroll stacking contexts with ScrollRootId instead of StackingContextId <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because this PR should not change behavior. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13957) <!-- Reviewable:end -->
This commit is contained in:
commit
3a3f3192a8
31 changed files with 540 additions and 301 deletions
|
@ -20,7 +20,7 @@ use euclid::{Matrix4D, Point2D, Rect, Size2D};
|
|||
use euclid::num::{One, Zero};
|
||||
use euclid::rect::TypedRect;
|
||||
use euclid::side_offsets::SideOffsets2D;
|
||||
use gfx_traits::{ScrollPolicy, StackingContextId};
|
||||
use gfx_traits::{ScrollPolicy, ScrollRootId, StackingContextId};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use ipc_channel::ipc::IpcSharedMemory;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -215,9 +215,11 @@ impl DisplayList {
|
|||
// the DOM-side code has already translated the point for us (e.g. in
|
||||
// `Window::hit_test_query()`) by now.
|
||||
if !is_fixed && stacking_context.id != StackingContextId::root() {
|
||||
if let Some(scroll_offset) = scroll_offsets.get(&stacking_context.id) {
|
||||
translated_point.x -= Au::from_f32_px(scroll_offset.x);
|
||||
translated_point.y -= Au::from_f32_px(scroll_offset.y);
|
||||
if let Some(scroll_root_id) = stacking_context.overflow_scroll_id {
|
||||
if let Some(scroll_offset) = scroll_offsets.get(&scroll_root_id) {
|
||||
translated_point.x -= Au::from_f32_px(scroll_offset.x);
|
||||
translated_point.y -= Au::from_f32_px(scroll_offset.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,7 +388,7 @@ pub struct StackingContext {
|
|||
pub children: Vec<StackingContext>,
|
||||
|
||||
/// If this StackingContext scrolls its overflow area, this will contain the id.
|
||||
pub overflow_scroll_id: Option<StackingContextId>,
|
||||
pub overflow_scroll_id: Option<ScrollRootId>,
|
||||
}
|
||||
|
||||
impl StackingContext {
|
||||
|
@ -403,7 +405,7 @@ impl StackingContext {
|
|||
perspective: Matrix4D<f32>,
|
||||
establishes_3d_context: bool,
|
||||
scroll_policy: ScrollPolicy,
|
||||
scroll_id: Option<StackingContextId>)
|
||||
scroll_root_id: Option<ScrollRootId>)
|
||||
-> StackingContext {
|
||||
StackingContext {
|
||||
id: id,
|
||||
|
@ -418,7 +420,7 @@ impl StackingContext {
|
|||
establishes_3d_context: establishes_3d_context,
|
||||
scroll_policy: scroll_policy,
|
||||
children: Vec::new(),
|
||||
overflow_scroll_id: scroll_id,
|
||||
overflow_scroll_id: scroll_root_id,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1194,7 +1196,7 @@ impl WebRenderImageInfo {
|
|||
}
|
||||
|
||||
/// The type of the scroll offset list. This is only populated if WebRender is in use.
|
||||
pub type ScrollOffsetMap = HashMap<StackingContextId, Point2D<f32>>;
|
||||
pub type ScrollOffsetMap = HashMap<ScrollRootId, Point2D<f32>>;
|
||||
|
||||
|
||||
pub trait SimpleMatrixDetection {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue