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 <meta name=viewport> handling #6185
Conversation
highfive
commented
May 26, 2015
hoppipolla-critic-bot
commented
May 26, 2015
|
Critic review: https://critic.hoppipolla.co.uk/r/5099 This is an external review system which you may optionally use for the code review of your pull request. In order to help critic track your changes, please do not make in-place history rewrites (e.g. via |
| let mut iter = content.chars().enumerate(); | ||
|
|
||
| macro_rules! start_of_name { | ||
| () => { |
This comment has been minimized.
This comment has been minimized.
pcwalton
May 26, 2015
Contributor
I think I'd prefer passing in iter as an argument to the macro to make it clear what variable it's using.
| } | ||
|
|
||
| macro_rules! skip_whitespace { | ||
| () => { |
This comment has been minimized.
This comment has been minimized.
| -> Option<(&'a str, &'a str)> | ||
| { | ||
| macro_rules! end_of_token { | ||
| () => { |
This comment has been minimized.
This comment has been minimized.
| match value.parse::<f32>() { | ||
| Ok(n) if n >= 0. => ViewportLength::Length(Length::from_px(n.max(1.).min(10000.))), | ||
| Ok(n) if n < 0. => return None, | ||
| _ => ViewportLength::Length(Length::from_px(1.)) |
This comment has been minimized.
This comment has been minimized.
pcwalton
May 26, 2015
Contributor
nit: Might be clearer as Ok(n) if n >= 0. => ..., Ok(n) => ..., Err(_) => ... ?
| let name = name.r().value(); | ||
| if !name.is_empty() { | ||
| match &**name { | ||
| "viewport" => self.translate_viewport(), |
This comment has been minimized.
This comment has been minimized.
|
We should file some kind of follow-up for proper handling of dynamic removal of |
|
Review status: 0 of 9 files reviewed, 5 unresolved discussions, all commit checks successful. components/script/dom/htmlmetaelement.rs, line 65 [r2] (raw file): Comments from the review on Reviewable.io |
|
Pushed two fixup commits to address comments |
|
@pcwalton Waiting for updated review. |
|
|
|
@pcwalton This has been waiting on you now for 2 months. |
|
Rebased, and converted the two macros to functions |
|
|
|
@pcwalton Ping? |
|
|
|
|
Implement <meta name=viewport> handling Translate <meta name=viewport> as according to [CSS Device Adaption § 9](http://dev.w3.org/csswg/css-device-adapt/#viewport-meta) Note: as the PR currently stands, handling `<meta name=viewport>` elements always occurs. This is probably not desired for some contexts (e.g. desktop), but I'm unsure of how to conditionally handle elements based on that. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6185) <!-- Reviewable:end -->
|
|
|
It looks like the unit tests were bit-rotted by an unrelated change:
|
|
That'd be my fault actually. I noticed the compiler complaining that the
feature flag was unused and removed it in the final squash.
I'll add it back in.
|
You can add it with |
|
|
|
Rebased and fixed the missing feature flag |
|
@bors-servo r+ |
|
|
Implement <meta name=viewport> handling Translate <meta name=viewport> as according to [CSS Device Adaption § 9](http://dev.w3.org/csswg/css-device-adapt/#viewport-meta) Note: as the PR currently stands, handling `<meta name=viewport>` elements always occurs. This is probably not desired for some contexts (e.g. desktop), but I'm unsure of how to conditionally handle elements based on that. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6185) <!-- Reviewable:end -->
|
|
luniv commentedMay 26, 2015
Translate as according to CSS Device Adaption § 9
Note: as the PR currently stands, handling
<meta name=viewport>elements always occurs. This is probably not desired for some contexts (e.g. desktop), but I'm unsure of how to conditionally handle elements based on that.