mirror of
https://github.com/servo/servo.git
synced 2025-08-01 19:50:30 +01:00
style: Refactor RestyleHint to be a struct.
Later PRs will add additional data to it that is not so easy to represent using bitflags.
This commit is contained in:
parent
c13be5cd13
commit
a397590838
9 changed files with 294 additions and 111 deletions
|
@ -131,7 +131,7 @@ use std::rc::Rc;
|
|||
use std::time::{Duration, Instant};
|
||||
use style::attr::AttrValue;
|
||||
use style::context::{QuirksMode, ReflowGoal};
|
||||
use style::restyle_hints::{RestyleHint, RESTYLE_SELF, RESTYLE_STYLE_ATTRIBUTE};
|
||||
use style::restyle_hints::{RestyleHint, RestyleReplacements, RESTYLE_STYLE_ATTRIBUTE};
|
||||
use style::selector_parser::{RestyleDamage, Snapshot};
|
||||
use style::shared_lock::SharedRwLock as StyleSharedRwLock;
|
||||
use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join};
|
||||
|
@ -2361,14 +2361,14 @@ impl Document {
|
|||
entry.snapshot = Some(Snapshot::new(el.html_element_in_html_document()));
|
||||
}
|
||||
if attr.local_name() == &local_name!("style") {
|
||||
entry.hint |= RESTYLE_STYLE_ATTRIBUTE;
|
||||
entry.hint.insert(RestyleHint::for_replacements(RESTYLE_STYLE_ATTRIBUTE));
|
||||
}
|
||||
|
||||
// FIXME(emilio): This should become something like
|
||||
// element.is_attribute_mapped(attr.local_name()).
|
||||
if attr.local_name() == &local_name!("width") ||
|
||||
attr.local_name() == &local_name!("height") {
|
||||
entry.hint |= RESTYLE_SELF;
|
||||
entry.hint.insert(RestyleHint::for_self());
|
||||
}
|
||||
|
||||
let mut snapshot = entry.snapshot.as_mut().unwrap();
|
||||
|
|
|
@ -102,7 +102,7 @@ use style::context::{QuirksMode, ReflowGoal};
|
|||
use style::element_state::*;
|
||||
use style::properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
|
||||
use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size, overflow_x};
|
||||
use style::restyle_hints::RESTYLE_SELF;
|
||||
use style::restyle_hints::RestyleHint;
|
||||
use style::rule_tree::CascadeLevel;
|
||||
use style::selector_parser::{NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl, SelectorParser};
|
||||
use style::shared_lock::{SharedRwLock, Locked};
|
||||
|
@ -245,7 +245,7 @@ impl Element {
|
|||
|
||||
// FIXME(bholley): I think we should probably only do this for
|
||||
// NodeStyleDamaged, but I'm preserving existing behavior.
|
||||
restyle.hint |= RESTYLE_SELF;
|
||||
restyle.hint.insert(RestyleHint::for_self());
|
||||
|
||||
if damage == NodeDamage::OtherNodeDamage {
|
||||
restyle.damage = RestyleDamage::rebuild_and_reflow();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue