mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05:33 +01:00
Use CSSPixelLength in LengthOrPercentage{*}.
Replace Au with CSSPixelLength in LengthOrPercentage, LengthOrPercentageOrAuto, and LengthOrPercentageOrNone.
This commit is contained in:
parent
535c1e3c6f
commit
b89286e8e7
25 changed files with 109 additions and 118 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
//! Little helpers for `nsCSSValue`.
|
||||
|
||||
use app_units::Au;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs;
|
||||
use gecko_bindings::structs::{nsCSSValue, nsCSSUnit};
|
||||
|
@ -75,8 +74,8 @@ impl nsCSSValue {
|
|||
/// Sets LengthOrPercentage value to this nsCSSValue.
|
||||
pub unsafe fn set_lop(&mut self, lop: LengthOrPercentage) {
|
||||
match lop {
|
||||
LengthOrPercentage::Length(au) => {
|
||||
bindings::Gecko_CSSValue_SetAbsoluteLength(self, au.0)
|
||||
LengthOrPercentage::Length(px) => {
|
||||
bindings::Gecko_CSSValue_SetPixelLength(self, px.px())
|
||||
}
|
||||
LengthOrPercentage::Percentage(pc) => {
|
||||
bindings::Gecko_CSSValue_SetPercentage(self, pc.0)
|
||||
|
@ -89,9 +88,10 @@ impl nsCSSValue {
|
|||
|
||||
/// Returns LengthOrPercentage value.
|
||||
pub unsafe fn get_lop(&self) -> LengthOrPercentage {
|
||||
use values::computed::Length;
|
||||
match self.mUnit {
|
||||
nsCSSUnit::eCSSUnit_Pixel => {
|
||||
LengthOrPercentage::Length(Au(bindings::Gecko_CSSValue_GetAbsoluteLength(self)))
|
||||
LengthOrPercentage::Length(Length::new(bindings::Gecko_CSSValue_GetNumber(self)))
|
||||
},
|
||||
nsCSSUnit::eCSSUnit_Percent => {
|
||||
LengthOrPercentage::Percentage(Percentage(bindings::Gecko_CSSValue_GetPercentage(self)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue