mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Disable incremental reflow for multicol and their descendants.
Fragmentation with dynamic updates is hard.
This commit is contained in:
parent
357463864b
commit
da2b4ab381
6 changed files with 41 additions and 1 deletions
|
@ -1318,6 +1318,9 @@ impl<'a, 'ln, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'ln>>
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if node.in_fragmentation_container() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
let mut style = node.style().clone();
|
let mut style = node.style().clone();
|
||||||
let mut data = node.mutate_layout_data().unwrap();
|
let mut data = node.mutate_layout_data().unwrap();
|
||||||
|
|
|
@ -50,7 +50,7 @@ use script::dom::htmlimageelement::LayoutHTMLImageElementHelpers;
|
||||||
use script::dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
|
use script::dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
|
||||||
use script::dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
|
use script::dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHelpers};
|
||||||
use script::dom::node::{HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
|
use script::dom::node::{HAS_CHANGED, HAS_DIRTY_DESCENDANTS, IS_DIRTY};
|
||||||
use script::dom::node::{LayoutNodeHelpers, Node, OpaqueStyleAndLayoutData};
|
use script::dom::node::{IN_FRAGMENTATION_CONTAINER, LayoutNodeHelpers, Node, OpaqueStyleAndLayoutData};
|
||||||
use script::dom::text::Text;
|
use script::dom::text::Text;
|
||||||
use script::layout_interface::TrustedNodeAddress;
|
use script::layout_interface::TrustedNodeAddress;
|
||||||
use selectors::matching::DeclarationBlock;
|
use selectors::matching::DeclarationBlock;
|
||||||
|
@ -226,6 +226,14 @@ impl<'ln> TNode<'ln> for ServoLayoutNode<'ln> {
|
||||||
self.node.set_flag(HAS_DIRTY_DESCENDANTS, value)
|
self.node.set_flag(HAS_DIRTY_DESCENDANTS, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn in_fragmentation_container(&self) -> bool {
|
||||||
|
unsafe { self.node.get_flag(IN_FRAGMENTATION_CONTAINER) }
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn set_in_fragmentation_container(&self, value: bool) {
|
||||||
|
self.node.set_flag(IN_FRAGMENTATION_CONTAINER, value)
|
||||||
|
}
|
||||||
|
|
||||||
unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData> {
|
unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData> {
|
||||||
self.borrow_layout_data_unchecked().map(|d| &(*d).style_data as *const PrivateStyleData)
|
self.borrow_layout_data_unchecked().map(|d| &(*d).style_data as *const PrivateStyleData)
|
||||||
}
|
}
|
||||||
|
@ -753,6 +761,8 @@ pub trait ThreadSafeLayoutNode<'ln> : Clone + Copy + Sized {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn in_fragmentation_container(&self) -> bool;
|
||||||
|
|
||||||
/// If this is a text node, generated content, or a form element, copies out
|
/// If this is a text node, generated content, or a form element, copies out
|
||||||
/// its content. Otherwise, panics.
|
/// its content. Otherwise, panics.
|
||||||
///
|
///
|
||||||
|
@ -929,6 +939,10 @@ impl<'ln> ThreadSafeLayoutNode<'ln> for ServoThreadSafeLayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn in_fragmentation_container(&self) -> bool {
|
||||||
|
self.node.in_fragmentation_container()
|
||||||
|
}
|
||||||
|
|
||||||
fn text_content(&self) -> TextContent {
|
fn text_content(&self) -> TextContent {
|
||||||
if self.pseudo != PseudoElementType::Normal {
|
if self.pseudo != PseudoElementType::Normal {
|
||||||
let data = &self.borrow_layout_data().unwrap().style_data;
|
let data = &self.borrow_layout_data().unwrap().style_data;
|
||||||
|
|
|
@ -144,6 +144,9 @@ bitflags! {
|
||||||
#[doc = "Specifies whether this node is focusable and whether it is supposed \
|
#[doc = "Specifies whether this node is focusable and whether it is supposed \
|
||||||
to be reachable with using sequential focus navigation."]
|
to be reachable with using sequential focus navigation."]
|
||||||
const SEQUENTIALLY_FOCUSABLE = 0x20,
|
const SEQUENTIALLY_FOCUSABLE = 0x20,
|
||||||
|
|
||||||
|
/// Whether any ancestor is a fragmentation container
|
||||||
|
const IN_FRAGMENTATION_CONTAINER = 0x40
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,10 @@ pub trait TNode<'ln> : Sized + Copy + Clone {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn in_fragmentation_container(&self) -> bool;
|
||||||
|
|
||||||
|
unsafe fn set_in_fragmentation_container(&self, value: bool);
|
||||||
|
|
||||||
/// Borrows the PrivateStyleData without checks.
|
/// Borrows the PrivateStyleData without checks.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData>;
|
unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData>;
|
||||||
|
|
|
@ -700,6 +700,11 @@ pub trait MatchMethods<'ln> : TNode<'ln> {
|
||||||
// This method needs to borrow the data as mutable, so make sure data_ref goes out of
|
// This method needs to borrow the data as mutable, so make sure data_ref goes out of
|
||||||
// scope first.
|
// scope first.
|
||||||
self.set_restyle_damage(damage);
|
self.set_restyle_damage(damage);
|
||||||
|
|
||||||
|
self.set_in_fragmentation_container(
|
||||||
|
parent.as_ref().map_or(false, |p| p.in_fragmentation_container()) ||
|
||||||
|
self.borrow_data().unwrap().style.as_ref().unwrap().is_multicol()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,17 @@ impl<'ln> TNode<'ln> for GeckoNode<'ln> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn in_fragmentation_container(&self) -> bool {
|
||||||
|
// FIXME(SimonSapin): Servo uses this to implement CSS multicol / fragmentation
|
||||||
|
// Maybe this isn’t useful for Gecko?
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn set_in_fragmentation_container(&self, _value: bool) {
|
||||||
|
// FIXME(SimonSapin): Servo uses this to implement CSS multicol / fragmentation
|
||||||
|
// Maybe this isn’t useful for Gecko?
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData> {
|
unsafe fn borrow_data_unchecked(&self) -> Option<*const PrivateStyleData> {
|
||||||
self.get_node_data().as_ref().map(|d| d.as_unsafe_cell().get() as *const PrivateStyleData)
|
self.get_node_data().as_ref().map(|d| d.as_unsafe_cell().get() as *const PrivateStyleData)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue