From badb7dd74412964e5ce350b6cd76f1485534e18a Mon Sep 17 00:00:00 2001 From: Raibipasha-24 Date: Sun, 23 Nov 2025 02:10:18 +0530 Subject: [PATCH] Add function property calc() and creating function map of maxWidth --- .../src/main/java/org/owasp/html/CssSchema.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/owasp-java-html-sanitizer/src/main/java/org/owasp/html/CssSchema.java b/owasp-java-html-sanitizer/src/main/java/org/owasp/html/CssSchema.java index edb1c054..50331674 100644 --- a/owasp-java-html-sanitizer/src/main/java/org/owasp/html/CssSchema.java +++ b/owasp-java-html-sanitizer/src/main/java/org/owasp/html/CssSchema.java @@ -355,6 +355,9 @@ Property forKey(String propertyName) { Set bottomLiterals0 = j8().setOf("auto", "inherit"); Set boxShadowLiterals0 = j8().setOf( ",", "inset", "none"); + + Map maxWidthFunctions = j8().mapOfEntries(j8().mapEntry("calc(", "calc()")); + Set clearLiterals0 = j8().setOf( "both", "inherit", "none"); Map clipFunctions = @@ -668,6 +671,8 @@ Property forKey(String propertyName) { builder.put("margin", margin); Property maxHeight = new Property(1, maxHeightLiterals0, zeroFns); builder.put("max-height", maxHeight); + Property maxWidth = new Property(1, maxHeightLiterals0, maxWidthFunctions); + builder.put("max-width", maxWidth); Property opacity = new Property(1, mozOpacityLiterals0, zeroFns); builder.put("opacity", opacity); builder.put("overflow", new Property(0, overflowLiterals0, zeroFns)); @@ -757,6 +762,8 @@ Property forKey(String propertyName) { builder.put("rgba()", rgb$Fun); builder.put("hsl()", rgb$Fun); builder.put("hsla()", rgb$Fun); + Property calc$Fun = new Property(1, j8().setOf(), zeroFns); + builder.put("calc()", calc$Fun); @SuppressWarnings("unchecked") Property image$Fun = new Property( 18, union(mozOutlineLiterals0, rgb$FunLiterals0), mozOutlineFunctions); @@ -976,6 +983,7 @@ private static Set union(Set... subsets) { "rgba()", "hsl()", "hsla()", + "calc()", "richness", "speak", "speak-header",