Skip to content

Commit

Permalink
#649 Fix build - background shorthand property
Browse files Browse the repository at this point in the history
must be kept in sync.
  • Loading branch information
danfickle committed Feb 12, 2021
1 parent 22ad732 commit a27b3a1
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package com.openhtmltopdf.css.parser.property;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.openhtmltopdf.css.constants.CSSName;
Expand Down Expand Up @@ -118,11 +119,13 @@ public List<PropertyDeclaration> buildDeclarations(
if (backgroundImage != null) {
throw new CSSParseException("A background-image value cannot be set twice", -1);
}


List<PropertyValue> bgImages = Collections.singletonList(value);

backgroundImage = new PropertyDeclaration(
CSSName.BACKGROUND_IMAGE, value, important, origin);
CSSName.BACKGROUND_IMAGE, new PropertyValue(bgImages), important, origin);
}

if (PrimitivePropertyBuilders.BACKGROUND_POSITIONS.get(ident.FS_ID)) {
processingBackgroundPosition = true;
}
Expand All @@ -137,9 +140,11 @@ public List<PropertyDeclaration> buildDeclarations(
if (backgroundImage != null) {
throw new CSSParseException("A background-image value cannot be set twice", -1);
}


List<PropertyValue> bgImages = Collections.singletonList(value);

backgroundImage = new PropertyDeclaration(
CSSName.BACKGROUND_IMAGE, value, important, origin);
CSSName.BACKGROUND_IMAGE, new PropertyValue(bgImages), important, origin);
}

if (processingBackgroundPosition || isLength(value) || type == CSSPrimitiveValue.CSS_PERCENTAGE) {
Expand Down Expand Up @@ -169,8 +174,10 @@ public List<PropertyDeclaration> buildDeclarations(
}

if (backgroundImage == null) {
List<PropertyValue> bgImages = Collections.singletonList(new PropertyValue(IdentValue.NONE));

backgroundImage = new PropertyDeclaration(
CSSName.BACKGROUND_IMAGE, new PropertyValue(IdentValue.NONE), important, origin);
CSSName.BACKGROUND_IMAGE, new PropertyValue(bgImages), important, origin);
}

if (backgroundRepeat == null) {
Expand Down

0 comments on commit a27b3a1

Please sign in to comment.