mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Remove all color stuff from nsCSSValue.
This commit is contained in:
parent
665ea9037a
commit
8932dc98be
1 changed files with 3 additions and 16 deletions
|
@ -7,7 +7,7 @@
|
|||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs;
|
||||
use gecko_bindings::structs::{nsCSSValue, nsCSSUnit};
|
||||
use gecko_bindings::structs::{nsCSSValue_Array, nsCSSValueList, nscolor};
|
||||
use gecko_bindings::structs::{nsCSSValue_Array, nsCSSValueList};
|
||||
use gecko_string_cache::Atom;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
|
@ -33,33 +33,20 @@ impl nsCSSValue {
|
|||
/// builds.
|
||||
pub fn integer_unchecked(&self) -> i32 {
|
||||
debug_assert!(self.mUnit == nsCSSUnit::eCSSUnit_Integer ||
|
||||
self.mUnit == nsCSSUnit::eCSSUnit_Enumerated ||
|
||||
self.mUnit == nsCSSUnit::eCSSUnit_EnumColor);
|
||||
self.mUnit == nsCSSUnit::eCSSUnit_Enumerated);
|
||||
unsafe { *self.mValue.mInt.as_ref() }
|
||||
}
|
||||
|
||||
/// Checks if it is an integer and returns it if so
|
||||
pub fn integer(&self) -> Option<i32> {
|
||||
if self.mUnit == nsCSSUnit::eCSSUnit_Integer ||
|
||||
self.mUnit == nsCSSUnit::eCSSUnit_Enumerated ||
|
||||
self.mUnit == nsCSSUnit::eCSSUnit_EnumColor {
|
||||
self.mUnit == nsCSSUnit::eCSSUnit_Enumerated {
|
||||
Some(unsafe { *self.mValue.mInt.as_ref() })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if it is an RGBA color, returning it if so
|
||||
/// Only use it with colors set by SetColorValue(),
|
||||
/// which always sets RGBA colors
|
||||
pub fn color_value(&self) -> Option<nscolor> {
|
||||
if self.mUnit == nsCSSUnit::eCSSUnit_RGBAColor {
|
||||
Some(unsafe { *self.mValue.mColor.as_ref() })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns this nsCSSValue value as a floating point value, unchecked in
|
||||
/// release builds.
|
||||
pub fn float_unchecked(&self) -> f32 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue