Example #1
0
 private static void BubbleRectangles(CssBox box, CssLineBox line)
 {
     if (box.Words.Count <= 0)
     {
         foreach (CssBox cssBox in box.Boxes)
         {
             CssLayoutEngine.BubbleRectangles(cssBox, line);
         }
     }
     else
     {
         float             single      = float.MaxValue;
         float             single1     = float.MaxValue;
         float             single2     = float.MinValue;
         float             single3     = float.MinValue;
         List <CssBoxWord> cssBoxWords = line.WordsOf(box);
         if (cssBoxWords.Count > 0)
         {
             foreach (CssBoxWord cssBoxWord in cssBoxWords)
             {
                 single  = Math.Min(single, cssBoxWord.Left);
                 single2 = Math.Max(single2, cssBoxWord.Right);
                 single1 = Math.Min(single1, cssBoxWord.Top);
                 single3 = Math.Max(single3, cssBoxWord.Bottom);
             }
             line.UpdateRectangle(box, single, single1, single2, single3);
             return;
         }
     }
 }
Example #2
0
        /// <summary>
        /// Recursively creates the rectangles of the blockBox, by bubbling from deep to outside of the boxes
        /// in the rectangle structure
        /// </summary>
        private static void BubbleRectangles(CssBox box, CssLineBox line)
        {
            if (box.Words.Count > 0)
            {
                float             x = float.MaxValue, y = float.MaxValue, r = float.MinValue, b = float.MinValue;
                List <CssBoxWord> words = line.WordsOf(box);

                if (words.Count > 0)
                {
                    foreach (CssBoxWord word in words)
                    {
                        x = Math.Min(x, word.Left);  // - word.SpacesBeforeWidth);
                        r = Math.Max(r, word.Right); // + word.SpacesAfterWidth);
                        y = Math.Min(y, word.Top);
                        b = Math.Max(b, word.Bottom);
                    }
                    line.UpdateRectangle(box, x, y, r, b);
                }
            }
            else
            {
                foreach (CssBox b in box.Boxes)
                {
                    BubbleRectangles(b, line);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Recursively creates the rectangles of the blockBox, by bubbling from deep to outside of the boxes 
        /// in the rectangle structure
        /// </summary>
        private static void BubbleRectangles(CssBox box, CssLineBox line)
        {
            if (box.Words.Count > 0)
            {
                float x = float.MaxValue, y = float.MaxValue, r = float.MinValue, b = float.MinValue;
                List<CssBoxWord> words = line.WordsOf(box);

                if (words.Count > 0)
                {
                    foreach (CssBoxWord word in words)
                    {
                        x = Math.Min(x, word.Left);// - word.SpacesBeforeWidth);
                        r = Math.Max(r, word.Right);// + word.SpacesAfterWidth);
                        y = Math.Min(y, word.Top);
                        b = Math.Max(b, word.Bottom);
                    }
                    line.UpdateRectangle(box, x, y, r, b); 
                }
            }
            else
            {
                foreach (CssBox b in box.Boxes)
                {
                    BubbleRectangles(b, line);
                }
            }
        }