File tree Expand file tree Collapse file tree 1 file changed +15
-26
lines changed
external/HtmlRenderer/Core/Parse Expand file tree Collapse file tree 1 file changed +15
-26
lines changed Original file line number Diff line number Diff line change @@ -648,42 +648,31 @@ private static void CorrectImgBoxes(CssBox box)
648648 /// move to a new line</param>
649649 private static void CorrectLineBreaksBlocks ( CssBox box , ref bool followingBlock )
650650 {
651- followingBlock = followingBlock || box . IsBlock ;
652651 foreach ( var childBox in box . Boxes )
653652 {
654653 CorrectLineBreaksBlocks ( childBox , ref followingBlock ) ;
655- followingBlock = childBox . Words . Count == 0 && ( followingBlock || childBox . IsBlock ) ;
656- }
657654
658- int lastBr = - 1 ;
659- CssBox brBox ;
660- do
661- {
662- brBox = null ;
663- for ( int i = 0 ; i < box . Boxes . Count && brBox == null ; i ++ )
655+ if ( childBox . IsBrElement )
664656 {
665- if ( i > lastBr && box . Boxes [ i ] . IsBrElement )
666- {
667- brBox = box . Boxes [ i ] ;
668- lastBr = i ;
669- }
670- else if ( box . Boxes [ i ] . Words . Count > 0 )
671- {
672- followingBlock = false ;
673- }
674- else if ( box . Boxes [ i ] . IsBlock )
657+ childBox . Display = CssConstants . Block ;
658+
659+ if ( followingBlock )
675660 {
676- followingBlock = true ;
661+ childBox . Height = ".95em" ; // TODO:a check the height to min-height when it is supported
677662 }
678- }
679663
680- if ( brBox != null )
664+ // after <br>, treat as if we just had a block so consecutive <br> will also create empty lines
665+ followingBlock = true ;
666+ }
667+ else if ( childBox . Words . Count > 0 )
681668 {
682- brBox . Display = CssConstants . Block ;
683- if ( followingBlock )
684- brBox . Height = ".95em" ; // TODO:a check the height to min-height when it is supported
669+ followingBlock = false ;
685670 }
686- } while ( brBox != null ) ;
671+ else if ( childBox . IsBlock )
672+ {
673+ followingBlock = true ;
674+ }
675+ }
687676 }
688677
689678 /// <summary>
You can’t perform that action at this time.
0 commit comments