Have ContentBox(es)Queries consult the flow tree

Instead of looking at the display tree, have ContentBox(es)Query consult
the flow tree. This allow optimizing away parts of the display tree
later. To do this we need to be more careful about how we send reflow
requests, only querying the flow tree when possible.

Fixes #3790.
This commit is contained in:
Martin Robinson 2014-10-29 19:02:31 -07:00
parent 1a3ff8739c
commit 2d72f00ccf
19 changed files with 374 additions and 213 deletions

View file

@ -60,9 +60,9 @@ pub enum Msg {
// 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, node: TrustedNodeAddress) -> ContentBoxResponse;
fn content_box(&self) -> ContentBoxResponse;
/// Requests the dimensions of all the content boxes, as in the `getClientRects()` call.
fn content_boxes(&self, node: TrustedNodeAddress) -> ContentBoxesResponse;
fn content_boxes(&self) -> ContentBoxesResponse;
/// 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, ()>;
@ -82,6 +82,13 @@ pub enum ReflowGoal {
ReflowForScriptQuery,
}
/// Any query to perform with this reflow.
pub enum ReflowQueryType {
NoQuery,
ContentBoxQuery(TrustedNodeAddress),
ContentBoxesQuery(TrustedNodeAddress),
}
/// Information needed for a reflow.
pub struct Reflow {
/// The document node.
@ -99,7 +106,9 @@ pub struct Reflow {
/// The channel that we send a notification to.
pub script_join_chan: Sender<()>,
/// Unique identifier
pub id: uint
pub id: uint,
/// The type of query if any to perform during this reflow.
pub query_type: ReflowQueryType,
}
/// Encapsulates a channel to the layout task.