mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
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:
commit
e0bd80f807
8 changed files with 217 additions and 1 deletions
|
@ -95,6 +95,8 @@ pub trait LayoutRPC {
|
|||
fn content_box(&self) -> ContentBoxResponse;
|
||||
/// Requests the dimensions of all the content boxes, as in the `getClientRects()` call.
|
||||
fn content_boxes(&self) -> ContentBoxesResponse;
|
||||
/// Requests the geometry of this node. Used by APIs such as `clientTop`.
|
||||
fn node_geometry(&self) -> NodeGeometryResponse;
|
||||
/// Requests the node containing the point of interest
|
||||
fn hit_test(&self, node: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()>;
|
||||
fn mouse_over(&self, node: TrustedNodeAddress, point: Point2D<f32>) -> Result<MouseOverResponse, ()>;
|
||||
|
@ -102,6 +104,9 @@ pub trait LayoutRPC {
|
|||
|
||||
pub struct ContentBoxResponse(pub Rect<Au>);
|
||||
pub struct ContentBoxesResponse(pub Vec<Rect<Au>>);
|
||||
pub struct NodeGeometryResponse {
|
||||
pub client_rect: Rect<i32>,
|
||||
}
|
||||
pub struct HitTestResponse(pub UntrustedNodeAddress);
|
||||
pub struct MouseOverResponse(pub Vec<UntrustedNodeAddress>);
|
||||
|
||||
|
@ -120,6 +125,7 @@ pub enum ReflowQueryType {
|
|||
NoQuery,
|
||||
ContentBoxQuery(TrustedNodeAddress),
|
||||
ContentBoxesQuery(TrustedNodeAddress),
|
||||
NodeGeometryQuery(TrustedNodeAddress),
|
||||
}
|
||||
|
||||
/// Information needed for a reflow.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue