Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upimplement support for the width query #14192
Conversation
highfive
commented
Nov 13, 2016
|
The test in https://github.com/servo/servo/pull/14192/files#diff-f199ebf0b50ca2e217e93e4f1b0d17bd is now passing, however I wonder if it's really 'that easy'... |
|
|
|
Yup, it was sort of "that easy" :P Still a few nits here and there, but looks good over-all :) |
| @@ -146,6 +146,7 @@ impl ToCss for MediaQuery { | |||
| let (mm, l) = match e { | |||
| Expression::Width(Range::Min(ref l)) => ("min", l), | |||
| Expression::Width(Range::Max(ref l)) => ("max", l), | |||
| Expression::Width(Range::Eq(ref l)) => ("eq", l), | |||
This comment has been minimized.
This comment has been minimized.
emilio
Nov 13, 2016
Member
This would serialize the query as eq-width: foo, which isn't what is supposed to happen (it should be serialized just as width: foo.
Please fix it and write a test for it :)
| @@ -8,8 +8,7 @@ | |||
| expected: FAIL | |||
|
|
|||
| [MediaQueryList.matches for "(width: 200px)"] | |||
| expected: FAIL | |||
| expected: PASS | |||
This comment has been minimized.
This comment has been minimized.
| @@ -42,7 +42,7 @@ impl Default for MediaList { | |||
| pub enum Range<T> { | |||
| Min(T), | |||
| Max(T), | |||
| //Eq(T), // FIXME: Implement parsing support for equality then re-enable this. | |||
| Eq(T), // FIXME: Implement parsing support for equality then re-enable this. | |||
This comment has been minimized.
This comment has been minimized.
|
@emilio thanks for your feedback, I will address those points next weekend |
34798a8
to
c3f4389
| @@ -129,8 +129,12 @@ impl ToCss for MediaQuery { | |||
| let (mm, l) = match e { | |||
| Expression::Width(Range::Min(ref l)) => ("min", l), | |||
| Expression::Width(Range::Max(ref l)) => ("max", l), | |||
| Expression::Width(Range::Eq(ref l)) => ("eq", l), | |||
| }; | |||
| match mm { | |||
This comment has been minimized.
This comment has been minimized.
emilio
Nov 26, 2016
Member
I think this could look cleaner as follows:
let (mm, l) = match e {
Expression::Width(Range::Min(ref l)) => ("min-", l),
Expression::Width(Range::Max(ref l)) => ("max-", l),
Expression::Width(Range::Eq(ref l)) => ("", l),
};
try!(write!("{}width: ", mm));What do you think?
This comment has been minimized.
This comment has been minimized.
|
Looks good otherwise, could you squash your commits? Thanks! |
|
Will do, should I squash all in one, or separate code from tests? @emilio |
|
Both work for me :) |
failing test for correct to_css of "width" separate test for mq and to_css implement css serialization for Eq remove PASS test expectation remove FIXME simplify serialization
c5c254c
to
84e9277
|
@bors-servo r+ Thanks! :) |
|
|
implement support for the width query <!-- Please describe your changes on the following line: --> implement support for the `width` media query --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix ##13670 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/14192) <!-- Reviewable:end -->
|
|
gterzian commentedNov 13, 2016
•
edited by larsbergstrom
implement support for the
widthmedia query./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is