8318112: CSS percentage values are capped at 100%

Reviewed-by: tr, prr
This commit is contained in:
Prasanta Sadhukhan 2024-01-17 02:28:36 +00:00
parent 2063bb8ffa
commit f70667ea68
2 changed files with 4 additions and 3 deletions

View File

@ -2627,7 +2627,7 @@ public class CSS implements Serializable {
case 1: case 1:
// % // %
lv = new LengthValue(); lv = new LengthValue();
lv.span = Math.max(0, Math.min(1, lu.value)); lv.span = Math.max(0, lu.value);
lv.percentage = true; lv.percentage = true;
break; break;
default: default:

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ import javax.swing.text.html.StyleSheet;
/* /*
* @test * @test
* @bug 7083187 8318113 * @bug 7083187 8318113 8318112
* @summary Verifies if CSS.CSSValue attribute is same * @summary Verifies if CSS.CSSValue attribute is same
* @run main CSSAttributeEqualityBug * @run main CSSAttributeEqualityBug
*/ */
@ -91,6 +91,7 @@ public class CSSAttributeEqualityBug {
{"margin-top: 100%", "margin-top: 50%"}, {"margin-top: 100%", "margin-top: 50%"},
{"background-image: none", "background-image: url(image.png)"}, {"background-image: none", "background-image: url(image.png)"},
{"width: 100%", "width: 200 %"},
}; };
private static final String[][] EQUALS_WITH_SPACE = { private static final String[][] EQUALS_WITH_SPACE = {