mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Make Servo deal with CSS property prefs more correctly.
Right now you could still set preffed-off properties from CSSStyleDeclaration.
This commit is contained in:
parent
030509e66b
commit
650e947c94
4 changed files with 54 additions and 16 deletions
|
@ -164,9 +164,17 @@ macro_rules! css_properties(
|
|||
( $([$getter:ident, $setter:ident, $id:expr],)* ) => (
|
||||
$(
|
||||
fn $getter(&self) -> DOMString {
|
||||
debug_assert!(
|
||||
$id.enabled_for_all_content(),
|
||||
"Someone forgot a #[Pref] annotation"
|
||||
);
|
||||
self.get_property_value($id)
|
||||
}
|
||||
fn $setter(&self, value: DOMString) -> ErrorResult {
|
||||
debug_assert!(
|
||||
$id.enabled_for_all_content(),
|
||||
"Someone forgot a #[Pref] annotation"
|
||||
);
|
||||
self.set_property($id, value, DOMString::new())
|
||||
}
|
||||
)*
|
||||
|
@ -238,6 +246,10 @@ impl CSSStyleDeclaration {
|
|||
return Err(Error::NoModificationAllowed);
|
||||
}
|
||||
|
||||
if !id.enabled_for_all_content() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.owner.mutate_associated_block(|pdb, changed| {
|
||||
if value.is_empty() {
|
||||
// Step 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue