Exemple #1
0
 public void Walk(CssLineBox endLineBox, VisitLineDelegate del)
 {
     //2 cases :
     //1. start with BlockRun
     //2. start with LineBox
     InnerWalk(endLineBox,
               del,
               (_startBlockRun != null) ?
               GetLineWalkDownIter(this, _startBlockRun.ContentBox) :
               GetLineWalkDownAndUpIter(this, _startLineBox));
 }
            void InnerWalk(CssLineBox endLineBox, VisitLineDelegate del, IEnumerable <CssLineBox> lineIter)
            {
                //recursive


                foreach (var ln in lineIter)
                {
                    this.currentVisitLineBox = ln;
                    if (ln == endLineBox)
                    {
                        del(LineCoverage.EndLine, ln, null);
                        //found endline
                        return;
                    }
                    else if (this.IsWalkTargetInCurrentLineArea())
                    {
                        int  j    = ln.RunCount;
                        bool isOK = false;
                        for (int i = 0; i < j && !isOK; ++i)
                        {
                            var run3 = ln.GetRun(i) as CssBlockRun;
                            if (run3 == null)
                            {
                                continue;
                            }

                            //recursive here
                            InnerWalk(endLineBox, del, GetLineWalkDownIter(this, run3.ContentBox));

                            if (i > 0)
                            {
                                del(LineCoverage.PartialLine, ln, ln.GetRun(i - 1));
                            }
                            isOK = true;
                            break;
                        }
                    }
                    else
                    {
                        del(LineCoverage.FullLine, ln, null);
                    }
                }
            }
            void InnerWalk(CssLineBox endLineBox, VisitLineDelegate del, IEnumerable <CssLineBox> lineIter)
            {
                //recursive
                foreach (CssLineBox ln in lineIter)
                {
#if DEBUG
                    //System.Diagnostics.Debug.WriteLine("pre_sel:" + ln.dbugId);
#endif
                    _currentVisitLineBox = ln;
                    if (ln == endLineBox)
                    {
                        del(LineCoverage.EndLine, ln, null);
                        //found endline
                        return;
                    }
                    else if (this.IsWalkTargetInCurrentLineArea())
                    {
                        int  j    = ln.RunCount;
                        bool isOK = false;
                        for (int i = 0; i < j && !isOK; ++i)
                        {
                            if (!(ln.GetRun(i) is CssBlockRun run3))
                            {
                                continue;
                            }
                            //recursive here
                            InnerWalk(endLineBox, del, GetLineWalkDownIter(this, run3.ContentBox));
                            if (i > 0)
                            {
                                del(LineCoverage.PartialLine, ln, ln.GetRun(i - 1));
                            }
                            isOK = true;
                            break;
                        }
                    }
                    else
                    {
                        del(LineCoverage.FullLine, ln, null);
                    }
                }
            }
            void InnerWalk(CssLineBox endLineBox, VisitLineDelegate del, IEnumerable<CssLineBox> lineIter)
            {
                //recursive


                foreach (var ln in lineIter)
                {
                    this.currentVisitLineBox = ln;
                    if (ln == endLineBox)
                    {
                        del(LineCoverage.EndLine, ln, null);
                        //found endline 
                        return;
                    }
                    else if (this.IsWalkTargetInCurrentLineArea())
                    {
                        int j = ln.RunCount;
                        bool isOK = false;
                        for (int i = 0; i < j && !isOK; ++i)
                        {
                            var run3 = ln.GetRun(i) as CssBlockRun;
                            if (run3 == null) continue;
                            //recursive here 
                            InnerWalk(endLineBox, del, GetLineWalkDownIter(this, run3.ContentBox));
                            if (i > 0)
                            {
                                del(LineCoverage.PartialLine, ln, ln.GetRun(i - 1));
                            }
                            isOK = true;
                            break;
                        }
                    }
                    else
                    {
                        del(LineCoverage.FullLine, ln, null);
                    }
                }
            }
 public void Walk(CssLineBox endLineBox, VisitLineDelegate del)
 {
     //2 cases :
     //1. start with BlockRun 
     //2. start with LineBox 
     InnerWalk(endLineBox,
               del,
               (startBlockRun != null) ?
                         GetLineWalkDownIter(this, startBlockRun.ContentBox) :
                         GetLineWalkDownAndUpIter(this, startLineBox));
 }