/** * Adds horizontal values of a table and its parent if present. Following values are added up: * <ul> * <li>left and right margins of the table.</li> * <li>left and right border widths of the table.</li> * <li>left and right margins of the parent of the table is present.</li> * <li>one horizontal border spacing.</li> * </ul> * @param tag * @param horBorderSpacing * @return * @throws NoCustomContextException */ private float GetTableOuterWidth(Tag tag, float horBorderSpacing, IWorkerContext ctx) { float total = utils.GetLeftAndRightMargin(tag, GetHtmlPipelineContext(ctx).PageSize.Width) + utils.CheckMetricStyle(tag, CSS.Property.BORDER_LEFT_WIDTH) + utils.CheckMetricStyle(tag, CSS.Property.BORDER_RIGHT_WIDTH) + horBorderSpacing; Tag parent = tag.Parent; if (parent != null) { total += utils.GetLeftAndRightMargin(parent, GetHtmlPipelineContext(ctx).PageSize.Width); } return(total); }
virtual public void CalculateHorizontalMargin() { Tag t = new Tag(str); t.CSS["margin-left"] = "15pt"; t.CSS["margin-right"] = "15pt"; Assert.AreEqual(30, css.GetLeftAndRightMargin(t, 0f), 0); }