mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Remove concept of Layers from Servo
Layers were a feature of the legacy drawing path. If we re-add them at some point, it probably makes more sense to make them a product of display list inspection. This change also remove a bunch of dead painting code.
This commit is contained in:
parent
e667e62f0c
commit
ccb7ab926a
21 changed files with 57 additions and 745 deletions
|
@ -23,7 +23,6 @@ pub mod color;
|
|||
pub mod print_tree;
|
||||
|
||||
use range::RangeIndex;
|
||||
use std::fmt::{self, Debug, Formatter};
|
||||
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
|
||||
|
||||
/// The next ID that will be used for a special stacking context.
|
||||
|
@ -80,56 +79,6 @@ pub enum ScrollPolicy {
|
|||
FixedPosition,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Copy, Hash, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct LayerId(
|
||||
/// The type of the layer. This serves to differentiate layers that share fragments.
|
||||
LayerType,
|
||||
/// The identifier for this layer's fragment, derived from the fragment memory address.
|
||||
usize,
|
||||
/// An index for identifying companion layers, synthesized to ensure that
|
||||
/// content on top of this layer's fragment has the proper rendering order.
|
||||
usize
|
||||
);
|
||||
|
||||
impl Debug for LayerId {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
let LayerId(layer_type, id, companion) = *self;
|
||||
let type_string = match layer_type {
|
||||
LayerType::FragmentBody => "-FragmentBody",
|
||||
LayerType::OverflowScroll => "-OverflowScroll",
|
||||
LayerType::BeforePseudoContent => "-BeforePseudoContent",
|
||||
LayerType::AfterPseudoContent => "-AfterPseudoContent",
|
||||
};
|
||||
|
||||
write!(f, "{}{}-{}", id, type_string, companion)
|
||||
}
|
||||
}
|
||||
|
||||
impl LayerId {
|
||||
/// FIXME(#2011, pcwalton): This is unfortunate. Maybe remove this in the future.
|
||||
pub fn null() -> LayerId {
|
||||
LayerId(LayerType::FragmentBody, 0, 0)
|
||||
}
|
||||
|
||||
pub fn new_of_type(layer_type: LayerType, fragment_id: usize) -> LayerId {
|
||||
LayerId(layer_type, fragment_id, 0)
|
||||
}
|
||||
|
||||
pub fn companion_layer_id(&self) -> LayerId {
|
||||
let LayerId(layer_type, id, companion) = *self;
|
||||
LayerId(layer_type, id, companion + 1)
|
||||
}
|
||||
|
||||
pub fn original(&self) -> LayerId {
|
||||
let LayerId(layer_type, id, _) = *self;
|
||||
LayerId(layer_type, id, 0)
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> LayerType {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
|
||||
pub struct Epoch(pub u32);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue