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

Support discrete animations for more Gecko things #17544

Merged
merged 14 commits into from
Jul 5, 2017

Conversation

dadaa
Copy link
Contributor

@dadaa dadaa commented Jun 28, 2017

This PR fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1371115


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes. Add some tests into dom/animation/test/ of m-c in patch 14. Also, remove test fail annotation from meta in wpt as patch 15.

This change is Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/position.mako.rs, components/style/properties/longhand/background.mako.rs, components/style/properties/longhand/text.mako.rs, components/style/gecko/conversions.rs, components/style/properties/longhand/svg.mako.rs and 17 more
  • @emilio: components/style/properties/longhand/position.mako.rs, components/style/properties/longhand/background.mako.rs, components/style/properties/longhand/text.mako.rs, components/style/gecko/conversions.rs, components/style/properties/longhand/svg.mako.rs and 17 more

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • 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 Jun 28, 2017
@dadaa
Copy link
Contributor Author

dadaa commented Jun 28, 2017

These patches have been reviewed by @hiikezoe

@nox nox changed the title Bug1371115 Support discrete animations for more Gecko things Jun 28, 2017
},
nsStyleImageType::eStyleImageType_Image => {
let url = self.get_image_url();
match self.mCropRect.mPtr.is_null() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use if instead of match.

let pos_y = LengthOrPercentage::from_gecko_style_coord(&gecko_gradient.mBgPosY)
.expect("mBgPosY has valid data");
let horizontal_direction = match pos_x {
LengthOrPercentage::Percentage(Percentage(0.0)) => X::Left,
Copy link
Contributor

Choose a reason for hiding this comment

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

Matching against float literals is a warning in nightly, please don't pattern match them if you have time.

NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER => ShapeExtent::ClosestCorner,
NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER => ShapeExtent::FarthestCorner,
// We don't choose ShapeExtent::Contain and ShapeExtent::Cover
// since those 'contain' and 'cover' keywords are handled as synonyms of the standard
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't they synonyms only in semantics, but must be preserved?

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 don't think we need to preserve since the contain and cover already dropped from spec[1]. Also, MDN[2] said "Early drafts included other keywords (cover and contain) as synonyms of the standard farthest-corner and closest-side respectively. ".
And Gecko does not preserve both contain and cover keywords.[3]

[1] https://drafts.csswg.org/css-images-3/#typedef-size
[2] https://developer.mozilla.org/en-US/docs/Web/CSS/radial-gradient
[3] https://searchfox.org/mozilla-central/source/layout/style/nsCSSProps.cpp#1917

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the spec you should be looking at. These keywords indeed were present only in an previous version of the spec, but that previous version is the one we are supposed to implement to support -webkit prefixed gradients.

Safari parses and preserves these two keywords with the prefixed gradients.

<div style="background-image: -webkit-radial-gradient(center, ellipse contain, yellow 0%, green 100%);"></div>
<pre>
<script>
    var div = document.getElementsByTagName("div")[0];
    document.writeln(div.style.backgroundImage);
    document.writeln(getComputedStyle(div).backgroundImage);
</script>

https://www.w3.org/TR/2011/WD-css3-images-20110217/#radial-gradients

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you very much, please let me check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please let me fix this after fixing https://bugzilla.mozilla.org/show_bug.cgi?id=1217664
I'll write a memo in that source code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure!

NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE => {
let radius = Length::from_gecko_style_coord(&gecko_gradient.mRadiusX)
.expect("mRadiusX has valid data");
debug_assert!(radius ==
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: debug_assert_eq.

NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE => {
Ellipse::Radii(
LengthOrPercentage::from_gecko_style_coord(&gecko_gradient.mRadiusX)
.expect("mRadiusX has valid data"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: AFAIK expect should be given the description of the error, not the description of what valid things are expected.

Copy link
Contributor Author

@dadaa dadaa Jun 28, 2017

Choose a reason for hiding this comment

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

thanks, I'll fix all messages that are in patches in this time.

use values::specified::url::SpecifiedUrl;
use values::None_;

match self.gecko.${gecko_ffi_name}.mRawPtr.is_null() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use if

longhands::_moz_border_${side.ident}_colors::computed_value::T(
if gecko_colors.is_null() {
None
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Short-circuiting would be better here:

if gecko_colors.is_null() {
    return None;
}

if self.gecko.${value.gecko}.mInteger == 0 {
None
} else {
debug_assert!(nsStyleGridLine_kMinLine <= self.gecko.${value.gecko}.mInteger &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: two assertions would be better, given it would print which particular test failed.

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'm sorry forgot to fix it.
I'll do soon.

use gecko_string_cache::Atom;
use values::CustomIdent;

match self.gecko.mWillChange.mBuffer.len() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use if.


#[cfg(feature = "gecko")] use values::computed::{LengthOrNumber, NumberOrPercentage};
#[cfg(feature = "gecko")] impl_rect_conversions!(LengthOrNumber);
#[cfg(feature = "gecko")] impl_rect_conversions!(NumberOrPercentage);
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't all of this be in gecko.mako.rs with the rest? Feels quite out of place 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'll move to related code to style/gecko/conversions.rs
Thanks

@bors-servo
Copy link
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jun 28, 2017
@dadaa dadaa force-pushed the bug1371115 branch 2 times, most recently from 7ec8f0b to 66562a5 Compare June 29, 2017 17:51
@dadaa
Copy link
Contributor Author

dadaa commented Jun 30, 2017

r? @nox
Could you review again?
I'll fix -webkit-radial-gradient in another bug.

@highfive highfive assigned nox and unassigned asajeffrey Jun 30, 2017
@nox
Copy link
Contributor

nox commented Jul 1, 2017

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 66562a5 has been approved by nox

@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. S-needs-rebase There are merge conflict errors. labels Jul 1, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit 66562a5 with merge e6eb90e...

bors-servo pushed a commit that referenced this pull request Jul 1, 2017
Support discrete animations for more Gecko things

<!-- Please describe your changes on the following line: -->
This PR fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1371115

---
<!-- 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

<!-- Either: -->
- [X] There are tests for these changes. Add some tests into dom/animation/test/ of m-c in patch 14. Also, remove test fail annotation from meta in wpt as patch 15.

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

💔 Test failed - linux-dev

@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 Jul 1, 2017
@bors-servo
Copy link
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jul 4, 2017
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Jul 5, 2017
@dadaa
Copy link
Contributor Author

dadaa commented Jul 5, 2017

These patches have been reviewed by @hiikezoe and @birtles

@birtles
Copy link
Contributor

birtles commented Jul 5, 2017

@bors-servo try

@bors-servo
Copy link
Contributor

⌛ Trying commit 1b28d5e with merge 42e551f...

bors-servo pushed a commit that referenced this pull request Jul 5, 2017
Support discrete animations for more Gecko things

<!-- Please describe your changes on the following line: -->
This PR fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1371115

---
<!-- 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

<!-- Either: -->
- [X] There are tests for these changes. Add some tests into dom/animation/test/ of m-c in patch 14. Also, remove test fail annotation from meta in wpt as patch 15.

<!-- 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/17544)
<!-- Reviewable:end -->
@hiikezoe
Copy link
Contributor

hiikezoe commented Jul 5, 2017

@bors-servo delegate+

@bors-servo
Copy link
Contributor

✌️ @dadaa can now approve this pull request

@dadaa
Copy link
Contributor Author

dadaa commented Jul 5, 2017

@bors-servo r=hiro p=10

@bors-servo
Copy link
Contributor

📌 Commit 1b28d5e has been approved by hiro

@highfive highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jul 5, 2017
@bors-servo
Copy link
Contributor

⚡ Previous build results for arm32, linux-rel-wpt, mac-dev-unit, windows-msvc-dev are reusable. Rebuilding only android, arm64, linux-dev, linux-rel-css, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4...

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-needs-rebase There are merge conflict errors. labels Jul 5, 2017
@bors-servo
Copy link
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: hiro
Pushing 42e551f to master...

@bors-servo bors-servo merged commit 1b28d5e into servo:master Jul 5, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 5, 2017
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.

7 participants