@@ -943,6 +943,58 @@ public virtual Rectangle GetInnerAreaBBox() {
943
943
return rect ;
944
944
}
945
945
946
+ /// <summary>Applies margins of the renderer on the given rectangle</summary>
947
+ /// <param name="rect">a rectangle margins will be applied on.</param>
948
+ /// <param name="reverse">
949
+ /// indicates whether margins will be applied
950
+ /// inside (in case of false) or outside (in case of true) the rectangle.
951
+ /// </param>
952
+ /// <returns>
953
+ /// a
954
+ /// <see cref="iText.Kernel.Geom.Rectangle">border box</see>
955
+ /// of the renderer
956
+ /// </returns>
957
+ /// <seealso cref="GetMargins()"/>
958
+ public virtual Rectangle ApplyMargins ( Rectangle rect , bool reverse ) {
959
+ return this . ApplyMargins ( rect , GetMargins ( ) , reverse ) ;
960
+ }
961
+
962
+ /// <summary>
963
+ /// Applies the border box of the renderer on the given rectangle
964
+ /// If the border of a certain side is null, the side will remain as it was.
965
+ /// </summary>
966
+ /// <param name="rect">a rectangle the border box will be applied on.</param>
967
+ /// <param name="reverse">
968
+ /// indicates whether the border box will be applied
969
+ /// inside (in case of false) or outside (in case of false) the rectangle.
970
+ /// </param>
971
+ /// <returns>
972
+ /// a
973
+ /// <see cref="iText.Kernel.Geom.Rectangle">border box</see>
974
+ /// of the renderer
975
+ /// </returns>
976
+ /// <seealso cref="GetBorders()"/>
977
+ public virtual Rectangle ApplyBorderBox ( Rectangle rect , bool reverse ) {
978
+ Border [ ] borders = GetBorders ( ) ;
979
+ return ApplyBorderBox ( rect , borders , reverse ) ;
980
+ }
981
+
982
+ /// <summary>Applies paddings of the renderer on the given rectangle</summary>
983
+ /// <param name="rect">a rectangle paddings will be applied on.</param>
984
+ /// <param name="reverse">
985
+ /// indicates whether paddings will be applied
986
+ /// inside (in case of false) or outside (in case of false) the rectangle.
987
+ /// </param>
988
+ /// <returns>
989
+ /// a
990
+ /// <see cref="iText.Kernel.Geom.Rectangle">border box</see>
991
+ /// of the renderer
992
+ /// </returns>
993
+ /// <seealso cref="GetPaddings()"/>
994
+ public virtual Rectangle ApplyPaddings ( Rectangle rect , bool reverse ) {
995
+ return ApplyPaddings ( rect , GetPaddings ( ) , reverse ) ;
996
+ }
997
+
946
998
public virtual bool IsFirstOnRootArea ( ) {
947
999
return IsFirstOnRootArea ( false ) ;
948
1000
}
@@ -953,27 +1005,27 @@ protected internal virtual void ApplyDestinationsAndAnnotation(DrawContext drawC
953
1005
ApplyLinkAnnotation ( drawContext . GetDocument ( ) ) ;
954
1006
}
955
1007
956
- internal static bool IsBorderBoxSizing ( IRenderer renderer ) {
1008
+ protected internal static bool IsBorderBoxSizing ( IRenderer renderer ) {
957
1009
BoxSizingPropertyValue ? boxSizing = renderer . GetProperty < BoxSizingPropertyValue ? > ( Property . BOX_SIZING ) ;
958
1010
return boxSizing != null && boxSizing . Equals ( BoxSizingPropertyValue . BORDER_BOX ) ;
959
1011
}
960
1012
961
- internal virtual bool IsOverflowProperty ( OverflowPropertyValue ? equalsTo , int overflowProperty ) {
1013
+ protected internal virtual bool IsOverflowProperty ( OverflowPropertyValue ? equalsTo , int overflowProperty ) {
962
1014
return IsOverflowProperty ( equalsTo , this . GetProperty < OverflowPropertyValue ? > ( overflowProperty ) ) ;
963
1015
}
964
1016
965
- internal static bool IsOverflowProperty ( OverflowPropertyValue ? equalsTo , IRenderer renderer , int overflowProperty
966
- ) {
1017
+ protected internal static bool IsOverflowProperty ( OverflowPropertyValue ? equalsTo , IRenderer renderer , int
1018
+ overflowProperty ) {
967
1019
return IsOverflowProperty ( equalsTo , renderer . GetProperty < OverflowPropertyValue ? > ( overflowProperty ) ) ;
968
1020
}
969
1021
970
- internal static bool IsOverflowProperty ( OverflowPropertyValue ? equalsTo , OverflowPropertyValue ? rendererOverflowProperty
971
- ) {
1022
+ protected internal static bool IsOverflowProperty ( OverflowPropertyValue ? equalsTo , OverflowPropertyValue ?
1023
+ rendererOverflowProperty ) {
972
1024
return equalsTo . Equals ( rendererOverflowProperty ) || equalsTo . Equals ( OverflowPropertyValue . FIT ) && rendererOverflowProperty
973
1025
== null ;
974
1026
}
975
1027
976
- internal static bool IsOverflowFit ( OverflowPropertyValue ? rendererOverflowProperty ) {
1028
+ protected internal static bool IsOverflowFit ( OverflowPropertyValue ? rendererOverflowProperty ) {
977
1029
return rendererOverflowProperty == null || OverflowPropertyValue . FIT . Equals ( rendererOverflowProperty ) ;
978
1030
}
979
1031
@@ -1128,7 +1180,7 @@ internal static void ProcessWaitingDrawing(IRenderer child, Transform transformP
1128
1180
/// property value.
1129
1181
/// </remarks>
1130
1182
/// <param name="updatedWidthValue">element's new fixed content box width.</param>
1131
- internal virtual void UpdateWidth ( UnitValue updatedWidthValue ) {
1183
+ protected internal virtual void UpdateWidth ( UnitValue updatedWidthValue ) {
1132
1184
if ( updatedWidthValue . IsPointValue ( ) && IsBorderBoxSizing ( this ) ) {
1133
1185
updatedWidthValue . SetValue ( updatedWidthValue . GetValue ( ) + CalculatePaddingBorderWidth ( this ) ) ;
1134
1186
}
@@ -1236,7 +1288,7 @@ private float[] CalculateRadii(BorderRadius[] radii, Rectangle area, bool horizo
1236
1288
/// property value.
1237
1289
/// </remarks>
1238
1290
/// <param name="updatedHeight">element's new fixed content box height, shall be not null.</param>
1239
- internal virtual void UpdateHeight ( UnitValue updatedHeight ) {
1291
+ protected internal virtual void UpdateHeight ( UnitValue updatedHeight ) {
1240
1292
if ( IsBorderBoxSizing ( this ) && updatedHeight . IsPointValue ( ) ) {
1241
1293
updatedHeight . SetValue ( updatedHeight . GetValue ( ) + CalculatePaddingBorderHeight ( this ) ) ;
1242
1294
}
@@ -1297,7 +1349,7 @@ internal virtual void UpdateHeight(UnitValue updatedHeight) {
1297
1349
/// property value.
1298
1350
/// </remarks>
1299
1351
/// <param name="updatedMaxHeight">element's new content box max-height, shall be not null.</param>
1300
- internal virtual void UpdateMaxHeight ( UnitValue updatedMaxHeight ) {
1352
+ protected internal virtual void UpdateMaxHeight ( UnitValue updatedMaxHeight ) {
1301
1353
if ( IsBorderBoxSizing ( this ) && updatedMaxHeight . IsPointValue ( ) ) {
1302
1354
updatedMaxHeight . SetValue ( updatedMaxHeight . GetValue ( ) + CalculatePaddingBorderHeight ( this ) ) ;
1303
1355
}
@@ -1349,7 +1401,7 @@ internal virtual void UpdateMaxHeight(UnitValue updatedMaxHeight) {
1349
1401
/// property value.
1350
1402
/// </remarks>
1351
1403
/// <param name="updatedMinHeight">element's new content box min-height, shall be not null.</param>
1352
- internal virtual void UpdateMinHeight ( UnitValue updatedMinHeight ) {
1404
+ protected internal virtual void UpdateMinHeight ( UnitValue updatedMinHeight ) {
1353
1405
if ( IsBorderBoxSizing ( this ) && updatedMinHeight . IsPointValue ( ) ) {
1354
1406
updatedMinHeight . SetValue ( updatedMinHeight . GetValue ( ) + CalculatePaddingBorderHeight ( this ) ) ;
1355
1407
}
@@ -1407,9 +1459,7 @@ protected internal virtual void AddAllProperties(IDictionary<int, Object> proper
1407
1459
}
1408
1460
1409
1461
protected internal virtual float ? GetLastYLineRecursively ( ) {
1410
- if ( IsOverflowProperty ( OverflowPropertyValue . HIDDEN , Property . OVERFLOW_X ) || IsOverflowProperty ( OverflowPropertyValue
1411
- . HIDDEN , Property . OVERFLOW_Y ) ) {
1412
- // TODO may be this logic should also be based on BlockFormattingContextUtil?
1462
+ if ( ! AllowLastYLineRecursiveExtraction ( ) ) {
1413
1463
return null ;
1414
1464
}
1415
1465
for ( int i = childRenderers . Count - 1 ; i >= 0 ; i -- ) {
@@ -1424,20 +1474,9 @@ protected internal virtual void AddAllProperties(IDictionary<int, Object> proper
1424
1474
return null ;
1425
1475
}
1426
1476
1427
- /// <summary>Applies margins of the renderer on the given rectangle</summary>
1428
- /// <param name="rect">a rectangle margins will be applied on.</param>
1429
- /// <param name="reverse">
1430
- /// indicates whether margins will be applied
1431
- /// inside (in case of false) or outside (in case of true) the rectangle.
1432
- /// </param>
1433
- /// <returns>
1434
- /// a
1435
- /// <see cref="iText.Kernel.Geom.Rectangle">border box</see>
1436
- /// of the renderer
1437
- /// </returns>
1438
- /// <seealso cref="GetMargins()"/>
1439
- protected internal virtual Rectangle ApplyMargins ( Rectangle rect , bool reverse ) {
1440
- return this . ApplyMargins ( rect , GetMargins ( ) , reverse ) ;
1477
+ protected internal virtual bool AllowLastYLineRecursiveExtraction ( ) {
1478
+ return ! IsOverflowProperty ( OverflowPropertyValue . HIDDEN , Property . OVERFLOW_X ) && ! IsOverflowProperty ( OverflowPropertyValue
1479
+ . HIDDEN , Property . OVERFLOW_Y ) ;
1441
1480
}
1442
1481
1443
1482
/// <summary>Applies given margins on the given rectangle</summary>
@@ -1497,22 +1536,6 @@ protected internal virtual UnitValue[] GetPaddings() {
1497
1536
return GetPaddings ( this ) ;
1498
1537
}
1499
1538
1500
- /// <summary>Applies paddings of the renderer on the given rectangle</summary>
1501
- /// <param name="rect">a rectangle paddings will be applied on.</param>
1502
- /// <param name="reverse">
1503
- /// indicates whether paddings will be applied
1504
- /// inside (in case of false) or outside (in case of false) the rectangle.
1505
- /// </param>
1506
- /// <returns>
1507
- /// a
1508
- /// <see cref="iText.Kernel.Geom.Rectangle">border box</see>
1509
- /// of the renderer
1510
- /// </returns>
1511
- /// <seealso cref="GetPaddings()"/>
1512
- protected internal virtual Rectangle ApplyPaddings ( Rectangle rect , bool reverse ) {
1513
- return ApplyPaddings ( rect , GetPaddings ( ) , reverse ) ;
1514
- }
1515
-
1516
1539
/// <summary>Applies given paddings on the given rectangle</summary>
1517
1540
/// <param name="rect">a rectangle paddings will be applied on.</param>
1518
1541
/// <param name="paddings">the paddings to be applied on the given rectangle</param>
@@ -1550,26 +1573,6 @@ protected internal virtual Rectangle ApplyPaddings(Rectangle rect, UnitValue[] p
1550
1573
3 ] . GetValue ( ) , reverse ) ;
1551
1574
}
1552
1575
1553
- /// <summary>
1554
- /// Applies the border box of the renderer on the given rectangle
1555
- /// If the border of a certain side is null, the side will remain as it was.
1556
- /// </summary>
1557
- /// <param name="rect">a rectangle the border box will be applied on.</param>
1558
- /// <param name="reverse">
1559
- /// indicates whether the border box will be applied
1560
- /// inside (in case of false) or outside (in case of false) the rectangle.
1561
- /// </param>
1562
- /// <returns>
1563
- /// a
1564
- /// <see cref="iText.Kernel.Geom.Rectangle">border box</see>
1565
- /// of the renderer
1566
- /// </returns>
1567
- /// <seealso cref="GetBorders()"/>
1568
- protected internal virtual Rectangle ApplyBorderBox ( Rectangle rect , bool reverse ) {
1569
- Border [ ] borders = GetBorders ( ) ;
1570
- return ApplyBorderBox ( rect , borders , reverse ) ;
1571
- }
1572
-
1573
1576
/// <summary>Applies the given border box (borders) on the given rectangle</summary>
1574
1577
/// <param name="rect">a rectangle paddings will be applied on.</param>
1575
1578
/// <param name="borders">
0 commit comments