boolean containsAppend = false;
// while siblings are assignments, starting with the current one
for(IDomNode aeNode = node; aeNode != null && includeInSequence(aeNode); aeNode = aeNode.getNextSibling()) {
DelegatingLayoutContext innerContext = new DelegatingLayoutContext(context, availableWidth);
TextFlow measuredFlow = new TextFlow(innerContext);
// iterate to format the LHS expression and measure, and find the = sign (which gets padded)
Iterator<IDomNode> itor = aeNode.treeIterator();
while(itor.hasNext()) {
IDomNode n = itor.next();
// forward until assignment expression =, or +=
if(!(n.getGrammarElement() == theAssignmentExpression || n.getGrammarElement() == theAppendExpression))
continue;
// Measure assignment expression
feeder.sequence(n, measuredFlow, innerContext, new FirstLeafWithTextAndTheRest(), untilTheEnd);
// forward to = or += sign
while(itor.hasNext()) {
n = itor.next();
if(n.getGrammarElement() == theEqualSign || n.getGrammarElement() == thePlusEqualSign)
break;
}
if(n.getGrammarElement() == thePlusEqualSign)
containsAppend = true;
if(!itor.hasNext())
break; // WAT, nothing after the '=', give up on this assignment, try to align the others
// If assignment node already has a width, it was processed by a preceding assignment
// and we were done a long time ago...
//
WidthStyle widthStyle = n.getStyles().getStyle(WidthStyle.class, n);
if(widthStyle != null)
return false;
equalSignNodes.add(n);
// collect the width of the last selector entry's values
int lastLineWidth = measuredFlow.getWidthOfLastLine();
clusters.add(lastLineWidth);
widths.add(lastLineWidth);
break;
}
}