private void BlockCorrection(CssBox startBox)
 {
     if (!startBox.ContainsInlinesOnly())
     {
         foreach (List <CssBox> cssBoxes in this.BlockCorrection_GetInlineGroups(startBox))
         {
             if (cssBoxes.Count == 0)
             {
                 continue;
             }
             if (cssBoxes.Count != 1 || !(cssBoxes[0] is CssAnonymousSpaceBox))
             {
                 CssAnonymousBlockBox cssAnonymousBlockBox = new CssAnonymousBlockBox(startBox, cssBoxes[0]);
                 foreach (CssBox cssBox in cssBoxes)
                 {
                     cssBox.ParentBox = cssAnonymousBlockBox;
                 }
             }
             else
             {
                 CssAnonymousSpaceBlockBox cssAnonymousSpaceBlockBox = new CssAnonymousSpaceBlockBox(startBox, cssBoxes[0]);
                 cssBoxes[0].ParentBox = cssAnonymousSpaceBlockBox;
             }
         }
     }
     foreach (CssBox box in startBox.Boxes)
     {
         this.BlockCorrection(box);
     }
 }
        /// <summary>
        /// Makes block boxes be among only block boxes.
        /// Inline boxes should live in a pool of Inline boxes only.
        /// </summary>
        /// <param name="startBox"></param>
        private void BlockCorrection(CssBox startBox)
        {
            bool inlinesonly = startBox.ContainsInlinesOnly();

            if (!inlinesonly)
            {
                List <List <CssBox> > inlinegroups = BlockCorrection_GetInlineGroups(startBox);

                foreach (List <CssBox> group in inlinegroups)
                {
                    if (group.Count == 0)
                    {
                        continue;
                    }

                    if (group.Count == 1 && group[0] is CssAnonymousSpaceBox)
                    {
                        CssAnonymousSpaceBlockBox sbox = new CssAnonymousSpaceBlockBox(startBox, group[0]);

                        group[0].ParentBox = sbox;
                    }
                    else
                    {
                        CssAnonymousBlockBox newbox = new CssAnonymousBlockBox(startBox, group[0]);

                        foreach (CssBox inline in group)
                        {
                            inline.ParentBox = newbox;
                        }
                    }
                }
            }

            foreach (CssBox b in startBox.Boxes)
            {
                BlockCorrection(b);
            }
        }