зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1355380 - Part 1: Have nsStyleImageOrientation::CreateAsAngleAndFlip handle negative angles correctly. r=manishearth
Previously we just took the input angle mod 2π, which will leave negative input angles as negative. By checking if the input mod 2π is negative and if so adding 2π and then taking that mod 2π again we can ensure that we end up with a an angle in the range [0, 2π]. We only do this if the result of the initial mod is negative because this adds rounding error that is enough to mess up whether 135 is determined to be closer to 90 or 180, for example. We add a test for this as well. Also fix property_database.js to account for this (we assert that -90deg should compute to the same value as the initial value, but it should actually compute to 270deg). MozReview-Commit-ID: Faf0f7wIEg3 --HG-- extra : rebase_source : 6b2d15f90e541fcb8b6083e15772eee514603e57
This commit is contained in:
Родитель
944a56812c
Коммит
016ee566a7
|
@ -33,6 +33,7 @@ fuzzy(1,1) == image-orientation-from-image.html?180&flip image-orientation-ref.h
|
|||
fuzzy(1,1) == image-orientation-from-image.html?270&flip image-orientation-ref.html?270&flip
|
||||
|
||||
# Tests for image-orientation used with an explicit orientation:
|
||||
fuzzy(1,1) == image-orientation-explicit.html?-900 image-orientation-ref.html?180
|
||||
fuzzy(1,1) == image-orientation-explicit.html?0 image-orientation-ref.html?0
|
||||
fuzzy(1,1) == image-orientation-explicit.html?90 image-orientation-ref.html?90
|
||||
fuzzy(1,1) == image-orientation-explicit.html?180 image-orientation-ref.html?180
|
||||
|
@ -43,6 +44,7 @@ fuzzy(1,1) == image-orientation-explicit.html?180&flip image-orientation-ref.htm
|
|||
fuzzy(1,1) == image-orientation-explicit.html?270&flip image-orientation-ref.html?270&flip
|
||||
|
||||
# Tests for image-orientation used with non-axis-aligned angles:
|
||||
fuzzy(1,1) == image-orientation-explicit.html?-46 image-orientation-ref.html?270
|
||||
fuzzy(1,1) fails-if(styloVsGecko||stylo) == image-orientation-explicit.html?-45 image-orientation-ref.html?0
|
||||
fuzzy(1,1) == image-orientation-explicit.html?-15 image-orientation-ref.html?0
|
||||
fuzzy(1,1) == image-orientation-explicit.html?15 image-orientation-ref.html?0
|
||||
|
|
|
@ -2030,6 +2030,9 @@ struct nsStyleImageOrientation
|
|||
|
||||
// Compute the final angle value, rounding to the closest quarter turn.
|
||||
double roundedAngle = fmod(aRadians, 2 * M_PI);
|
||||
if (roundedAngle < 0) {
|
||||
roundedAngle = roundedAngle + 2 * M_PI;
|
||||
}
|
||||
if (roundedAngle < 0.25 * M_PI) { orientation = ANGLE_0; }
|
||||
else if (roundedAngle < 0.75 * M_PI) { orientation = ANGLE_90; }
|
||||
else if (roundedAngle < 1.25 * M_PI) { orientation = ANGLE_180;}
|
||||
|
|
|
@ -6811,11 +6811,11 @@ if (IsCSSPropertyPrefEnabled("layout.css.image-orientation.enabled")) {
|
|||
"0turn",
|
||||
|
||||
// Rounded initial values.
|
||||
"-90deg",
|
||||
"15deg",
|
||||
"360deg",
|
||||
],
|
||||
other_values: [
|
||||
"-90deg",
|
||||
"0deg flip",
|
||||
"90deg",
|
||||
"90deg flip",
|
||||
|
|
Загрузка…
Ссылка в новой задаче