@@ -77,13 +77,17 @@ public override LayoutResult Layout(LayoutContext layoutContext) {
7777 Rectangle layoutBox = layoutContext . GetArea ( ) . GetBBox ( ) . Clone ( ) ;
7878 bool wasParentsHeightClipped = layoutContext . GetArea ( ) . IsClippedHeight ( ) ;
7979 IList < Rectangle > floatRendererAreas = layoutContext . GetFloatRendererAreas ( ) ;
80+ OverflowPropertyValue ? oldXOverflow = null ;
81+ bool wasXOverflowChanged = false ;
8082 if ( floatRendererAreas != null ) {
83+ float layoutWidth = layoutBox . GetWidth ( ) ;
8184 FloatingHelper . AdjustLineAreaAccordingToFloats ( floatRendererAreas , layoutBox ) ;
82- if ( 0 != floatRendererAreas . Count ) {
85+ if ( layoutWidth > layoutBox . GetWidth ( ) ) {
86+ oldXOverflow = this . GetProperty < OverflowPropertyValue ? > ( Property . OVERFLOW_X ) ;
87+ wasXOverflowChanged = true ;
8388 SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . FIT ) ;
8489 }
8590 }
86- // TODO
8791 occupiedArea = new LayoutArea ( layoutContext . GetArea ( ) . GetPageNumber ( ) , layoutBox . Clone ( ) . MoveUp ( layoutBox .
8892 GetHeight ( ) ) . SetHeight ( 0 ) . SetWidth ( 0 ) ) ;
8993 float curWidth = 0 ;
@@ -175,15 +179,14 @@ public override LayoutResult Layout(LayoutContext layoutContext) {
175179 // when floating span is split on other line;
176180 // TODO may be process floating spans as inline blocks always?
177181 if ( childPos > 0 ) {
182+ oldXOverflow = this . GetProperty < OverflowPropertyValue ? > ( Property . OVERFLOW_X ) ;
183+ wasXOverflowChanged = true ;
178184 SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . FIT ) ;
179185 }
180186 if ( overflowFloats . IsEmpty ( ) && ( ! anythingPlaced || floatingBoxFullWidth <= bbox . GetWidth ( ) ) ) {
181187 childResult = childRenderer . Layout ( new LayoutContext ( new LayoutArea ( layoutContext . GetArea ( ) . GetPageNumber (
182188 ) , layoutContext . GetArea ( ) . GetBBox ( ) . Clone ( ) , wasParentsHeightClipped ) , null , floatRendererAreas ) ) ;
183189 }
184- if ( childPos > 0 ) {
185- DeleteOwnProperty ( Property . OVERFLOW_X ) ;
186- }
187190 // Get back child width so that it's not lost
188191 if ( childWidthWasReplaced ) {
189192 if ( childRendererHasOwnWidthProperty ) {
@@ -272,13 +275,12 @@ public override LayoutResult Layout(LayoutContext layoutContext) {
272275 }
273276 if ( childResult == null ) {
274277 if ( childPos > 0 ) {
278+ oldXOverflow = this . GetProperty < OverflowPropertyValue ? > ( Property . OVERFLOW_X ) ;
279+ wasXOverflowChanged = true ;
275280 SetProperty ( Property . OVERFLOW_X , OverflowPropertyValue . FIT ) ;
276281 }
277282 childResult = childRenderer . Layout ( new LayoutContext ( new LayoutArea ( layoutContext . GetArea ( ) . GetPageNumber (
278283 ) , bbox , wasParentsHeightClipped ) ) ) ;
279- if ( childPos > 0 ) {
280- DeleteOwnProperty ( Property . OVERFLOW_X ) ;
281- }
282284 }
283285 // Get back child width so that it's not lost
284286 if ( childWidthWasReplaced ) {
@@ -621,16 +623,13 @@ public override LayoutResult Layout(LayoutContext layoutContext) {
621623 processed . AdjustChildrenYLine ( ) . TrimLast ( ) ;
622624 result . SetMinMaxWidth ( minMaxWidth ) ;
623625 }
624- if ( floatRendererAreas != null ) {
625- if ( 0 != floatRendererAreas . Count ) {
626- DeleteOwnProperty ( Property . OVERFLOW_X ) ;
627- // TODO
628- if ( null != result . GetSplitRenderer ( ) ) {
629- result . GetSplitRenderer ( ) . DeleteOwnProperty ( Property . OVERFLOW_X ) ;
630- }
631- if ( null != result . GetOverflowRenderer ( ) ) {
632- result . GetOverflowRenderer ( ) . DeleteOwnProperty ( Property . OVERFLOW_X ) ;
633- }
626+ if ( wasXOverflowChanged ) {
627+ SetProperty ( Property . OVERFLOW_X , oldXOverflow ) ;
628+ if ( null != result . GetSplitRenderer ( ) ) {
629+ result . GetSplitRenderer ( ) . SetProperty ( Property . OVERFLOW_X , oldXOverflow ) ;
630+ }
631+ if ( null != result . GetOverflowRenderer ( ) ) {
632+ result . GetOverflowRenderer ( ) . SetProperty ( Property . OVERFLOW_X , oldXOverflow ) ;
634633 }
635634 }
636635 return result ;
0 commit comments