Skip to content

Commit

Permalink
Auto merge of #10426 - rilut:fix-elementsFromPoint-no-viewport-availa…
Browse files Browse the repository at this point in the history
…ble-test, r=nox

Fix Document#elementsFromPoint no viewport available test

Fixes #10093 and improves #10034.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10426)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Apr 15, 2016
2 parents bfe5453 + 5a3ce59 commit 44d7657
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 4 additions & 2 deletions components/script/dom/document.rs
Expand Up @@ -1551,8 +1551,6 @@ impl Document {
}

pub fn nodes_from_point(&self, page_point: &Point2D<f32>) -> Vec<UntrustedNodeAddress> {
assert!(self.GetDocumentElement().is_some());

self.window.layout().nodes_from_point(*page_point)
}
}
Expand Down Expand Up @@ -2718,6 +2716,10 @@ impl DocumentMethods for Document {
let window = window_from_node(self);
let viewport = window.window_size().unwrap().visible_viewport;

if self.browsing_context().is_none() {
return vec!();
}

// Step 2
if x < 0.0 || y < 0.0 || x > viewport.width.get() || y > viewport.height.get() {
return vec!();
Expand Down
3 changes: 0 additions & 3 deletions tests/wpt/metadata/cssom-view/elementsFromPoint.html.ini
Expand Up @@ -12,6 +12,3 @@
[no hit target at x,y]
expected: FAIL

[No viewport available]
expected: FAIL

0 comments on commit 44d7657

Please sign in to comment.