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

initial-letter property #16166

Merged
merged 1 commit into from Mar 31, 2017
Merged

initial-letter property #16166

merged 1 commit into from Mar 31, 2017

Conversation

@streichgeorg
Copy link
Contributor

streichgeorg commented Mar 28, 2017

Implemented parsing and serialization for the initial-letter property.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #15959 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Mar 28, 2017

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

@highfive
Copy link

highfive commented Mar 28, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/text.mako.rs
  • @emilio: components/style/properties/longhand/text.mako.rs
match *self {
SpecifiedValue::Normal => try!(dest.write_str("normal")),
SpecifiedValue::Specified(size, Some(sink)) =>
try!(write!(dest, "{} {}", size.to_css_string(), sink.to_css_string())),

This comment has been minimized.

@emilio

emilio Mar 28, 2017

Member

let's do instead:

SpecifiedValue::Specified(size, sink) => {
    try!(size.to_css(dest));
    if let Some(sink) = sink {
        try!(dest.write_str(" "));
        try!(sink.to_css(dest));
    }
}

And remove the branch below.

size = value;
} else {
return Err(());
}

This comment has been minimized.

@emilio

emilio Mar 28, 2017

Member

instead of this, just:

let size = try!(Number::parse_at_least_one(input));
return Err(());
}

if let Ok(value) = Integer::parse(context, input) {

This comment has been minimized.

@emilio

emilio Mar 28, 2017

Member

This needs to use input.try to avoid inadvertently treating invalid input as valid. For example, I suspect with your patch 1.5 5px would parse as 1.5. Could you add a test for this?

Let's write this instead as:

match input.try(|input| Integer::parse(context, input)) {
    Ok(number) => {
        if number.value() < 1 {
            return Err(());
        }
        Ok(SpecifiedValue::Specified(size, Some(value))
    }
    Err(()) => Ok(SpecifiedValue::Specified(size, None)),
}
Copy link
Member

emilio left a comment

Looks good to me with that bit addressed, thanks!


match input.try(|input| Integer::parse(context, input)) {
Ok(number) => {
if number.0 < 1 {

This comment has been minimized.

@emilio

emilio Mar 28, 2017

Member

You need to rebase to account for #16144, which makes this not compile (you need to use number.value() instead of number.0).

@emilio
Copy link
Member

emilio commented Mar 28, 2017

Also, if you could squash, that'd be great! :)

@jdm jdm added the S-needs-squash label Mar 28, 2017
@KiChjang
Copy link
Member

KiChjang commented Mar 30, 2017

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

bors-servo commented Mar 30, 2017

📌 Commit a0d23e3 has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Mar 30, 2017

Testing commit a0d23e3 with merge 04d12fa...

bors-servo added a commit that referenced this pull request Mar 30, 2017
initial-letter property

<!-- Please describe your changes on the following line: -->
Implemented parsing and serialization for the initial-letter property.

---
<!-- 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 #15959 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/16166)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 31, 2017

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev
Approved by: emilio
Pushing 04d12fa to master...

@bors-servo bors-servo merged commit a0d23e3 into servo:master Mar 31, 2017
3 checks passed
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
Linked issues

Successfully merging this pull request may close these issues.

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