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 -->
This commit is contained in:
bors-servo 2015-07-27 20:45:05 -06:00
commit e0bd80f807
8 changed files with 217 additions and 1 deletions

View file

@ -1317,6 +1317,26 @@ impl<'a> ElementMethods for &'a Element {
rect.origin.x + rect.size.width)
}
fn ClientTop(self) -> i32 {
let node = NodeCast::from_ref(self);
node.get_client_rect().origin.y
}
fn ClientLeft(self) -> i32 {
let node = NodeCast::from_ref(self);
node.get_client_rect().origin.x
}
fn ClientWidth(self) -> i32 {
let node = NodeCast::from_ref(self);
node.get_client_rect().size.width
}
fn ClientHeight(self) -> i32 {
let node = NodeCast::from_ref(self);
node.get_client_rect().size.height
}
// https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#widl-Element-innerHTML
fn GetInnerHTML(self) -> Fallible<DOMString> {
//XXX TODO: XML case