mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Bug 1317016 - Basic infrastructure for RestyleHint-driven traversal.
MozReview-Commit-ID: 7wH5XcILVmX
This commit is contained in:
parent
e1eff691f8
commit
992f7dddf4
35 changed files with 1465 additions and 901 deletions
|
@ -6,6 +6,8 @@
|
|||
|
||||
use Atom;
|
||||
use element_state::*;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::structs::nsRestyleHint;
|
||||
#[cfg(feature = "servo")]
|
||||
use heapsize::HeapSizeOf;
|
||||
use selector_parser::{AttrValue, ElementExt, NonTSPseudoClass, Snapshot, SelectorImpl};
|
||||
|
@ -23,7 +25,7 @@ use std::sync::Arc;
|
|||
/// attribute selectors. Doing this conservatively is expensive, and so we use
|
||||
/// RestyleHints to short-circuit work we know is unnecessary.
|
||||
bitflags! {
|
||||
pub flags RestyleHint: u8 {
|
||||
pub flags RestyleHint: u32 {
|
||||
#[doc = "Rerun selector matching on the element."]
|
||||
const RESTYLE_SELF = 0x01,
|
||||
#[doc = "Rerun selector matching on all of the element's descendants."]
|
||||
|
@ -35,6 +37,21 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl From<nsRestyleHint> for RestyleHint {
|
||||
fn from(raw: nsRestyleHint) -> Self {
|
||||
use std::mem;
|
||||
let raw_bits: u32 = unsafe { mem::transmute(raw) };
|
||||
// FIXME(bholley): Finish aligning the binary representations here and
|
||||
// then .expect() the result of the checked version.
|
||||
if Self::from_bits(raw_bits).is_none() {
|
||||
error!("stylo: dropping unsupported restyle hint bits");
|
||||
}
|
||||
|
||||
Self::from_bits_truncate(raw_bits)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
impl HeapSizeOf for RestyleHint {
|
||||
fn heap_size_of_children(&self) -> usize { 0 }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue