diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-04-20 18:40:26 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-04-20 18:40:26 +0530 |
commit | 8d988f20c12e0a5267e79650a90310951c66ca77 (patch) | |
tree | 6417b5b0a4c11b176f5e066df6a2299212c041c5 /components/script/layout_interface.rs | |
parent | eda711307ceb873b32b66a092b7430b8a393059f (diff) | |
parent | 11b12f677b14516e92b02c0ded30310b6d6a7f96 (diff) | |
download | servo-8d988f20c12e0a5267e79650a90310951c66ca77.tar.gz servo-8d988f20c12e0a5267e79650a90310951c66ca77.zip |
Auto merge of #9968 - izgzhen:scroll, r=asajeffrey
Implement scroll, scrollLeft, scrollTop and friends, addressing issue #9650
This is a work in progress to solve https://github.com/servo/servo/issues/9650. Thanks a lot for helping the review.
- [x] scroll
- [x] scrollTo
- [x] scrollBy
- [x] scrollTop (setter and getter)
- [x] scrollLeft (setter and getter)
The setters will be implemented in another PR after this is merged.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9968)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/layout_interface.rs')
-rw-r--r-- | components/script/layout_interface.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs index e72bb168f33..2a9598fcc8b 100644 --- a/components/script/layout_interface.rs +++ b/components/script/layout_interface.rs @@ -23,7 +23,7 @@ use std::sync::Arc; use std::sync::mpsc::{Receiver, Sender, channel}; use string_cache::Atom; use style::context::ReflowGoal; -use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left}; +use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left, overflow_x}; use style::selector_impl::PseudoElement; use style::servo::Stylesheet; use url::Url; @@ -104,8 +104,12 @@ pub trait LayoutRPC { fn content_boxes(&self) -> ContentBoxesResponse; /// Requests the geometry of this node. Used by APIs such as `clientTop`. fn node_geometry(&self) -> NodeGeometryResponse; + /// Requests the overflow-x and overflow-y of this node. Used by `scrollTop` etc. + fn node_overflow(&self) -> NodeOverflowResponse; /// Requests the scroll geometry of this node. Used by APIs such as `scrollTop`. fn node_scroll_area(&self) -> NodeGeometryResponse; + /// Requests the layer id of this node. Used by APIs such as `scrollTop` + fn node_layer_id(&self) -> NodeLayerIdResponse; /// Requests the node containing the point of interest fn hit_test(&self) -> HitTestResponse; /// Query layout for the resolved value of a given CSS property @@ -136,6 +140,8 @@ impl MarginStyleResponse { } } +pub struct NodeOverflowResponse(pub Option<Point2D<overflow_x::computed_value::T>>); + pub struct ContentBoxResponse(pub Rect<Au>); pub struct ContentBoxesResponse(pub Vec<Rect<Au>>); pub struct HitTestResponse { @@ -144,6 +150,11 @@ pub struct HitTestResponse { pub struct NodeGeometryResponse { pub client_rect: Rect<i32>, } + +pub struct NodeLayerIdResponse { + pub layer_id: LayerId, +} + pub struct ResolvedStyleResponse(pub Option<String>); #[derive(Clone)] @@ -167,8 +178,10 @@ pub enum ReflowQueryType { NoQuery, ContentBoxQuery(TrustedNodeAddress), ContentBoxesQuery(TrustedNodeAddress), + NodeOverflowQuery(TrustedNodeAddress), HitTestQuery(Point2D<f32>, bool), NodeGeometryQuery(TrustedNodeAddress), + NodeLayerIdQuery(TrustedNodeAddress), NodeScrollGeometryQuery(TrustedNodeAddress), ResolvedStyleQuery(TrustedNodeAddress, Option<PseudoElement>, Atom), OffsetParentQuery(TrustedNodeAddress), |