示例#1
0
        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();
        }
示例#2
0
 private void Push(FormatNode node)
 {
     if (this.outputStack == null)
     {
         this.outputStack = new FormatOutput.OutputStackEntry[32];
     }
     else if (this.outputStackTop == this.outputStack.Length)
     {
         if (this.outputStackTop >= 4096)
         {
             throw new TextConvertersException(TextConvertersStrings.InputDocumentTooComplex);
         }
         FormatOutput.OutputStackEntry[] destinationArray = new FormatOutput.OutputStackEntry[this.outputStack.Length * 2];
         Array.Copy(this.outputStack, 0, destinationArray, 0, this.outputStackTop);
         this.outputStack = destinationArray;
     }
     this.outputStack[this.outputStackTop++]   = this.currentOutputLevel;
     this.currentOutputLevel.Node              = node;
     this.currentOutputLevel.State             = FormatOutput.OutputState.NotStarted;
     this.currentOutputLevel.Index             = this.currentOutputLevel.ChildIndex;
     this.currentOutputLevel.ChildIndex        = 0;
     this.currentOutputLevel.PropertyUndoLevel = this.propertyState.ApplyProperties(node.FlagProperties, node.Properties, FormatStoreData.GlobalInheritanceMasks[node.InheritanceMaskIndex].FlagProperties, FormatStoreData.GlobalInheritanceMasks[node.InheritanceMaskIndex].PropertyMask);
     node.SetOnLeftEdge();
 }