Skip to content

Commit 7637ac7

Browse files
committed
Chrome/Edge 135, FF137: Setter validation for length style properties adjusted
1 parent a1efe78 commit 7637ac7

File tree

11 files changed

+104
-90
lines changed

11 files changed

+104
-90
lines changed

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
<body>
1010
<release version="4.12.0" date="April xx, 2025" description="Chrome/Edge 135, Firefox 137, Rhino RegExp, Bugfixes">
11+
<action type="update" dev="rbri">
12+
Chrome/Edge 135, FF137: Setter validation for length style properties adjusted.
13+
</action>
1114
<action type="add" dev="rbri">
1215
Chrome/Edge 135: Style properties 'interactivity', 'overflowBlock', 'overflowInline', and 'scrollMarkerGroup' added.
1316
</action>

src/main/java/org/htmlunit/BrowserVersionFeatures.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ public enum BrowserVersionFeatures {
420420
@BrowserFeature({FF, FF_ESR})
421421
JS_STORAGE_PRESERVED_INCLUDED,
422422

423+
/** Indicates letterSpacing support percent values. */
424+
@BrowserFeature(FF)
425+
JS_STYLE_LETTER_SPACING_ACCEPTS_PERCENT,
426+
423427
/** Indicates wordSpacing support percent values. */
424428
@BrowserFeature({FF, FF_ESR})
425429
JS_STYLE_WORD_SPACING_ACCEPTS_PERCENT,

src/main/java/org/htmlunit/css/StyleAttributes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,7 @@ public enum Definition {
14261426
HYPHENATE_CHARACTER_("hyphenate-character", "hyphenate-character", ff("auto")),
14271427

14281428
/** The style property {@code hyphenateLimitChars}. */
1429-
HYPHENATE_LIMIT_CHAR("hyphenateLimitChars", "hyphenate-limit-char", chromeAndEdgeAuto()),
1429+
HYPHENATE_LIMIT_CHAR("hyphenateLimitChars", "hyphenate-limit-char", chromeAndEdgeAuto(), ffLatest("auto")),
14301430

14311431
/** The style property {@code hyphens}. */
14321432
HYPHENS("hyphens", "hyphens", ff("manual"), chromeAndEdge("manual")),

src/main/java/org/htmlunit/javascript/host/css/CSSStyleDeclaration.java

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.htmlunit.javascript.host.css;
1616

1717
import static org.htmlunit.BrowserVersionFeatures.CSS_BACKGROUND_INITIAL;
18+
import static org.htmlunit.BrowserVersionFeatures.JS_STYLE_LETTER_SPACING_ACCEPTS_PERCENT;
1819
import static org.htmlunit.BrowserVersionFeatures.JS_STYLE_WORD_SPACING_ACCEPTS_PERCENT;
1920
import static org.htmlunit.css.CssStyleSheet.ABSOLUTE;
2021
import static org.htmlunit.css.CssStyleSheet.AUTO;
@@ -400,7 +401,7 @@ public String getBorderBottomWidth() {
400401
@JsxSetter
401402
public void setBorderBottomWidth(final Object borderBottomWidth) {
402403
setStyleLengthAttribute(Definition.BORDER_BOTTOM_WIDTH.getAttributeName(), borderBottomWidth, "",
403-
false, false, false, null);
404+
false, false, true, null);
404405
}
405406

406407
/**
@@ -464,7 +465,7 @@ public String getBorderLeftWidth() {
464465
@JsxSetter
465466
public void setBorderLeftWidth(final Object borderLeftWidth) {
466467
setStyleLengthAttribute(Definition.BORDER_LEFT_WIDTH.getAttributeName(), borderLeftWidth, "",
467-
false, false, false, null);
468+
false, false, true, null);
468469
}
469470

470471
/**
@@ -528,7 +529,7 @@ public String getBorderRightWidth() {
528529
@JsxSetter
529530
public void setBorderRightWidth(final Object borderRightWidth) {
530531
setStyleLengthAttribute(Definition.BORDER_RIGHT_WIDTH.getAttributeName(), borderRightWidth, "",
531-
false, false, false, null);
532+
false, false, true, null);
532533
}
533534

534535
/**
@@ -613,7 +614,7 @@ public String getBorderTopWidth() {
613614
@JsxSetter
614615
public void setBorderTopWidth(final Object borderTopWidth) {
615616
setStyleLengthAttribute(Definition.BORDER_TOP_WIDTH.getAttributeName(), borderTopWidth, "",
616-
false, false, false, null);
617+
false, false, true, null);
617618
}
618619

619620
/**
@@ -634,7 +635,7 @@ public String getBottom() {
634635
*/
635636
@JsxSetter
636637
public void setBottom(final Object bottom) {
637-
setStyleLengthAttribute(Definition.BOTTOM.getAttributeName(), bottom, "", true, true, false, null);
638+
setStyleLengthAttribute(Definition.BOTTOM.getAttributeName(), bottom, "", true, true, true, null);
638639
}
639640

640641
/**
@@ -744,7 +745,7 @@ public String getFontSize() {
744745
*/
745746
@JsxSetter
746747
public void setFontSize(final Object fontSize) {
747-
setStyleLengthAttribute(Definition.FONT_SIZE.getAttributeName(), fontSize, "", false, true, false, FONT_SIZES);
748+
setStyleLengthAttribute(Definition.FONT_SIZE.getAttributeName(), fontSize, "", false, true, true, FONT_SIZES);
748749
updateFont(getFont(), false);
749750
}
750751

@@ -867,7 +868,7 @@ public String getHeight() {
867868
*/
868869
@JsxSetter
869870
public void setHeight(final Object height) {
870-
setStyleLengthAttribute(Definition.HEIGHT.getAttributeName(), height, "", true, true, false, null);
871+
setStyleLengthAttribute(Definition.HEIGHT.getAttributeName(), height, "", true, true, true, null);
871872
}
872873

873874
/**
@@ -888,7 +889,7 @@ public String getLeft() {
888889
*/
889890
@JsxSetter
890891
public void setLeft(final Object left) {
891-
setStyleLengthAttribute(Definition.LEFT.getAttributeName(), left, "", true, true, false, null);
892+
setStyleLengthAttribute(Definition.LEFT.getAttributeName(), left, "", true, true, true, null);
892893
}
893894

894895
/**
@@ -944,7 +945,7 @@ public String getLetterSpacing() {
944945
@JsxSetter
945946
public void setLetterSpacing(final Object letterSpacing) {
946947
setStyleLengthAttribute(Definition.LETTER_SPACING.getAttributeName(), letterSpacing, "",
947-
false, false, false, null);
948+
false, getBrowserVersion().hasFeature(JS_STYLE_LETTER_SPACING_ACCEPTS_PERCENT), true, null);
948949
}
949950

950951
/**
@@ -986,7 +987,7 @@ public String getMarginBottom() {
986987
*/
987988
@JsxSetter
988989
public void setMarginBottom(final Object marginBottom) {
989-
setStyleLengthAttribute(Definition.MARGIN_BOTTOM.getAttributeName(), marginBottom, "", true, true, false, null);
990+
setStyleLengthAttribute(Definition.MARGIN_BOTTOM.getAttributeName(), marginBottom, "", true, true, true, null);
990991
}
991992

992993
/**
@@ -1007,7 +1008,7 @@ public String getMarginLeft() {
10071008
*/
10081009
@JsxSetter
10091010
public void setMarginLeft(final Object marginLeft) {
1010-
setStyleLengthAttribute(Definition.MARGIN_LEFT.getAttributeName(), marginLeft, "", true, true, false, null);
1011+
setStyleLengthAttribute(Definition.MARGIN_LEFT.getAttributeName(), marginLeft, "", true, true, true, null);
10111012
}
10121013

10131014
/**
@@ -1028,7 +1029,7 @@ public String getMarginRight() {
10281029
*/
10291030
@JsxSetter
10301031
public void setMarginRight(final Object marginRight) {
1031-
setStyleLengthAttribute(Definition.MARGIN_RIGHT.getAttributeName(), marginRight, "", true, true, false, null);
1032+
setStyleLengthAttribute(Definition.MARGIN_RIGHT.getAttributeName(), marginRight, "", true, true, true, null);
10321033
}
10331034

10341035
/**
@@ -1049,7 +1050,7 @@ public String getMarginTop() {
10491050
*/
10501051
@JsxSetter
10511052
public void setMarginTop(final Object marginTop) {
1052-
setStyleLengthAttribute(Definition.MARGIN_TOP.getAttributeName(), marginTop, "", true, true, false, null);
1053+
setStyleLengthAttribute(Definition.MARGIN_TOP.getAttributeName(), marginTop, "", true, true, true, null);
10531054
}
10541055

10551056
/**
@@ -1070,7 +1071,7 @@ public String getMaxHeight() {
10701071
*/
10711072
@JsxSetter
10721073
public void setMaxHeight(final Object maxHeight) {
1073-
setStyleLengthAttribute(Definition.MAX_HEIGHT.getAttributeName(), maxHeight, "", false, true, false, null);
1074+
setStyleLengthAttribute(Definition.MAX_HEIGHT.getAttributeName(), maxHeight, "", false, true, true, null);
10741075
}
10751076

10761077
/**
@@ -1091,7 +1092,7 @@ public String getMaxWidth() {
10911092
*/
10921093
@JsxSetter
10931094
public void setMaxWidth(final Object maxWidth) {
1094-
setStyleLengthAttribute(Definition.MAX_WIDTH.getAttributeName(), maxWidth, "", false, true, false, null);
1095+
setStyleLengthAttribute(Definition.MAX_WIDTH.getAttributeName(), maxWidth, "", false, true, true, null);
10951096
}
10961097

10971098
/**
@@ -1112,7 +1113,7 @@ public String getMinHeight() {
11121113
*/
11131114
@JsxSetter
11141115
public void setMinHeight(final Object minHeight) {
1115-
setStyleLengthAttribute(Definition.MIN_HEIGHT.getAttributeName(), minHeight, "", true, true, false, null);
1116+
setStyleLengthAttribute(Definition.MIN_HEIGHT.getAttributeName(), minHeight, "", true, true, true, null);
11161117
}
11171118

11181119
/**
@@ -1133,7 +1134,7 @@ public String getMinWidth() {
11331134
*/
11341135
@JsxSetter
11351136
public void setMinWidth(final Object minWidth) {
1136-
setStyleLengthAttribute(Definition.MIN_WIDTH.getAttributeName(), minWidth, "", true, true, false, null);
1137+
setStyleLengthAttribute(Definition.MIN_WIDTH.getAttributeName(), minWidth, "", true, true, true, null);
11371138
}
11381139

11391140
/**
@@ -1405,7 +1406,7 @@ public String getPaddingBottom() {
14051406
@JsxSetter
14061407
public void setPaddingBottom(final Object paddingBottom) {
14071408
setStyleLengthAttribute(Definition.PADDING_BOTTOM.getAttributeName(),
1408-
paddingBottom, "", false, true, false, null);
1409+
paddingBottom, "", false, true, true, null);
14091410
}
14101411

14111412
/**
@@ -1426,7 +1427,7 @@ public String getPaddingLeft() {
14261427
*/
14271428
@JsxSetter
14281429
public void setPaddingLeft(final Object paddingLeft) {
1429-
setStyleLengthAttribute(Definition.PADDING_LEFT.getAttributeName(), paddingLeft, "", false, true, false, null);
1430+
setStyleLengthAttribute(Definition.PADDING_LEFT.getAttributeName(), paddingLeft, "", false, true, true, null);
14301431
}
14311432

14321433
/**
@@ -1448,7 +1449,7 @@ public String getPaddingRight() {
14481449
@JsxSetter
14491450
public void setPaddingRight(final Object paddingRight) {
14501451
setStyleLengthAttribute(Definition.PADDING_RIGHT.getAttributeName(),
1451-
paddingRight, "", false, true, false, null);
1452+
paddingRight, "", false, true, true, null);
14521453
}
14531454

14541455
/**
@@ -1469,7 +1470,7 @@ public String getPaddingTop() {
14691470
*/
14701471
@JsxSetter
14711472
public void setPaddingTop(final Object paddingTop) {
1472-
setStyleLengthAttribute(Definition.PADDING_TOP.getAttributeName(), paddingTop, "", false, true, false, null);
1473+
setStyleLengthAttribute(Definition.PADDING_TOP.getAttributeName(), paddingTop, "", false, true, true, null);
14731474
}
14741475

14751476
/**
@@ -1514,7 +1515,7 @@ public String getRight() {
15141515
*/
15151516
@JsxSetter
15161517
public void setRight(final Object right) {
1517-
setStyleLengthAttribute(Definition.RIGHT.getAttributeName(), right, "", true, true, false, null);
1518+
setStyleLengthAttribute(Definition.RIGHT.getAttributeName(), right, "", true, true, true, null);
15181519
}
15191520

15201521
/**
@@ -1577,7 +1578,7 @@ public String getTextIndent() {
15771578
*/
15781579
@JsxSetter
15791580
public void setTextIndent(final Object textIndent) {
1580-
setStyleLengthAttribute(Definition.TEXT_INDENT.getAttributeName(), textIndent, "", false, true, false, null);
1581+
setStyleLengthAttribute(Definition.TEXT_INDENT.getAttributeName(), textIndent, "", false, true, true, null);
15811582
}
15821583

15831584
/**
@@ -1598,7 +1599,7 @@ public String getTop() {
15981599
*/
15991600
@JsxSetter
16001601
public void setTop(final Object top) {
1601-
setStyleLengthAttribute(Definition.TOP.getAttributeName(), top, "", true, true, false, null);
1602+
setStyleLengthAttribute(Definition.TOP.getAttributeName(), top, "", true, true, true, null);
16021603
}
16031604

16041605
/**
@@ -1620,7 +1621,7 @@ public String getVerticalAlign() {
16201621
@JsxSetter
16211622
public void setVerticalAlign(final Object verticalAlign) {
16221623
setStyleLengthAttribute(Definition.VERTICAL_ALIGN.getAttributeName(),
1623-
verticalAlign, "", false, true, false, ALIGN_KEYWORDS);
1624+
verticalAlign, "", false, true, true, ALIGN_KEYWORDS);
16241625
}
16251626

16261627
/**
@@ -1641,7 +1642,7 @@ public String getWidth() {
16411642
*/
16421643
@JsxSetter
16431644
public void setWidth(final Object width) {
1644-
setStyleLengthAttribute(Definition.WIDTH.getAttributeName(), width, "", true, true, false, null);
1645+
setStyleLengthAttribute(Definition.WIDTH.getAttributeName(), width, "", true, true, true, null);
16451646
}
16461647

16471648
/**
@@ -1750,7 +1751,7 @@ public String getWordSpacing() {
17501751
@JsxSetter
17511752
public void setWordSpacing(final Object wordSpacing) {
17521753
setStyleLengthAttribute(Definition.WORD_SPACING.getAttributeName(), wordSpacing, "",
1753-
false, getBrowserVersion().hasFeature(JS_STYLE_WORD_SPACING_ACCEPTS_PERCENT), false, null);
1754+
false, getBrowserVersion().hasFeature(JS_STYLE_WORD_SPACING_ACCEPTS_PERCENT), true, null);
17541755
}
17551756

17561757
/**

0 commit comments

Comments
 (0)