Skip to content

Commit

Permalink
FOP-3177: Remove space generated by fo:wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsteiner1984 committed Apr 15, 2024
1 parent 1484cf8 commit 7b29d1d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
Expand Up @@ -19,6 +19,9 @@

package org.apache.fop.layoutmgr.inline;

import java.util.Collections;
import java.util.List;

import org.apache.fop.area.Block;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.fo.flow.Wrapper;
Expand Down Expand Up @@ -87,4 +90,11 @@ protected void addId() {
getPSLM().addIDToPage(fobj.getId());
}

public List getNextKnuthElements(LayoutContext context, int alignment) {
List list = super.getNextKnuthElements(context, alignment);
if (parentLayoutManager instanceof LineLayoutManager && !fobj.hasId() && fobj.hasChildren()) {
return Collections.emptyList();
}
return list;
}
}
53 changes: 53 additions & 0 deletions fop/test/layoutengine/standard-testcases/wrapper_space.xml
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Id$ -->
<testcase>
<info>
<p>
This test checks fo:wrapper surrounding block-level content.
</p>
</info>
<fo>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master margin-top="13mm" margin-bottom="5mm" margin-left="15mm" margin-right="16mm" page-width="210mm" page-height="297mm" master-name="First Page">
<fo:region-body margin-bottom="7mm" margin-left="0mm" margin-right="0mm" margin-top="67mm" region-name="Body"/>
<fo:region-before region-name="First Header" extent="65mm" background-color="yellow"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence format="1" id="th_default_sequence1" master-reference="First Page">
<fo:static-content flow-name="First Header">
<fo:block>
<fo:wrapper role="artifact">
<fo:block>
<fo:external-graphic scaling="uniform" src="url(test.png)" width="5cm" content-width="5cm" height="1.6cm" content-height="1.6cm" />
</fo:block>
</fo:wrapper>
</fo:block>
</fo:static-content>
<fo:flow flow-name="Body">
<fo:block>a</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
<eval expected="51138" xpath="//block/@bpd"/>
<eval expected="2" xpath="count(//lineArea)"/>
</checks>
</testcase>

0 comments on commit 7b29d1d

Please sign in to comment.