/// <summary>Lets the renderer know that the given parent element has finished /// packing all of its kids. This allows alignment to occur next.</summary> /// <param name="renderable">The element that is done packing.</param> public void EndLines(LineBoxMeta lineZone, ComputedStyle computed, LayoutBox box) { // Pop the box: BoxStack.Pop(); // Complete the last line: lineZone.CompleteLine(LineBreakMode.NoBreak | LineBreakMode.Last); // If inline-block or float, clear: if (box.DisplayMode == DisplayMode.InlineBlock || box.FloatMode != FloatMode.None) { // Must clear: lineZone.ClearFloat(FloatMode.Both); lineZone.PenY += lineZone.ClearY_; lineZone.ClearY_ = 0f; } // block, inline-block if (lineZone is BlockBoxMeta) { bool heightChange = false; if (box.InnerHeight == -1f) { heightChange = true; box.InnerHeight = lineZone.PenY; // Clip height now: box.InnerHeight = computed.ClipHeight(box.DisplayMode, box.InnerHeight); } box.ContentHeight = lineZone.PenY; box.ContentWidth = lineZone.LargestLineWidth; // If it's inline then we set the line width. if (box.InnerWidth == -1f) { box.InnerWidth = lineZone.LargestLineWidth; // Apply valid width/height: box.SetDimensions(false, false); } else if (heightChange) { // Apply valid width/height: box.SetDimensions(false, false); } bool inFlow = (box.PositionMode & PositionMode.InFlow) != 0; // Update position of the top-of-stack pen: LineBoxMeta tos = TopOfStackSafe; if (tos == null) { LastBlockBox = null; } else { if (inFlow) { // Advance the pen: tos.AdvancePen(box); } // Restore previous block: LastBlockBox = tos as BlockBoxMeta; if (LastBlockBox == null) { // Rare - block inside inline. LastBlockBox = (tos as InlineBoxMeta).HostBlock; } } } }