diff options
author | AJ <M-AJ@users.noreply.github.com> | 2018-01-31 05:09:45 -0800 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-02-06 13:33:14 +0200 |
commit | 09b74f0e1a5913f24d8e4c8db7e04e14a7cbd36f (patch) | |
tree | e076f84174208c81de54df662ec6abef668d4c92 | |
parent | b4b8279854bdef776a56e7d03d3f82d5815b0e04 (diff) | |
download | vaadin-framework-09b74f0e1a5913f24d8e4c8db7e04e14a7cbd36f.tar.gz vaadin-framework-09b74f0e1a5913f24d8e4c8db7e04e14a7cbd36f.zip |
Optimize style theme duplicates (#10534)
-rw-r--r-- | server/src/main/java/com/vaadin/ui/AbstractComponent.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index 89dd61986a..86d99af32a 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -30,6 +30,8 @@ import java.util.Objects; import java.util.Set; import java.util.StringTokenizer; +import com.vaadin.annotations.Theme; +import com.vaadin.ui.themes.ValoTheme; import org.jsoup.nodes.Attribute; import org.jsoup.nodes.Attributes; import org.jsoup.nodes.Element; @@ -224,6 +226,9 @@ public abstract class AbstractComponent extends AbstractClientConnector if (style == null || style.isEmpty()) { return; } + if (getState().styles != null && getState().styles.contains(style)) { + return; + } if (style.contains(" ")) { // Split space separated style names and add them one by one. StringTokenizer tokenizer = new StringTokenizer(style, " "); @@ -237,9 +242,7 @@ public abstract class AbstractComponent extends AbstractClientConnector getState().styles = new ArrayList<>(); } List<String> styles = getState().styles; - if (!styles.contains(style)) { - styles.add(style); - } + styles.add(style); } @Override |