private void appendBodySortDeclarations(Body node) { // this is sort of hack, bypass the usual append method appendComments(node.getOpeningComments(), true); if (!isCompressing()) cssOnly.ensureSeparator(); append(node.getOpeningCurlyBrace()); if (!isCompressing()) cssOnly.ensureNewLine().increaseIndentationLevel(); Iterator<ASTCssNode> declarations = node.getDeclarations().iterator(); List<ASTCssNode> notDeclarations = node.getNotDeclarations(); while (declarations.hasNext()) { ASTCssNode declaration = declarations.next(); append(declaration); if (!isCompressing() && (declarations.hasNext() || notDeclarations.isEmpty())) cssOnly.ensureNewLine(); } appendAll(notDeclarations); appendComments(node.getOrphanComments(), false); if (!isCompressing()) cssOnly.decreaseIndentationLevel(); append(node.getClosingCurlyBrace()); // this is sort of hack, bypass the usual append method appendComments(node.getTrailingComments(), false); }
private boolean appendBodyOptimizeDuplicates(Body body) { if (body.isEmpty()) return false; if (!isCompressing()) cssOnly.ensureSeparator(); append(body.getOpeningCurlyBrace()); if (!isCompressing()) cssOnly.ensureNewLine().increaseIndentationLevel(); Iterable<CssPrinter> declarationsBuilders = collectUniqueBodyMembersStrings(body); for (CssPrinter miniBuilder : declarationsBuilders) { append(miniBuilder); } appendComments(body.getOrphanComments(), false); cssOnly.decreaseIndentationLevel(); append(body.getClosingCurlyBrace()); return true; }