diff --git a/itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs b/itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs index 4ad4172402..1432c8314c 100644 --- a/itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs +++ b/itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs @@ -28,7 +28,6 @@ You should have received a copy of the GNU Affero General Public License using iText.Kernel.Utils; using iText.Layout; using iText.Layout.Borders; -using iText.Layout.Exceptions; using iText.Layout.Properties; using iText.Layout.Properties.Grid; using iText.Test; @@ -344,12 +343,48 @@ public virtual void FixedColumnRowGoesFirstTest() { } [NUnit.Framework.Test] - public virtual void OverlapWithExistingColumnTest() { - String filename = DESTINATION_FOLDER + "overlapWithExistingColumnTest.pdf"; + public virtual void OverlapWithExistingItemTest() { + String filename = DESTINATION_FOLDER + "overlapWithExistingItemTest.pdf"; + String cmpName = SOURCE_FOLDER + "cmp_overlapWithExistingItemTest.pdf"; IList templateColumns = new List(); - templateColumns.Add(new PointValue(100.0f)); - templateColumns.Add(new PointValue(100.0f)); - templateColumns.Add(new PointValue(100.0f)); + templateColumns.Add(MinContentValue.VALUE); + templateColumns.Add(MinContentValue.VALUE); + templateColumns.Add(MinContentValue.VALUE); + using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { + GridContainer grid = new GridContainer(); + SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); + grid.SetProperty(Property.GRID_TEMPLATE_COLUMNS, templateColumns); + Paragraph paragraph1 = new Paragraph("Two"); + paragraph1.SetProperty(Property.GRID_COLUMN_START, 1); + paragraph1.SetProperty(Property.GRID_COLUMN_END, 3); + paragraph1.SetProperty(Property.GRID_ROW_START, 1); + paragraph1.SetProperty(Property.GRID_ROW_END, 3); + paragraph1.SetBorder(border); + grid.Add(paragraph1); + grid.Add(new Paragraph("Three").SetBorder(border)); + grid.Add(new Paragraph("Four").SetBorder(border)); + grid.Add(new Paragraph("Five").SetBorder(border)); + Paragraph paragraph2 = new Paragraph("One (long content)"); + paragraph2.SetProperty(Property.GRID_COLUMN_START, 1); + paragraph2.SetProperty(Property.GRID_COLUMN_END, 2); + paragraph2.SetProperty(Property.GRID_ROW_START, 1); + paragraph2.SetProperty(Property.GRID_ROW_END, 2); + paragraph2.SetBorder(border); + grid.Add(paragraph2); + document.Add(grid); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(filename, cmpName, DESTINATION_FOLDER, "diff_" + )); + } + + [NUnit.Framework.Test] + public virtual void CoverExistingItemTest() { + String filename = DESTINATION_FOLDER + "coverExistingItemTest.pdf"; + String cmpName = SOURCE_FOLDER + "cmp_coverExistingItemTest.pdf"; + IList templateColumns = new List(); + templateColumns.Add(MinContentValue.VALUE); + templateColumns.Add(MinContentValue.VALUE); + templateColumns.Add(MinContentValue.VALUE); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); @@ -364,16 +399,17 @@ public virtual void OverlapWithExistingColumnTest() { grid.Add(new Paragraph("Three").SetBorder(border)); grid.Add(new Paragraph("Four").SetBorder(border)); grid.Add(new Paragraph("Five").SetBorder(border)); - Paragraph paragraph2 = new Paragraph("One"); + Paragraph paragraph2 = new Paragraph("One (long content)"); paragraph2.SetProperty(Property.GRID_COLUMN_START, 1); paragraph2.SetProperty(Property.GRID_COLUMN_END, 3); paragraph2.SetProperty(Property.GRID_ROW_START, 1); paragraph2.SetProperty(Property.GRID_ROW_END, 3); paragraph2.SetBorder(border); grid.Add(paragraph2); - Exception e = NUnit.Framework.Assert.Catch(typeof(ArgumentException), () => document.Add(grid)); - NUnit.Framework.Assert.AreEqual(LayoutExceptionMessageConstant.INVALID_CELL_INDEXES, e.Message); + document.Add(grid); } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(filename, cmpName, DESTINATION_FOLDER, "diff_" + )); } [NUnit.Framework.Test] diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_coverExistingItemTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_coverExistingItemTest.pdf new file mode 100644 index 0000000000..1487e68af2 Binary files /dev/null and b/itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_coverExistingItemTest.pdf differ diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_overlapWithExistingItemTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_overlapWithExistingItemTest.pdf new file mode 100644 index 0000000000..1aecbe067b Binary files /dev/null and b/itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_overlapWithExistingItemTest.pdf differ diff --git a/itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/resolve/shorthand/GapShorthandResolverTest.cs b/itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/resolve/shorthand/GapShorthandResolverTest.cs index 29fa43ce56..79c75e2ca2 100644 --- a/itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/resolve/shorthand/GapShorthandResolverTest.cs +++ b/itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/resolve/shorthand/GapShorthandResolverTest.cs @@ -131,6 +131,18 @@ public virtual void GapWithTwoValidValuesTest() { NUnit.Framework.Assert.AreEqual("15px", resolvedShorthand[1].GetExpression()); } + [NUnit.Framework.Test] + public virtual void GridGapWithTwoValidValuesTest() { + IShorthandResolver resolver = new GapShorthandResolver(CommonCssConstants.GRID_GAP); + String shorthand = "10px 15px"; + IList resolvedShorthand = resolver.ResolveShorthand(shorthand); + NUnit.Framework.Assert.AreEqual(2, resolvedShorthand.Count); + NUnit.Framework.Assert.AreEqual(CommonCssConstants.ROW_GAP, resolvedShorthand[0].GetProperty()); + NUnit.Framework.Assert.AreEqual("10px", resolvedShorthand[0].GetExpression()); + NUnit.Framework.Assert.AreEqual(CommonCssConstants.COLUMN_GAP, resolvedShorthand[1].GetProperty()); + NUnit.Framework.Assert.AreEqual("15px", resolvedShorthand[1].GetExpression()); + } + [NUnit.Framework.Test] [LogMessage(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION)] public virtual void GapWithValidAndInvalidValuesTest() { diff --git a/itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/validate/CssDeclarationValidationMasterTest.cs b/itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/validate/CssDeclarationValidationMasterTest.cs index 1e8a5d7312..66af6da2ad 100644 --- a/itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/validate/CssDeclarationValidationMasterTest.cs +++ b/itext.tests/itext.styledxmlparser.tests/itext/styledxmlparser/css/validate/CssDeclarationValidationMasterTest.cs @@ -426,6 +426,24 @@ public virtual void MulticolValidationTest() { .COLUMN_GAP, "10"))); } + [NUnit.Framework.Test] + public virtual void GridRowColumnGapTest() { + NUnit.Framework.Assert.IsTrue(CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(CommonCssConstants + .GRID_ROW_GAP, "normal"))); + NUnit.Framework.Assert.IsTrue(CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(CommonCssConstants + .GRID_COLUMN_GAP, "30px"))); + NUnit.Framework.Assert.IsTrue(CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(CommonCssConstants + .GRID_ROW_GAP, "15%"))); + NUnit.Framework.Assert.IsTrue(CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(CommonCssConstants + .GRID_ROW_GAP, "2em"))); + NUnit.Framework.Assert.IsTrue(CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(CommonCssConstants + .GRID_COLUMN_GAP, "3rem"))); + NUnit.Framework.Assert.IsFalse(CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(CommonCssConstants + .GRID_COLUMN_GAP, "-5em"))); + NUnit.Framework.Assert.IsFalse(CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(CommonCssConstants + .GRID_ROW_GAP, "10"))); + } + [NUnit.Framework.Test] public virtual void ChangeValidatorTest() { try { diff --git a/itext/itext.kernel/itext/kernel/pdf/canvas/parser/data/ImageRenderInfo.cs b/itext/itext.kernel/itext/kernel/pdf/canvas/parser/data/ImageRenderInfo.cs index fb6fc08be2..c69e86f5ff 100644 --- a/itext/itext.kernel/itext/kernel/pdf/canvas/parser/data/ImageRenderInfo.cs +++ b/itext/itext.kernel/itext/kernel/pdf/canvas/parser/data/ImageRenderInfo.cs @@ -96,7 +96,7 @@ public ImageRenderInfo(Stack canvasTagHierarchy, CanvasGraphicsState /// /// with /// - /// ; + /// ; // Android-Conversion-Skip-Line (java.awt library isn't available on Android) /// /// /// diff --git a/itext/itext.layout/itext/layout/exceptions/LayoutExceptionMessageConstant.cs b/itext/itext.layout/itext/layout/exceptions/LayoutExceptionMessageConstant.cs index 0085777eb1..18613acbfc 100644 --- a/itext/itext.layout/itext/layout/exceptions/LayoutExceptionMessageConstant.cs +++ b/itext/itext.layout/itext/layout/exceptions/LayoutExceptionMessageConstant.cs @@ -59,8 +59,6 @@ public sealed class LayoutExceptionMessageConstant { public const String INVALID_COLUMN_PROPERTIES = "Invalid column-count/column-width/column-gap properties, they're absent or have negative value"; - public const String INVALID_CELL_INDEXES = "Invalid grid-column/grid-row properties, cells overlapping"; - public const String INVALID_FONT_PROPERTY_VALUE = "Invalid FONT property value type."; public const String TAGGING_HINTKEY_SHOULD_HAVE_ACCES = "TaggingHintKey should have accessibility properties"; diff --git a/itext/itext.layout/itext/layout/renderer/Grid.cs b/itext/itext.layout/itext/layout/renderer/Grid.cs index 4b39123fa9..10a0f5cbda 100644 --- a/itext/itext.layout/itext/layout/renderer/Grid.cs +++ b/itext/itext.layout/itext/layout/renderer/Grid.cs @@ -24,7 +24,6 @@ You should have received a copy of the GNU Affero General Public License using System.Collections.Generic; using System.Linq; using iText.Commons.Utils; -using iText.Layout.Exceptions; using iText.Layout.Properties.Grid; namespace iText.Layout.Renderer { @@ -42,6 +41,8 @@ internal class Grid { //Using array list instead of array for .NET portability private readonly IList> uniqueCells = new List>(2); + private readonly IList itemsWithoutPlace = new List(); + //\cond DO_NOT_DOCUMENT /// Creates a new grid instance. /// initial number of row for the grid @@ -138,6 +139,7 @@ internal virtual ICollection GetUniqueGridCells(Grid.GridOrder iterati } } } + result.AddAll(itemsWithoutPlace); uniqueCells[(int)(iterationOrder)] = result; return result; } @@ -149,6 +151,7 @@ internal virtual ICollection GetUniqueGridCells(Grid.GridOrder iterati } } } + result.AddAll(itemsWithoutPlace); uniqueCells[(int)(iterationOrder)] = result; return result; } @@ -224,11 +227,18 @@ internal virtual int CollapseNullLines(Grid.GridOrder order, int minSize) { /// Add cell in the grid, checking that it would fit and initializing it bottom left corner (x, y). /// cell to and in the grid private void AddCell(GridCell cell) { + bool placeFound = false; for (int i = cell.GetRowStart(); i < cell.GetRowEnd(); ++i) { for (int j = cell.GetColumnStart(); j < cell.GetColumnEnd(); ++j) { - rows[i][j] = cell; + if (rows[i][j] == null) { + rows[i][j] = cell; + placeFound = true; + } } } + if (!placeFound) { + itemsWithoutPlace.Add(cell); + } } private int DetermineNullLinesStart(Grid.GridOrder order) { @@ -471,9 +481,10 @@ internal virtual void Fit(GridCell cell) { //Move grid view cursor pos = view.Next(); } - //If cell restricts both x and y position grow and can't be fitted on a grid, throw an excpetion + // If cell restricts both x and y position grow and can't be fitted on a grid, + // exit occupying fixed position if (view.IsFixed()) { - throw new ArgumentException(LayoutExceptionMessageConstant.INVALID_CELL_INDEXES); + break; } //If cell was not fitted while iterating grid, then there is not enough space to fit it, and grid //has to be resized diff --git a/itext/itext.layout/itext/layout/renderer/GridContainerRenderer.cs b/itext/itext.layout/itext/layout/renderer/GridContainerRenderer.cs index 55f1c52834..380412e436 100644 --- a/itext/itext.layout/itext/layout/renderer/GridContainerRenderer.cs +++ b/itext/itext.layout/itext/layout/renderer/GridContainerRenderer.cs @@ -93,6 +93,9 @@ public override LayoutResult Layout(LayoutContext layoutContext) { /// public override void AddChild(IRenderer renderer) { + // The grid's items are not affected by the 'float' and 'clear' properties. + // Still let clear them on renderer level not model element + renderer.SetProperty(Property.FLOAT, null); renderer.SetProperty(Property.OVERFLOW_X, OverflowPropertyValue.VISIBLE); renderer.SetProperty(Property.OVERFLOW_Y, OverflowPropertyValue.VISIBLE); renderer.SetProperty(Property.COLLAPSING_MARGINS, DetermineCollapsingMargins(renderer)); @@ -171,20 +174,19 @@ private GridContainerRenderer.GridLayoutResult LayoutGrid(LayoutContext layoutCo private static int ProcessLayoutResult(GridContainerRenderer.GridLayoutResult layoutResult, GridCell cell, LayoutResult cellResult) { - IRenderer cellToRenderer = cell.GetValue(); + IRenderer overflowRenderer = cellResult.GetOverflowRenderer(); if (cellResult.GetStatus() == LayoutResult.NOTHING) { - cellToRenderer.SetProperty(Property.GRID_COLUMN_START, cell.GetColumnStart() + 1); - cellToRenderer.SetProperty(Property.GRID_COLUMN_END, cell.GetColumnEnd() + 1); - cellToRenderer.SetProperty(Property.GRID_ROW_START, cell.GetRowStart() + 1); - cellToRenderer.SetProperty(Property.GRID_ROW_END, cell.GetRowEnd() + 1); - layoutResult.GetOverflowRenderers().Add(cellToRenderer); + overflowRenderer.SetProperty(Property.GRID_COLUMN_START, cell.GetColumnStart() + 1); + overflowRenderer.SetProperty(Property.GRID_COLUMN_END, cell.GetColumnEnd() + 1); + overflowRenderer.SetProperty(Property.GRID_ROW_START, cell.GetRowStart() + 1); + overflowRenderer.SetProperty(Property.GRID_ROW_END, cell.GetRowEnd() + 1); + layoutResult.GetOverflowRenderers().Add(overflowRenderer); layoutResult.SetCauseOfNothing(cellResult.GetCauseOfNothing()); return cell.GetRowStart(); } // PARTIAL + FULL result handling - layoutResult.GetSplitRenderers().Add(cellToRenderer); + layoutResult.GetSplitRenderers().Add(cell.GetValue()); if (cellResult.GetStatus() == LayoutResult.PARTIAL) { - IRenderer overflowRenderer = cellResult.GetOverflowRenderer(); overflowRenderer.SetProperty(Property.GRID_COLUMN_START, cell.GetColumnStart() + 1); overflowRenderer.SetProperty(Property.GRID_COLUMN_END, cell.GetColumnEnd() + 1); int rowStart = cell.GetRowStart() + 1; diff --git a/itext/itext.layout/itext/layout/renderer/GridItemRenderer.cs b/itext/itext.layout/itext/layout/renderer/GridItemRenderer.cs index 24c6175693..3a56f7775c 100644 --- a/itext/itext.layout/itext/layout/renderer/GridItemRenderer.cs +++ b/itext/itext.layout/itext/layout/renderer/GridItemRenderer.cs @@ -70,7 +70,14 @@ public override T1 GetProperty(int key) { case Property.GRID_ROW_START: case Property.GRID_ROW_END: case Property.GRID_ROW_SPAN: { - return renderer.GetProperty(key); + T1 ownValue = this.GetOwnProperty(key); + if (ownValue != null) { + return ownValue; + } + else { + return renderer.GetProperty(key); + } + goto default; } default: { @@ -93,18 +100,18 @@ public override void SetProperty(int property, Object value) { break; } - case Property.FILL_AVAILABLE_AREA: + case Property.FILL_AVAILABLE_AREA: { + renderer.SetProperty(property, value); + break; + } + + case Property.COLLAPSING_MARGINS: case Property.GRID_COLUMN_START: case Property.GRID_COLUMN_END: case Property.GRID_COLUMN_SPAN: case Property.GRID_ROW_START: case Property.GRID_ROW_END: case Property.GRID_ROW_SPAN: { - renderer.SetProperty(property, value); - break; - } - - case Property.COLLAPSING_MARGINS: { base.SetProperty(property, value); break; } diff --git a/itext/itext.styledxmlparser/itext/styledxmlparser/css/CommonCssConstants.cs b/itext/itext.styledxmlparser/itext/styledxmlparser/css/CommonCssConstants.cs index 9b69be2420..9ae275d296 100644 --- a/itext/itext.styledxmlparser/itext/styledxmlparser/css/CommonCssConstants.cs +++ b/itext/itext.styledxmlparser/itext/styledxmlparser/css/CommonCssConstants.cs @@ -331,12 +331,21 @@ static CommonCssConstants() { /// The Constant GRID_COLUMN_END. public const String GRID_COLUMN_END = "grid-column-end"; + /// The Constant GRID_COLUMN_GAP. + public const String GRID_COLUMN_GAP = "grid-column-gap"; + /// The Constant GRID_COLUMN_START. public const String GRID_COLUMN_START = "grid-column-start"; + /// The Constant GRID_GAP. + public const String GRID_GAP = "grid-gap"; + /// The Constant GRID_ROW_END. public const String GRID_ROW_END = "grid-row-end"; + /// The Constant GRID_ROW_GAP. + public const String GRID_ROW_GAP = "grid-row-gap"; + /// The Constant GRID_ROW_START. public const String GRID_ROW_START = "grid-row-start"; diff --git a/itext/itext.styledxmlparser/itext/styledxmlparser/css/resolve/shorthand/ShorthandResolverFactory.cs b/itext/itext.styledxmlparser/itext/styledxmlparser/css/resolve/shorthand/ShorthandResolverFactory.cs index 7477334e5d..b63a108341 100644 --- a/itext/itext.styledxmlparser/itext/styledxmlparser/css/resolve/shorthand/ShorthandResolverFactory.cs +++ b/itext/itext.styledxmlparser/itext/styledxmlparser/css/resolve/shorthand/ShorthandResolverFactory.cs @@ -52,7 +52,8 @@ static ShorthandResolverFactory() { shorthandResolvers.Put(CommonCssConstants.TEXT_DECORATION, new TextDecorationShorthandResolver()); shorthandResolvers.Put(CommonCssConstants.FLEX, new FlexShorthandResolver()); shorthandResolvers.Put(CommonCssConstants.FLEX_FLOW, new FlexFlowShorthandResolver()); - shorthandResolvers.Put(CommonCssConstants.GAP, new GapShorthandResolver()); + shorthandResolvers.Put(CommonCssConstants.GAP, new GapShorthandResolver(CommonCssConstants.GAP)); + shorthandResolvers.Put(CommonCssConstants.GRID_GAP, new GapShorthandResolver(CommonCssConstants.GRID_GAP)); shorthandResolvers.Put(CommonCssConstants.PLACE_ITEMS, new PlaceItemsShorthandResolver()); shorthandResolvers.Put(CommonCssConstants.COLUMNS, new ColumnsShorthandResolver()); shorthandResolvers.Put(CommonCssConstants.COLUMN_RULE, new ColumnRuleShortHandResolver()); diff --git a/itext/itext.styledxmlparser/itext/styledxmlparser/css/resolve/shorthand/impl/GapShorthandResolver.cs b/itext/itext.styledxmlparser/itext/styledxmlparser/css/resolve/shorthand/impl/GapShorthandResolver.cs index f78652b3ac..5cca4d3cc8 100644 --- a/itext/itext.styledxmlparser/itext/styledxmlparser/css/resolve/shorthand/impl/GapShorthandResolver.cs +++ b/itext/itext.styledxmlparser/itext/styledxmlparser/css/resolve/shorthand/impl/GapShorthandResolver.cs @@ -31,8 +31,39 @@ You should have received a copy of the GNU Affero General Public License using iText.StyledXmlParser.Css.Validate; namespace iText.StyledXmlParser.Css.Resolve.Shorthand.Impl { + /// + /// Shorthand resolver for gap shorthand properties, can be used for + /// different gap properties like + /// gap + /// or + /// grid-gap. + /// public class GapShorthandResolver : IShorthandResolver { - private static readonly ILogger LOGGER = ITextLogManager.GetLogger(typeof(GapShorthandResolver)); + private readonly String gapShorthandProperty; + + /// + /// Instantiates default + /// + /// for + /// gap + /// shorthand. + /// + public GapShorthandResolver() + : this(CommonCssConstants.GAP) { + } + + /// + /// Instantiates default + /// + /// for passed gap shorthand. + /// + /// the name of the gap shorthand property + public GapShorthandResolver(String gapShorthandProperty) { + this.gapShorthandProperty = gapShorthandProperty; + } + + private static readonly ILogger LOGGER = ITextLogManager.GetLogger(typeof(iText.StyledXmlParser.Css.Resolve.Shorthand.Impl.GapShorthandResolver + )); /// public virtual IList ResolveShorthand(String shorthandExpression) { @@ -43,11 +74,11 @@ public virtual IList ResolveShorthand(String shorthandExpression } if (CssTypesValidationUtils.ContainsInitialOrInheritOrUnset(shorthandExpression)) { return HandleExpressionError(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION - , CommonCssConstants.GAP, shorthandExpression); + , gapShorthandProperty, shorthandExpression); } if (String.IsNullOrEmpty(shorthandExpression)) { return HandleExpressionError(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.SHORTHAND_PROPERTY_CANNOT_BE_EMPTY - , CommonCssConstants.GAP, shorthandExpression); + , gapShorthandProperty, shorthandExpression); } String[] gapProps = iText.Commons.Utils.StringUtil.Split(shorthandExpression, " "); if (gapProps.Length == 1) { @@ -59,7 +90,7 @@ public virtual IList ResolveShorthand(String shorthandExpression } else { return HandleExpressionError(iText.StyledXmlParser.Logs.StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION - , CommonCssConstants.GAP, shorthandExpression); + , gapShorthandProperty, shorthandExpression); } } } diff --git a/itext/itext.styledxmlparser/itext/styledxmlparser/css/validate/impl/CssDefaultValidator.cs b/itext/itext.styledxmlparser/itext/styledxmlparser/css/validate/impl/CssDefaultValidator.cs index f84facb810..0ebe0619e0 100644 --- a/itext/itext.styledxmlparser/itext/styledxmlparser/css/validate/impl/CssDefaultValidator.cs +++ b/itext/itext.styledxmlparser/itext/styledxmlparser/css/validate/impl/CssDefaultValidator.cs @@ -85,14 +85,16 @@ public CssDefaultValidator() { defaultValidators.Put(CommonCssConstants.LINE_HEIGHT, new MultiTypeDeclarationValidator(new CssNumberValueValidator (false), new CssLengthValueValidator(false), new CssPercentageValueValidator(false), normalValidator, inheritInitialUnsetValidator)); - defaultValidators.Put(CommonCssConstants.COLUMN_GAP, new MultiTypeDeclarationValidator(new CssLengthValueValidator - (false), new CssPercentageValueValidator(false), normalValidator)); + MultiTypeDeclarationValidator gapValidator = new MultiTypeDeclarationValidator(new CssLengthValueValidator + (false), new CssPercentageValueValidator(false), normalValidator, inheritInitialUnsetValidator); + defaultValidators.Put(CommonCssConstants.COLUMN_GAP, gapValidator); + defaultValidators.Put(CommonCssConstants.GRID_COLUMN_GAP, gapValidator); defaultValidators.Put(CommonCssConstants.COLUMN_WIDTH, new MultiTypeDeclarationValidator(new CssLengthValueValidator (false), new CssPercentageValueValidator(false), new CssEnumValidator(CommonCssConstants.AUTO))); defaultValidators.Put(CommonCssConstants.COLUMN_COUNT, new MultiTypeDeclarationValidator(new CssIntegerNumberValueValidator (false, false), new CssEnumValidator(CommonCssConstants.AUTO))); - defaultValidators.Put(CommonCssConstants.ROW_GAP, new MultiTypeDeclarationValidator(new CssLengthValueValidator - (false), new CssPercentageValueValidator(false), normalValidator, inheritInitialUnsetValidator)); + defaultValidators.Put(CommonCssConstants.ROW_GAP, gapValidator); + defaultValidators.Put(CommonCssConstants.GRID_ROW_GAP, gapValidator); defaultValidators.Put(CommonCssConstants.FLEX_GROW, new MultiTypeDeclarationValidator(new CssNumberValueValidator (false), inheritInitialUnsetValidator)); defaultValidators.Put(CommonCssConstants.FLEX_SHRINK, new MultiTypeDeclarationValidator(new CssNumberValueValidator diff --git a/port-hash b/port-hash index 0c73e6bc49..0bd73f67c3 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -e054c7abf957145ef4dcd2d3a8628b7c8bf24b7a +5a8f86d5e1ee424e95f9bae23d0ae30f8a971989