Ver código fonte

FOP-3177: Remove space generated by fo:wrapper

pull/80/merge
Simon Steiner 1 mês atrás
pai
commit
7b29d1d135

+ 10
- 0
fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java Ver arquivo

@@ -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;
@@ -87,4 +90,11 @@ public class WrapperLayoutManager extends LeafNodeLayoutManager {
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
- 0
fop/test/layoutengine/standard-testcases/wrapper_space.xml Ver arquivo

@@ -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>

Carregando…
Cancelar
Salvar