diff options
-rw-r--r-- | fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java | 10 | ||||
-rw-r--r-- | fop/test/layoutengine/standard-testcases/wrapper_space.xml | 53 |
2 files changed, 63 insertions, 0 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java index ff2c59f4a..c6a2b05b2 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java @@ -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; + } } diff --git a/fop/test/layoutengine/standard-testcases/wrapper_space.xml b/fop/test/layoutengine/standard-testcases/wrapper_space.xml new file mode 100644 index 000000000..e90f3b1ae --- /dev/null +++ b/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> |