Closed Bug 1341763 Opened 7 years ago Closed 7 years ago

stylo: need -moz-image-rect support

Categories

(Core :: CSS Parsing and Computation, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: bzbarsky, Assigned: canova)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

Again, probably this is mostly servo-side....
Flags: needinfo?(simon.sapin)
Blocks: stylo-syntax
Priority: -- → P1
Assignee: nobody → canaltinova
Flags: needinfo?(simon.sapin)
Comment on attachment 8851221 [details]
Bug 1341763 - stylo: Rename and move PercentageOrNumber to values

https://reviewboard.mozilla.org/r/123590/#review126082

::: servo/components/style/gecko/values.rs:69
(Diff revision 1)
>  
> +impl GeckoStyleCoordConvertible for NumberOrPercentage {
> +    fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
> +        match *self {
> +            NumberOrPercentage::Number(ref n) => n.to_gecko_style_coord(coord),
> +            NumberOrPercentage::Percentage(p) => coord.set_value(CoordDataValue::Percent(p)),

does p.to_gecko_style_coord not work?

(If it doesn't,  we should probably add a GSCC impl for Percentage)

Edit: Oh, I see, you are using CSSFloat and not Percent -- that should be changed.

::: servo/components/style/values/computed/mod.rs:271
(Diff revision 1)
>  
> +#[derive(Debug, Clone, PartialEq)]
> +#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
> +#[allow(missing_docs)]
> +pub enum NumberOrPercentage {
> +    Percentage(CSSFloat),

Use the Percentage type here, it has ToCss impls and stuff that are useful.

::: servo/components/style/values/specified/mod.rs:567
(Diff revision 1)
> +        if let Ok(per) = input.try(|input| Percentage::parse(context, input)) {
> +            return Ok(NumberOrPercentage::Percentage(per));
> +        }
> +
> +        let num = try!(Number::parse_non_negative(input));
> +        Ok(NumberOrPercentage::Number(num))

nonnegativeness of the number should be documented somewhere, preferably on numberorpercentage itself
Attachment #8851221 - Flags: review?(manishearth) → review+
Comment on attachment 8851222 [details]
Bug 1341763 - stylo: Add support for -moz-image-rect value

https://reviewboard.mozilla.org/r/123592/#review126084
Attachment #8851222 - Flags: review?(manishearth) → review+
Comment on attachment 8851221 [details]
Bug 1341763 - stylo: Rename and move PercentageOrNumber to values

https://reviewboard.mozilla.org/r/123590/#review126082

> Use the Percentage type here, it has ToCss impls and stuff that are useful.

I thought this too when I wrote it but there is no computed Percentage type in servo currently. All other types like LengthOrPercentage uses CSSFloat for computed percentage. I should write that.

> nonnegativeness of the number should be documented somewhere, preferably on numberorpercentage itself

Ok, will do.
Comment on attachment 8851221 [details]
Bug 1341763 - stylo: Rename and move PercentageOrNumber to values

https://reviewboard.mozilla.org/r/123590/#review126082

> I thought this too when I wrote it but there is no computed Percentage type in servo currently. All other types like LengthOrPercentage uses CSSFloat for computed percentage. I should write that.

Oh, or probably I can use specified Percentage and add `ComputedValueAsSpecified` to Percentage for this since there are no differences with specified and computed.
Comment on attachment 8851260 [details]
Bug 1341763 - stylo: Update test expectations

https://reviewboard.mozilla.org/r/123612/#review126102

Go forth and split the commits :)
Attachment #8851260 - Flags: review+
Btw, the gecko and stylo test reference listings were different at some places. For example it was `== dom-api-computed-style.html dom-api-ref.html` in the gecko side but `fails == dom-api-computed-style.html dom-api-computed-style.html` in stylo side. I changed to match with gecko. Is it true?
No, keep it as is. The gecko tests test gecko rendering of foo.html with gecko rendering of foo-ref.html. The stylo tests test stylo rendering of foo.html against gecko rendering of foo.html -- for stylo correctness we want it to look like gecko, not necessarily pass all reftests.
Attachment #8851221 - Attachment is obsolete: true
Ok, reversed the reftests. Related Servo part: https://github.com/servo/servo/pull/16133
Pushed by manishearth@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/b315010da573
stylo: Add support for -moz-image-rect value r=manishearth
https://hg.mozilla.org/integration/autoland/rev/aadf315df1f8
stylo: Update test expectations r=manishearth
https://hg.mozilla.org/mozilla-central/rev/b315010da573
https://hg.mozilla.org/mozilla-central/rev/aadf315df1f8
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: