@@ -1203,6 +1203,31 @@ public function data_safecss_filter_attr() {
12031203 'css ' => 'height: expression( body.scrollTop + 50 + "px" ) ' ,
12041204 'expected ' => '' ,
12051205 ),
1206+ // RGBA background color are allowed.
1207+ array (
1208+ 'css ' => 'background-color: rgba(0,0,0,0) ' ,
1209+ 'expected ' => 'background-color: rgba(0,0,0,0) ' ,
1210+ ),
1211+ array (
1212+ 'css ' => 'background-color: rgba(0, 0, 0, 0) ' ,
1213+ 'expected ' => 'background-color: rgba(0, 0, 0, 0) ' ,
1214+ ),
1215+ array (
1216+ 'css ' => 'background-color: rgba(100, 100, 100, 0) ' ,
1217+ 'expected ' => 'background-color: rgba(100, 100, 100, 0) ' ,
1218+ ),
1219+ array (
1220+ 'css ' => 'background-color: rgba(10%, 10%, 10%, 0) ' ,
1221+ 'expected ' => 'background-color: rgba(10%, 10%, 10%, 0) ' ,
1222+ ),
1223+ array (
1224+ 'css ' => 'background-color: rgba(0, 0, 0, 0.1) ' ,
1225+ 'expected ' => 'background-color: rgba(0, 0, 0, 0.1) ' ,
1226+ ),
1227+ array (
1228+ 'css ' => 'background-color: rgba(0, 0, 0, .1) ' ,
1229+ 'expected ' => 'background-color: rgba(0, 0, 0, .1) ' ,
1230+ ),
12061231 // RGB color values are not allowed.
12071232 array (
12081233 'css ' => 'color: rgb( 100, 100, 100 ) ' ,
@@ -1333,6 +1358,71 @@ public function data_safecss_filter_attr() {
13331358 'css ' => 'gap: 10px;column-gap: 5px;row-gap: 20px ' ,
13341359 'expected ' => 'gap: 10px;column-gap: 5px;row-gap: 20px ' ,
13351360 ),
1361+ // RGB color.
1362+ array (
1363+ 'css ' => 'color: rgb(255, 0, 0) ' ,
1364+ 'expected ' => 'color: rgb(255, 0, 0) ' ,
1365+ ),
1366+ array (
1367+ 'css ' => 'color: rgb(255 0 0) ' ,
1368+ 'expected ' => 'color: rgb(255 0 0) ' ,
1369+ ),
1370+ array (
1371+ 'css ' => 'color: rgb(100%, 0%, 50%) ' ,
1372+ 'expected ' => 'color: rgb(100%, 0%, 50%) ' ,
1373+ ),
1374+ array (
1375+ 'css ' => 'color: rgb(255, 50%, 0) ' ,
1376+ 'expected ' => 'color: rgb(255, 50%, 0) ' ,
1377+ ),
1378+ // RGBA color.
1379+ array (
1380+ 'css ' => 'color: rgba(255, 128, 0, 0.5) ' ,
1381+ 'expected ' => 'color: rgba(255, 128, 0, 0.5) ' ,
1382+ ),
1383+ array (
1384+ 'css ' => 'color: rgb(255 128 0 / 50%) ' ,
1385+ 'expected ' => 'color: rgb(255 128 0 / 50%) ' ,
1386+ ),
1387+ // RGB color with extra whitespace.
1388+ array (
1389+ 'css ' => 'color: rgb( 255 , 128 , 0 ) ' ,
1390+ 'expected ' => 'color: rgb( 255 , 128 , 0 ) ' ,
1391+ ),
1392+ // RGB background color.
1393+ array (
1394+ 'css ' => 'background-color: rgb(200, 100, 50) ' ,
1395+ 'expected ' => 'background-color: rgb(200, 100, 50) ' ,
1396+ ),
1397+ // RGBA border color.
1398+ array (
1399+ 'css ' => 'border-color: rgba(100, 200, 300, 0.8) ' ,
1400+ 'expected ' => 'border-color: rgba(100, 200, 300, 0.8) ' ,
1401+ ),
1402+ // Malformed RGB color, invalid number of values.
1403+ array (
1404+ 'css ' => 'color: rgb(255, 128, 0, 0.5, 100) ' ,
1405+ 'expected ' => '' ,
1406+ ),
1407+ array (
1408+ 'css ' => 'color: rgb(255, 128) ' ,
1409+ 'expected ' => '' ,
1410+ ),
1411+ // Malformed RGB color, non-numeric values.
1412+ array (
1413+ 'css ' => 'color: rgb(red, green, blue) ' ,
1414+ 'expected ' => '' ,
1415+ ),
1416+ // Malformed RGB color, unmatched parentheses.
1417+ array (
1418+ 'css ' => 'color: rgb(255, 128, 0 ' ,
1419+ 'expected ' => '' ,
1420+ ),
1421+ // Malformed RGB color, empty values.
1422+ array (
1423+ 'css ' => 'color: rgb(, , ) ' ,
1424+ 'expected ' => '' ,
1425+ ),
13361426 // Margin and padding logical properties introduced in 6.1.
13371427 array (
13381428 'css ' => 'margin-block-start: 1px;margin-block-end: 2px;margin-inline-start: 3px;margin-inline-end: 4px; ' ,
0 commit comments