-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
Heads up! This PR modifies the following files:
|
These patches have been reviewed by @hiikezoe |
}, | ||
nsStyleImageType::eStyleImageType_Image => { | ||
let url = self.get_image_url(); | ||
match self.mCropRect.mPtr.is_null() { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 == |
There was a problem hiding this comment.
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"), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 && |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
☔ The latest upstream changes (presumably #17541) made this pull request unmergeable. Please resolve the merge conflicts. |
7ec8f0b
to
66562a5
Compare
r? @nox |
@bors-servo r+ |
📌 Commit 66562a5 has been approved by |
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 -->
💔 Test failed - linux-dev |
☔ The latest upstream changes (presumably #17268) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors-servo try |
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 delegate+ |
✌️ @dadaa can now approve this pull request |
@bors-servo r=hiro p=10 |
📌 Commit 1b28d5e has been approved by |
⚡ 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... |
☀️ 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 |
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 errorsThis change is