From: William Victor Mote Date: Fri, 2 May 2003 15:56:15 +0000 (+0000) Subject: Refactor: unwind "for" statement in findNearestAncestorGeneratingRAs() for more flexi... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1495 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f38f1324a9af2a9faad3b3a810ddbe2a937d5769;p=xmlgraphics-fop.git Refactor: unwind "for" statement in findNearestAncestorGeneratingRAs() for more flexibility. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196390 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index a35729774..c008b5ac9 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -180,11 +180,11 @@ public class FObj extends FONode { * @return FObj of the nearest ancestor that generates Reference Areas */ private FObj findNearestAncestorGeneratingRAs() { - FObj p; - FONode parent; - for (p = this; !p.generatesReferenceAreas() - && (parent = p.getParent()) != null - && (parent instanceof FObj); p = (FObj) parent) { + FObj p = this; + FObj parent = p.findNearestAncestorFObj(); + while (parent != null && !p.generatesReferenceAreas()) { + p = (FObj) parent; + parent = p.findNearestAncestorFObj(); } return p; }