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

Only allow border-image-outset to use non-negative numbers. #14347

Merged
merged 1 commit into from Nov 23, 2016

Conversation

@jcdyer
Copy link
Contributor

commented Nov 23, 2016

Restricts border-image-outline to only allow positive values.

Fixes #14295


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14295.
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive

This comment has been minimized.

Copy link

commented Nov 23, 2016

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon.

@highfive

This comment has been minimized.

Copy link

commented Nov 23, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/values/specified/length.rs, components/style/properties/longhand/border.mako.rs
  • @emilio: components/style/values/specified/length.rs, components/style/properties/longhand/border.mako.rs

impl LengthOrNumber {
pub fn parse_non_negative_number(input: &mut Parser) -> Result<Self, ()> {
if let Ok(v) = input.try(|i| Length::parse(i)) {

This comment has been minimized.

Copy link
@Manishearth

Manishearth Nov 23, 2016

Member

Should be Length::parse_non_negative here.

This comment has been minimized.

Copy link
@jcdyer

jcdyer Nov 23, 2016

Author Contributor

The original implementation did a plain parse for Length and a parse_non_negative only for Number. Was that incorrect, too?

This comment has been minimized.

Copy link
@Manishearth

Manishearth Nov 23, 2016

Member

Yeah. Spec (https://drafts.csswg.org/css-backgrounds-3/#border-image-outset) says "negative values are invalid" for LengthOrNumber.

This comment has been minimized.

Copy link
@wafflespeanut

wafflespeanut Nov 23, 2016

Member

Oh, I somehow seem to have misread this as negative "number". Hmph.

@@ -12,7 +12,7 @@ use style::properties::shorthands::border_image;
use style::stylesheets::Origin;

#[test]
fn border_image_shorhand_should_parse_when_all_properties_specified() {
fn border_image_shorthand_should_parse_when_all_properties_specified() {

This comment has been minimized.

Copy link
@wafflespeanut

wafflespeanut Nov 23, 2016

Member

Pfft. "shorhand" - thanks for fixing that 😄

@wafflespeanut
Copy link
Member

left a comment

This looks great! Thanks :)

@wafflespeanut

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented Nov 23, 2016

📌 Commit da03a55 has been approved by Wafflespeanut

@Manishearth

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

@bors-servo r-

needs to fix the length thing too

@@ -1009,3 +1009,13 @@ impl Parse for LengthOrPercentageOrAutoOrContent {
}

pub type LengthOrNumber = Either<Length, Number>;

impl LengthOrNumber {
pub fn parse_non_negative_number(input: &mut Parser) -> Result<Self, ()> {

This comment has been minimized.

Copy link
@wafflespeanut

wafflespeanut Nov 23, 2016

Member

In that case, the method itself should be renamed to parse_non_negative

This comment has been minimized.

Copy link
@jcdyer

jcdyer Nov 23, 2016

Author Contributor

Agreed.

@wafflespeanut

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

Squash please :)

@jcdyer jcdyer force-pushed the jcdyer:cdyer/len-parsing branch from 6958d78 to 46c4c9c Nov 23, 2016

@jcdyer

This comment has been minimized.

Copy link
Contributor Author

commented Nov 23, 2016

Squashed.

@wafflespeanut

This comment has been minimized.

Copy link
Member

commented Nov 23, 2016

@bors-servo r+

Thanks!

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented Nov 23, 2016

📌 Commit 46c4c9c has been approved by Wafflespeanut

@bors-servo

This comment has been minimized.

Copy link
Contributor

commented Nov 23, 2016

⌛️ Testing commit 46c4c9c with merge 210b1be...

bors-servo added a commit that referenced this pull request Nov 23, 2016
Auto merge of #14347 - jcdyer:cdyer/len-parsing, r=Wafflespeanut
Only allow border-image-outset to use non-negative numbers.

Restricts border-image-outline to only allow positive values.

Fixes #14295

---
<!-- 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 #14295.

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

This comment has been minimized.

Copy link
Contributor

commented Nov 23, 2016

@bors-servo bors-servo merged commit 46c4c9c into servo:master Nov 23, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.