|
| 1 | +/* |
| 2 | + This file is part of the iText (R) project. |
| 3 | + Copyright (c) 1998-2024 Apryse Group NV |
| 4 | + Authors: Apryse Software. |
| 5 | +
|
| 6 | + This program is offered under a commercial and under the AGPL license. |
| 7 | + For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. |
| 8 | +
|
| 9 | + AGPL licensing: |
| 10 | + This program is free software: you can redistribute it and/or modify |
| 11 | + it under the terms of the GNU Affero General Public License as published by |
| 12 | + the Free Software Foundation, either version 3 of the License, or |
| 13 | + (at your option) any later version. |
| 14 | +
|
| 15 | + This program is distributed in the hope that it will be useful, |
| 16 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + GNU Affero General Public License for more details. |
| 19 | +
|
| 20 | + You should have received a copy of the GNU Affero General Public License |
| 21 | + along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 22 | + */ |
| 23 | +package com.itextpdf.html2pdf.attach.impl.tags; |
| 24 | + |
| 25 | +import com.itextpdf.html2pdf.attach.ITagWorker; |
| 26 | +import com.itextpdf.html2pdf.attach.ProcessorContext; |
| 27 | +import com.itextpdf.layout.IPropertyContainer; |
| 28 | +import com.itextpdf.layout.element.GridContainer; |
| 29 | +import com.itextpdf.layout.element.IElement; |
| 30 | +import com.itextpdf.styledxmlparser.node.IElementNode; |
| 31 | + |
| 32 | +/** |
| 33 | + * {@link ITagWorker} implementation for elements with {@code display: grid}. |
| 34 | + */ |
| 35 | +public class DisplayGridTagWorker extends DivTagWorker { |
| 36 | + |
| 37 | + /** |
| 38 | + * Creates a new {@link DisplayGridTagWorker} instance. |
| 39 | + * |
| 40 | + * @param element the element |
| 41 | + * @param context the context |
| 42 | + */ |
| 43 | + public DisplayGridTagWorker(IElementNode element, ProcessorContext context) { |
| 44 | + super(element, context, new GridContainer()); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * {@inheritDoc} |
| 49 | + */ |
| 50 | + @Override |
| 51 | + public boolean processTagChild(ITagWorker childTagWorker, ProcessorContext context) { |
| 52 | + final IPropertyContainer element = childTagWorker.getElementResult(); |
| 53 | + if (childTagWorker instanceof BrTagWorker) { |
| 54 | + return super.processTagChild(childTagWorker, context); |
| 55 | + } else { |
| 56 | + return addBlockChild((IElement) element); |
| 57 | + } |
| 58 | + } |
| 59 | +} |
0 commit comments