Answer content box queries for layout_2020 for the root element

This isn't correct yet, but it is necessary to give a value in order for
scrolling from script to work. Later this should give an accurate
content box response as well as work for non-root elements.
This commit is contained in:
Martin Robinson 2020-01-20 13:57:54 +01:00
parent 27e0400891
commit 1cd772fe5f
3 changed files with 58 additions and 8 deletions

View file

@ -46,7 +46,7 @@ use layout::query::{
process_text_index_request,
};
use layout::traversal::RecalcStyle;
use layout::BoxTreeRoot;
use layout::{BoxTreeRoot, FragmentTreeRoot};
use layout_traits::LayoutThreadFactory;
use libc::c_void;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
@ -172,10 +172,10 @@ pub struct LayoutThread {
outstanding_web_fonts: Arc<AtomicUsize>,
/// The root of the box tree.
box_tree_root: RefCell<Option<layout::BoxTreeRoot>>,
box_tree_root: RefCell<Option<BoxTreeRoot>>,
/// The root of the fragment tree.
fragment_tree_root: RefCell<Option<layout::FragmentTreeRoot>>,
fragment_tree_root: RefCell<Option<FragmentTreeRoot>>,
/// The document-specific shared lock used for author-origin stylesheets
document_shared_lock: Option<SharedRwLock>,
@ -1218,7 +1218,10 @@ impl LayoutThread {
match *reflow_goal {
ReflowGoal::LayoutQuery(ref querymsg, _) => match querymsg {
&QueryMsg::ContentBoxQuery(node) => {
rw_data.content_box_response = process_content_box_request(node);
rw_data.content_box_response = process_content_box_request(
node,
(&*self.fragment_tree_root.borrow()).as_ref(),
);
},
&QueryMsg::ContentBoxesQuery(node) => {
rw_data.content_boxes_response = process_content_boxes_request(node);
@ -1355,7 +1358,7 @@ impl LayoutThread {
fn perform_post_style_recalc_layout_passes(
&self,
fragment_tree: &layout::FragmentTreeRoot,
fragment_tree: &FragmentTreeRoot,
reflow_goal: &ReflowGoal,
document: Option<&ServoLayoutDocument>,
context: &mut LayoutContext,