aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-07-27 20:45:05 -0600
committerbors-servo <metajack+bors@gmail.com>2015-07-27 20:45:05 -0600
commite0bd80f80715bdbdf30de1de9c79a99a41cfd99e (patch)
tree9a7c7bb8825e07b755ad7dd7aa36863db56951a2 /components/script/dom/window.rs
parent2672f2bbe46fd833c6a84b70edaa99dcaf092b5c (diff)
parent126938a963e79e5dc50ad748bb590df3c9bfdd35 (diff)
downloadservo-e0bd80f80715bdbdf30de1de9c79a99a41cfd99e.tar.gz
servo-e0bd80f80715bdbdf30de1de9c79a99a41cfd99e.zip
Auto merge of #6662 - tschneidereit:client-geometry, r=glennw,pcwatson
Implement Element.client{Top,Left,Width,Height} This isn't done, but contains a working implementation of at least `clientTop`. Feedback would be much appreciated: it's probably far from ideal. Implementing `clientLeft` is straight-forward, I think, but `clientWidth` and `clientHeight` require accessing the `border_box` - and I don't know how that works, yet. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6662) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 04f6b3ee6ce..7bea165b46d 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -540,6 +540,7 @@ pub trait WindowHelpers {
fn layout(&self) -> &LayoutRPC;
fn content_box_query(self, content_box_request: TrustedNodeAddress) -> Rect<Au>;
fn content_boxes_query(self, content_boxes_request: TrustedNodeAddress) -> Vec<Rect<Au>>;
+ fn client_rect_query(self, node_geometry_request: TrustedNodeAddress) -> Rect<i32>;
fn handle_reflow_complete_msg(self, reflow_id: u32);
fn set_fragment_name(self, fragment: Option<String>);
fn steal_fragment_name(self) -> Option<String>;
@@ -771,6 +772,13 @@ impl<'a> WindowHelpers for &'a Window {
rects
}
+ fn client_rect_query(self, node_geometry_request: TrustedNodeAddress) -> Rect<i32> {
+ self.reflow(ReflowGoal::ForScriptQuery,
+ ReflowQueryType::NodeGeometryQuery(node_geometry_request),
+ ReflowReason::Query);
+ self.layout_rpc.node_geometry().client_rect
+ }
+
fn handle_reflow_complete_msg(self, reflow_id: u32) {
let last_reflow_id = self.last_reflow_id.get();
if last_reflow_id == reflow_id {
@@ -1077,6 +1085,7 @@ fn debug_reflow_events(goal: &ReflowGoal, query_type: &ReflowQueryType, reason:
ReflowQueryType::NoQuery => "\tNoQuery",
ReflowQueryType::ContentBoxQuery(_n) => "\tContentBoxQuery",
ReflowQueryType::ContentBoxesQuery(_n) => "\tContentBoxesQuery",
+ ReflowQueryType::NodeGeometryQuery(_n) => "\tNodeGeometryQuery",
});
debug_msg.push_str(match *reason {