mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Add support for auto value in nsCSSValue sugar.
This commit is contained in:
parent
11ac1e894e
commit
3ea2f3a16c
2 changed files with 19 additions and 4 deletions
|
@ -217,9 +217,9 @@ impl ToNsCssValue for counter_style::Symbol {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToNsCssValue for counter_style::Ranges {
|
impl ToNsCssValue for counter_style::Ranges {
|
||||||
fn convert(&self, _nscssvalue: &mut nsCSSValue) {
|
fn convert(&self, nscssvalue: &mut nsCSSValue) {
|
||||||
if self.0.is_empty() {
|
if self.0.is_empty() {
|
||||||
//nscssvalue.set_auto(); // FIXME: add bindings for nsCSSValue::SetAutoValue
|
nscssvalue.set_auto();
|
||||||
} else {
|
} else {
|
||||||
for range in &self.0 {
|
for range in &self.0 {
|
||||||
fn set_bound(bound: Option<i32>, nscssvalue: &mut nsCSSValue) {
|
fn set_bound(bound: Option<i32>, nscssvalue: &mut nsCSSValue) {
|
||||||
|
@ -274,7 +274,7 @@ impl ToNsCssValue for counter_style::SpeakAs {
|
||||||
fn convert(&self, nscssvalue: &mut nsCSSValue) {
|
fn convert(&self, nscssvalue: &mut nsCSSValue) {
|
||||||
use counter_style::SpeakAs::*;
|
use counter_style::SpeakAs::*;
|
||||||
match *self {
|
match *self {
|
||||||
Auto => {} //nscssvalue.set_auto(), // FIXME: add bindings for nsCSSValue::SetAutoValue
|
Auto => nscssvalue.set_auto(),
|
||||||
Bullets => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_BULLETS as i32),
|
Bullets => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_BULLETS as i32),
|
||||||
Numbers => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_NUMBERS as i32),
|
Numbers => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_NUMBERS as i32),
|
||||||
Words => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_WORDS as i32),
|
Words => nscssvalue.set_enum(structs::NS_STYLE_COUNTER_SPEAKAS_WORDS as i32),
|
||||||
|
|
|
@ -101,9 +101,24 @@ impl nsCSSValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_valueless_unit(&mut self, unit: nsCSSUnit) {
|
||||||
|
debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_Null);
|
||||||
|
debug_assert!(unit as u32 <= nsCSSUnit::eCSSUnit_DummyInherit as u32, "Not a valueless unit");
|
||||||
|
self.mUnit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set to an auto value
|
||||||
|
///
|
||||||
|
/// This method requires the current value to be null.
|
||||||
|
pub fn set_auto(&mut self) {
|
||||||
|
self.set_valueless_unit(nsCSSUnit::eCSSUnit_Auto);
|
||||||
|
}
|
||||||
|
|
||||||
/// Set to a normal value
|
/// Set to a normal value
|
||||||
|
///
|
||||||
|
/// This method requires the current value to be null.
|
||||||
pub fn set_normal(&mut self) {
|
pub fn set_normal(&mut self) {
|
||||||
unsafe { bindings::Gecko_CSSValue_SetNormal(self) }
|
self.set_valueless_unit(nsCSSUnit::eCSSUnit_Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_string_internal(&mut self, s: &str, unit: nsCSSUnit) {
|
fn set_string_internal(&mut self, s: &str, unit: nsCSSUnit) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue