Changeset 267551 in webkit
- Timestamp:
- Sep 24, 2020, 3:40:06 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (3 diffs)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-angle-computed-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt (modified) (7 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt (modified) (3 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt (modified) (1 diff)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/MathExtras.h (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSPrimitiveValue.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r267547 r267551 1 2020-09-24 Keith Miller <keith_miller@apple.com> 2 3 CSS angle unit conversions should consistently use the same associativity 4 https://bugs.webkit.org/show_bug.cgi?id=216906 5 6 Reviewed by Simon Fraser. 7 8 Rebaseline tests. 9 10 * TestExpectations: 11 1 12 2020-09-24 Lauro Moura <lmoura@igalia.com> 2 13 -
trunk/LayoutTests/TestExpectations
r267531 r267551 1189 1189 webkit.org/b/64861 imported/w3c/web-platform-tests/css/selectors/selectors-dir-selector-ltr-001.html [ ImageOnlyFailure ] 1190 1190 webkit.org/b/64861 imported/w3c/web-platform-tests/css/selectors/selectors-dir-selector-rtl-001.html [ ImageOnlyFailure ] 1191 imported/w3c/web-platform-tests/css/selectors/selector-placeholder-shown-type-change-001.html [ ImageOnlyFailure ]1192 imported/w3c/web-platform-tests/css/selectors/selector-placeholder-shown-type-change-002.html [ ImageOnlyFailure ]1193 imported/w3c/web-platform-tests/css/selectors/selector-placeholder-shown-type-change-003.html [ ImageOnlyFailure ]1194 imported/w3c/web-platform-tests/css/selectors/selector-read-write-type-change-002.html [ ImageOnlyFailure ]1195 imported/w3c/web-platform-tests/css/selectors/selector-required-type-change-002.html [ ImageOnlyFailure ]1196 1191 imported/w3c/web-platform-tests/css/selectors/old-tests/css3-modsel-172a.xml [ ImageOnlyFailure ] 1197 1192 imported/w3c/web-platform-tests/css/selectors/old-tests/css3-modsel-172b.xml [ ImageOnlyFailure ] … … 1667 1662 imported/w3c/web-platform-tests/svg/extensibility/foreignObject/isolation-with-svg.html [ ImageOnlyFailure ] 1668 1663 imported/w3c/web-platform-tests/svg/painting/reftests/display-none-mask.html [ ImageOnlyFailure ] 1669 imported/w3c/web-platform-tests/svg/struct/reftests/use-external-resource-with-revalidation.tentative.html [ ImageOnlyFailure ]1670 1664 1671 1665 webkit.org/b/139595 imported/w3c/web-platform-tests/svg/import/animate-dom-02-f-manual.svg [ Skip ] … … 2483 2477 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-008.html [ ImageOnlyFailure Pass ] 2484 2478 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-009.html [ ImageOnlyFailure Pass ] 2485 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-010.html [ ImageOnlyFailure ]2486 2479 2487 2480 # overflow-wrap:anywhere feature is not implemented yet. -
trunk/LayoutTests/imported/w3c/ChangeLog
r267531 r267551 1 2020-09-24 Keith Miller <keith_miller@apple.com> 2 3 CSS angle unit conversions should consistently use the same associativity 4 https://bugs.webkit.org/show_bug.cgi?id=216906 5 6 Reviewed by Simon Fraser. 7 8 Rebaseline tests for different rounding errors in angle unit conversions. The minmax-angle-computed test 9 is now passing and the webaudio tests just have slightly different results now. 10 11 * web-platform-tests/css/css-values/minmax-angle-computed-expected.txt: 12 * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt: 13 * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt: 14 * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt: 15 1 16 2020-09-24 Frederic Wang <fwang@igalia.com> 2 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-angle-computed-expected.txt
r264522 r267551 17 17 PASS max(1turn, 2turn) should be used-value-equivalent to 2turn 18 18 PASS min(90deg, 0.26turn) should be used-value-equivalent to 90deg 19 FAIL min(1.57rad, 95deg) should be used-value-equivalent to 1.57rad assert_equals: rotate(min(1.57rad, 95deg)) and rotate(1.57rad) serialize to the same thing in used values. expected "matrix(0.0007963267107332633, 0.9999996829318346, -0.9999996829318346, 0.0007963267107332633, 0, 0)" but got "matrix(0.0007963267107334854, 0.9999996829318346, -0.9999996829318346, 0.0007963267107334854, 0, 0)" 19 PASS min(1.57rad, 95deg) should be used-value-equivalent to 1.57rad 20 20 PASS max(91deg, 0.25turn) should be used-value-equivalent to 91deg 21 21 PASS max(1.58rad, 90deg) should be used-value-equivalent to 1.58rad 22 FAIL min(270deg, max(0.25turn, 3.14rad)) should be used-value-equivalent to 3.14rad assert_equals: rotate(min(270deg, max(0.25turn, 3.14rad))) and rotate(3.14rad) serialize to the same thing in used values. expected "matrix(-0.9999987317275395, 0.0015926529164868282, -0.0015926529164868282, -0.9999987317275395, 0, 0)" but got "matrix(-0.9999987317275395, 0.0015926529164872723, -0.0015926529164872723, -0.9999987317275395, 0, 0)" 23 FAIL max(0.25turn, min(270deg, 3.14rad)) should be used-value-equivalent to 3.14rad assert_equals: rotate(max(0.25turn, min(270deg, 3.14rad))) and rotate(3.14rad) serialize to the same thing in used values. expected "matrix(-0.9999987317275395, 0.0015926529164868282, -0.0015926529164868282, -0.9999987317275395, 0, 0)" but got "matrix(-0.9999987317275395, 0.0015926529164872723, -0.0015926529164872723, -0.9999987317275395, 0, 0)" 22 PASS min(270deg, max(0.25turn, 3.14rad)) should be used-value-equivalent to 3.14rad 23 PASS max(0.25turn, min(270deg, 3.14rad)) should be used-value-equivalent to 3.14rad 24 24 PASS calc(min(90deg, 1.58rad) + 0.25turn) should be used-value-equivalent to 180deg 25 25 PASS calc(min(90deg, 1.58rad) - 0.125turn) should be used-value-equivalent to 45deg -
trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt
r267167 r267551 10 10 PASS > [Panner x] k-rate input 11 11 PASS Panner: positionX: Expected output channel 0 is not constantly 0.017871389165520668 (contains 512 different values). 12 PASS positionX: Expected output channel 1 is not constantly 0.0364862 1588945389(contains 512 different values).12 PASS positionX: Expected output channel 1 is not constantly 0.036486223340034485 (contains 512 different values). 13 13 PASS Panner: positionX: Channel 0 output[0, 127] contains only the constant 0.017871389165520668. 14 14 PASS Panner: positionX: Channel 0 output[128, 255] contains only the constant 0.012888134457170963. … … 16 16 PASS Panner: positionX: Channel 0 output[384, 511] contains only the constant 0.004646967630833387. 17 17 PASS Panner: positionX: Channel 0 output[512, 639] contains only the constant 0.0030441549606621265. 18 PASS Panner: positionX: Channel 1 output[0, 127] contains only the constant 0.0364862 1588945389.18 PASS Panner: positionX: Channel 1 output[0, 127] contains only the constant 0.036486223340034485. 19 19 PASS Panner: positionX: Channel 1 output[128, 255] contains only the constant 0.044254120439291. 20 20 PASS Panner: positionX: Channel 1 output[256, 383] contains only the constant 0.04127275571227074. … … 26 26 PASS > [Panner y] k-rate input 27 27 PASS Panner: positionY: Expected output channel 0 is not constantly 0.039904240518808365 (contains 512 different values). 28 PASS positionY: Expected output channel 1 is not constantly 0.08146847 039461136 (contains 512 different values).28 PASS positionY: Expected output channel 1 is not constantly 0.08146847784519196 (contains 512 different values). 29 29 PASS Panner: positionY: Channel 0 output[0, 127] contains only the constant 0.039904240518808365. 30 30 PASS Panner: positionY: Channel 0 output[128, 255] contains only the constant 0.030709920451045036. … … 32 32 PASS Panner: positionY: Channel 0 output[384, 511] contains only the constant 0.01528366282582283. 33 33 PASS Panner: positionY: Channel 0 output[512, 639] contains only the constant 0.011893529444932938. 34 PASS Panner: positionY: Channel 1 output[0, 127] contains only the constant 0.08146847 039461136.35 PASS Panner: positionY: Channel 1 output[128, 255] contains only the constant 0.0626973 5842943192.36 PASS Panner: positionY: Channel 1 output[256, 383] contains only the constant 0.04277536 2730026245.37 PASS Panner: positionY: Channel 1 output[384, 511] contains only the constant 0.0312031 17221593857.38 PASS Panner: positionY: Channel 1 output[512, 639] contains only the constant 0.02428182 21449852.34 PASS Panner: positionY: Channel 1 output[0, 127] contains only the constant 0.08146847784519196. 35 PASS Panner: positionY: Channel 1 output[128, 255] contains only the constant 0.06269736588001251. 36 PASS Panner: positionY: Channel 1 output[256, 383] contains only the constant 0.042775366455316544. 37 PASS Panner: positionY: Channel 1 output[384, 511] contains only the constant 0.031203120946884155. 38 PASS Panner: positionY: Channel 1 output[512, 639] contains only the constant 0.024281825870275497. 39 39 PASS Panner: positionY: Actual output channel 0 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 40 40 PASS Panner: positionY: Actual output channel 1 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. … … 51 51 PASS Panner: positionZ: Channel 1 output[128, 255] contains only the constant 0.03781212866306305. 52 52 PASS Panner: positionZ: Channel 1 output[256, 383] contains only the constant 0.031430669128894806. 53 PASS Panner: positionZ: Channel 1 output[384, 511] contains only the constant 0.02571591 1760926247.53 PASS Panner: positionZ: Channel 1 output[384, 511] contains only the constant 0.025715915486216545. 54 54 PASS Panner: positionZ: Channel 1 output[512, 639] contains only the constant 0.021292630583047867. 55 55 PASS Panner: positionZ: Actual output channel 0 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. … … 69 69 PASS < [Listener x] All assertions passed. (total 10 assertions) 70 70 PASS > [Listener y] k-rate input 71 PASS Listener: positionY: Channel 0 output[0, 127] contains only the constant 0.01660643 8905000687.71 PASS Listener: positionY: Channel 0 output[0, 127] contains only the constant 0.016606437042355537. 72 72 PASS Listener: positionY: Channel 0 output[128, 255] contains only the constant 0.023375829681754112. 73 PASS Listener: positionY: Channel 0 output[256, 383] contains only the constant 0.0325558 9306354523.73 PASS Listener: positionY: Channel 0 output[256, 383] contains only the constant 0.03255588933825493. 74 74 PASS Listener: positionY: Channel 0 output[384, 511] contains only the constant 0.03216671943664551. 75 PASS Listener: positionY: Channel 0 output[512, 639] contains only the constant 0.02294781 431555748.76 PASS Listener: positionY: Channel 1 output[0, 127] contains only the constant 0.04241393 506526947.77 PASS Listener: positionY: Channel 1 output[128, 255] contains only the constant 0.0597034 0967178345.78 PASS Listener: positionY: Channel 1 output[256, 383] contains only the constant 0.083149 89507198334.79 PASS Listener: positionY: Channel 1 output[384, 511] contains only the constant 0.08215592 056512833.80 PASS Listener: positionY: Channel 1 output[512, 639] contains only the constant 0.0586102 269589901.75 PASS Listener: positionY: Channel 0 output[512, 639] contains only the constant 0.02294781245291233. 76 PASS Listener: positionY: Channel 1 output[0, 127] contains only the constant 0.04241393879055977. 77 PASS Listener: positionY: Channel 1 output[128, 255] contains only the constant 0.059703417122364044. 78 PASS Listener: positionY: Channel 1 output[256, 383] contains only the constant 0.08314990252256393. 79 PASS Listener: positionY: Channel 1 output[384, 511] contains only the constant 0.08215592801570892. 80 PASS Listener: positionY: Channel 1 output[512, 639] contains only the constant 0.058610234409570694. 81 81 PASS < [Listener y] All assertions passed. (total 10 assertions) 82 82 PASS > [Listener z] k-rate input … … 88 88 PASS Listener: positionZ: Channel 1 output[0, 127] contains only the constant 0.04121469706296921. 89 89 PASS Listener: positionZ: Channel 1 output[128, 255] contains only the constant 0.032292626798152924. 90 PASS Listener: positionZ: Channel 1 output[256, 383] contains only the constant 0.02588506 042957306.90 PASS Listener: positionZ: Channel 1 output[256, 383] contains only the constant 0.025885064154863358. 91 91 PASS Listener: positionZ: Channel 1 output[384, 511] contains only the constant 0.021276984363794327. 92 92 PASS Listener: positionZ: Channel 1 output[512, 639] contains only the constant 0.017917200922966003. -
trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt
r267357 r267551 97 97 PASS Listener k-rate positionX: Output is not constantly 0.0012908608186990023 (contains 512 different values). 98 98 PASS Listener k-rate positionX: Output [0, 127] contains only the constant 0.0012908608186990023. 99 PASS Listener k-rate positionX: Output [128, 255] contains only the constant 0.01269751 3215243816.99 PASS Listener k-rate positionX: Output [128, 255] contains only the constant 0.012697515077888966. 100 100 PASS Listener k-rate positionX: Output [256, 383] contains only the constant 0.012066217139363289. 101 PASS Listener k-rate positionX: Output [384, 511] contains only the constant 0.00895657 8560173512.101 PASS Listener k-rate positionX: Output [384, 511] contains only the constant 0.008956579491496086. 102 102 PASS Listener k-rate positionX: Output [512, 639] contains only the constant 0.006926612462848425. 103 103 PASS < [Listener k-rate positionX] All assertions passed. (total 9 assertions) … … 131 131 PASS Listener k-rate forwardX: Output [0, 127] contains only the constant 0.00111640605609864. 132 132 PASS Listener k-rate forwardX: Output [128, 255] contains only the constant 0.001115163555368781. 133 PASS Listener k-rate forwardX: Output [256, 383] contains only the constant 0.001113853 300921619.133 PASS Listener k-rate forwardX: Output [256, 383] contains only the constant 0.0011138531845062971. 134 134 PASS Listener k-rate forwardX: Output [384, 511] contains only the constant 0.0011124692391604185. 135 135 PASS Listener k-rate forwardX: Output [512, 639] contains only the constant 0.0011110050836578012. … … 183 183 PASS Listener upZ.setValueAtTime(-1,0) did not throw an exception. 184 184 PASS Listener upZ.linearRampToValueAtTime(1000,1) did not throw an exception. 185 PASS Listener k-rate upZ: Output is not constantly 0.001004426 390863955(contains 512 different values).186 PASS Listener k-rate upZ: Output [0, 127] contains only the constant 0.001004426 390863955.185 PASS Listener k-rate upZ: Output is not constantly 0.0010044265072792768 (contains 512 different values). 186 PASS Listener k-rate upZ: Output [0, 127] contains only the constant 0.0010044265072792768. 187 187 PASS Listener k-rate upZ: Output [128, 255] contains only the constant 0.0010139397345483303. 188 188 PASS Listener k-rate upZ: Output [256, 383] contains only the constant 0.0010087323607876897. -
trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt
r266476 r267551 93 93 PASS Mono listener.positionY.value frame [0, 128) channel 0 contains only the constant 0.22094237804412842. 94 94 PASS Mono listener.positionY.value frame [0, 128) channel 1 contains only the constant 0.5334020853042603. 95 PASS Mono listener.positionY.value frame [128, 256) channel 0 contains only the constant 0.00003826833 926723339.95 PASS Mono listener.positionY.value frame [128, 256) channel 0 contains only the constant 0.00003826833562925458. 96 96 PASS Mono listener.positionY.value frame [128, 256) channel 1 contains only the constant 0.00009238795610144734. 97 97 PASS Mono listener.positionY: Output at frame 128 channel 0 is not equal to 0.22094237804412842. -
trunk/Source/WTF/ChangeLog
r267533 r267551 1 2020-09-24 Keith Miller <keith_miller@apple.com> 2 3 CSS angle unit conversions should consistently use the same associativity 4 https://bugs.webkit.org/show_bug.cgi?id=216906 5 6 Reviewed by Simon Fraser. 7 8 Right now we inconsistently associate our floating point math for 9 angle unit conversions. In particular, 10 conversionToCanonicalUnitsScaleFactor expects there to be a single 11 fixed constant we can multiply by to change units. However, the 12 various conversion functions in WTF are not associated in this 13 way. e.g. rad2deg does ((radian * 180) / pi) rather than 14 (radian *(180 / pi)). Since FP math is NOT associative these 15 produce different results. For example, 1.57 radians is 16 89.954373835539258 degrees in the first case but 17 89.954373835539243 in the second. 18 19 This patch changes those WTF functions to operate on a single 20 scale factor when converting to/from the canonical 21 unit. Conversions between non-canonical units first convert to the 22 canonical unit (degree). 23 24 * wtf/MathExtras.h: 25 (deg2rad): 26 (rad2deg): 27 (deg2grad): 28 (grad2deg): 29 (deg2turn): 30 (turn2deg): 31 (rad2grad): 32 (grad2rad): 33 1 34 2020-09-24 Antti Koivisto <antti@apple.com> 2 35 -
trunk/Source/WTF/wtf/MathExtras.h
r265416 r267551 41 41 42 42 #ifndef M_PI 43 const double piDouble = 3.14159265358979323846;44 const float piFloat = 3.14159265358979323846f;43 constexpr double piDouble = 3.14159265358979323846; 44 constexpr float piFloat = 3.14159265358979323846f; 45 45 #else 46 const double piDouble = M_PI;47 const float piFloat = static_cast<float>(M_PI);46 constexpr double piDouble = M_PI; 47 constexpr float piFloat = static_cast<float>(M_PI); 48 48 #endif 49 49 50 50 #ifndef M_PI_2 51 const double piOverTwoDouble = 1.57079632679489661923;52 const float piOverTwoFloat = 1.57079632679489661923f;51 constexpr double piOverTwoDouble = 1.57079632679489661923; 52 constexpr float piOverTwoFloat = 1.57079632679489661923f; 53 53 #else 54 const double piOverTwoDouble = M_PI_2;55 const float piOverTwoFloat = static_cast<float>(M_PI_2);54 constexpr double piOverTwoDouble = M_PI_2; 55 constexpr float piOverTwoFloat = static_cast<float>(M_PI_2); 56 56 #endif 57 57 58 58 #ifndef M_PI_4 59 const double piOverFourDouble = 0.785398163397448309616;60 const float piOverFourFloat = 0.785398163397448309616f;59 constexpr double piOverFourDouble = 0.785398163397448309616; 60 constexpr float piOverFourFloat = 0.785398163397448309616f; 61 61 #else 62 const double piOverFourDouble = M_PI_4;63 const float piOverFourFloat = static_cast<float>(M_PI_4);62 constexpr double piOverFourDouble = M_PI_4; 63 constexpr float piOverFourFloat = static_cast<float>(M_PI_4); 64 64 #endif 65 65 66 66 #ifndef M_SQRT2 67 const double sqrtOfTwoDouble = 1.41421356237309504880;68 const float sqrtOfTwoFloat = 1.41421356237309504880f;67 constexpr double sqrtOfTwoDouble = 1.41421356237309504880; 68 constexpr float sqrtOfTwoFloat = 1.41421356237309504880f; 69 69 #else 70 const double sqrtOfTwoDouble = M_SQRT2;71 const float sqrtOfTwoFloat = static_cast<float>(M_SQRT2);70 constexpr double sqrtOfTwoDouble = M_SQRT2; 71 constexpr float sqrtOfTwoFloat = static_cast<float>(M_SQRT2); 72 72 #endif 73 73 … … 101 101 #endif // COMPILER(MSVC) 102 102 103 inline double deg2rad(double d) { return d * piDouble / 180.0; } 104 inline double rad2deg(double r) { return r * 180.0 / piDouble; } 105 inline double deg2grad(double d) { return d * 400.0 / 360.0; } 106 inline double grad2deg(double g) { return g * 360.0 / 400.0; } 107 inline double turn2deg(double t) { return t * 360.0; } 108 inline double deg2turn(double d) { return d / 360.0; } 109 inline double rad2grad(double r) { return r * 200.0 / piDouble; } 110 inline double grad2rad(double g) { return g * piDouble / 200.0; } 111 112 inline float deg2rad(float d) { return d * piFloat / 180.0f; } 113 inline float rad2deg(float r) { return r * 180.0f / piFloat; } 114 inline float deg2grad(float d) { return d * 400.0f / 360.0f; } 115 inline float grad2deg(float g) { return g * 360.0f / 400.0f; } 116 inline float turn2deg(float t) { return t * 360.0f; } 117 inline float deg2turn(float d) { return d / 360.0f; } 118 inline float rad2grad(float r) { return r * 200.0f / piFloat; } 119 inline float grad2rad(float g) { return g * piFloat / 200.0f; } 103 constexpr double radiansPerDegreeDouble = piDouble / 180.0; 104 constexpr double degreesPerRadianDouble = 180.0 / piDouble; 105 constexpr double gradientsPerDegreeDouble = 400.0 / 360.0; 106 constexpr double degreesPerGradientDouble = 360.0 / 400.0; 107 constexpr double turnsPerDegreeDouble = 1.0 / 360.0; 108 constexpr double degreesPerTurnDouble = 360.0; 109 110 constexpr inline double deg2rad(double d) { return d * radiansPerDegreeDouble; } 111 constexpr inline double rad2deg(double r) { return r * degreesPerRadianDouble; } 112 constexpr inline double deg2grad(double d) { return d * gradientsPerDegreeDouble; } 113 constexpr inline double grad2deg(double g) { return g * degreesPerGradientDouble; } 114 constexpr inline double deg2turn(double d) { return d * turnsPerDegreeDouble; } 115 constexpr inline double turn2deg(double t) { return t * degreesPerTurnDouble; } 116 117 118 // Note that these differ from the casting the double values above in their rounding errors. 119 constexpr float radiansPerDegreeFloat = piFloat / 180.0f; 120 constexpr float degreesPerRadianFloat = 180.0f / piFloat; 121 constexpr float gradientsPerDegreeFloat= 400.0f / 360.0f; 122 constexpr float degreesPerGradientFloat = 360.0f / 400.0f; 123 constexpr float turnsPerDegreeFloat = 1.0f / 360.0f; 124 constexpr float degreesPerTurnFloat = 360.0f; 125 126 constexpr inline float deg2rad(float d) { return d * radiansPerDegreeFloat; } 127 constexpr inline float rad2deg(float r) { return r * degreesPerRadianFloat; } 128 constexpr inline float deg2grad(float d) { return d * gradientsPerDegreeFloat; } 129 constexpr inline float grad2deg(float g) { return g * degreesPerGradientFloat; } 130 constexpr inline float deg2turn(float d) { return d * turnsPerDegreeFloat; } 131 constexpr inline float turn2deg(float t) { return t * degreesPerTurnFloat; } 132 133 // Treat theses as conversions through the cannonical unit for angles, which is degrees. 134 constexpr inline double rad2grad(double r) { return deg2grad(rad2deg(r)); } 135 constexpr inline double grad2rad(double g) { return deg2rad(grad2deg(g)); } 136 constexpr inline float rad2grad(float r) { return deg2grad(rad2deg(r)); } 137 constexpr inline float grad2rad(float g) { return deg2rad(grad2deg(g)); } 120 138 121 139 // std::numeric_limits<T>::min() returns the smallest positive value for floating point types -
trunk/Source/WebCore/ChangeLog
r267550 r267551 1 2020-09-24 Keith Miller <keith_miller@apple.com> 2 3 CSS angle unit conversions should consistently use the same associativity 4 https://bugs.webkit.org/show_bug.cgi?id=216906 5 6 Reviewed by Simon Fraser. 7 8 Right now we inconsistently associate our floating point math for 9 angle unit conversions. In particular, 10 conversionToCanonicalUnitsScaleFactor expects there to be a single 11 fixed constant we can multiply by to change units. However, the 12 various conversion functions in WTF are not associated in this 13 way. e.g. rad2deg does ((radian * 180) / pi) rather than 14 (radian * (180 / pi)). Since FP math is NOT associative these 15 produce different results. For example, 1.57 radians is 16 89.954373835539258 degrees in the first case but 17 89.954373835539243 in the second. 18 19 This patch changes the WTF functions to operate on a single scale 20 factor when converting to/from the canonical unit. Conversions 21 between non-canonical units first convert to the canonical unit 22 (degree). Also, conversionToCanonicalUnitsScaleFactor now gets the 23 scale factor from WTF to ensure we get the same associativity 24 everywhere. 25 26 * css/CSSPrimitiveValue.cpp: 27 (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor): 28 1 29 2020-09-24 Fujii Hironori <Hironori.Fujii@sony.com> 2 30 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r267154 r267551 756 756 break; 757 757 case CSSUnitType::CSS_RAD: 758 factor = 180 / piDouble;758 factor = degreesPerRadianDouble; 759 759 break; 760 760 case CSSUnitType::CSS_GRAD: 761 factor = 0.9;761 factor = degreesPerGradientDouble; 762 762 break; 763 763 case CSSUnitType::CSS_TURN: 764 factor = 360;764 factor = degreesPerTurnDouble; 765 765 break; 766 766 case CSSUnitType::CSS_S:
Note:
See TracChangeset
for help on using the changeset viewer.