]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla #50763: Implemented non-standard behavior for basic-link areas, such that...
authorVincent Hennebert <vhennebert@apache.org>
Thu, 24 Mar 2011 18:14:23 +0000 (18:14 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Thu, 24 Mar 2011 18:14:23 +0000 (18:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1085058 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
src/java/org/apache/fop/area/inline/AbstractTextArea.java
src/java/org/apache/fop/area/inline/BasicLinkArea.java [new file with mode: 0644]
src/java/org/apache/fop/area/inline/InlineArea.java
src/java/org/apache/fop/area/inline/InlineParent.java
src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java
src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
status.xml
test/layoutengine/disabled-testcases.xml
test/layoutengine/standard-testcases/basic-link_external-destination_2.xml
test/layoutengine/standard-testcases/basic-link_height.xml [new file with mode: 0644]
test/layoutengine/standard-testcases/basic-link_height_baseline-shift.xml [new file with mode: 0644]
test/layoutengine/standard-testcases/basic-link_height_inline-child.xml [new file with mode: 0644]
test/layoutengine/standard-testcases/basic-link_height_multi-child.xml [new file with mode: 0644]
test/layoutengine/standard-testcases/basic-link_height_multi-line.xml [new file with mode: 0644]

index 08997a8179ea8dd511b91b4381654206ed0fa89d..1558e81608e1e49fec6bc6bef888dfd00e719e11 100644 (file)
@@ -185,4 +185,15 @@ public abstract class AbstractTextArea extends InlineParent {
     public void setBaselineOffset(int baselineOffset) {
         this.baselineOffset = baselineOffset;
     }
+
+    @Override
+    int getVirtualOffset() {
+        return getOffset();
+    }
+
+    @Override
+    int getVirtualBPD() {
+        /* Word and space areas don't have a properly set bpd; return this area's bpd instead. */
+        return getBPD();
+    }
 }
diff --git a/src/java/org/apache/fop/area/inline/BasicLinkArea.java b/src/java/org/apache/fop/area/inline/BasicLinkArea.java
new file mode 100644 (file)
index 0000000..fce9139
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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$ */
+
+package org.apache.fop.area.inline;
+
+import org.apache.fop.area.Area;
+
+/**
+ * An inline area produced by an fo:basic-link element. This class implements a different
+ * behavior to what is prescribed by the XSL-FO 1.1 Recommendation. With the standard
+ * behavior, there is no easy way to make a link cover e.g. a whole image.
+ *
+ * <p>See following bug report at W3C's:
+ * http://www.w3.org/Bugs/Public/show_bug.cgi?id=11672</p>
+ */
+public class BasicLinkArea extends InlineParent {
+
+    private static final long serialVersionUID = 5183753430412208151L;
+
+    @Override
+    public void setParentArea(Area parentArea) {
+        super.setParentArea(parentArea);
+        /*
+         * Perform necessary modifications to make this area encompass all of its children
+         * elements, so as to have a useful active area. We assume that this method is
+         * called after all of the children areas have been added to this area.
+         */
+        /* Make this area start at its beforest child. */
+        setOffset(getOffset() + minChildOffset);
+        /* Update children offsets accordingly. */
+        for (InlineArea inline : inlines) {
+            inline.setOffset(inline.getOffset() - minChildOffset);
+        }
+        setBPD(getVirtualBPD());
+    }
+
+}
index 515f45b6835ac1ad1ae6fab1f0d404d5e40fc38c..d62e6f721522934b503844f0b4a02f2508657ef6 100644 (file)
@@ -251,5 +251,32 @@ public class InlineArea extends Area {
             storedIPDVariation += ipdVariation;
         }
     }
+
+    /**
+     * Returns the offset that this area would have if its offset and size were taking
+     * children areas into account. The bpd of an inline area is taken from its nominal
+     * font and doesn't depend on the bpds of its children elements. However, in the case
+     * of a basic-link element we want the active area to cover all of the children
+     * elements.
+     *
+     * @return the offset that this area would have if the before-edge of its
+     * content-rectangle were coinciding with the <q>beforest</q> before-edge of its
+     * children allocation-rectangles.
+     * @see #getVirtualBPD()
+     * @see BasicLinkArea
+     */
+    int getVirtualOffset() {
+        return getOffset();
+    }
+
+    /**
+     * Returns the block-progression-dimension that this area would have if it were taking
+     * its children elements into account. See {@linkplain #getVirtualOffset()}.
+     *
+     * @return the bpd
+     */
+    int getVirtualBPD() {
+        return getBPD();
+    }
 }
 
index db8f2f056f7a461bf4992c3611bdc9b3657e33bd..521080469fdb5e2e51fbcf069491a69d4b6dc221 100644 (file)
@@ -39,31 +39,42 @@ public class InlineParent extends InlineArea {
     /** Controls whether the IPD is automatically adjusted based on the area's children. */
     protected transient boolean autoSize;
 
-    /**
-     * Create a new inline parent to add areas to.
-     */
-    public InlineParent() {
-    }
+    /** The offset of the <q>beforest</q> child area of this area. */
+    protected int minChildOffset;
 
     /**
-     * Override generic Area method.
-     *
-     * @param childArea the child area to add
+     * The offset of the <q>afterest</q> child area of this area. Offset from the
+     * before-edge of this area's content-rectangle and the after-edge of the child area's
+     * allocation-rectangle.
      */
+    private int maxAfterEdge;
+
     @Override
-    public void addChildArea(Area childArea) {
+    public void addChildArea(Area c) {
+        assert c instanceof InlineArea;
         if (inlines.size() == 0) {
             autoSize = (getIPD() == 0);
         }
-        if (childArea instanceof InlineArea) {
-            InlineArea inlineChildArea = (InlineArea) childArea;
-            inlines.add(inlineChildArea);
-            // set the parent area for the child area
-            inlineChildArea.setParentArea(this);
-            if (autoSize) {
-                increaseIPD(inlineChildArea.getAllocIPD());
-            }
+        InlineArea childArea = (InlineArea) c;
+        inlines.add(childArea);
+        // set the parent area for the child area
+        childArea.setParentArea(this);
+        if (autoSize) {
+            increaseIPD(childArea.getAllocIPD());
         }
+        int childOffset = childArea.getVirtualOffset();
+        minChildOffset = Math.min(minChildOffset, childOffset);
+        maxAfterEdge = Math.max(maxAfterEdge, childOffset + childArea.getVirtualBPD());
+    }
+
+    @Override
+    int getVirtualOffset() {
+        return getOffset() + minChildOffset;
+    }
+
+    @Override
+    int getVirtualBPD() {
+        return maxAfterEdge - minChildOffset;
     }
 
     /**
@@ -98,5 +109,6 @@ public class InlineParent extends InlineArea {
 
         return hasUnresolvedAreas;
     }
+
 }
 
index eef649c972e71e0524ef71a6152033e6bb3a0f7e..40c9a324e1e58e2d713ccc020e01c3ab723fefa7 100644 (file)
@@ -21,7 +21,9 @@ package org.apache.fop.layoutmgr.inline;
 
 import org.apache.fop.area.LinkResolver;
 import org.apache.fop.area.Trait;
+import org.apache.fop.area.inline.BasicLinkArea;
 import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.area.inline.InlineParent;
 import org.apache.fop.datatypes.URISpecification;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.flow.BasicLink;
@@ -77,4 +79,10 @@ public class BasicLinkLayoutManager extends InlineLayoutManager {
             }
         }
     }
+
+    @Override
+    protected InlineParent createInlineParent() {
+        return new BasicLinkArea();
+    }
+
 }
index 085174fae678531ef6d4417b6a9c86f4a7af184d..9563b491ee7759fd870426de7dfecc3275fe0358 100644 (file)
@@ -198,13 +198,13 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
     /**
      * Create and initialize an <code>InlineArea</code>
      *
-     * @param hasInlineParent   true if the parent is an inline
+     * @param isInline   true if the parent is an inline
      * @return the area
      */
-    protected InlineArea createArea(boolean hasInlineParent) {
+    protected InlineArea createArea(boolean isInline) {
         InlineArea area;
-        if (hasInlineParent) {
-            area = new InlineParent();
+        if (isInline) {
+            area = createInlineParent();
             area.setOffset(0);
         } else {
             area = new InlineBlockParent();
@@ -215,6 +215,10 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
         return area;
     }
 
+    protected InlineParent createInlineParent() {
+        return new InlineParent();
+    }
+
     /** {@inheritDoc} */
     @Override
     protected void setTraits(boolean isNotFirst, boolean isNotLast) {
index 304c0817304495233c0913f5762c92df8a10cad0..20a77f567d01da1f565f553e13e9e8d686ef734a 100644 (file)
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Layout" dev="VH" type="fix" fixex-bug="50763">
+        Implemented non-standard behavior for basic-link areas, such that they take into account the 
+        heights of their descendants areas.
+      </action>
       <action context="Layout" dev="VH" type="fix">
         Bugfix: keep-together does not apply to fo:table-cell.
       </action>
index 6c61ca747b1ff322f5393b3fdae2d6f273fa532f..cd63ad03f5d29b568401aae384d51b94ef7759e4 100644 (file)
 <!-- $Id$ -->
 <!--DOCTYPE disabled-testcases SYSTEM "disabled-testcases.dtd"-->
 <disabled-testcases>
-  <testcase>
-    <name>External link around an SVG not properly sized</name>
-    <file>basic-link_external-destination_2.xml</file>
-    <description>The bpd trait of the inlineparent area for the basic-link
-    is not sized correctly if it wraps an image that is higher than the 
-    nominal line.</description>
-  </testcase>
   <testcase>
     <name>Auto-height block-containers produce fences</name>
     <file>block-container_space-before_space-after_3.xml</file>
index f804893ac627f3820eb08ca3c2617bdcc20719dc..0f00da82c68e24245c63e35be528bcd36fecf605 100644 (file)
     </fo:root>
   </fo>
   <checks>
-    <eval expected="192000" xpath="//inlineparent[@prod-id='link']/viewport/@ipd"/>
-    <eval expected="192000" xpath="//inlineparent[@prod-id='link']/viewport/@bpd"/>
-    
-    <eval expected="192000" xpath="//inlineparent[@prod-id='link']/@ipd"/>
-    <eval expected="192000" xpath="//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="144000" xpath="//inlineparent[@prod-id='link']/@ipd"/>
+    <eval expected="144000" xpath="//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="0"      xpath="//inlineparent[@prod-id='link']/@offset"/>
+
+    <eval expected="144000" xpath="//inlineparent[@prod-id='link']/viewport/@ipd"/>
+    <eval expected="144000" xpath="//inlineparent[@prod-id='link']/viewport/@bpd"/>
+    <eval expected="0"      xpath="//inlineparent[@prod-id='link']/viewport/@offset"/>
   </checks>
 </testcase>
diff --git a/test/layoutengine/standard-testcases/basic-link_height.xml b/test/layoutengine/standard-testcases/basic-link_height.xml
new file mode 100644 (file)
index 0000000..cb56f7f
--- /dev/null
@@ -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 the height of an fo:basic-link wrapping a bigger element.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page"
+          page-height="420pt" page-width="320pt" margin="10pt">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="page">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In in <fo:basic-link 
+              id="link" color="blue" 
+              external-destination="url(http://xmlgraphics.apache.org/fop/)"><fo:inline id="inline"
+                font-size="24pt" baseline-shift="12pt">egestas</fo:inline></fo:basic-link> nisi. 
+            Etiam at ante eget velit placerat ullamcorper.</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="84048" xpath="//inlineparent[@prod-id='link']/@ipd"/>
+    <eval expected="22200" xpath="//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="0"     xpath="//inlineparent[@prod-id='link']/@offset"/>
+
+    <eval expected="84048" xpath="//inlineparent[@prod-id='link']/inlineparent/@ipd"/>
+    <eval expected="22200" xpath="//inlineparent[@prod-id='link']/inlineparent/@bpd"/>
+    <eval expected="0"     xpath="//inlineparent[@prod-id='link']/inlineparent/@offset"/>
+  </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/basic-link_height_baseline-shift.xml b/test/layoutengine/standard-testcases/basic-link_height_baseline-shift.xml
new file mode 100644 (file)
index 0000000..582ef61
--- /dev/null
@@ -0,0 +1,62 @@
+<?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 the height of an fo:basic-link with baseline-shift.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page"
+          page-height="420pt" page-width="320pt" margin="10pt">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="page">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block font-size="40pt">Lorem ipsum dolor <fo:basic-link id="link" color="blue" 
+              font-size="12pt" external-destination="url(http://xmlgraphics.apache.org/fop/)" 
+              baseline-shift="-5pt">sit <fo:inline baseline-shift="5pt">amet,</fo:inline> <fo:inline 
+                font-size="24pt" baseline-shift="-10pt">consectetur</fo:inline> 
+              adipiscing</fo:basic-link>elit.</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <!-- First line -->
+    <eval expected="28584" xpath="//lineArea[2]//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="20104" xpath="//lineArea[2]//inlineparent[@prod-id='link']/@offset"/>
+
+    <eval expected="11100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/text[1]/@bpd"/>
+    <eval expected="5000"  xpath="//lineArea[2]//inlineparent[@prod-id='link']/text[1]/@offset"/>
+
+    <eval expected="11100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent[1]/@bpd"/>
+    <eval expected="0"     xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent[1]/@offset"/>
+
+    <eval expected="22200" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent[2]/@bpd"/>
+    <eval expected="6384"  xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent[2]/@offset"/>
+
+    <!-- Second line -->
+    <eval expected="11100" xpath="//lineArea[3]//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="25104" xpath="//lineArea[3]//inlineparent[@prod-id='link']/@offset"/>
+  </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/basic-link_height_inline-child.xml b/test/layoutengine/standard-testcases/basic-link_height_inline-child.xml
new file mode 100644 (file)
index 0000000..3b74781
--- /dev/null
@@ -0,0 +1,62 @@
+<?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 the height of an fo:basic-link having several child elements wrapped into a 
+      single fo:inline element.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page"
+          page-height="420pt" page-width="320pt" margin="10pt">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="page">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <fo:basic-link 
+              id="link" color="blue" 
+              external-destination="url(http://xmlgraphics.apache.org/fop/)"><fo:inline>In 
+                <fo:inline baseline-shift="12pt">in</fo:inline> <fo:inline font-size="24pt"
+                baseline-shift="-20pt">egestas</fo:inline> nisi</fo:inline></fo:basic-link>. Etiam 
+          at ante eget velit placerat ullamcorper.</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="45584"  xpath="//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="0"      xpath="//inlineparent[@prod-id='link']/@offset"/>
+
+    <eval expected="11100"  xpath="//inlineparent[@prod-id='link']/inlineparent/@bpd"/>
+    <eval expected="12000"  xpath="//inlineparent[@prod-id='link']/inlineparent/@offset"/>
+
+    <eval expected="11100"  xpath="//inlineparent[@prod-id='link']/inlineparent/text[1]/@bpd"/>
+    <eval expected="0"      xpath="//inlineparent[@prod-id='link']/inlineparent/text[1]/@offset"/>
+
+    <eval expected="11100"  xpath="//inlineparent[@prod-id='link']/inlineparent/inlineparent[1]/@bpd"/>
+    <eval expected="-12000" xpath="//inlineparent[@prod-id='link']/inlineparent/inlineparent[1]/@offset"/>
+
+    <eval expected="22200"  xpath="//inlineparent[@prod-id='link']/inlineparent/inlineparent[2]/@bpd"/>
+    <eval expected="11384"  xpath="//inlineparent[@prod-id='link']/inlineparent/inlineparent[2]/@offset"/>
+  </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/basic-link_height_multi-child.xml b/test/layoutengine/standard-testcases/basic-link_height_multi-child.xml
new file mode 100644 (file)
index 0000000..845a1d1
--- /dev/null
@@ -0,0 +1,58 @@
+<?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 the height of an fo:basic-link having several child elements.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page"
+          page-height="420pt" page-width="320pt" margin="10pt">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="page">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <fo:basic-link 
+              id="link" color="blue" 
+              external-destination="url(http://xmlgraphics.apache.org/fop/)">In <fo:inline 
+                baseline-shift="12pt">in</fo:inline> <fo:inline font-size="24pt"
+                baseline-shift="-20pt">egestas</fo:inline> nisi</fo:basic-link>. Etiam at ante eget 
+            velit placerat ullamcorper.</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="45584" xpath="//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="0"     xpath="//inlineparent[@prod-id='link']/@offset"/>
+
+    <eval expected="11100" xpath="//inlineparent[@prod-id='link']/text[1]/@bpd"/>
+    <eval expected="12000" xpath="//inlineparent[@prod-id='link']/text[1]/@offset"/>
+
+    <eval expected="11100" xpath="//inlineparent[@prod-id='link']/inlineparent[1]/@bpd"/>
+    <eval expected="0"     xpath="//inlineparent[@prod-id='link']/inlineparent[1]/@offset"/>
+
+    <eval expected="22200" xpath="//inlineparent[@prod-id='link']/inlineparent[2]/@bpd"/>
+    <eval expected="23384" xpath="//inlineparent[@prod-id='link']/inlineparent[2]/@offset"/>
+  </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/basic-link_height_multi-line.xml b/test/layoutengine/standard-testcases/basic-link_height_multi-line.xml
new file mode 100644 (file)
index 0000000..9a52d01
--- /dev/null
@@ -0,0 +1,67 @@
+<?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 the height of an fo:basic-link spanning over several lines.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="page"
+          page-height="420pt" page-width="320pt" margin="10pt">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="page">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer quis neque 
+            vitae lectus condimentum. <fo:basic-link id="link" color="blue" 
+              external-destination="url(http://xmlgraphics.apache.org/fop/)">In <fo:inline 
+                baseline-shift="12pt">in</fo:inline> <fo:inline font-size="24pt"
+                baseline-shift="-20pt">egestas</fo:inline> nisi</fo:basic-link>. Etiam at ante eget 
+            velit placerat ullamcorper.</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <!-- First line -->
+    <eval expected="23100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="0"     xpath="//lineArea[2]//inlineparent[@prod-id='link']/@offset"/>
+                                               
+    <eval expected="11100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/text[1]/@bpd"/>
+    <eval expected="12000" xpath="//lineArea[2]//inlineparent[@prod-id='link']/text[1]/@offset"/>
+                                               
+    <eval expected="11100" xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent/@bpd"/>
+    <eval expected="0"     xpath="//lineArea[2]//inlineparent[@prod-id='link']/inlineparent/@offset"/>
+
+    <!-- Second line -->
+    <eval expected="33584" xpath="//lineArea[3]//inlineparent[@prod-id='link']/@bpd"/>
+    <eval expected="0"     xpath="//lineArea[3]//inlineparent[@prod-id='link']/@offset"/>
+
+    <eval expected="22200" xpath="//lineArea[3]//inlineparent[@prod-id='link']/inlineparent/@bpd"/>
+    <eval expected="11384" xpath="//lineArea[3]//inlineparent[@prod-id='link']/inlineparent/@offset"/>
+
+    <eval expected="11100" xpath="//lineArea[3]//inlineparent[@prod-id='link']/text[1]/@bpd"/>
+    <eval expected="0"     xpath="//lineArea[3]//inlineparent[@prod-id='link']/text[1]/@offset"/>
+
+  </checks>
+</testcase>