mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Separate style+layout and layout-specific wrapper functionality.
This patch does a number of things, unfortunately all at once: * Hoists a large subset of the layout wrapper functionality into the style system. * Merges TElementAttributes into the newly-created TElement. * Reorganizes LayoutData by style vs layout, and removes LayoutDataShared. * Simplifies the API for borrowing style/layout data. There's still more to do to make the style system usable standalone, but this is a good start.
This commit is contained in:
parent
89ab368258
commit
47059d2d26
20 changed files with 657 additions and 706 deletions
|
@ -4,18 +4,15 @@
|
|||
|
||||
use construct::ConstructionResult;
|
||||
use incremental::RestyleDamage;
|
||||
use parallel::DomParallelInfo;
|
||||
use script::dom::node::SharedLayoutData;
|
||||
use std::sync::Arc;
|
||||
use style::properties::ComputedValues;
|
||||
use style::data::PrivateStyleData;
|
||||
|
||||
/// Data that layout associates with a node.
|
||||
pub struct PrivateLayoutData {
|
||||
/// The results of CSS styling for this node's `before` pseudo-element, if any.
|
||||
pub before_style: Option<Arc<ComputedValues>>,
|
||||
|
||||
/// The results of CSS styling for this node's `after` pseudo-element, if any.
|
||||
pub after_style: Option<Arc<ComputedValues>>,
|
||||
/// Data that the style system associates with a node. When the
|
||||
/// style system is being used standalone, this is all that hangs
|
||||
/// off the node. This must be first to permit the various
|
||||
/// transmuations between PrivateStyleData PrivateLayoutData.
|
||||
pub style_data: PrivateStyleData,
|
||||
|
||||
/// Description of how to account for recent style changes.
|
||||
pub restyle_damage: RestyleDamage,
|
||||
|
@ -28,9 +25,6 @@ pub struct PrivateLayoutData {
|
|||
|
||||
pub after_flow_construction_result: ConstructionResult,
|
||||
|
||||
/// Information needed during parallel traversals.
|
||||
pub parallel: DomParallelInfo,
|
||||
|
||||
/// Various flags.
|
||||
pub flags: LayoutDataFlags,
|
||||
}
|
||||
|
@ -39,13 +33,11 @@ impl PrivateLayoutData {
|
|||
/// Creates new layout data.
|
||||
pub fn new() -> PrivateLayoutData {
|
||||
PrivateLayoutData {
|
||||
before_style: None,
|
||||
after_style: None,
|
||||
style_data: PrivateStyleData::new(),
|
||||
restyle_damage: RestyleDamage::empty(),
|
||||
flow_construction_result: ConstructionResult::None,
|
||||
before_flow_construction_result: ConstructionResult::None,
|
||||
after_flow_construction_result: ConstructionResult::None,
|
||||
parallel: DomParallelInfo::new(),
|
||||
flags: LayoutDataFlags::empty(),
|
||||
}
|
||||
}
|
||||
|
@ -57,16 +49,3 @@ bitflags! {
|
|||
const HAS_NEWLY_CONSTRUCTED_FLOW = 0x01
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LayoutDataWrapper {
|
||||
pub shared_data: SharedLayoutData,
|
||||
pub data: Box<PrivateLayoutData>,
|
||||
}
|
||||
|
||||
#[allow(dead_code, unsafe_code)]
|
||||
fn static_assertion(x: Option<LayoutDataWrapper>) {
|
||||
unsafe {
|
||||
let _: Option<::script::dom::node::LayoutData> =
|
||||
::std::intrinsics::transmute(x);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue