forked from mirrors/gecko-dev
		
	 b35beae16d
			
		
	
	
		b35beae16d
		
	
	
	
	
		
			
			Just use WebRender's ClipId directly. This will allow us to create and use ReferenceFrames in the future, if we need to do that. It will also make it easier to have Servo responsible for creating the root scrolling area, which will allow removing some old hacks in the future. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because they should not change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 6e05a903afe81af5a45067dde4f9af26a2ea4be2 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : ed3c05a3a6ad1de7c189632886473e8b9b294565
		
			
				
	
	
		
			102 lines
		
	
	
	
		
			3.7 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			102 lines
		
	
	
	
		
			3.7 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
| /* This Source Code Form is subject to the terms of the Mozilla Public
 | |
|  * License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 | |
| 
 | |
| use PendingImage;
 | |
| use app_units::Au;
 | |
| use euclid::point::Point2D;
 | |
| use euclid::rect::Rect;
 | |
| use script_traits::UntrustedNodeAddress;
 | |
| use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left, overflow_x};
 | |
| use webrender_traits::ClipId;
 | |
| 
 | |
| /// Synchronous messages that script can send to layout.
 | |
| ///
 | |
| /// In general, you should use messages to talk to Layout. Use the RPC interface
 | |
| /// if and only if the work is
 | |
| ///
 | |
| ///   1) read-only with respect to LayoutThreadData,
 | |
| ///   2) small,
 | |
| ///   3) and really needs to be fast.
 | |
| pub trait LayoutRPC {
 | |
|     /// Requests the dimensions of the content box, as in the `getBoundingClientRect()` call.
 | |
|     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 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 scroll root id of this node. Used by APIs such as `scrollTop`
 | |
|     fn node_scroll_root_id(&self) -> NodeScrollRootIdResponse;
 | |
|     /// Requests the node containing the point of interest
 | |
|     fn hit_test(&self) -> HitTestResponse;
 | |
|     /// Query layout for the resolved value of a given CSS property
 | |
|     fn resolved_style(&self) -> ResolvedStyleResponse;
 | |
|     fn offset_parent(&self) -> OffsetParentResponse;
 | |
|     /// Query layout for the resolve values of the margin properties for an element.
 | |
|     fn margin_style(&self) -> MarginStyleResponse;
 | |
|     /// Requests the list of not-yet-loaded images that were encountered in the last reflow.
 | |
|     fn pending_images(&self) -> Vec<PendingImage>;
 | |
|     /// Requests the list of nodes from the given point.
 | |
|     fn nodes_from_point_response(&self) -> Vec<UntrustedNodeAddress>;
 | |
| 
 | |
|     fn text_index(&self) -> TextIndexResponse;
 | |
| }
 | |
| 
 | |
| pub struct ContentBoxResponse(pub Option<Rect<Au>>);
 | |
| 
 | |
| pub struct ContentBoxesResponse(pub Vec<Rect<Au>>);
 | |
| 
 | |
| pub struct NodeGeometryResponse {
 | |
|     pub client_rect: Rect<i32>,
 | |
| }
 | |
| 
 | |
| pub struct NodeOverflowResponse(pub Option<Point2D<overflow_x::computed_value::T>>);
 | |
| 
 | |
| pub struct NodeScrollRootIdResponse(pub ClipId);
 | |
| 
 | |
| pub struct HitTestResponse {
 | |
|     pub node_address: Option<UntrustedNodeAddress>,
 | |
| }
 | |
| 
 | |
| pub struct ResolvedStyleResponse(pub String);
 | |
| 
 | |
| #[derive(Clone)]
 | |
| pub struct OffsetParentResponse {
 | |
|     pub node_address: Option<UntrustedNodeAddress>,
 | |
|     pub rect: Rect<Au>,
 | |
| }
 | |
| 
 | |
| impl OffsetParentResponse {
 | |
|     pub fn empty() -> OffsetParentResponse {
 | |
|         OffsetParentResponse {
 | |
|             node_address: None,
 | |
|             rect: Rect::zero(),
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[derive(Clone)]
 | |
| pub struct MarginStyleResponse {
 | |
|     pub top: margin_top::computed_value::T,
 | |
|     pub right: margin_right::computed_value::T,
 | |
|     pub bottom: margin_bottom::computed_value::T,
 | |
|     pub left: margin_left::computed_value::T,
 | |
| }
 | |
| 
 | |
| impl MarginStyleResponse {
 | |
|     pub fn empty() -> MarginStyleResponse {
 | |
|         MarginStyleResponse {
 | |
|             top: margin_top::computed_value::T::Auto,
 | |
|             right: margin_right::computed_value::T::Auto,
 | |
|             bottom: margin_bottom::computed_value::T::Auto,
 | |
|             left: margin_left::computed_value::T::Auto,
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| #[derive(Clone)]
 | |
| pub struct TextIndexResponse(pub Option<usize>);
 |