mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
gfx: Don't mutate the same point multiple times while translating it to other stacking context space.
I don't know how neither review or a test caught this.
This commit is contained in:
parent
9cd1b861ec
commit
602b45a372
4 changed files with 43 additions and 8 deletions
|
@ -115,7 +115,7 @@ impl DisplayList {
|
|||
// Return all nodes containing the point of interest, bottommost first, and
|
||||
// respecting the `pointer-events` CSS property.
|
||||
pub fn hit_test(&self,
|
||||
translated_point: &mut Point2D<Au>,
|
||||
translated_point: &Point2D<Au>,
|
||||
client_point: &Point2D<Au>,
|
||||
scroll_offsets: &ScrollOffsetMap)
|
||||
-> Vec<DisplayItemMetadata> {
|
||||
|
@ -131,28 +131,30 @@ impl DisplayList {
|
|||
|
||||
pub fn hit_test_contents<'a>(&self,
|
||||
traversal: &mut DisplayListTraversal<'a>,
|
||||
translated_point: &mut Point2D<Au>,
|
||||
translated_point: &Point2D<Au>,
|
||||
client_point: &Point2D<Au>,
|
||||
scroll_offsets: &ScrollOffsetMap,
|
||||
result: &mut Vec<DisplayItemMetadata>) {
|
||||
while let Some(item) = traversal.next() {
|
||||
match item {
|
||||
&DisplayItem::PushStackingContext(ref stacking_context_item) => {
|
||||
let mut point = *translated_point;
|
||||
DisplayList::translate_point(&stacking_context_item.stacking_context,
|
||||
translated_point,
|
||||
&mut point,
|
||||
client_point);
|
||||
self.hit_test_contents(traversal,
|
||||
translated_point,
|
||||
&point,
|
||||
client_point,
|
||||
scroll_offsets,
|
||||
result);
|
||||
}
|
||||
&DisplayItem::PushScrollRoot(ref item) => {
|
||||
let mut point = *translated_point;
|
||||
DisplayList::scroll_root(&item.scroll_root,
|
||||
translated_point,
|
||||
&mut point,
|
||||
scroll_offsets);
|
||||
self.hit_test_contents(traversal,
|
||||
translated_point,
|
||||
&point,
|
||||
client_point,
|
||||
scroll_offsets,
|
||||
result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue