Skip to content

style: Move font -moz-script-min-size outside of mako - #19051

Merged
bors-servo merged 1 commit into
servo:masterfrom
CYBAI:moz-script-min-size-no-mako
Oct 30, 2017
Merged

bors-servo merged 1 commit into
servo:masterfrom
CYBAI:moz-script-min-size-no-mako

Conversation

@CYBAI

@CYBAI CYBAI commented Oct 28, 2017 •

Copy link
Copy Markdown
Member

This is a sub-PR for #19015
r? emilio



This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/gecko.mako.rs, components/style/values/specified/font.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/computed/font.rs and 1 more
  • @canaltinova: components/style/properties/gecko.mako.rs, components/style/values/specified/font.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/computed/font.rs and 1 more
  • @emilio: components/style/properties/gecko.mako.rs, components/style/values/specified/font.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/computed/font.rs and 1 more

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 28, 2017

@canova canova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!
It looks good overall but adding some minor comments.

}
}

#[allow(non_snake_case)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We don't change anything here and the new methods will be removed after my comment below. So we can put that back to its previous place.

#[allow(non_snake_case)]
pub fn reset__x_lang(&mut self, other: &Self) {
self.copy__x_lang_from(other)
pub fn set__moz_script_min_size(&mut self, v: longhands::_moz_script_min_size::computed_value::T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can create these methods with something like

${impl_absolute_length("_moz_script_min_size", "mScriptMinSize")}

Or we can append this dictionary with "MozScriptMinSize": impl_absolute_length,: https://dxr.mozilla.org/servo/source/components/style/properties/gecko.mako.rs#1107 This list is probably for more generic stuff but I don't have a preference.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review! I'll try the second solution!

use values::specified::length::{FontBaseSize, NoCalcLength};

pub use values::specified::font::XTextZoom;
pub use values::computed::Length as MozScriptMinSize;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should avoid adding uses like this. We might need Length in that file at some point. How about creating a type alias instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, we do this in another places.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A type alias has the inconvenience that you can't use enum variants anymore, this is a rust known issue, so I'd rather keep this for now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emilio Thanks for the clarification! I didn't know about that type alias would have that inconvenience but now I learn it 😄


pub use values::specified::font::XTextZoom;
pub use values::computed::Length as MozScriptMinSize;
pub use values::specified::font::{XTextZoom, MozScriptMinSize as SpecifiedMozScriptMinSize };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: afaict, we don't need to make SpecifiedMozScriptMinSize use public.

use values::specified::length::FontBaseSize;
use values::specified::length::{AU_PER_PT, AU_PER_PX, FontBaseSize};

const DEFAULT_SCRIPT_MIN_SIZE_PT: ::std::os::raw::c_uint = 8;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be best to get this from bindings like the previous approach. We can wrap the new structs and its impls with #[cfg(feature = "gecko")] since it's only used in gecko.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested doing this, because we're removing the Gecko constant anyway, and the less build-time dependent stuff we have the better. It should probably be a u32 though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks emilio for clarification. I'll update the type to u32.

@CYBAI
CYBAI force-pushed the moz-script-min-size-no-mako branch 3 times, most recently from 5e69f57 to 9bba945 Compare October 30, 2017 16:29
}
}

impl Parse for specified::MozScriptMinSize {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Parse implementations go usually in the specified module, mind moving this there?

Also, there's some weird indentation below (not really your fault), mind fixing it up like:

    fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
        // ...
    }

With that, this looks great, thanks a lot!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me move it into specified module.

@CYBAI
CYBAI force-pushed the moz-script-min-size-no-mako branch from 9bba945 to 63cd930 Compare October 30, 2017 16:45

@emilio emilio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@emilio

emilio commented Oct 30, 2017

Copy link
Copy Markdown
Member

@bors-servo r=emilio,canaltinova

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 63cd930 has been approved by emilio,canaltinova

@highfive highfive assigned emilio and unassigned mbrubeck Oct 30, 2017
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 30, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 63cd930 with merge 807687f...

bors-servo pushed a commit that referenced this pull request Oct 30, 2017
…naltinova

style: Move font -moz-script-min-size outside of mako

This is a sub-PR for #19015
r? @emilio

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19034 (github issue number if applicable).
- [X] These changes do not require tests because _____

<!-- 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/19051)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Oct 30, 2017
@emilio

emilio commented Oct 30, 2017

Copy link
Copy Markdown
Member

@bors-servo retry #19064

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 63cd930 with merge 10227e3...

bors-servo pushed a commit that referenced this pull request Oct 30, 2017
…naltinova

style: Move font -moz-script-min-size outside of mako

This is a sub-PR for #19015
r? emilio

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19034 (github issue number if applicable).
- [X] These changes do not require tests because _____

<!-- 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/19051)
<!-- Reviewable:end -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Oct 30, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: emilio,canaltinova
Pushing 10227e3 to master...

@bors-servo
bors-servo merged commit 63cd930 into servo:master Oct 30, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 30, 2017
@CYBAI
CYBAI deleted the moz-script-min-size-no-mako branch October 31, 2017 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move -moz-script-min-size outside of mako.

6 participants