GetReadyStripDic() private méthode

private GetReadyStripDic ( ) : PartialBoxStrip>.Dictionary
Résultat PartialBoxStrip>.Dictionary
        internal void CloseLine(LayoutVisitor lay)
        {
#if DEBUG
            this.dbugIsClosed = true;
#endif

            //=============================================================
            //part 1: MakeStrips()
            //=============================================================
            //***
            List <CssRun>          myruns    = _runs;
            CssBox                 lineOwner = _ownerBox;
            List <PartialBoxStrip> tmpStrips = lay.GetReadyStripList();
            //---------------------------------------------------------------------------
            //first level
            Dictionary <CssBox, PartialBoxStrip> unqiueStrips = lay.GetReadyStripDic();
            //location of run and strip related to its containng block
            float maxRight        = 0;
            float maxBottom       = 0;
            int   j               = myruns.Count;
            float firstRunStartAt = 0;
            for (int i = 0; i < j; ++i)
            {
                CssRun run = myruns[i];
                if (i == 0)
                {
                    firstRunStartAt = run.Left;
                }
                maxRight  = run.Right > maxRight ? run.Right : maxRight;
                maxBottom = run.Bottom > maxBottom ? run.Bottom : maxBottom;
                if (run.IsSpaces)
                {
                    //strip size include whitespace ?
                    continue;
                }
                //-------------
                //first level data
                RegisterStripPart(run.OwnerBox, run.Left, run.Top, run.Right, run.Bottom, tmpStrips, unqiueStrips);
            }

            //---------------------------------------------------------------------------
            //other step to upper layer, until no new strip
            int newStripIndex = 0;
            for (int numNewStripCreate = tmpStrips.Count; numNewStripCreate > 0; newStripIndex += numNewStripCreate)
            {
                numNewStripCreate = StepUpRegisterStrips(unqiueStrips, lineOwner, tmpStrips, newStripIndex);
            }

            _bottomUpBoxStrips = tmpStrips.ToArray();
            lay.ReleaseStripList(tmpStrips);
            lay.ReleaseStripDic(unqiueStrips);
            //=============================================================
            //part 2: Calculate
            //=============================================================

            this.CacheLineHeight         = maxBottom;
            this.CachedLineContentWidth  = maxRight;
            this.CachedExactContentWidth = (maxRight - firstRunStartAt);
            if (lineOwner.VisualWidth < CachedLineContentWidth)
            {
                this.CachedLineContentWidth = this.OwnerBox.VisualWidth;
            }
        }
Exemple #2
0
        internal void CloseLine(LayoutVisitor lay)
        {
#if DEBUG
            this.dbugIsClosed = true;
#endif

            //=============================================================
            //part 1: MakeStrips()
            //=============================================================
            //***
            List<CssRun> myruns = this._runs;
            CssBox lineOwner = this._ownerBox;
            List<PartialBoxStrip> tmpStrips = lay.GetReadyStripList();
            //--------------------------------------------------------------------------- 
            //first level 
            Dictionary<CssBox, PartialBoxStrip> unqiueStrips = lay.GetReadyStripDic();
            //location of run and strip related to its containng block
            float maxRight = 0;
            float maxBottom = 0;
            int j = myruns.Count;
            float firstRunStartAt = 0;
            for (int i = 0; i < j; ++i)
            {
                CssRun run = myruns[i];
                if (i == 0)
                {
                    firstRunStartAt = run.Left;
                }
                maxRight = run.Right > maxRight ? run.Right : maxRight;
                maxBottom = run.Bottom > maxBottom ? run.Bottom : maxBottom;
                if (run.IsSpaces)
                {
                    //strip size include whitespace ?
                    continue;
                }
                //-------------
                //first level data
                RegisterStripPart(run.OwnerBox, run.Left, run.Top, run.Right, run.Bottom, tmpStrips, unqiueStrips);
            }

            //---------------------------------------------------------------------------
            //other step to upper layer, until no new strip     
            int newStripIndex = 0;
            for (int numNewStripCreate = tmpStrips.Count; numNewStripCreate > 0; newStripIndex += numNewStripCreate)
            {
                numNewStripCreate = StepUpRegisterStrips(unqiueStrips, lineOwner, tmpStrips, newStripIndex);
            }

            this._bottomUpBoxStrips = tmpStrips.ToArray();
            lay.ReleaseStripList(tmpStrips);
            lay.ReleaseStripDic(unqiueStrips);
            //=============================================================
            //part 2: Calculate 
            //=============================================================     

            this.CacheLineHeight = maxBottom;
            this.CachedLineContentWidth = maxRight;
            this.CachedExactContentWidth = (maxRight - firstRunStartAt);
            if (lineOwner.VisualWidth < CachedLineContentWidth)
            {
                this.CachedLineContentWidth = this.OwnerBox.VisualWidth;
            }
        }