public HtmlTagInstruction(FormatContainerType containerType, int defaultStyle, int inheritanceMaskIndex, HtmlAttributeInstruction[] attributeInstructions) { this.containerType = containerType; this.defaultStyle = defaultStyle; this.inheritanceMaskIndex = inheritanceMaskIndex; this.attributeInstructions = attributeInstructions; }
private int PushContainer(FormatContainerType type, bool empty, int inheritanceMaskIndex) { int buildStackTop = this.BuildStackTop; if (buildStackTop == this.BuildStack.Length) { if (this.BuildStack.Length >= 4096) { throw new TextConvertersException(TextConvertersStrings.InputDocumentTooComplex); } int num = (2048 > this.BuildStack.Length) ? (this.BuildStack.Length * 2) : 4096; FormatConverter.BuildStackEntry[] array = new FormatConverter.BuildStackEntry[num]; Array.Copy(this.BuildStack, 0, array, 0, this.BuildStackTop); this.BuildStack = array; } this.Store.SetTextBoundary(); this.BuildStack[buildStackTop].Type = type; this.BuildStack[buildStackTop].TagName = HtmlNameIndex._NOTANAME; this.BuildStack[buildStackTop].InheritanceMaskIndex = inheritanceMaskIndex; this.BuildStack[buildStackTop].TagIndex = HtmlTagIndex._NULL; this.BuildStack[buildStackTop].FlagProperties.ClearAll(); this.BuildStack[buildStackTop].PropertyMask.ClearAll(); this.BuildStack[buildStackTop].Properties = null; this.BuildStack[buildStackTop].Node = 0; if (!empty) { this.BuildStackTop++; } this.EmptyContainer = empty; this.ContainerFlushed = false; return(buildStackTop); }
protected FormatNode CreateNode(FormatContainerType type) { FormatNode result = this.Store.AllocateNode(type); result.EndTextPosition = result.BeginTextPosition; result.SetOutOfOrder(); return(result); }
public FormatConverterContainer OpenContainer(FormatContainerType nodeType, bool empty) { if (!this.ContainerFlushed) { this.FlushContainer(this.EmptyContainer ? this.BuildStackTop : (this.BuildStackTop - 1)); } if (this.EmptyContainer) { this.PrepareToCloseContainer(this.BuildStackTop); } int level = this.PushContainer(nodeType, empty, 1); return(new FormatConverterContainer(this, level)); }
protected void CloseContainer(FormatContainerType containerType) { if (!this.ContainerFlushed) { this.FlushContainer(this.EmptyContainer ? this.BuildStackTop : (this.BuildStackTop - 1)); } if (this.EmptyContainer) { this.PrepareToCloseContainer(this.BuildStackTop); } for (int i = this.BuildStackTop - 1; i > 0; i--) { if (this.BuildStack[i].Type == containerType) { this.PopContainer(i); return; } } }
public FormatConverterContainer OpenContainer(FormatContainerType nodeType, bool empty, int inheritanceMaskIndex, FormatStyle baseStyle, HtmlNameIndex tagName) { if (!this.ContainerFlushed) { this.FlushContainer(this.EmptyContainer ? this.BuildStackTop : (this.BuildStackTop - 1)); } if (this.EmptyContainer) { this.PrepareToCloseContainer(this.BuildStackTop); } int num = this.PushContainer(nodeType, empty, inheritanceMaskIndex); if (!baseStyle.IsNull) { baseStyle.AddRef(); this.ContainerStyleBuildHelper.AddStyle(10, baseStyle.Handle); } this.BuildStack[num].TagName = tagName; return(new FormatConverterContainer(this, num)); }
private void EndCurrentLevel() { FormatContainerType nodeType = this.currentOutputLevel.Node.NodeType; switch (nodeType) { case FormatContainerType.TableContainer: this.EndTableContainer(); return; case FormatContainerType.TableDefinition: this.EndTableDefinition(); return; case FormatContainerType.TableColumnGroup: this.EndTableColumnGroup(); return; case FormatContainerType.TableColumn: case (FormatContainerType)11: case (FormatContainerType)12: case (FormatContainerType)13: case (FormatContainerType)14: case (FormatContainerType)15: case (FormatContainerType)16: case (FormatContainerType)17: case (FormatContainerType)21: case FormatContainerType.Area: case (FormatContainerType)23: case FormatContainerType.BaseFont: case (FormatContainerType)35: break; case FormatContainerType.Inline: this.EndInline(); return; case FormatContainerType.HyperLink: this.EndHyperLink(); return; case FormatContainerType.Bookmark: this.EndBookmark(); return; case FormatContainerType.Form: this.EndForm(); return; case FormatContainerType.FieldSet: this.EndFieldSet(); return; case FormatContainerType.Label: this.EndLabel(); return; case FormatContainerType.Input: this.EndInput(); return; case FormatContainerType.Button: this.EndButton(); return; case FormatContainerType.Legend: this.EndLegend(); return; case FormatContainerType.TextArea: this.EndTextArea(); return; case FormatContainerType.Select: this.EndSelect(); return; case FormatContainerType.OptionGroup: this.EndOptionGroup(); return; case FormatContainerType.Option: this.EndOption(); return; case FormatContainerType.Text: this.EndText(); break; default: switch (nodeType) { case FormatContainerType.Root: this.EndRoot(); return; case FormatContainerType.Document: this.EndDocument(); return; case FormatContainerType.Fragment: this.EndFragment(); return; case FormatContainerType.Block: this.EndBlock(); return; case FormatContainerType.BlockQuote: this.EndBlockQuote(); return; case FormatContainerType.HorizontalLine: case (FormatContainerType)135: case (FormatContainerType)136: case (FormatContainerType)137: case (FormatContainerType)138: case (FormatContainerType)146: case (FormatContainerType)147: case (FormatContainerType)148: case (FormatContainerType)149: case (FormatContainerType)150: break; case FormatContainerType.TableCaption: this.EndTableCaption(); return; case FormatContainerType.TableExtraContent: this.EndTableExtraContent(); return; case FormatContainerType.Table: this.EndTable(); return; case FormatContainerType.TableRow: this.EndTableRow(); return; case FormatContainerType.TableCell: this.EndTableCell(); return; case FormatContainerType.List: this.EndList(); return; case FormatContainerType.ListItem: this.EndListItem(); return; case FormatContainerType.Map: this.EndMap(); return; default: return; } break; } }
private bool StartCurrentLevel() { FormatContainerType nodeType = this.currentOutputLevel.Node.NodeType; switch (nodeType) { case FormatContainerType.TableContainer: return(this.StartTableContainer()); case FormatContainerType.TableDefinition: return(this.StartTableDefinition()); case FormatContainerType.TableColumnGroup: return(this.StartTableColumnGroup()); case FormatContainerType.TableColumn: this.StartEndTableColumn(); return(false); case (FormatContainerType)11: case (FormatContainerType)12: case (FormatContainerType)13: case (FormatContainerType)14: case (FormatContainerType)15: case (FormatContainerType)16: case (FormatContainerType)17: case (FormatContainerType)21: case (FormatContainerType)23: case (FormatContainerType)35: break; case FormatContainerType.Inline: return(this.StartInline()); case FormatContainerType.HyperLink: return(this.StartHyperLink()); case FormatContainerType.Bookmark: return(this.StartBookmark()); case FormatContainerType.Area: this.StartEndArea(); return(false); case FormatContainerType.BaseFont: this.StartEndBaseFont(); return(false); case FormatContainerType.Form: return(this.StartForm()); case FormatContainerType.FieldSet: return(this.StartFieldSet()); case FormatContainerType.Label: return(this.StartLabel()); case FormatContainerType.Input: return(this.StartInput()); case FormatContainerType.Button: return(this.StartButton()); case FormatContainerType.Legend: return(this.StartLegend()); case FormatContainerType.TextArea: return(this.StartTextArea()); case FormatContainerType.Select: return(this.StartSelect()); case FormatContainerType.OptionGroup: return(this.StartOptionGroup()); case FormatContainerType.Option: return(this.StartOption()); case FormatContainerType.Text: return(this.StartText()); default: if (nodeType == FormatContainerType.Image) { this.StartEndImage(); return(false); } switch (nodeType) { case FormatContainerType.Root: return(this.StartRoot()); case FormatContainerType.Document: return(this.StartDocument()); case FormatContainerType.Fragment: return(this.StartFragment()); case FormatContainerType.Block: return(this.StartBlock()); case FormatContainerType.BlockQuote: return(this.StartBlockQuote()); case FormatContainerType.HorizontalLine: this.StartEndHorizontalLine(); return(false); case FormatContainerType.TableCaption: return(this.StartTableCaption()); case FormatContainerType.TableExtraContent: return(this.StartTableExtraContent()); case FormatContainerType.Table: return(this.StartTable()); case FormatContainerType.TableRow: return(this.StartTableRow()); case FormatContainerType.TableCell: return(this.StartTableCell()); case FormatContainerType.List: return(this.StartList()); case FormatContainerType.ListItem: return(this.StartListItem()); case FormatContainerType.Map: return(this.StartMap()); } break; } return(true); }
private void FlushContainer(int stackPos) { FormatContainerType formatContainerType = this.FixContainerType(this.BuildStack[stackPos].Type, this.ContainerStyleBuildHelper); if (formatContainerType != this.BuildStack[stackPos].Type) { this.BuildStack[stackPos].Type = formatContainerType; } this.ContainerStyleBuildHelper.GetPropertyList(out this.BuildStack[stackPos].Properties, out this.BuildStack[stackPos].FlagProperties, out this.BuildStack[stackPos].PropertyMask); if (!this.BuildStack[stackPos].IsPropertyContainerOrNull) { if (!this.newLine && (byte)(this.BuildStack[stackPos].Type & FormatContainerType.BlockFlag) != 0) { this.Store.AddBlockBoundary(); this.newLine = true; this.textQuotingExpected = true; } FormatNode formatNode; if (formatContainerType == FormatContainerType.Document) { formatNode = this.Store.AllocateNode(this.BuildStack[stackPos].Type, 0U); } else { formatNode = this.Store.AllocateNode(this.BuildStack[stackPos].Type); } formatNode.SetOnRightEdge(); if ((byte)(this.BuildStack[stackPos].Type & FormatContainerType.InlineObjectFlag) != 0) { this.Store.AddInlineObject(); } FormatNode node = this.Store.GetNode(this.LastNodeInternal); int num; this.GetParentForNewNode(formatNode, node, stackPos, out num).AppendChild(formatNode); this.BuildStack[stackPos].Node = formatNode.Handle; this.LastNodeInternal = formatNode.Handle; FlagProperties flagProperties2; Property[] properties; PropertyBitMask propertyMask; if (num < stackPos) { FlagProperties flagProperties = FlagProperties.AllOn; PropertyBitMask propertyBitMask = PropertyBitMask.AllOn; int num2 = stackPos; while (num2 >= num && (!flagProperties.IsClear || !propertyBitMask.IsClear)) { if (num2 == stackPos || this.BuildStack[num2].Type == FormatContainerType.PropertyContainer) { flagProperties2 = (this.BuildStack[num2].FlagProperties & flagProperties); this.ContainerStyleBuildHelper.AddProperties(11, flagProperties2, propertyBitMask, this.BuildStack[num2].Properties); flagProperties &= ~this.BuildStack[num2].FlagProperties; propertyBitMask &= ~this.BuildStack[num2].PropertyMask; flagProperties &= FormatStoreData.GlobalInheritanceMasks[this.BuildStack[num2].InheritanceMaskIndex].FlagProperties; propertyBitMask &= FormatStoreData.GlobalInheritanceMasks[this.BuildStack[num2].InheritanceMaskIndex].PropertyMask; } num2--; } this.ContainerStyleBuildHelper.GetPropertyList(out properties, out flagProperties2, out propertyMask); } else { flagProperties2 = this.BuildStack[stackPos].FlagProperties; propertyMask = this.BuildStack[stackPos].PropertyMask; properties = this.BuildStack[stackPos].Properties; if (properties != null) { for (int i = 0; i < properties.Length; i++) { if (properties[i].Value.IsRefCountedHandle) { this.Store.AddRefValue(properties[i].Value); } } } } formatNode.SetProps(flagProperties2, propertyMask, properties, this.BuildStack[stackPos].InheritanceMaskIndex); } this.ContainerStyleBuildHelper.Clean(); this.ContainerFlushed = true; }
protected virtual FormatContainerType FixContainerType(FormatContainerType type, StyleBuildHelper styleBuilderWithContainerProperties) { return(type); }
public void ChangeNodeType(FormatContainerType newType) { this.nodes.Plane(this.nodeHandle)[this.nodes.Index(this.nodeHandle)].Type = newType; }