diff options
author | Henri Sara <hesara@vaadin.com> | 2012-11-26 12:36:46 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2012-11-26 12:37:37 +0200 |
commit | 78bfb5cb1cc72164e73cf7919501fa22ba05445d (patch) | |
tree | 8e0eec4e643a9d691146b56c92797c090463bdd7 /theme-compiler/src | |
parent | b010b21a15dfd47790255e36122d3b30682d4990 (diff) | |
download | vaadin-framework-78bfb5cb1cc72164e73cf7919501fa22ba05445d.tar.gz vaadin-framework-78bfb5cb1cc72164e73cf7919501fa22ba05445d.zip |
Keep block order when unnesting (#10309)
Change-Id: I5a7e6b74a55176799e85c943a128d9aab0db0876
Diffstat (limited to 'theme-compiler/src')
-rw-r--r-- | theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java | 7 | ||||
-rw-r--r-- | theme-compiler/src/com/vaadin/sass/internal/visitor/BlockNodeHandler.java | 13 |
2 files changed, 13 insertions, 7 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java index af061d8e95..2a5d617a6b 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java +++ b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java @@ -235,9 +235,14 @@ public class ScssStylesheet extends Node { variables.clear(); variables.putAll(variableScope); + // clean up insert point so that processing of the next block will + // insert after that block + lastNodeAdded.remove(originalParent); + // has the node been removed from its parent? if (originalParent != null) { - return !originalParent.getChildren().contains(node); + boolean removed = !originalParent.getChildren().contains(node); + return removed; } else { return false; } diff --git a/theme-compiler/src/com/vaadin/sass/internal/visitor/BlockNodeHandler.java b/theme-compiler/src/com/vaadin/sass/internal/visitor/BlockNodeHandler.java index cb736ba558..fc34e32f7a 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/visitor/BlockNodeHandler.java +++ b/theme-compiler/src/com/vaadin/sass/internal/visitor/BlockNodeHandler.java @@ -98,14 +98,15 @@ public class BlockNodeHandler { } node.setSelectorList(newList); Node oldParent = node.getParentNode(); + HashMap<Node, Node> lastNodeAdded = ScssStylesheet.getLastNodeAdded(); - if (lastNodeAdded.get(oldParent) != null) { - oldParent.getParentNode().appendChild(node, - lastNodeAdded.get(oldParent)); - } else { - oldParent.getParentNode().appendChild(node, oldParent); + Node lastAdded = lastNodeAdded.get(oldParent.getParentNode()); + if (lastAdded == null) { + lastAdded = oldParent; } - lastNodeAdded.put(oldParent, node); + oldParent.getParentNode().appendChild(node, lastAdded); + + lastNodeAdded.put(oldParent.getParentNode(), node); } } |