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

box-shadow is now serialized properly #15703

Closed
wants to merge 0 commits into from

Conversation

niki-04
Copy link
Contributor

@niki-04 niki-04 commented Feb 23, 2017

Box shadow in now serialized properly. The changes are in the file components/style/properties/longhand/effects.mako.rs. Tests for the serialization of box-shadow are in tests/unit/style/properties/serialization.rs. ./mach test-unit -p style passes all tests including the newly added test case.


  • [X ] There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

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

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/effects.mako.rs
  • @emilio: components/style/properties/longhand/effects.mako.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 23, 2017
Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! The serialization changes look great to me, though I believe the test can be shorter.

Also, could you squash your commits? We don't use to land commits like "Fixes tidy" or so.

With that test change, this can land with r=emilio.

Thanks again for this patch! :)

#[test]
fn box_shadow_should_serialize_correctly() {
let mut properties = Vec::new();
let color = Some(CSSColor {
Copy link
Member

Choose a reason for hiding this comment

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

Let's move the property_declaration_block function to the parent module, and write this test as follows, which will be easier to maintain:

let shadow_css = "box-shadow: 1px 2px 3px 4px";
let shadow = property_declaration_block(shadow_css);
assert_eq!(shadow.to_css_string(), shadow_css);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. So how to use the property_declaration_block function how do I define it in the parent module?

Copy link
Member

Choose a reason for hiding this comment

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

You can just move it to the top of the file making it pub (above the first mod), and use it from the others.

@jdm jdm added S-needs-squash Some (or all) of the commits in the PR should be combined. S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 23, 2017
@jdm jdm assigned emilio and unassigned Ms2ger Feb 23, 2017
@@ -1231,4 +1231,26 @@ mod shorthand_serialization {
assert_eq!(serialization, block_text);
}
}
mod effects {
Copy link
Member

Choose a reason for hiding this comment

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

Also, one nit, alignment seems to be off-by-one here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did make the changes. Also committed and squashed the commits.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think something went wrong and it created merge master branch. I don't know how to undo that but last commit to be considered is in box-shadow is now serialized properly. Let me know if I need to do anything to fix it. Sorry if this messes something!!

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Mar 5, 2017
@bors-servo
Copy link
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Mar 8, 2017
@KiChjang
Copy link
Contributor

KiChjang commented Mar 8, 2017

Please remove the merge commit and rebase against master instead.

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 9, 2017

I removed the merge commit. How do I rebase against the master instead.

@KiChjang
Copy link
Contributor

KiChjang commented Mar 9, 2017

First, git fetch upstream master, and then git rebase upstream/master. You will encounter merge conflicts along the way, I suggest using a mergetool like meld, and you can configure your git client to open it up to solve merge conflicts through git mergetool.

@wafflespeanut
Copy link
Contributor

wafflespeanut commented Mar 21, 2017

@niki-04 Are you planning to finish this? Need help?

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 21, 2017

@wafflespeanut sorry about the delay. I will finish it by today. Will let you know if i need help

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 21, 2017

I was going through the changes I see property_declaration_block to parse_declaration_block. Should I make the relevant changes in my code. I was having trouble merging the code for the same

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 22, 2017

I resolved the conflicts and committed the code again. Let me know if I need to squash my commits. I did all the checks again everything passes :)

@wafflespeanut
Copy link
Contributor

No, you haven't? It looks like you haven't rebased it properly.

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 22, 2017

When I rebased it showed me the conflicts and I resolved those and committed again. What should I do now to resolve the issue?

@wafflespeanut
Copy link
Contributor

  • Export the diff from your current branch. Since you need only your last 4 commits squashed, you can do something like git diff HEAD~4.. > patch.diff
  • git checkout master, sync with upstream and delete your old branch with git branch -D box-shadow-serialization
  • git checkout -b box-shadow-serialization and git apply patch.diff (resolve conflicts, if any, and also remove patch.diff)
  • Finally, git add -A && git commit -m "<commit-message>" and push it.

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 23, 2017

@wafflespeanut thanks for the information. I am trying that but when I apply my patch it fails with the error patch does not apply. I tried looking for the same error but couldn't find any relevant information.

@wafflespeanut
Copy link
Contributor

It may probably have conflicts. Check whether the files have conflicts. If they don't have any, then what does it say? Can you paste the log output?

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 23, 2017

No conflicts. The output is

Checking patch components/style/properties/longhand/effects.mako.rs...
error: while searching for:
            if self.inset {
                try!(dest.write_str("inset "));
            }
            try!(self.blur_radius.to_css(dest));
            try!(dest.write_str(" "));
            try!(self.spread_radius.to_css(dest));
            try!(dest.write_str(" "));
            try!(self.offset_x.to_css(dest));
            try!(dest.write_str(" "));
            try!(self.offset_y.to_css(dest));

            if let Some(ref color) = self.color {
                try!(dest.write_str(" "));

error: patch failed: components/style/properties/longhand/effects.mako.rs:29
error: components/style/properties/longhand/effects.mako.rs: patch does not apply
Checking patch tests/unit/style/properties/serialization.rs...
error: while searching for:
            assert_eq!(serialization, block_text);
        }
    }

    mod keywords {
        pub use super::*;
        #[test]

error: patch failed: tests/unit/style/properties/serialization.rs:1130
error: tests/unit/style/properties/serialization.rs: patch does not apply

@wafflespeanut
Copy link
Contributor

Oh, okay. What if you try git am -3 patch.diff? From what I see in the manual, git should now try to merge the changes, and will result in the usual file conflicts.

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 23, 2017

I get a Patch format detection failed.

@wafflespeanut
Copy link
Contributor

Oh wait, it should be done with apply (not am, which is only for exported patches using format-patch). Sorry about that. Try git apply -3 --whitespace=fix?

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 23, 2017

git apply -3 --whitespace=fix doesn't work. It just hangs up and does nothing

@wafflespeanut
Copy link
Contributor

Oh, you need to point it to the patch like you did previously. git apply -3 --whitespace=fix patch.diff

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 23, 2017

Oh my bad. It still doesn't work
error: components/style/properties/longhand/effects.mako.rs: does not match index
error: tests/unit/style/properties/serialization.rs: does not match index

@wafflespeanut
Copy link
Contributor

Strange. I just pulled from your branch, exported the patch and applied it, and it seems to work. I'm unable to reproduce the error. Can you check the "Allow edits from maintainers" check box to the right? (so that I'll be able to push to your branch?)

@niki-04
Copy link
Contributor Author

niki-04 commented Mar 23, 2017

I did the check allow edits from maintainers. Thanks a lot for helping out. It is strange you don't get the error.

@bors-servo
Copy link
Contributor

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

@wafflespeanut
Copy link
Contributor

@niki-04 Apologies. I'd accidentally pushed "nothingness" into your PR, and it's now closed. Anyway, I've opened this in #16104. Thanks for working on this :)

bors-servo pushed a commit that referenced this pull request Mar 23, 2017
…lespeanut

Properly serialize <box-shadow>

Rebase of #15703, fixes #15203

<!-- 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/16104)
<!-- Reviewable:end -->
@niki-04
Copy link
Contributor Author

niki-04 commented Mar 23, 2017

No worries. I enjoyed working on this!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. S-needs-squash Some (or all) of the commits in the PR should be combined.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Value of box-shadow is serialized in a wrong order
8 participants