mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
auto merge of #3857 : mrobinson/servo/queries, r=pcwalton
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:
commit
c9089c45c4
19 changed files with 374 additions and 213 deletions
|
@ -45,8 +45,7 @@ use dom::text::Text;
|
|||
use dom::virtualmethods::{VirtualMethods, vtable_for};
|
||||
use dom::window::Window;
|
||||
use geom::rect::Rect;
|
||||
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC,
|
||||
LayoutChan, ReapLayoutDataMsg};
|
||||
use layout_interface::{LayoutChan, ReapLayoutDataMsg};
|
||||
use devtools_traits::NodeInfo;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use servo_util::geometry::Au;
|
||||
|
@ -689,20 +688,11 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
}
|
||||
|
||||
fn get_bounding_content_box(self) -> Rect<Au> {
|
||||
let window = window_from_node(self).root();
|
||||
let page = window.page();
|
||||
let addr = self.to_trusted_node_address();
|
||||
|
||||
let ContentBoxResponse(rect) = page.layout().content_box(addr);
|
||||
rect
|
||||
window_from_node(self).root().page().content_box_query(self.to_trusted_node_address())
|
||||
}
|
||||
|
||||
fn get_content_boxes(self) -> Vec<Rect<Au>> {
|
||||
let window = window_from_node(self).root();
|
||||
let page = window.page();
|
||||
let addr = self.to_trusted_node_address();
|
||||
let ContentBoxesResponse(rects) = page.layout().content_boxes(addr);
|
||||
rects
|
||||
window_from_node(self).root().page().content_boxes_query(self.to_trusted_node_address())
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
||||
|
|
|
@ -19,7 +19,7 @@ use dom::location::Location;
|
|||
use dom::navigator::Navigator;
|
||||
use dom::performance::Performance;
|
||||
use dom::screen::Screen;
|
||||
use layout_interface::ReflowGoal;
|
||||
use layout_interface::NoQuery;
|
||||
use page::Page;
|
||||
use script_task::{ExitWindowMsg, ScriptChan, TriggerLoadMsg, TriggerFragmentMsg};
|
||||
use script_task::FromWindow;
|
||||
|
@ -312,7 +312,7 @@ impl Reflectable for Window {
|
|||
|
||||
pub trait WindowHelpers {
|
||||
fn reflow(self);
|
||||
fn flush_layout(self, goal: ReflowGoal);
|
||||
fn flush_layout(self);
|
||||
fn wait_until_safe_to_modify_dom(self);
|
||||
fn init_browser_context(self, doc: JSRef<Document>);
|
||||
fn load_url(self, href: DOMString);
|
||||
|
@ -350,8 +350,8 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
|
|||
self.page().damage();
|
||||
}
|
||||
|
||||
fn flush_layout(self, goal: ReflowGoal) {
|
||||
self.page().flush_layout(goal);
|
||||
fn flush_layout(self) {
|
||||
self.page().flush_layout(NoQuery);
|
||||
}
|
||||
|
||||
fn wait_until_safe_to_modify_dom(self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue