Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle backface-visibility:hidden in hit testing (Gecko bug 1447131) #2585

Merged
merged 1 commit into from
Mar 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions webrender/src/hit_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub struct HitTestingItem {
rect: LayerRect,
clip_rect: LayerRect,
tag: ItemTag,
is_backface_visible: bool,
}

impl HitTestingItem {
Expand All @@ -65,6 +66,7 @@ impl HitTestingItem {
rect: info.rect,
clip_rect: info.clip_rect,
tag: tag,
is_backface_visible: info.is_backface_visible,
}
}
}
Expand Down Expand Up @@ -232,6 +234,7 @@ impl HitTester {
}

let transform = scroll_node.world_content_transform;
let mut facing_backwards: Option<bool> = None; // will be computed on first use
let point_in_layer = match transform.inverse() {
Some(inverted) => inverted.transform_point2d(&point),
None => continue,
Expand Down Expand Up @@ -265,6 +268,13 @@ impl HitTester {
None => continue,
};

// Don't hit items with backface-visibility:hidden if they are facing the back.
if !item.is_backface_visible {
if *facing_backwards.get_or_insert_with(|| transform.is_backface_visible()) {
continue;
}
}

result.items.push(HitTestItem {
pipeline: pipeline_id,
tag: item.tag,
Expand Down