changeset 1446:8b3da2148b1b

RT-21894: LabeledImpl needs to track the origin of the Labeled properites it does not mirror.
author David Grieve<david.grieve@oracle.com>
date Fri, 13 Jul 2012 13:15:20 -0400
parents d12adf6ea5d5
children d3c8bd0df966
files javafx-ui-common/src/com/sun/javafx/css/StyleHelper.java
diffstat 1 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/css/StyleHelper.java	Fri Jul 13 13:15:20 2012 -0400
+++ b/javafx-ui-common/src/com/sun/javafx/css/StyleHelper.java	Fri Jul 13 13:15:20 2012 -0400
@@ -852,19 +852,6 @@
 
                 calculatedValue = cacheEntry.get(property);
 
-                // RT-10522:
-                // If the user set the property and there is a style and
-                // the style came from the user agent stylesheet, then
-                // skip the value. A style from a user agent stylesheet should
-                // not override the user set style.
-                if (calculatedValue == SKIP
-                    || (   calculatedValue != null
-                        && calculatedValue.origin == Origin.USER_AGENT
-                        && isUserSetProperty(node, styleable)
-                       )
-                    ) {
-                    continue;
-                }
             }
 
             if (calculatedValue == null) {
@@ -882,8 +869,28 @@
 
             }
 
-            // If the CalculatedValue value is not SKIP then we will set it.
-            if (calculatedValue == SKIP) continue;
+            // RT-10522:
+            // If the user set the property and there is a style and
+            // the style came from the user agent stylesheet, then
+            // skip the value. A style from a user agent stylesheet should
+            // not override the user set style.
+            //
+            // RT-21894: the origin might be null if the calculatedValue 
+            // comes from reverting back to the initial value. In this case,
+            // make sure the initial value doesn't overwrite the user set value.
+            // Also moved this condition from the fastpath block to here since
+            // the check needs to be done on any calculated value, not just
+            // calculatedValues from cache
+            //
+            if (calculatedValue == SKIP
+                || (   calculatedValue != null
+                    && (   calculatedValue.origin == Origin.USER_AGENT
+                        || calculatedValue.origin == null) 
+                    && isUserSetProperty(node, styleable)
+                    )
+                ) {
+                continue;
+            }
             
                 final Object value = calculatedValue.value;
                 if (LOGGER.isLoggable(PlatformLogger.FINER)) {