Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement <meta name=viewport> handling #6185

Merged
merged 2 commits into from Oct 1, 2015
Merged

Conversation

@luniv
Copy link
Contributor

luniv commented May 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.

Review on Reviewable

@highfive
Copy link

highfive commented May 26, 2015

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@hoppipolla-critic-bot
Copy link

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 git rebase -i or git commit --amend) when updating this pull request.

let mut iter = content.chars().enumerate();

macro_rules! start_of_name {
() => {

This comment has been minimized.

@pcwalton

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.

@pcwalton

pcwalton May 26, 2015

Contributor

Same here.

-> Option<(&'a str, &'a str)>
{
macro_rules! end_of_token {
() => {

This comment has been minimized.

@pcwalton

pcwalton May 26, 2015

Contributor

Same here.

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.

@pcwalton

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.

@pcwalton

pcwalton May 26, 2015

Contributor

Is this supposed to be case-sensitive?

@pcwalton
Copy link
Contributor

pcwalton commented May 26, 2015

We should file some kind of follow-up for proper handling of dynamic removal of <meta name="viewport"> elements.

@luniv
Copy link
Contributor Author

luniv commented May 26, 2015

Review status: 0 of 9 files reviewed, 5 unresolved discussions, all commit checks successful.


components/script/dom/htmlmetaelement.rs, line 65 [r2] (raw file):
No, it should be case-insensitive.


Comments from the review on Reviewable.io

@luniv
Copy link
Contributor Author

luniv commented May 27, 2015

Pushed two fixup commits to address comments

@metajack
Copy link
Contributor

metajack commented Jun 1, 2015

@pcwalton Waiting for updated review.

@bors-servo
Copy link
Contributor

bors-servo commented Jun 19, 2015

The latest upstream changes (presumably #6424) made this pull request unmergeable. Please resolve the merge conflicts.

@metajack
Copy link
Contributor

metajack commented Jul 29, 2015

@pcwalton This has been waiting on you now for 2 months.

@nox nox removed the S-awaiting-review label Sep 13, 2015
@luniv luniv force-pushed the luniv:viewport-meta branch from 7b44f3a to 437bd77 Sep 19, 2015
@luniv
Copy link
Contributor Author

luniv commented Sep 19, 2015

Rebased, and converted the two macros to functions

@bors-servo
Copy link
Contributor

bors-servo commented Sep 19, 2015

The latest upstream changes (presumably #7662) made this pull request unmergeable. Please resolve the merge conflicts.

@luniv luniv force-pushed the luniv:viewport-meta branch from 43c11f5 to d8358d0 Sep 20, 2015
@nox
Copy link
Member

nox commented Sep 22, 2015

@pcwalton Ping?

@nox nox removed the S-needs-rebase label Sep 22, 2015
@bors-servo
Copy link
Contributor

bors-servo commented Sep 24, 2015

The latest upstream changes (presumably #7710) made this pull request unmergeable. Please resolve the merge conflicts.

@luniv luniv force-pushed the luniv:viewport-meta branch from d8358d0 to f9988c3 Sep 24, 2015
@bors-servo
Copy link
Contributor

bors-servo commented Sep 30, 2015

📌 Commit ffc1329 has been approved by mbrubeck

@bors-servo
Copy link
Contributor

bors-servo commented Sep 30, 2015

Testing commit ffc1329 with merge 3795054...

bors-servo pushed a commit that referenced this pull request Sep 30, 2015
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 30, 2015

💔 Test failed - linux-dev

@mbrubeck
Copy link
Contributor

mbrubeck commented Sep 30, 2015

It looks like the unit tests were bit-rotted by an unrelated change:

   Compiling style_tests v0.0.1 (file:///home/servo/buildbot/slave/linux-dev/build/components/servo)
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:47:13: 47:48 error: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library (see issue #0)
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:47         use std::intrinsics::discriminant_value;
                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:46:5: 60:6 note: in this expansion of if let expansion
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:47:13: 47:48 help: add #![feature(core_intrinsics)] to the crate attributes to enable
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:52:30: 52:48 error: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library (see issue #0)
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:52             let a = unsafe { discriminant_value(&a.descriptor) };
                                                                                                        ^~~~~~~~~~~~~~~~~~
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:46:5: 60:6 note: in this expansion of if let expansion
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:52:30: 52:48 help: add #![feature(core_intrinsics)] to the crate attributes to enable
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:53:30: 53:48 error: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library (see issue #0)
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:53             let b = unsafe { discriminant_value(&b.descriptor) };
                                                                                                        ^~~~~~~~~~~~~~~~~~
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:46:5: 60:6 note: in this expansion of if let expansion
/home/servo/buildbot/slave/linux-dev/build/tests/unit/style/viewport.rs:53:30: 53:48 help: add #![feature(core_intrinsics)] to the crate attributes to enable
error: aborting due to 3 previous errors
Could not compile `style_tests`.
@luniv
Copy link
Contributor Author

luniv commented Sep 30, 2015

@mbrubeck
Copy link
Contributor

mbrubeck commented Sep 30, 2015

That'd be my fault actually. I noticed the compiler complaining that the feature flag was unused and removed it in the final squash.

You can add it with #![cfg_attr(test, feature(...))] to avoid the unused feature warning, if it's only used in tests.

@bors-servo
Copy link
Contributor

bors-servo commented Sep 30, 2015

The latest upstream changes (presumably #7805) made this pull request unmergeable. Please resolve the merge conflicts.

@luniv luniv force-pushed the luniv:viewport-meta branch from ffc1329 to d0ace58 Oct 1, 2015
@luniv
Copy link
Contributor Author

luniv commented Oct 1, 2015

Rebased and fixed the missing feature flag

@jdm jdm removed the S-needs-rebase label Oct 1, 2015
@mbrubeck
Copy link
Contributor

mbrubeck commented Oct 1, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2015

📌 Commit d0ace58 has been approved by mbrubeck

@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2015

Testing commit d0ace58 with merge a774305...

bors-servo pushed a commit that referenced this pull request Oct 1, 2015
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2015

@bors-servo bors-servo merged commit d0ace58 into servo:master Oct 1, 2015
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@luniv luniv deleted the luniv:viewport-meta branch Oct 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

9 participants
You can’t perform that action at this time.