Diff
Modified: trunk/LayoutTests/ChangeLog (267550 => 267551)
--- trunk/LayoutTests/ChangeLog 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/LayoutTests/ChangeLog 2020-09-24 22:40:06 UTC (rev 267551)
@@ -1,3 +1,14 @@
+2020-09-24 Keith Miller <[email protected]>
+
+ CSS angle unit conversions should consistently use the same associativity
+ https://bugs.webkit.org/show_bug.cgi?id=216906
+
+ Reviewed by Simon Fraser.
+
+ Rebaseline tests.
+
+ * TestExpectations:
+
2020-09-24 Lauro Moura <[email protected]>
[GLIB] Update baseline and expectations after r267531
Modified: trunk/LayoutTests/TestExpectations (267550 => 267551)
--- trunk/LayoutTests/TestExpectations 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/LayoutTests/TestExpectations 2020-09-24 22:40:06 UTC (rev 267551)
@@ -1188,11 +1188,6 @@
# selectors
webkit.org/b/64861 imported/w3c/web-platform-tests/css/selectors/selectors-dir-selector-ltr-001.html [ ImageOnlyFailure ]
webkit.org/b/64861 imported/w3c/web-platform-tests/css/selectors/selectors-dir-selector-rtl-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/selectors/selector-placeholder-shown-type-change-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/selectors/selector-placeholder-shown-type-change-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/selectors/selector-placeholder-shown-type-change-003.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/selectors/selector-read-write-type-change-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/selectors/selector-required-type-change-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/selectors/old-tests/css3-modsel-172a.xml [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/selectors/old-tests/css3-modsel-172b.xml [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/selectors/old-tests/css3-modsel-173a.xml [ ImageOnlyFailure ]
@@ -1666,7 +1661,6 @@
imported/w3c/web-platform-tests/svg/extensibility/foreignObject/isolation-with-html.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/svg/extensibility/foreignObject/isolation-with-svg.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/svg/painting/reftests/display-none-mask.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/svg/struct/reftests/use-external-resource-with-revalidation.tentative.html [ ImageOnlyFailure ]
webkit.org/b/139595 imported/w3c/web-platform-tests/svg/import/animate-dom-02-f-manual.svg [ Skip ]
webkit.org/b/201110 imported/w3c/web-platform-tests/svg/extensibility/foreignObject/stacking-context.html [ Skip ]
@@ -2482,7 +2476,6 @@
webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-008.html [ ImageOnlyFailure Pass ]
webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-009.html [ ImageOnlyFailure Pass ]
-webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-animations/animation-delay-010.html [ ImageOnlyFailure ]
# overflow-wrap:anywhere feature is not implemented yet.
webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-001.html [ Skip ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (267550 => 267551)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-09-24 22:40:06 UTC (rev 267551)
@@ -1,3 +1,18 @@
+2020-09-24 Keith Miller <[email protected]>
+
+ CSS angle unit conversions should consistently use the same associativity
+ https://bugs.webkit.org/show_bug.cgi?id=216906
+
+ Reviewed by Simon Fraser.
+
+ Rebaseline tests for different rounding errors in angle unit conversions. The minmax-angle-computed test
+ is now passing and the webaudio tests just have slightly different results now.
+
+ * web-platform-tests/css/css-values/minmax-angle-computed-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt:
+
2020-09-24 Frederic Wang <[email protected]>
Resync WPT's mathml and math-script-level-and-math-style tests
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-angle-computed-expected.txt (267550 => 267551)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-angle-computed-expected.txt 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-angle-computed-expected.txt 2020-09-24 22:40:06 UTC (rev 267551)
@@ -16,11 +16,11 @@
PASS max(1rad, 2rad) should be used-value-equivalent to 2rad
PASS max(1turn, 2turn) should be used-value-equivalent to 2turn
PASS min(90deg, 0.26turn) should be used-value-equivalent to 90deg
-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)"
+PASS min(1.57rad, 95deg) should be used-value-equivalent to 1.57rad
PASS max(91deg, 0.25turn) should be used-value-equivalent to 91deg
PASS max(1.58rad, 90deg) should be used-value-equivalent to 1.58rad
-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)"
-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)"
+PASS min(270deg, max(0.25turn, 3.14rad)) should be used-value-equivalent to 3.14rad
+PASS max(0.25turn, min(270deg, 3.14rad)) should be used-value-equivalent to 3.14rad
PASS calc(min(90deg, 1.58rad) + 0.25turn) should be used-value-equivalent to 180deg
PASS calc(min(90deg, 1.58rad) - 0.125turn) should be used-value-equivalent to 45deg
PASS calc(min(90deg, 1.58rad) * 2 should be used-value-equivalent to 180deg
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt (267550 => 267551)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-connections-expected.txt 2020-09-24 22:40:06 UTC (rev 267551)
@@ -9,13 +9,13 @@
PASS Audit report
PASS > [Panner x] k-rate input
PASS Panner: positionX: Expected output channel 0 is not constantly 0.017871389165520668 (contains 512 different values).
-PASS positionX: Expected output channel 1 is not constantly 0.03648621588945389 (contains 512 different values).
+PASS positionX: Expected output channel 1 is not constantly 0.036486223340034485 (contains 512 different values).
PASS Panner: positionX: Channel 0 output[0, 127] contains only the constant 0.017871389165520668.
PASS Panner: positionX: Channel 0 output[128, 255] contains only the constant 0.012888134457170963.
PASS Panner: positionX: Channel 0 output[256, 383] contains only the constant 0.007589160930365324.
PASS Panner: positionX: Channel 0 output[384, 511] contains only the constant 0.004646967630833387.
PASS Panner: positionX: Channel 0 output[512, 639] contains only the constant 0.0030441549606621265.
-PASS Panner: positionX: Channel 1 output[0, 127] contains only the constant 0.03648621588945389.
+PASS Panner: positionX: Channel 1 output[0, 127] contains only the constant 0.036486223340034485.
PASS Panner: positionX: Channel 1 output[128, 255] contains only the constant 0.044254120439291.
PASS Panner: positionX: Channel 1 output[256, 383] contains only the constant 0.04127275571227074.
PASS Panner: positionX: Channel 1 output[384, 511] contains only the constant 0.03552864491939545.
@@ -25,17 +25,17 @@
PASS < [Panner x] All assertions passed. (total 14 assertions)
PASS > [Panner y] k-rate input
PASS Panner: positionY: Expected output channel 0 is not constantly 0.039904240518808365 (contains 512 different values).
-PASS positionY: Expected output channel 1 is not constantly 0.08146847039461136 (contains 512 different values).
+PASS positionY: Expected output channel 1 is not constantly 0.08146847784519196 (contains 512 different values).
PASS Panner: positionY: Channel 0 output[0, 127] contains only the constant 0.039904240518808365.
PASS Panner: positionY: Channel 0 output[128, 255] contains only the constant 0.030709920451045036.
PASS Panner: positionY: Channel 0 output[256, 383] contains only the constant 0.02095188945531845.
PASS Panner: positionY: Channel 0 output[384, 511] contains only the constant 0.01528366282582283.
PASS Panner: positionY: Channel 0 output[512, 639] contains only the constant 0.011893529444932938.
-PASS Panner: positionY: Channel 1 output[0, 127] contains only the constant 0.08146847039461136.
-PASS Panner: positionY: Channel 1 output[128, 255] contains only the constant 0.06269735842943192.
-PASS Panner: positionY: Channel 1 output[256, 383] contains only the constant 0.042775362730026245.
-PASS Panner: positionY: Channel 1 output[384, 511] contains only the constant 0.031203117221593857.
-PASS Panner: positionY: Channel 1 output[512, 639] contains only the constant 0.0242818221449852.
+PASS Panner: positionY: Channel 1 output[0, 127] contains only the constant 0.08146847784519196.
+PASS Panner: positionY: Channel 1 output[128, 255] contains only the constant 0.06269736588001251.
+PASS Panner: positionY: Channel 1 output[256, 383] contains only the constant 0.042775366455316544.
+PASS Panner: positionY: Channel 1 output[384, 511] contains only the constant 0.031203120946884155.
+PASS Panner: positionY: Channel 1 output[512, 639] contains only the constant 0.024281825870275497.
PASS Panner: positionY: Actual output channel 0 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
PASS Panner: positionY: Actual output channel 1 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
PASS < [Panner y] All assertions passed. (total 14 assertions)
@@ -50,7 +50,7 @@
PASS Panner: positionZ: Channel 1 output[0, 127] contains only the constant 0.054120492190122604.
PASS Panner: positionZ: Channel 1 output[128, 255] contains only the constant 0.03781212866306305.
PASS Panner: positionZ: Channel 1 output[256, 383] contains only the constant 0.031430669128894806.
-PASS Panner: positionZ: Channel 1 output[384, 511] contains only the constant 0.025715911760926247.
+PASS Panner: positionZ: Channel 1 output[384, 511] contains only the constant 0.025715915486216545.
PASS Panner: positionZ: Channel 1 output[512, 639] contains only the constant 0.021292630583047867.
PASS Panner: positionZ: Actual output channel 0 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
PASS Panner: positionZ: Actual output channel 1 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
@@ -68,16 +68,16 @@
PASS Listener: positionX: Channel 1 output[512, 639] contains only the constant 0.007476956583559513.
PASS < [Listener x] All assertions passed. (total 10 assertions)
PASS > [Listener y] k-rate input
-PASS Listener: positionY: Channel 0 output[0, 127] contains only the constant 0.016606438905000687.
+PASS Listener: positionY: Channel 0 output[0, 127] contains only the constant 0.016606437042355537.
PASS Listener: positionY: Channel 0 output[128, 255] contains only the constant 0.023375829681754112.
-PASS Listener: positionY: Channel 0 output[256, 383] contains only the constant 0.03255589306354523.
+PASS Listener: positionY: Channel 0 output[256, 383] contains only the constant 0.03255588933825493.
PASS Listener: positionY: Channel 0 output[384, 511] contains only the constant 0.03216671943664551.
-PASS Listener: positionY: Channel 0 output[512, 639] contains only the constant 0.02294781431555748.
-PASS Listener: positionY: Channel 1 output[0, 127] contains only the constant 0.04241393506526947.
-PASS Listener: positionY: Channel 1 output[128, 255] contains only the constant 0.05970340967178345.
-PASS Listener: positionY: Channel 1 output[256, 383] contains only the constant 0.08314989507198334.
-PASS Listener: positionY: Channel 1 output[384, 511] contains only the constant 0.08215592056512833.
-PASS Listener: positionY: Channel 1 output[512, 639] contains only the constant 0.0586102269589901.
+PASS Listener: positionY: Channel 0 output[512, 639] contains only the constant 0.02294781245291233.
+PASS Listener: positionY: Channel 1 output[0, 127] contains only the constant 0.04241393879055977.
+PASS Listener: positionY: Channel 1 output[128, 255] contains only the constant 0.059703417122364044.
+PASS Listener: positionY: Channel 1 output[256, 383] contains only the constant 0.08314990252256393.
+PASS Listener: positionY: Channel 1 output[384, 511] contains only the constant 0.08215592801570892.
+PASS Listener: positionY: Channel 1 output[512, 639] contains only the constant 0.058610234409570694.
PASS < [Listener y] All assertions passed. (total 10 assertions)
PASS > [Listener z] k-rate input
PASS Listener: positionZ: Channel 0 output[0, 127] contains only the constant 0.016306867823004723.
@@ -87,7 +87,7 @@
PASS Listener: positionZ: Channel 0 output[512, 639] contains only the constant 0.008515486493706703.
PASS Listener: positionZ: Channel 1 output[0, 127] contains only the constant 0.04121469706296921.
PASS Listener: positionZ: Channel 1 output[128, 255] contains only the constant 0.032292626798152924.
-PASS Listener: positionZ: Channel 1 output[256, 383] contains only the constant 0.02588506042957306.
+PASS Listener: positionZ: Channel 1 output[256, 383] contains only the constant 0.025885064154863358.
PASS Listener: positionZ: Channel 1 output[384, 511] contains only the constant 0.021276984363794327.
PASS Listener: positionZ: Channel 1 output[512, 639] contains only the constant 0.017917200922966003.
PASS < [Listener z] All assertions passed. (total 10 assertions)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt (267550 => 267551)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-panner-expected.txt 2020-09-24 22:40:06 UTC (rev 267551)
@@ -96,9 +96,9 @@
PASS Listener positionX.linearRampToValueAtTime(1000,1) did not throw an exception.
PASS Listener k-rate positionX: Output is not constantly 0.0012908608186990023 (contains 512 different values).
PASS Listener k-rate positionX: Output [0, 127] contains only the constant 0.0012908608186990023.
-PASS Listener k-rate positionX: Output [128, 255] contains only the constant 0.012697513215243816.
+PASS Listener k-rate positionX: Output [128, 255] contains only the constant 0.012697515077888966.
PASS Listener k-rate positionX: Output [256, 383] contains only the constant 0.012066217139363289.
-PASS Listener k-rate positionX: Output [384, 511] contains only the constant 0.008956578560173512.
+PASS Listener k-rate positionX: Output [384, 511] contains only the constant 0.008956579491496086.
PASS Listener k-rate positionX: Output [512, 639] contains only the constant 0.006926612462848425.
PASS < [Listener k-rate positionX] All assertions passed. (total 9 assertions)
PASS > [Listener k-rate positionY]
@@ -130,7 +130,7 @@
PASS Listener k-rate forwardX: Output is not constantly 0.00111640605609864 (contains 512 different values).
PASS Listener k-rate forwardX: Output [0, 127] contains only the constant 0.00111640605609864.
PASS Listener k-rate forwardX: Output [128, 255] contains only the constant 0.001115163555368781.
-PASS Listener k-rate forwardX: Output [256, 383] contains only the constant 0.001113853300921619.
+PASS Listener k-rate forwardX: Output [256, 383] contains only the constant 0.0011138531845062971.
PASS Listener k-rate forwardX: Output [384, 511] contains only the constant 0.0011124692391604185.
PASS Listener k-rate forwardX: Output [512, 639] contains only the constant 0.0011110050836578012.
PASS < [Listener k-rate forwardX] All assertions passed. (total 9 assertions)
@@ -182,8 +182,8 @@
PASS Listener upZ.automationRate is equal to k-rate.
PASS Listener upZ.setValueAtTime(-1,0) did not throw an exception.
PASS Listener upZ.linearRampToValueAtTime(1000,1) did not throw an exception.
-PASS Listener k-rate upZ: Output is not constantly 0.001004426390863955 (contains 512 different values).
-PASS Listener k-rate upZ: Output [0, 127] contains only the constant 0.001004426390863955.
+PASS Listener k-rate upZ: Output is not constantly 0.0010044265072792768 (contains 512 different values).
+PASS Listener k-rate upZ: Output [0, 127] contains only the constant 0.0010044265072792768.
PASS Listener k-rate upZ: Output [128, 255] contains only the constant 0.0010139397345483303.
PASS Listener k-rate upZ: Output [256, 383] contains only the constant 0.0010087323607876897.
PASS Listener k-rate upZ: Output [384, 511] contains only the constant 0.0010072044096887112.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt (267550 => 267551)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-automation-basic-expected.txt 2020-09-24 22:40:06 UTC (rev 267551)
@@ -92,7 +92,7 @@
PASS > [Mono listener.positionY]
PASS Mono listener.positionY.value frame [0, 128) channel 0 contains only the constant 0.22094237804412842.
PASS Mono listener.positionY.value frame [0, 128) channel 1 contains only the constant 0.5334020853042603.
-PASS Mono listener.positionY.value frame [128, 256) channel 0 contains only the constant 0.00003826833926723339.
+PASS Mono listener.positionY.value frame [128, 256) channel 0 contains only the constant 0.00003826833562925458.
PASS Mono listener.positionY.value frame [128, 256) channel 1 contains only the constant 0.00009238795610144734.
PASS Mono listener.positionY: Output at frame 128 channel 0 is not equal to 0.22094237804412842.
PASS Mono listener.positionY: Output at frame 128 channel 1 is not equal to 0.5334020853042603.
Modified: trunk/Source/WTF/ChangeLog (267550 => 267551)
--- trunk/Source/WTF/ChangeLog 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/Source/WTF/ChangeLog 2020-09-24 22:40:06 UTC (rev 267551)
@@ -1,3 +1,36 @@
+2020-09-24 Keith Miller <[email protected]>
+
+ CSS angle unit conversions should consistently use the same associativity
+ https://bugs.webkit.org/show_bug.cgi?id=216906
+
+ Reviewed by Simon Fraser.
+
+ Right now we inconsistently associate our floating point math for
+ angle unit conversions. In particular,
+ conversionToCanonicalUnitsScaleFactor expects there to be a single
+ fixed constant we can multiply by to change units. However, the
+ various conversion functions in WTF are not associated in this
+ way. e.g. rad2deg does ((radian * 180) / pi) rather than
+ (radian *(180 / pi)). Since FP math is NOT associative these
+ produce different results. For example, 1.57 radians is
+ 89.954373835539258 degrees in the first case but
+ 89.954373835539243 in the second.
+
+ This patch changes those WTF functions to operate on a single
+ scale factor when converting to/from the canonical
+ unit. Conversions between non-canonical units first convert to the
+ canonical unit (degree).
+
+ * wtf/MathExtras.h:
+ (deg2rad):
+ (rad2deg):
+ (deg2grad):
+ (grad2deg):
+ (deg2turn):
+ (turn2deg):
+ (rad2grad):
+ (grad2rad):
+
2020-09-24 Antti Koivisto <[email protected]>
[LFC][Integration] Enable on Apple Windows port
Modified: trunk/Source/WTF/wtf/MathExtras.h (267550 => 267551)
--- trunk/Source/WTF/wtf/MathExtras.h 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/Source/WTF/wtf/MathExtras.h 2020-09-24 22:40:06 UTC (rev 267551)
@@ -40,35 +40,35 @@
#endif
#ifndef M_PI
-const double piDouble = 3.14159265358979323846;
-const float piFloat = 3.14159265358979323846f;
+constexpr double piDouble = 3.14159265358979323846;
+constexpr float piFloat = 3.14159265358979323846f;
#else
-const double piDouble = M_PI;
-const float piFloat = static_cast<float>(M_PI);
+constexpr double piDouble = M_PI;
+constexpr float piFloat = static_cast<float>(M_PI);
#endif
#ifndef M_PI_2
-const double piOverTwoDouble = 1.57079632679489661923;
-const float piOverTwoFloat = 1.57079632679489661923f;
+constexpr double piOverTwoDouble = 1.57079632679489661923;
+constexpr float piOverTwoFloat = 1.57079632679489661923f;
#else
-const double piOverTwoDouble = M_PI_2;
-const float piOverTwoFloat = static_cast<float>(M_PI_2);
+constexpr double piOverTwoDouble = M_PI_2;
+constexpr float piOverTwoFloat = static_cast<float>(M_PI_2);
#endif
#ifndef M_PI_4
-const double piOverFourDouble = 0.785398163397448309616;
-const float piOverFourFloat = 0.785398163397448309616f;
+constexpr double piOverFourDouble = 0.785398163397448309616;
+constexpr float piOverFourFloat = 0.785398163397448309616f;
#else
-const double piOverFourDouble = M_PI_4;
-const float piOverFourFloat = static_cast<float>(M_PI_4);
+constexpr double piOverFourDouble = M_PI_4;
+constexpr float piOverFourFloat = static_cast<float>(M_PI_4);
#endif
#ifndef M_SQRT2
-const double sqrtOfTwoDouble = 1.41421356237309504880;
-const float sqrtOfTwoFloat = 1.41421356237309504880f;
+constexpr double sqrtOfTwoDouble = 1.41421356237309504880;
+constexpr float sqrtOfTwoFloat = 1.41421356237309504880f;
#else
-const double sqrtOfTwoDouble = M_SQRT2;
-const float sqrtOfTwoFloat = static_cast<float>(M_SQRT2);
+constexpr double sqrtOfTwoDouble = M_SQRT2;
+constexpr float sqrtOfTwoFloat = static_cast<float>(M_SQRT2);
#endif
#if COMPILER(MSVC)
@@ -100,24 +100,42 @@
#endif // COMPILER(MSVC)
-inline double deg2rad(double d) { return d * piDouble / 180.0; }
-inline double rad2deg(double r) { return r * 180.0 / piDouble; }
-inline double deg2grad(double d) { return d * 400.0 / 360.0; }
-inline double grad2deg(double g) { return g * 360.0 / 400.0; }
-inline double turn2deg(double t) { return t * 360.0; }
-inline double deg2turn(double d) { return d / 360.0; }
-inline double rad2grad(double r) { return r * 200.0 / piDouble; }
-inline double grad2rad(double g) { return g * piDouble / 200.0; }
+constexpr double radiansPerDegreeDouble = piDouble / 180.0;
+constexpr double degreesPerRadianDouble = 180.0 / piDouble;
+constexpr double gradientsPerDegreeDouble = 400.0 / 360.0;
+constexpr double degreesPerGradientDouble = 360.0 / 400.0;
+constexpr double turnsPerDegreeDouble = 1.0 / 360.0;
+constexpr double degreesPerTurnDouble = 360.0;
-inline float deg2rad(float d) { return d * piFloat / 180.0f; }
-inline float rad2deg(float r) { return r * 180.0f / piFloat; }
-inline float deg2grad(float d) { return d * 400.0f / 360.0f; }
-inline float grad2deg(float g) { return g * 360.0f / 400.0f; }
-inline float turn2deg(float t) { return t * 360.0f; }
-inline float deg2turn(float d) { return d / 360.0f; }
-inline float rad2grad(float r) { return r * 200.0f / piFloat; }
-inline float grad2rad(float g) { return g * piFloat / 200.0f; }
+constexpr inline double deg2rad(double d) { return d * radiansPerDegreeDouble; }
+constexpr inline double rad2deg(double r) { return r * degreesPerRadianDouble; }
+constexpr inline double deg2grad(double d) { return d * gradientsPerDegreeDouble; }
+constexpr inline double grad2deg(double g) { return g * degreesPerGradientDouble; }
+constexpr inline double deg2turn(double d) { return d * turnsPerDegreeDouble; }
+constexpr inline double turn2deg(double t) { return t * degreesPerTurnDouble; }
+
+// Note that these differ from the casting the double values above in their rounding errors.
+constexpr float radiansPerDegreeFloat = piFloat / 180.0f;
+constexpr float degreesPerRadianFloat = 180.0f / piFloat;
+constexpr float gradientsPerDegreeFloat= 400.0f / 360.0f;
+constexpr float degreesPerGradientFloat = 360.0f / 400.0f;
+constexpr float turnsPerDegreeFloat = 1.0f / 360.0f;
+constexpr float degreesPerTurnFloat = 360.0f;
+
+constexpr inline float deg2rad(float d) { return d * radiansPerDegreeFloat; }
+constexpr inline float rad2deg(float r) { return r * degreesPerRadianFloat; }
+constexpr inline float deg2grad(float d) { return d * gradientsPerDegreeFloat; }
+constexpr inline float grad2deg(float g) { return g * degreesPerGradientFloat; }
+constexpr inline float deg2turn(float d) { return d * turnsPerDegreeFloat; }
+constexpr inline float turn2deg(float t) { return t * degreesPerTurnFloat; }
+
+// Treat theses as conversions through the cannonical unit for angles, which is degrees.
+constexpr inline double rad2grad(double r) { return deg2grad(rad2deg(r)); }
+constexpr inline double grad2rad(double g) { return deg2rad(grad2deg(g)); }
+constexpr inline float rad2grad(float r) { return deg2grad(rad2deg(r)); }
+constexpr inline float grad2rad(float g) { return deg2rad(grad2deg(g)); }
+
// std::numeric_limits<T>::min() returns the smallest positive value for floating point types
template<typename T> constexpr T defaultMinimumForClamp() { return std::numeric_limits<T>::min(); }
template<> constexpr float defaultMinimumForClamp() { return -std::numeric_limits<float>::max(); }
Modified: trunk/Source/WebCore/ChangeLog (267550 => 267551)
--- trunk/Source/WebCore/ChangeLog 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/Source/WebCore/ChangeLog 2020-09-24 22:40:06 UTC (rev 267551)
@@ -1,3 +1,31 @@
+2020-09-24 Keith Miller <[email protected]>
+
+ CSS angle unit conversions should consistently use the same associativity
+ https://bugs.webkit.org/show_bug.cgi?id=216906
+
+ Reviewed by Simon Fraser.
+
+ Right now we inconsistently associate our floating point math for
+ angle unit conversions. In particular,
+ conversionToCanonicalUnitsScaleFactor expects there to be a single
+ fixed constant we can multiply by to change units. However, the
+ various conversion functions in WTF are not associated in this
+ way. e.g. rad2deg does ((radian * 180) / pi) rather than
+ (radian * (180 / pi)). Since FP math is NOT associative these
+ produce different results. For example, 1.57 radians is
+ 89.954373835539258 degrees in the first case but
+ 89.954373835539243 in the second.
+
+ This patch changes the WTF functions to operate on a single scale
+ factor when converting to/from the canonical unit. Conversions
+ between non-canonical units first convert to the canonical unit
+ (degree). Also, conversionToCanonicalUnitsScaleFactor now gets the
+ scale factor from WTF to ensure we get the same associativity
+ everywhere.
+
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor):
+
2020-09-24 Fujii Hironori <[email protected]>
[SVG2] Remove color-profile tag
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (267550 => 267551)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2020-09-24 22:25:45 UTC (rev 267550)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2020-09-24 22:40:06 UTC (rev 267551)
@@ -755,13 +755,13 @@
factor = cssPixelsPerInch * 12.0 / 72.0; // 1 pc == 12 pt
break;
case CSSUnitType::CSS_RAD:
- factor = 180 / piDouble;
+ factor = degreesPerRadianDouble;
break;
case CSSUnitType::CSS_GRAD:
- factor = 0.9;
+ factor = degreesPerGradientDouble;
break;
case CSSUnitType::CSS_TURN:
- factor = 360;
+ factor = degreesPerTurnDouble;
break;
case CSSUnitType::CSS_S:
case CSSUnitType::CSS_KHZ: