mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #14214 - bholley:dirtiness_overhaul, r=emilio
Overhaul dirtiness handling in Servo to prepare for the new incremental restyle architecture <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14214) <!-- Reviewable:end -->
This commit is contained in:
commit
e4a27c4d16
12 changed files with 192 additions and 183 deletions
|
@ -14,7 +14,7 @@ use parking_lot::RwLock;
|
|||
use properties::{ComputedValues, PropertyDeclarationBlock};
|
||||
use properties::longhands::display::computed_value as display;
|
||||
use restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
|
||||
use selector_impl::{ElementExt, PseudoElement, RestyleDamage, Snapshot};
|
||||
use selector_impl::{ElementExt, PseudoElement, RestyleDamage};
|
||||
use selector_matching::ApplicableDeclarationBlock;
|
||||
use sink::Push;
|
||||
use std::fmt::Debug;
|
||||
|
@ -105,8 +105,7 @@ impl<T, I> Iterator for LayoutIterator<T> where T: Iterator<Item=I>, I: NodeInfo
|
|||
}
|
||||
|
||||
pub trait TNode : Sized + Copy + Clone + NodeInfo {
|
||||
type ConcreteElement: TElement<ConcreteNode = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||
type ConcreteDocument: TDocument<ConcreteNode = Self, ConcreteElement = Self::ConcreteElement>;
|
||||
type ConcreteElement: TElement<ConcreteNode = Self>;
|
||||
type ConcreteChildrenIterator: Iterator<Item = Self>;
|
||||
|
||||
fn to_unsafe(&self) -> UnsafeNode;
|
||||
|
@ -130,8 +129,6 @@ pub trait TNode : Sized + Copy + Clone + NodeInfo {
|
|||
|
||||
fn as_element(&self) -> Option<Self::ConcreteElement>;
|
||||
|
||||
fn as_document(&self) -> Option<Self::ConcreteDocument>;
|
||||
|
||||
fn needs_dirty_on_viewport_size_changed(&self) -> bool;
|
||||
|
||||
unsafe fn set_dirty_on_viewport_size_changed(&self);
|
||||
|
@ -151,28 +148,13 @@ pub trait TNode : Sized + Copy + Clone + NodeInfo {
|
|||
fn next_sibling(&self) -> Option<Self>;
|
||||
}
|
||||
|
||||
pub trait TDocument : Sized + Copy + Clone {
|
||||
type ConcreteNode: TNode<ConcreteElement = Self::ConcreteElement, ConcreteDocument = Self>;
|
||||
type ConcreteElement: TElement<ConcreteNode = Self::ConcreteNode, ConcreteDocument = Self>;
|
||||
|
||||
fn as_node(&self) -> Self::ConcreteNode;
|
||||
|
||||
fn root_node(&self) -> Option<Self::ConcreteNode>;
|
||||
|
||||
fn drain_modified_elements(&self) -> Vec<(Self::ConcreteElement, Snapshot)>;
|
||||
|
||||
fn needs_paint_from_layout(&self);
|
||||
fn will_paint(&self);
|
||||
}
|
||||
|
||||
pub trait PresentationalHintsSynthetizer {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
|
||||
where V: Push<ApplicableDeclarationBlock>;
|
||||
}
|
||||
|
||||
pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + PresentationalHintsSynthetizer {
|
||||
type ConcreteNode: TNode<ConcreteElement = Self, ConcreteDocument = Self::ConcreteDocument>;
|
||||
type ConcreteDocument: TDocument<ConcreteNode = Self::ConcreteNode, ConcreteElement = Self>;
|
||||
type ConcreteNode: TNode<ConcreteElement = Self>;
|
||||
|
||||
fn as_node(&self) -> Self::ConcreteNode;
|
||||
|
||||
|
|
|
@ -7,22 +7,20 @@
|
|||
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell};
|
||||
use data::ElementData;
|
||||
use dom::{LayoutIterator, NodeInfo, TDocument, TElement, TNode, UnsafeNode};
|
||||
use dom::{LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
|
||||
use dom::{OpaqueNode, PresentationalHintsSynthetizer};
|
||||
use element_state::ElementState;
|
||||
use error_reporting::StdoutErrorReporter;
|
||||
use gecko::restyle_damage::GeckoRestyleDamage;
|
||||
use gecko::selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PseudoElement};
|
||||
use gecko::snapshot::GeckoElementSnapshot;
|
||||
use gecko::snapshot_helpers;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::bindings::{Gecko_DropStyleChildrenIterator, Gecko_MaybeCreateStyleChildrenIterator};
|
||||
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentElement};
|
||||
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetNextStyleChild};
|
||||
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetLastChild, Gecko_GetNextStyleChild};
|
||||
use gecko_bindings::bindings::{Gecko_GetServoDeclarationBlock, Gecko_IsHTMLElementInHTMLDocument};
|
||||
use gecko_bindings::bindings::{Gecko_IsLink, Gecko_IsRootElement};
|
||||
use gecko_bindings::bindings::{Gecko_IsUnvisitedLink, Gecko_IsVisitedLink, Gecko_Namespace};
|
||||
use gecko_bindings::bindings::{RawGeckoDocument, RawGeckoElement, RawGeckoNode};
|
||||
use gecko_bindings::bindings::{RawGeckoElement, RawGeckoNode};
|
||||
use gecko_bindings::bindings::Gecko_ClassOrClassList;
|
||||
use gecko_bindings::bindings::Gecko_GetStyleContext;
|
||||
use gecko_bindings::bindings::Gecko_SetNodeFlags;
|
||||
|
@ -78,7 +76,6 @@ impl<'ln> NodeInfo for GeckoNode<'ln> {
|
|||
}
|
||||
|
||||
impl<'ln> TNode for GeckoNode<'ln> {
|
||||
type ConcreteDocument = GeckoDocument<'ln>;
|
||||
type ConcreteElement = GeckoElement<'ln>;
|
||||
type ConcreteChildrenIterator = GeckoChildrenIterator<'ln>;
|
||||
|
||||
|
@ -137,10 +134,6 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
|||
}
|
||||
}
|
||||
|
||||
fn as_document(&self) -> Option<GeckoDocument<'ln>> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn can_be_fragmented(&self) -> bool {
|
||||
// FIXME(SimonSapin): Servo uses this to implement CSS multicol / fragmentation
|
||||
// Maybe this isn’t useful for Gecko?
|
||||
|
@ -218,33 +211,6 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct GeckoDocument<'ld>(pub &'ld RawGeckoDocument);
|
||||
|
||||
impl<'ld> TDocument for GeckoDocument<'ld> {
|
||||
type ConcreteNode = GeckoNode<'ld>;
|
||||
type ConcreteElement = GeckoElement<'ld>;
|
||||
|
||||
fn as_node(&self) -> GeckoNode<'ld> {
|
||||
unsafe { GeckoNode(&*(self.0 as *const _ as *const RawGeckoNode)) }
|
||||
}
|
||||
|
||||
fn root_node(&self) -> Option<GeckoNode<'ld>> {
|
||||
unsafe {
|
||||
Gecko_GetDocumentElement(self.0).map(|el| GeckoElement(el).as_node())
|
||||
}
|
||||
}
|
||||
|
||||
fn drain_modified_elements(&self) -> Vec<(GeckoElement<'ld>, GeckoElementSnapshot)> {
|
||||
unimplemented!()
|
||||
/*
|
||||
let elements = unsafe { self.0.drain_modified_elements() };
|
||||
elements.into_iter().map(|(el, snapshot)| (ServoLayoutElement::from_layout_js(el), snapshot)).collect()*/
|
||||
}
|
||||
fn will_paint(&self) { unimplemented!() }
|
||||
fn needs_paint_from_layout(&self) { unimplemented!() }
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct GeckoElement<'le>(pub &'le RawGeckoElement);
|
||||
|
||||
|
@ -322,7 +288,6 @@ lazy_static! {
|
|||
|
||||
impl<'le> TElement for GeckoElement<'le> {
|
||||
type ConcreteNode = GeckoNode<'le>;
|
||||
type ConcreteDocument = GeckoDocument<'le>;
|
||||
|
||||
fn as_node(&self) -> Self::ConcreteNode {
|
||||
unsafe { GeckoNode(&*(self.0 as *const _ as *const RawGeckoNode)) }
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use computed_values::display;
|
||||
use dom::TRestyleDamage;
|
||||
use heapsize::HeapSizeOf;
|
||||
use properties::ServoComputedValues;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
@ -48,6 +49,10 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
impl HeapSizeOf for ServoRestyleDamage {
|
||||
fn heap_size_of_children(&self) -> usize { 0 }
|
||||
}
|
||||
|
||||
impl TRestyleDamage for ServoRestyleDamage {
|
||||
/// For Servo the style source is always the computed values.
|
||||
type PreExistingComputedValues = Arc<ServoComputedValues>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue