static private GetNextSibling ( |
||
a | ||
return |
///// walk down and up ///// </summary> ///// <param name="startLine"></param> ///// <returns></returns> //static IEnumerable<CssLineBox> GetLineWalkDownAndUpIter(LineWalkVisitor visitor, CssLineBox startLine) //{ // float sx, sy; // startLine.OwnerBox.GetGlobalLocation(out sx, out sy); // CssLineBox curLine = startLine; // //walk up and down the tree // CssLineBox nextline = curLine.NextLine; // while (nextline != null) // { // visitor._globalY = sy + startLine.CachedLineTop; // yield return nextline; // nextline = nextline.NextLine; // } // //-------------------- // //no next line // //then walk up *** // CssBox curBox = startLine.OwnerBox; // RETRY://*** // CssBox level1Sibling = BoxHitUtils.GetNextSibling(curBox); // while (level1Sibling != null) // { // level1Sibling.GetGlobalLocation(out sx, out sy); // visitor._globalY = sy; // //walk down // foreach (CssLineBox line in GetLineWalkDownIter(visitor, level1Sibling)) // { // yield return line; // } // level1Sibling = BoxHitUtils.GetNextSibling(level1Sibling); // } // //-------------------- // //other further sibling // //then step to parent of lineOwner // if (curBox.ParentBox != null) // { // //if has parent // //walk up*** // curBox = curBox.ParentBox; // goto RETRY; // } //} /// walk down and up /// </summary> /// <param name="startLine"></param> /// <returns></returns> static IEnumerable <CssLineBox> GetLineWalkDownAndUpIter(LineWalkVisitor visitor, CssLineBox startLine) { PointF p = new PointF(); startLine.OwnerBox.GetGlobalLocationRelativeToRoot(ref p); CssLineBox curLine = startLine; //walk up and down the tree CssLineBox nextline = curLine.NextLine; while (nextline != null) { visitor._globalY = p.Y + startLine.CachedLineTop; yield return(nextline); nextline = nextline.NextLine; } //-------------------- //no next line //then walk up *** CssBox curBox = startLine.OwnerBox; RETRY: //*** CssBox level1Sibling = BoxHitUtils.GetNextSibling(curBox); while (level1Sibling != null) { p = new PointF(); level1Sibling.GetGlobalLocationRelativeToRoot(ref p); visitor._globalY = p.Y; //walk down foreach (CssLineBox line in GetLineWalkDownIter(visitor, level1Sibling)) { yield return(line); } level1Sibling = BoxHitUtils.GetNextSibling(level1Sibling); } //-------------------- //other further sibling //then step to parent of lineOwner if (curBox.ParentBox != null) { //if has parent //walk up*** curBox = curBox.ParentBox; goto RETRY; } }
/// walk down and up /// </summary> /// <param name="startLine"></param> /// <returns></returns> static IEnumerable <CssLineBox> GetLineWalkDownAndUpIter(LineWalkVisitor visitor, CssLineBox startLine) { float sx, sy; startLine.OwnerBox.GetGlobalLocation(out sx, out sy); CssLineBox curLine = startLine; //walk up and down the tree CssLineBox nextline = curLine.NextLine; while (nextline != null) { visitor.globalY = sy + startLine.CachedLineTop; yield return(nextline); nextline = nextline.NextLine; } //-------------------- //no next line //then walk up *** CssBox curBox = startLine.OwnerBox; RETRY: CssBox level1Sibling = BoxHitUtils.GetNextSibling(curBox); while (level1Sibling != null) { level1Sibling.GetGlobalLocation(out sx, out sy); visitor.globalY = sy; //walk down foreach (var line in GetLineWalkDownIter(visitor, level1Sibling)) { yield return(line); } level1Sibling = BoxHitUtils.GetNextSibling(level1Sibling); } //-------------------- //other further sibling //then step to parent of lineOwner if (curBox.ParentBox != null) { //if has parent //walk up*** curBox = curBox.ParentBox; goto RETRY; } }