mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Refactor style to be completely backend-independent
This commit refactors the style crate to be completely independent of the actual implementation and pseudo-elements supported. This also adds a gecko backend which introduces parsing for the anonymous box pseudo-elements[1], although there's still no way of querying them. https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSAnonBoxList.h
This commit is contained in:
parent
a164176876
commit
dd503dfacb
41 changed files with 767 additions and 310 deletions
|
@ -3,29 +3,27 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use properties::ComputedValues;
|
||||
use selectors::parser::SelectorImpl;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicIsize;
|
||||
|
||||
pub struct PrivateStyleData {
|
||||
pub struct PrivateStyleData<Impl: SelectorImpl> {
|
||||
/// The results of CSS styling for this node.
|
||||
pub style: Option<Arc<ComputedValues>>,
|
||||
|
||||
/// 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>>,
|
||||
/// The results of CSS styling for each pseudo-element (if any).
|
||||
pub per_pseudo: HashMap<Impl::PseudoElement, Option<Arc<ComputedValues>>>,
|
||||
|
||||
/// Information needed during parallel traversals.
|
||||
pub parallel: DomParallelInfo,
|
||||
}
|
||||
|
||||
impl PrivateStyleData {
|
||||
pub fn new() -> PrivateStyleData {
|
||||
impl<Impl: SelectorImpl> PrivateStyleData<Impl> {
|
||||
pub fn new() -> PrivateStyleData<Impl> {
|
||||
PrivateStyleData {
|
||||
style: None,
|
||||
before_style: None,
|
||||
after_style: None,
|
||||
per_pseudo: HashMap::new(),
|
||||
parallel: DomParallelInfo::new(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue