Implement client{Top, Left, Height, Width} element properties

This commit is contained in:
Till Schneidereit 2015-07-19 15:04:50 +02:00
parent acf47a02cf
commit 162ecd0aac
8 changed files with 214 additions and 1 deletions

View file

@ -534,6 +534,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 handle_resize_inactive_msg(self, new_size: WindowSizeData);
fn set_fragment_name(self, fragment: Option<String>);
@ -764,6 +765,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 {
@ -1072,6 +1080,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 {