private void UpdateCollapseBeforeIfPrevKidIsFirstAndSelfCollapsed(MarginsCollapse collapseAfter) { if (prevChildMarginInfo.IsSelfCollapsing() && prevChildMarginInfo.IsIgnoreOwnMarginTop()) { // prevChildMarginInfo.isIgnoreOwnMarginTop() is true only if it's the first kid and is adjoined to parent margin collapseInfo.GetCollapseBefore().JoinMargin(collapseAfter); } }
/// <summary>This method shall be called after child occupied area is included into parent occupied area.</summary> public virtual void EndChildMarginsHandling(Rectangle layoutBox) { int childIndex = processedChildrenNum - 1; if (RendererIsFloated(GetRendererChild(childIndex))) { return; } if (childMarginInfo != null) { if (firstNotEmptyKidIndex == childIndex && childMarginInfo.IsSelfCollapsing()) { firstNotEmptyKidIndex = childIndex + 1; } collapseInfo.SetSelfCollapsing(collapseInfo.IsSelfCollapsing() && childMarginInfo.IsSelfCollapsing()); lastKidCollapsedAfterHasClearanceApplied = childMarginInfo.IsSelfCollapsing() && childMarginInfo.IsClearanceApplied (); } else { lastKidCollapsedAfterHasClearanceApplied = false; collapseInfo.SetSelfCollapsing(false); } if (prevChildMarginInfo != null) { FixPrevChildOccupiedArea(childIndex); UpdateCollapseBeforeIfPrevKidIsFirstAndSelfCollapsed(prevChildMarginInfo.GetOwnCollapseAfter()); } if (firstNotEmptyKidIndex == childIndex && FirstChildMarginAdjoinedToParent(renderer)) { if (!collapseInfo.IsSelfCollapsing()) { GetRidOfCollapseArtifactsAtopOccupiedArea(); if (childMarginInfo != null) { ProcessUsedChildBufferSpaceOnTop(layoutBox); } } } prevChildMarginInfo = childMarginInfo; childMarginInfo = null; backupLayoutBox = null; backupCollapseInfo = null; }