aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-01-17 00:22:42 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-01-17 13:55:08 +0100
commit485fe874e8674e9a54b69e3f78f1bb9f43fdbbc9 (patch)
treee2ea91ab68ff27f1bd9851041668f0c0172c347c /components/script/dom/node.rs
parent8159dac506f7fc24675270079d3286e86731bb5c (diff)
downloadservo-485fe874e8674e9a54b69e3f78f1bb9f43fdbbc9.tar.gz
servo-485fe874e8674e9a54b69e3f78f1bb9f43fdbbc9.zip
layout: Expose whether the element was rendered in content_box_query to script.
But don't change the API yet.
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 8902a0545ab..940f98fc8fd 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -524,8 +524,12 @@ impl Node {
TrustedNodeAddress(&*self as *const Node as *const libc::c_void)
}
+ /// Returns the rendered bounding content box if the element is rendered,
+ /// and none otherwise.
pub fn bounding_content_box(&self) -> Rect<Au> {
- window_from_node(self).content_box_query(self.to_trusted_node_address())
+ window_from_node(self)
+ .content_box_query(self.to_trusted_node_address())
+ .unwrap_or_else(Rect::zero)
}
pub fn content_boxes(&self) -> Vec<Rect<Au>> {