Skip to content

Commit 84bb5e8

Browse files
committed
more compact end condition
1 parent 50fae44 commit 84bb5e8

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

org/w3c/css/properties/css3/CssScrollPadding.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public CssScrollPadding(ApplContext ac, CssExpression expression, boolean check)
6262
_longhand_left = new CssScrollPaddingLeft();
6363

6464

65-
for (int i = 0; i < 4; i++) {
65+
for (int i = 0; i < 4 && !expression.end(); i++) {
6666
val = expression.getValue();
6767
op = expression.getOperator();
6868

@@ -113,10 +113,6 @@ public CssScrollPadding(ApplContext ac, CssExpression expression, boolean check)
113113
getPropertyName(), ac);
114114
}
115115
expression.next();
116-
if (expression.end()) {
117-
// get out of the loop when end is reached prematurely
118-
break;
119-
}
120116
}
121117
value = (values.size() == 1) ? values.get(0) : new CssValueList(values);
122118
}

org/w3c/css/properties/css3/CssScrollSnapMargin.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public CssScrollSnapMargin(ApplContext ac, CssExpression expression, boolean che
6060
_longhand_right = new CssScrollSnapMarginRight();
6161
_longhand_top = new CssScrollSnapMarginTop();
6262

63-
for (int i = 0; i < 4; i++) {
63+
for (int i = 0; i < 4 && !expression.end(); i++) {
6464
val = expression.getValue();
6565
op = expression.getOperator();
6666

@@ -110,10 +110,6 @@ public CssScrollSnapMargin(ApplContext ac, CssExpression expression, boolean che
110110
getPropertyName(), ac);
111111
}
112112
expression.next();
113-
if (expression.end()) {
114-
// get out of the loop when end is reached prematurely
115-
break;
116-
}
117113
}
118114
value = (values.size() == 1) ? values.get(0) : new CssValueList(values);
119115
}

0 commit comments

Comments
 (0)