mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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 -->
This commit is contained in:
commit
8d988f20c1
15 changed files with 569 additions and 12 deletions
|
@ -45,10 +45,11 @@ use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
|
|||
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
|
||||
use profile_traits::time::{self, TimerMetadata, profile};
|
||||
use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request};
|
||||
use query::{process_node_geometry_request, process_node_scroll_area_request, process_offset_parent_query};
|
||||
use query::{process_resolved_style_request, process_margin_style_query};
|
||||
use query::{process_node_geometry_request, process_node_layer_id_request, process_node_scroll_area_request};
|
||||
use query::{process_node_overflow_request, process_resolved_style_request, process_margin_style_query};
|
||||
use query::{process_offset_parent_query};
|
||||
use script::dom::node::OpaqueStyleAndLayoutData;
|
||||
use script::layout_interface::{LayoutRPC, OffsetParentResponse, MarginStyleResponse};
|
||||
use script::layout_interface::{LayoutRPC, OffsetParentResponse, NodeOverflowResponse, MarginStyleResponse};
|
||||
use script::layout_interface::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType};
|
||||
use script::layout_interface::{ScriptLayoutChan, ScriptReflow};
|
||||
use script::reporter::CSSErrorReporter;
|
||||
|
@ -117,9 +118,14 @@ pub struct LayoutThreadData {
|
|||
/// A queued response for the client {top, left, width, height} of a node in pixels.
|
||||
pub client_rect_response: Rect<i32>,
|
||||
|
||||
pub layer_id_response: Option<LayerId>,
|
||||
|
||||
/// A queued response for the node at a given point
|
||||
pub hit_test_response: (Option<DisplayItemMetadata>, bool),
|
||||
|
||||
/// A pair of overflow property in x and y
|
||||
pub overflow_response: NodeOverflowResponse,
|
||||
|
||||
/// A queued response for the scroll {top, left, width, height} of a node in pixels.
|
||||
pub scroll_area_response: Rect<i32>,
|
||||
|
||||
|
@ -463,8 +469,10 @@ impl LayoutThread {
|
|||
content_box_response: Rect::zero(),
|
||||
content_boxes_response: Vec::new(),
|
||||
client_rect_response: Rect::zero(),
|
||||
layer_id_response: None,
|
||||
hit_test_response: (None, false),
|
||||
scroll_area_response: Rect::zero(),
|
||||
overflow_response: NodeOverflowResponse(None),
|
||||
resolved_style_response: None,
|
||||
offset_parent_response: OffsetParentResponse::empty(),
|
||||
margin_style_response: MarginStyleResponse::empty(),
|
||||
|
@ -1015,9 +1023,15 @@ impl LayoutThread {
|
|||
ReflowQueryType::NodeGeometryQuery(_) => {
|
||||
rw_data.client_rect_response = Rect::zero();
|
||||
},
|
||||
ReflowQueryType::NodeLayerIdQuery(_) => {
|
||||
rw_data.layer_id_response = None;
|
||||
},
|
||||
ReflowQueryType::NodeScrollGeometryQuery(_) => {
|
||||
rw_data.scroll_area_response = Rect::zero();
|
||||
},
|
||||
ReflowQueryType::NodeOverflowQuery(_) => {
|
||||
rw_data.overflow_response = NodeOverflowResponse(None);
|
||||
},
|
||||
ReflowQueryType::ResolvedStyleQuery(_, _, _) => {
|
||||
rw_data.resolved_style_response = None;
|
||||
},
|
||||
|
@ -1177,6 +1191,14 @@ impl LayoutThread {
|
|||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
rw_data.scroll_area_response = process_node_scroll_area_request(node, &mut root_flow);
|
||||
},
|
||||
ReflowQueryType::NodeOverflowQuery(node) => {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
rw_data.overflow_response = process_node_overflow_request(node);
|
||||
},
|
||||
ReflowQueryType::NodeLayerIdQuery(node) => {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
rw_data.layer_id_response = Some(process_node_layer_id_request(node));
|
||||
},
|
||||
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
rw_data.resolved_style_response =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue