mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #13157 - Manishearth:background-size, r=emilio
stylo: support background-size and corner gradients Forgot to fix this in the midst of all other things fixed in #12945 <s>(not yet tested, need to figure out how to test bg-size with gradients)</s> r? @bholley <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13157) <!-- Reviewable:end -->
This commit is contained in:
commit
c46003eb05
3 changed files with 133 additions and 6 deletions
|
@ -14,7 +14,7 @@ use gecko_bindings::structs::nsStyleCoord_CalcValue;
|
|||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI};
|
||||
use properties::ComputedValues;
|
||||
use stylesheets::Stylesheet;
|
||||
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage};
|
||||
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
|
||||
unsafe impl HasFFI for Stylesheet {
|
||||
type FFIType = RawServoStyleSheet;
|
||||
|
@ -72,6 +72,29 @@ impl From<LengthOrPercentage> for nsStyleCoord_CalcValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl LengthOrPercentageOrAuto {
|
||||
pub fn to_calc_value(&self) -> Option<nsStyleCoord_CalcValue> {
|
||||
match *self {
|
||||
LengthOrPercentageOrAuto::Length(au) => {
|
||||
Some(nsStyleCoord_CalcValue {
|
||||
mLength: au.0,
|
||||
mPercent: 0.0,
|
||||
mHasPercent: false,
|
||||
})
|
||||
},
|
||||
LengthOrPercentageOrAuto::Percentage(pc) => {
|
||||
Some(nsStyleCoord_CalcValue {
|
||||
mLength: 0,
|
||||
mPercent: pc,
|
||||
mHasPercent: true,
|
||||
})
|
||||
},
|
||||
LengthOrPercentageOrAuto::Calc(calc) => Some(calc.into()),
|
||||
LengthOrPercentageOrAuto::Auto => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<nsStyleCoord_CalcValue> for LengthOrPercentage {
|
||||
fn from(other: nsStyleCoord_CalcValue) -> LengthOrPercentage {
|
||||
match (other.mHasPercent, other.mLength) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue