private GetHeightAfterMarginBottomCollapse ( |
||
containerBox | ||
Результат | float |
static void DoLayoutBlocksContext(CssBox box, LayoutVisitor lay) { //block formatting context.... lay.PushContaingBlock(box); var currentLevelLatestSibling = lay.LatestSiblingBox; lay.LatestSiblingBox = null;//reset //------------------------------------------ var children = CssBox.UnsafeGetChildren(box); var cnode = children.GetFirstLinkedNode(); while (cnode != null) { var childBox = cnode.Value; //---------------------------- if (childBox.IsBrElement) { //br always block CssBox.ChangeDisplayType(childBox, Css.CssDisplay.Block); childBox.SetVisualHeight(FontDefaultConfig.DEFAULT_FONT_SIZE * 0.95f); } //----------------------------- if (childBox.OutsideDisplayIsInline) { //inline correction on-the-fly ! //1. collect consecutive inlinebox // and move to new anon block box CssBox anoForInline = CreateAnonBlock(box, childBox); anoForInline.ReEvaluateComputedValues(lay.SampleIFonts, box); var tmp = cnode.Next; do { children.Remove(childBox); anoForInline.AppendChild(childBox); if (tmp != null) { childBox = tmp.Value; if (childBox.OutsideDisplayIsInline) { tmp = tmp.Next; if (tmp == null) { children.Remove(childBox); anoForInline.AppendChild(childBox); break;//break from do while } } else { break;//break from do while } } else { break;//break from do while } } while (true); childBox = anoForInline; //------------------------ //2. move this inline box //to new anonbox cnode = tmp; //------------------------ childBox.PerformLayout(lay); if (childBox.CanBeReferenceSibling) { lay.LatestSiblingBox = childBox; } } else { //if(childBox.__aa_dbugId == 5) //{ //} childBox.PerformLayout(lay); switch (childBox.Float) { case CssFloat.Left: { childBox.IsOutOfFlowBox = true; // lay.LatestLeftFloatBox = childBox; } break; case CssFloat.Right: { childBox.IsOutOfFlowBox = true; //float box is out-of-flow box //so move it to abs layer //lay.LatestRightFloatBox = childBox; } break; } if (childBox.Float == CssFloat.None && childBox.CanBeReferenceSibling) { lay.LatestSiblingBox = childBox; } cnode = cnode.Next; } } //------------------------------------------ lay.LatestSiblingBox = currentLevelLatestSibling; lay.PopContainingBlock(); //------------------------------------------------ float boxWidth = CalculateActualWidth(box); if (lay.ContainerBlockGlobalX + boxWidth > CssBoxConstConfig.BOX_MAX_RIGHT) { } else { if (box.CssDisplay != Css.CssDisplay.TableCell) { if (box.Width.IsEmptyOrAuto) { box.SetVisualWidth(boxWidth); } } } float boxHeight = box.GetHeightAfterMarginBottomCollapse(lay.LatestContainingBlock); //TODO: review here again, box.SetVisualHeight(boxHeight); //-------------------------------------------------------------------------------- //final SetFinalInnerContentSize(box, boxWidth, boxHeight, lay); }