Skip to content

Commit d7c5230

Browse files
committed
Update max-width handling for images.
Update background with zero size warning: it is not an error. DEVSIX-1195 Autoported commit. Original commit hash: [36b7b2ab1]
1 parent 736d760 commit d7c5230

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

itext/itext.layout/itext/layout/renderer/AbstractRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public virtual void DrawBackground(DrawContext drawContext) {
462462
Rectangle backgroundArea = ApplyMargins(bBox, false);
463463
if (backgroundArea.GetWidth() <= 0 || backgroundArea.GetHeight() <= 0) {
464464
ILogger logger = LoggerFactory.GetLogger(typeof(iText.Layout.Renderer.AbstractRenderer));
465-
logger.Error(MessageFormatUtil.Format(iText.IO.LogMessageConstant.RECTANGLE_HAS_NEGATIVE_OR_ZERO_SIZES, "background"
465+
logger.Warn(MessageFormatUtil.Format(iText.IO.LogMessageConstant.RECTANGLE_HAS_NEGATIVE_OR_ZERO_SIZES, "background"
466466
));
467467
return;
468468
}
@@ -486,7 +486,7 @@ public virtual void DrawBackground(DrawContext drawContext) {
486486
GetImage().GetHeight(), backgroundImage.GetImage().GetWidth(), backgroundImage.GetImage().GetHeight());
487487
if (imageRectangle.GetWidth() <= 0 || imageRectangle.GetHeight() <= 0) {
488488
ILogger logger = LoggerFactory.GetLogger(typeof(iText.Layout.Renderer.AbstractRenderer));
489-
logger.Error(MessageFormatUtil.Format(iText.IO.LogMessageConstant.RECTANGLE_HAS_NEGATIVE_OR_ZERO_SIZES, "background-image"
489+
logger.Warn(MessageFormatUtil.Format(iText.IO.LogMessageConstant.RECTANGLE_HAS_NEGATIVE_OR_ZERO_SIZES, "background-image"
490490
));
491491
return;
492492
}

itext/itext.layout/itext/layout/renderer/ImageRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public ImageRenderer(Image image)
9999
public override LayoutResult Layout(LayoutContext layoutContext) {
100100
LayoutArea area = layoutContext.GetArea().Clone();
101101
Rectangle layoutBox = area.GetBBox().Clone();
102-
float? retrievedWidth = RetrieveWidth(layoutBox.GetWidth());
102+
float? retrievedWidth = HasProperty(Property.WIDTH) ? RetrieveWidth(layoutBox.GetWidth()) : null;
103103
IList<Rectangle> floatRendererAreas = layoutContext.GetFloatRendererAreas();
104104
float clearHeightCorrection = FloatingHelper.CalculateClearHeightCorrection(this, floatRendererAreas, layoutBox
105105
);

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6050baf43726dc4ce3100fd436758dce7eaa63e2
1+
36b7b2ab1debbcf4abb399de672d2ee2c03eea4d

0 commit comments

Comments
 (0)