From 65d4fd6e83d421e7fa7a8c7df44d01797e3c69ae Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 18 Mar 2021 09:16:30 +0000 Subject: Selection: Remove client callback for unit conversion. Now clients provide a unit conversion context and libcss provides code to perform unit conversion. This reduces the amount of common code that clients have to write. --- test/data/select/tests1.dat | 246 ++++++++++++++++++++++---------------------- test/select.c | 85 +++------------ 2 files changed, 140 insertions(+), 191 deletions(-) (limited to 'test') diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat index eaf37d7..295ab2e 100644 --- a/test/data/select/tests1.dat +++ b/test/data/select/tests1.dat @@ -59,7 +59,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -173,7 +173,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -291,7 +291,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -410,7 +410,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -529,7 +529,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -648,7 +648,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -757,7 +757,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -867,7 +867,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -977,7 +977,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -1086,7 +1086,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -1200,7 +1200,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -1314,7 +1314,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -1429,7 +1429,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -1547,7 +1547,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -1664,7 +1664,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -1787,7 +1787,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -1910,7 +1910,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -2033,7 +2033,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -2160,7 +2160,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -2286,7 +2286,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -2410,7 +2410,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -2533,7 +2533,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -2656,7 +2656,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -2779,7 +2779,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -2902,7 +2902,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -3025,7 +3025,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -3148,7 +3148,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -3271,7 +3271,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -3394,7 +3394,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -3517,7 +3517,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -3640,7 +3640,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 10.600pt +font-size: 13.342px font-style: normal font-variant: normal font-weight: normal @@ -3763,7 +3763,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 14.391pt +font-size: 19.187px font-style: normal font-variant: normal font-weight: normal @@ -3886,7 +3886,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 24pt +font-size: 32px font-style: normal font-variant: normal font-weight: normal @@ -4009,7 +4009,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 18pt +font-size: 24px font-style: normal font-variant: normal font-weight: normal @@ -4132,7 +4132,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 13.500pt +font-size: 18px font-style: normal font-variant: normal font-weight: normal @@ -4255,7 +4255,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -4378,7 +4378,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 9.750pt +font-size: 13px font-style: normal font-variant: normal font-weight: normal @@ -4501,7 +4501,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 7.500pt +font-size: 10px font-style: normal font-variant: normal font-weight: normal @@ -4624,7 +4624,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 6.750pt +font-size: 9px font-style: normal font-variant: normal font-weight: normal @@ -4870,7 +4870,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -4986,7 +4986,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -5102,7 +5102,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -5218,7 +5218,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -5331,7 +5331,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -5445,7 +5445,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -5559,7 +5559,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -5673,7 +5673,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -5783,7 +5783,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -5894,7 +5894,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6004,7 +6004,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6114,7 +6114,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6224,7 +6224,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6334,7 +6334,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6444,7 +6444,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6556,7 +6556,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6666,7 +6666,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6776,7 +6776,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6887,7 +6887,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -6997,7 +6997,7 @@ flex-shrink: 3.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7107,7 +7107,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7217,7 +7217,7 @@ flex-shrink: 0.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7327,7 +7327,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7437,7 +7437,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7547,7 +7547,7 @@ flex-shrink: 0.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7657,7 +7657,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7766,7 +7766,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7875,7 +7875,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -7984,7 +7984,7 @@ flex-shrink: 30.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8095,7 +8095,7 @@ flex-shrink: 3.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8206,7 +8206,7 @@ flex-shrink: 3.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8315,7 +8315,7 @@ flex-shrink: 0.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8426,7 +8426,7 @@ flex-shrink: 0.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8537,7 +8537,7 @@ flex-shrink: 3.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8648,7 +8648,7 @@ flex-shrink: 3.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8757,7 +8757,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8866,7 +8866,7 @@ flex-shrink: 1.000 flex-wrap: wrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -8975,7 +8975,7 @@ flex-shrink: 1.000 flex-wrap: wrap-reverse float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9084,7 +9084,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9193,7 +9193,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9302,7 +9302,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9411,7 +9411,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9520,7 +9520,7 @@ flex-shrink: 1.000 flex-wrap: wrap-reverse float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9631,7 +9631,7 @@ flex-shrink: 1.000 flex-wrap: wrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9742,7 +9742,7 @@ flex-shrink: 1.000 flex-wrap: wrap-reverse float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9851,7 +9851,7 @@ flex-shrink: 0.899 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -9960,7 +9960,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10069,7 +10069,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10178,7 +10178,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10287,7 +10287,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10396,7 +10396,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10505,7 +10505,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10616,7 +10616,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10727,7 +10727,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10836,7 +10836,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -10945,7 +10945,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11054,7 +11054,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11165,7 +11165,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11274,7 +11274,7 @@ flex-shrink: 3.780 flex-wrap: wrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11385,7 +11385,7 @@ flex-shrink: 3.780 flex-wrap: wrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11494,7 +11494,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11603,7 +11603,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11712,7 +11712,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11821,7 +11821,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -11930,7 +11930,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12039,7 +12039,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12148,7 +12148,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12257,7 +12257,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12366,7 +12366,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12475,7 +12475,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12584,7 +12584,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12693,7 +12693,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12802,7 +12802,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -12911,7 +12911,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13020,7 +13020,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13129,7 +13129,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13238,7 +13238,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13347,7 +13347,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13456,7 +13456,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13565,7 +13565,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13674,7 +13674,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13783,7 +13783,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -13892,7 +13892,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal @@ -14020,7 +14020,7 @@ flex-shrink: 1.000 flex-wrap: nowrap float: none font-family: sans-serif -font-size: 12pt +font-size: 16px font-style: normal font-variant: normal font-weight: normal diff --git a/test/select.c b/test/select.c index 33f31dd..a3319fe 100644 --- a/test/select.c +++ b/test/select.c @@ -159,13 +159,15 @@ static css_error node_presentational_hint(void *pw, void *node, uint32_t *nhints, css_hint **hints); static css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hints); -static css_error compute_font_size(void *pw, const css_hint *parent, - css_hint *size); static css_error set_libcss_node_data(void *pw, void *n, void *libcss_node_data); static css_error get_libcss_node_data(void *pw, void *n, void **libcss_node_data); +static css_unit_len_ctx unit_len_ctx = { + .font_size_default = 16 * (1 << CSS_RADIX_POINT), +}; + static css_select_handler select_handler = { CSS_SELECT_HANDLER_VERSION_1, @@ -203,9 +205,9 @@ static css_select_handler select_handler = { node_is_lang, node_presentational_hint, ua_default_for_property, - compute_font_size, + set_libcss_node_data, - get_libcss_node_data + get_libcss_node_data, }; static css_error resolve_url(void *pw, @@ -798,7 +800,12 @@ static void run_test_select_tree(css_select_ctx *select, css_select_results *sr; struct node *n = NULL; - assert(css_select_style(select, node, &ctx->media, NULL, + if (node->parent == NULL) { + unit_len_ctx.root_style = NULL; + } + + + assert(css_select_style(select, node, &unit_len_ctx, &ctx->media, NULL, &select_handler, ctx, &sr) == CSS_OK); if (node->parent != NULL) { @@ -806,7 +813,7 @@ static void run_test_select_tree(css_select_ctx *select, assert(css_computed_style_compose( node->parent->sr->styles[ctx->pseudo_element], sr->styles[ctx->pseudo_element], - compute_font_size, NULL, + &unit_len_ctx, &composed) == CSS_OK); css_computed_style_destroy(sr->styles[ctx->pseudo_element]); sr->styles[ctx->pseudo_element] = composed; @@ -819,6 +826,10 @@ static void run_test_select_tree(css_select_ctx *select, buf, buflen); } + if (node->parent == NULL) { + unit_len_ctx.root_style = node->sr->styles[ctx->pseudo_element]; + } + for (n = node->children; n != NULL; n = n->next) { run_test_select_tree(select, n, ctx, buf, buflen); } @@ -1639,68 +1650,6 @@ css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint) return CSS_OK; } -css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size) -{ - static css_hint_length sizes[] = { - { FLTTOFIX(6.75), CSS_UNIT_PT }, - { FLTTOFIX(7.50), CSS_UNIT_PT }, - { FLTTOFIX(9.75), CSS_UNIT_PT }, - { FLTTOFIX(12.0), CSS_UNIT_PT }, - { FLTTOFIX(13.5), CSS_UNIT_PT }, - { FLTTOFIX(18.0), CSS_UNIT_PT }, - { FLTTOFIX(24.0), CSS_UNIT_PT } - }; - const css_hint_length *parent_size; - - UNUSED(pw); - - /* Grab parent size, defaulting to medium if none */ - if (parent == NULL) { - parent_size = &sizes[CSS_FONT_SIZE_MEDIUM - 1]; - } else { - assert(parent->status == CSS_FONT_SIZE_DIMENSION); - assert(parent->data.length.unit != CSS_UNIT_EM); - assert(parent->data.length.unit != CSS_UNIT_EX); - parent_size = &parent->data.length; - } - - assert(size->status != CSS_FONT_SIZE_INHERIT); - - if (size->status < CSS_FONT_SIZE_LARGER) { - /* Keyword -- simple */ - size->data.length = sizes[size->status - 1]; - } else if (size->status == CSS_FONT_SIZE_LARGER) { - /** \todo Step within table, if appropriate */ - size->data.length.value = - FMUL(parent_size->value, FLTTOFIX(1.2)); - size->data.length.unit = parent_size->unit; - } else if (size->status == CSS_FONT_SIZE_SMALLER) { - /** \todo Step within table, if appropriate */ - size->data.length.value = - FDIV(parent_size->value, FLTTOFIX(1.2)); - size->data.length.unit = parent_size->unit; - } else if (size->data.length.unit == CSS_UNIT_EM || - size->data.length.unit == CSS_UNIT_EX) { - size->data.length.value = - FMUL(size->data.length.value, parent_size->value); - - if (size->data.length.unit == CSS_UNIT_EX) { - size->data.length.value = FMUL(size->data.length.value, - FLTTOFIX(0.6)); - } - - size->data.length.unit = parent_size->unit; - } else if (size->data.length.unit == CSS_UNIT_PCT) { - size->data.length.value = FDIV(FMUL(size->data.length.value, - parent_size->value), FLTTOFIX(100)); - size->data.length.unit = parent_size->unit; - } - - size->status = CSS_FONT_SIZE_DIMENSION; - - return CSS_OK; -} - static css_error set_libcss_node_data(void *pw, void *n, void *libcss_node_data) { -- cgit v1.2.1