private void Pop() { InternalDebug.Assert(outputStackTop != 0); if (outputStackTop != 0) { #if DEBUG if (formatOutputTraceWriter != null) { formatOutputTraceWriter.WriteLine("{0}{1} Pop {2}", Indent(outputStackTop), outputStackTop, currentOutputLevel.node.NodeType.ToString()); formatOutputTraceWriter.Flush(); } #endif currentOutputLevel.node.ResetOnLeftEdge(); propertyState.UndoProperties(currentOutputLevel.propertyUndoLevel); currentOutputLevel = outputStack[--outputStackTop]; #if DEBUG if (formatOutputTraceWriter != null) { formatOutputTraceWriter.Flush(); } #endif } }
private void Push(FormatNode node) { if (outputStack == null) { InternalDebug.Assert(outputStackTop == 0 && formatStore != null); outputStack = new OutputStackEntry[32]; } else if (outputStackTop == outputStack.Length) { if (outputStackTop >= HtmlSupport.HtmlNestingLimit) { throw new TextConvertersException(Strings.InputDocumentTooComplex); } var newOutputStack = new OutputStackEntry[outputStack.Length * 2]; Array.Copy(outputStack, 0, newOutputStack, 0, outputStackTop); outputStack = newOutputStack; } #if DEBUG if (formatOutputTraceWriter != null) { formatOutputTraceWriter.WriteLine("{0}{1} Push {2}", Indent(outputStackTop), outputStackTop, node.NodeType.ToString()); formatOutputTraceWriter.Flush(); } #endif outputStack[outputStackTop++] = currentOutputLevel; currentOutputLevel.node = node; currentOutputLevel.state = OutputState.NotStarted; currentOutputLevel.index = currentOutputLevel.childIndex; currentOutputLevel.childIndex = 0; currentOutputLevel.propertyUndoLevel = propertyState.ApplyProperties(node.FlagProperties, node.Properties, FormatStoreData.GlobalInheritanceMasks[node.InheritanceMaskIndex].flagProperties, FormatStoreData.GlobalInheritanceMasks[node.InheritanceMaskIndex].propertyMask); #if DEBUG if (formatOutputTraceWriter != null) { formatOutputTraceWriter.WriteLine("{0}{1} Props After {2}", Indent(outputStackTop), outputStackTop, propertyState.ToString()); formatOutputTraceWriter.Flush(); } #endif node.SetOnLeftEdge(); }