From 8d02434eb39c898e43bccd4b189018406bc3b5b5 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Wed, 1 Jul 2020 15:55:38 -0700 Subject: [PATCH 1/2] [css-color-5] Adjustments to edge cases and set notation for hue interpolation types. This makes a few adjustments to the definitions of hue interpolation types to follow up on the discussions in #4735. First, it adjusts the pseudo-code so that for 'shorter' and 'longer', angles that differ by 180 degrees will always go in the decreasing direction, as described in https://github.com/w3c/csswg-drafts/issues/4735#issuecomment-650254063 Second, it adjusts the set notation to match the pseudo-code. (They were not matching even prior to this change.) The set notation previously seemed to assume that there were absolute-value functions present that were not actually there. However, given the asymmetry of always going in the decreasing direction, it's more correct to write it without absolute values. --- css-color-5/Overview.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/css-color-5/Overview.bs b/css-color-5/Overview.bs index 10c89748c96..c17b027afb8 100644 --- a/css-color-5/Overview.bs +++ b/css-color-5/Overview.bs @@ -752,20 +752,20 @@ Unless the type of hue interpolation is ''specified'', both angles need to be co One way to do this is θ = ((θ % 360) + 360) % 360. : ''shorter'' -:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 180). In pseudo-Javascript: +:: Angles are adjusted so that θ₂ - θ₁ ∈ [-180, 180). In pseudo-Javascript:
 	if (θ₂ - θ₁ >= 180) {
 		θ₁ += 360;
 	}
-	else if (θ₂ - θ₁ <= -180) {
+	else if (θ₂ - θ₁ < -180) {
 		θ₂ += 360;
 	}
 	
: ''longer'' -:: Angles are adjusted so that θ₂ - θ₁ ∈ [180, 360). In pseudo-Javascript: +:: Angles are adjusted so that θ₂ - θ₁ ∈ {(-360, -180], 0, (180, 360)}. In pseudo-Javascript:
-	if (0 < θ₂ - θ₁ < 180) {
+	if (0 < θ₂ - θ₁ <= 180) {
 	  θ₁ += 360;
 	}
 	else if (-180 < θ₂ - θ₁ < 0) {
@@ -774,7 +774,7 @@ One way to do this is θ = ((θ % 360) + 360) % 360.
 	
: ''increasing'' -:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 360) and θ₁ ≤ θ₂. In pseudo-Javascript: +:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 360). In pseudo-Javascript:
 	if (θ₂ < θ₁) {
 		θ₂ += 360;
@@ -782,7 +782,7 @@ One way to do this is θ = ((θ % 360) + 360) % 360.
 	
: ''decreasing'' -:: Angles are adjusted so that θ₂ - θ₁ ∈ [0, 360) and θ₁ ≥ θ₂. In pseudo-Javascript: +:: Angles are adjusted so that θ₂ - θ₁ ∈ (-360, 0]. In pseudo-Javascript:
 	if (θ₁ < θ₂) {
 		θ₁ += 360;

From 09236c1f558771c6911fa458753dc5059bf086ff Mon Sep 17 00:00:00 2001
From: "L. David Baron" 
Date: Wed, 8 Jul 2020 16:09:33 -0700
Subject: [PATCH 2/2] [to merge into previous commit] Address review comments
 from @LeaVerou, and fix inconsistent indent.

---
 css-color-5/Overview.bs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/css-color-5/Overview.bs b/css-color-5/Overview.bs
index c17b027afb8..422df0367c2 100644
--- a/css-color-5/Overview.bs
+++ b/css-color-5/Overview.bs
@@ -752,9 +752,9 @@ Unless the type of hue interpolation is ''specified'', both angles need to be co
 One way to do this is θ = ((θ % 360) + 360) % 360.
 
 : ''shorter''
-:: Angles are adjusted so that θ₂ - θ₁ ∈ [-180, 180). In pseudo-Javascript:
+:: Angles are adjusted so that θ₂ - θ₁ ∈ [-180, 180]. In pseudo-Javascript:
 	
-	if (θ₂ - θ₁ >= 180) {
+	if (θ₂ - θ₁ > 180) {
 		θ₁ += 360;
 	}
 	else if (θ₂ - θ₁ < -180) {
@@ -763,13 +763,13 @@ One way to do this is θ = ((θ % 360) + 360) % 360.
 	
: ''longer'' -:: Angles are adjusted so that θ₂ - θ₁ ∈ {(-360, -180], 0, (180, 360)}. In pseudo-Javascript: +:: Angles are adjusted so that |θ₂ - θ₁| ∈ {0, [180, 360)}. In pseudo-Javascript:
-	if (0 < θ₂ - θ₁ <= 180) {
-	  θ₁ += 360;
+	if (0 < θ₂ - θ₁ < 180) {
+		θ₁ += 360;
 	}
 	else if (-180 < θ₂ - θ₁ < 0) {
-	  θ₂ += 360;
+		θ₂ += 360;
 	}