style: Three-value position syntax uses calc() as its computed value representation.

This restores the previous behavior of using calc().

Note that background-position / object-position, which test this, weren't
hitting the assertion because they use another codepath.

I didn't add more extensive tests for this because it's well tested for those
two properties, and because this is legacy anyway, see the comment in the test.

I did add the assertion to the codepath those two properties hit.

Differential Revision: https://phabricator.services.mozilla.com/D16176
This commit is contained in:
Emilio Cobos Álvarez 2019-01-11 01:07:22 +01:00
parent 119b316885
commit 99f6d6f1b8
2 changed files with 8 additions and 2 deletions

View file

@ -22,8 +22,8 @@ use crate::values::computed::transform::Matrix3D;
use crate::values::computed::url::ComputedImageUrl;
use crate::values::computed::{Angle, Gradient, Image};
use crate::values::computed::{Integer, LengthPercentage};
use crate::values::computed::{Length, Percentage, TextAlign};
use crate::values::computed::{LengthPercentageOrAuto, NonNegativeLengthPercentageOrAuto};
use crate::values::computed::{Percentage, TextAlign};
use crate::values::generics::box_::VerticalAlign;
use crate::values::generics::grid::{TrackListValue, TrackSize};
use crate::values::generics::image::{CompatMode, GradientItem, Image as GenericImage};
@ -35,6 +35,11 @@ use style_traits::values::specified::AllowedNumericType;
impl From<LengthPercentage> for nsStyleCoord_CalcValue {
fn from(other: LengthPercentage) -> nsStyleCoord_CalcValue {
debug_assert!(
other.was_calc ||
other.percentage.is_none() ||
other.unclamped_length() == Length::zero()
);
let has_percentage = other.percentage.is_some();
nsStyleCoord_CalcValue {
mLength: other.unclamped_length().to_i32_au(),