changeset 1375:385a5b779565

Backed out changeset 9a2b4524a317
author David Grieve<david.grieve@oracle.com>
date Wed, 27 Jun 2012 18:52:39 -0400
parents 9a2b4524a317
children d20976d5d10f
files javafx-ui-common/src/com/sun/javafx/css/StyleManager.java
diffstat 1 files changed, 12 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/css/StyleManager.java	Tue Jun 26 12:20:35 2012 -0400
+++ b/javafx-ui-common/src/com/sun/javafx/css/StyleManager.java	Wed Jun 27 18:52:39 2012 -0400
@@ -142,22 +142,15 @@
         
         if (scene == null) return;
 
-        final StylesheetContainer container = 
-            (containerMap != null) 
-                ? get(containerMap, scene)
-                : null;
+        if (containerMap == null) {
+            containerMap = new HashMap<WeakReference<Scene>,StylesheetContainer>(); 
+        }
+        StylesheetContainer container = containerMap.get(scene);
+        if (container == null) {
+            container = new StylesheetContainer(null);
+            put(containerMap, scene, container);
+        }
         
-        if (container == null && defaultContainer == null) return;
-        
-        
-        boolean containerNeedsCleared = false;
-        final Map<String,Stylesheet> mapFromContainer = container != null
-                ? container.parentStylesheetMap : null;
-        
-        boolean defaultContainerNeedsCleared = false;
-        final Map<String,Stylesheet> mapFromDefaultContainer = defaultContainer != null
-                ? defaultContainer.parentStylesheetMap : null;
-
         while (c.next()) {
             
             List<String> list = null;
@@ -174,19 +167,12 @@
             // must have been a permutation. continue on to the next change.
             if (list == null) continue;
             
-            for (int n=0, nMax=list.size(); n<nMax; n++) {                
-                final String key = list.get(n);
-                if (mapFromContainer != null && mapFromContainer.remove(key) != null) {
-                    containerNeedsCleared = true;
-                }
-                if (mapFromDefaultContainer != null && mapFromDefaultContainer.remove(key) != null) {
-                    defaultContainerNeedsCleared = true;
-                }
+            for (int n=0, nMax=list.size(); n<nMax; n++) {
+                container.parentStylesheetMap.remove(list.get(n));
             }                
         }
         
-        if (containerNeedsCleared) container.clearCaches();        
-        if (defaultContainerNeedsCleared) defaultContainer.clearCaches();
+        container.clearCaches();        
     }
     /**
      * A map from Scene => StylesheetContainer. This provides us a way to find
@@ -903,7 +889,7 @@
         * added to the authorStylesheetMap because we don't want the scene's
         * list of stylesheets in the container to be updated.
         */
-        private Map<String,Stylesheet> parentStylesheetMap =
+        private static Map<String,Stylesheet> parentStylesheetMap =
                 new HashMap<String,Stylesheet>();
 
         /**