changeset 5030:5bd907a630b0

RT-32229: track resolves always
author David Grieve<david.grieve@oracle.com>
date Mon, 16 Sep 2013 15:03:40 -0400
parents e7c8e1ec0e84
children dbbbd1dbfa4a
files modules/graphics/src/main/java/javafx/scene/CssStyleHelper.java
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/javafx/scene/CssStyleHelper.java	Mon Sep 16 15:03:38 2013 -0400
+++ b/modules/graphics/src/main/java/javafx/scene/CssStyleHelper.java	Mon Sep 16 15:03:40 2013 -0400
@@ -1132,24 +1132,18 @@
 
                 if (resolved != null) {
 
-                    if (resolves != null ) {
+                    if (resolves.contains(resolved.getParsedValueImpl())) {
 
-                        if (resolves.contains(resolved.getParsedValueImpl())) {
-
-                            if (LOGGER.isLoggable(Level.WARNING)) {
-                                LOGGER.warning("Loop detected in " + resolved.getRule().toString() + " while resolving '" + sval + "'");
-                            }
-                            throw new IllegalArgumentException("Loop detected in " + resolved.getRule().toString() + " while resolving '" + sval + "'");
-
-                        } else {
-                            resolves.add(parsedValue);
+                        if (LOGGER.isLoggable(Level.WARNING)) {
+                            LOGGER.warning("Loop detected in " + resolved.getRule().toString() + " while resolving '" + sval + "'");
                         }
+                        throw new IllegalArgumentException("Loop detected in " + resolved.getRule().toString() + " while resolving '" + sval + "'");
 
                     } else {
-                        resolves = new HashSet<>();
                         resolves.add(parsedValue);
                     }
 
+
                     if (styleList != null) {
                         final Style style = resolved.getStyle();
                         if (style != null && !styleList.contains(style)) {
@@ -1192,6 +1186,7 @@
         final Object val = parsedValue.getValue();
 
         if (val instanceof ParsedValueImpl[][]) {
+
             // If ParsedValueImpl is a layered sequence of values, resolve the lookups for each.
             final ParsedValueImpl[][] layers = (ParsedValueImpl[][])val;
             ParsedValueImpl[][] resolved = new ParsedValueImpl[layers.length][0];
@@ -1200,22 +1195,27 @@
                 for (int ll=0; ll<layers[l].length; ll++) {
                     if (layers[l][ll] == null) continue;
                     resolved[l][ll] =
-                        resolveLookups(styleable, layers[l][ll], styleMap, states, whence, null, styleList);
+                        resolveLookups(styleable, layers[l][ll], styleMap, states, whence, resolves, styleList);
                 }
             }
 
+            resolves.clear();
+
             return new ParsedValueImpl(resolved, parsedValue.getConverter(), false);
 
         } else if (val instanceof ParsedValueImpl[]) {
-        // If ParsedValueImpl is a sequence of values, resolve the lookups for each.
+
+            // If ParsedValueImpl is a sequence of values, resolve the lookups for each.
             final ParsedValueImpl[] layer = (ParsedValueImpl[])val;
             ParsedValueImpl[] resolved = new ParsedValueImpl[layer.length];
             for (int l=0; l<layer.length; l++) {
                 if (layer[l] == null) continue;
                 resolved[l] =
-                    resolveLookups(styleable, layer[l], styleMap, states, whence, null, styleList);
+                    resolveLookups(styleable, layer[l], styleMap, states, whence, resolves, styleList);
             }
 
+            resolves.clear();
+
             return new ParsedValueImpl(resolved, parsedValue.getConverter(), false);
 
         }
@@ -1326,7 +1326,7 @@
             try {
 
                 ObjectProperty<StyleOrigin> whence = new SimpleObjectProperty<StyleOrigin>(style.getOrigin());
-                resolved = resolveLookups(styleable, cssValue, styleMap, states, whence, null, styleList);
+                resolved = resolveLookups(styleable, cssValue, styleMap, states, whence, new HashSet<>(), styleList);
 
                 final String property = cssMetaData.getProperty();