cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Block.java
cbowditch2004/04/02 05:50:52 Modified:src/java/org/apache/fop/fo/flow Block.java Log: Applied Luca Furini's patch from bugzilla entry 28021. Corrections to behaviour of whitespace-treatment property Revision ChangesPath 1.14 +404 -391 xml-fop/src/java/org/apache/fop/fo/flow/Block.java Index: Block.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Block.java7 Mar 2004 17:52:43 - 1.13 +++ Block.java2 Apr 2004 13:50:52 - 1.14 @@ -1,391 +1,404 @@ -/* - * Copyright 1999-2004 The Apache Software Foundation. - * - * Licensed 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.fo.flow; - -// XML -import org.xml.sax.Attributes; - -// FOP -import org.apache.fop.apps.FOPException; -import org.apache.fop.datatypes.ColorType; -import org.apache.fop.fo.CharIterator; -import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; -import org.apache.fop.fo.FObjMixed; -import org.apache.fop.fo.RecursiveCharIterator; -import org.apache.fop.fo.FOTreeVisitor; -import org.apache.fop.fo.Constants; -import org.apache.fop.fo.properties.CommonAccessibility; -import org.apache.fop.fo.properties.CommonAural; -import org.apache.fop.fo.properties.CommonBackground; -import org.apache.fop.fo.properties.CommonBorderAndPadding; -import org.apache.fop.fo.properties.CommonHyphenation; -import org.apache.fop.fo.properties.CommonMarginBlock; -import org.apache.fop.fo.properties.CommonRelativePosition; -import org.apache.fop.util.CharUtilities; - -/* - Modified by Mark Lillywhite [EMAIL PROTECTED] The changes - here are based on memory profiling and do not change functionality. - Essentially, the Block object had a pointer to a BlockArea object - that it created. The BlockArea was not referenced after the Block - was finished except to determine the size of the BlockArea, however - a reference to the BlockArea was maintained and this caused a lot of - GC problems, and was a major reason for FOP memory leaks. So, - the reference to BlockArea was made local, the required information - is now stored (instead of a reference to the complex BlockArea object) - and it appears that there are a lot of changes in this file, in fact - there are only a few sematic changes; mostly I just got rid of - this. from blockArea since BlockArea is now local. - */ - /** - * Class modelling the fo:block object. See Sec. 6.5.2 of the XSL-FO Standard. - */ -public class Block extends FObjMixed { - -private int align; -private int alignLast; -private int breakAfter; -private int lineHeight; -private int startIndent; -private int endIndent; -private int spaceBefore; -private int spaceAfter; -private int textIndent; -private int keepWithNext; -private ColorType backgroundColor; -private int blockWidows; -private int blockOrphans; - -private String id; -private int span; -private int wsTreatment; //ENUMERATION -private int lfTreatment; //ENUMERATION -private boolean bWScollapse; //true if white-space-collapse=true - -// this may be helpful on other FOs too -private boolean anythingLaidOut = false; - -/** - * Index of first inline-type FO seen in a sequence. - * Used during FO tree building to do white-space handling. - */ -private FONode firstInlineChild = null; - -/** - * @param parent FONode that is the parent of this object - */ -public Block(FONode parent) { -super(parent); -} - -/** - * @see org.apache.fop.fo.FObj#handleAttrs - */ -public void handleAttrs(Attributes attlist) throws FOPException { -super.handleAttrs(attlist); -this.span = this.propertyList.get(PR_SPAN).getEnum(); -this.wsTreatment = - this.propertyList.get(PR_WHITE_SPACE_TREATMENT).getEnum(); -this.bWScollapse = - (this.propertyList.get(PR_WHITE_SPACE_COLLAPSE).getEnum() - == Constants.TRUE); -this.lfTreatment = -
Re: cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Block.java
cbowditch (at) apache.org wrote: cbowditch2004/04/02 05:50:52 Modified:src/java/org/apache/fop/fo/flow Block.java Log: Applied Luca Furini's patch from bugzilla entry 28021. Corrections to behaviour of whitespace-treatment property Revision ChangesPath 1.14 +404 -391 xml-fop/src/java/org/apache/fop/fo/flow/Block.java Uh, looks like there went something wrong with the linefeeds. And keyword substitution is wrong (ko instead of kkv) -- Christian
Re: cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Block.java
Christian Geisert wrote: cbowditch (at) apache.org wrote: cbowditch2004/04/02 05:50:52 Modified:src/java/org/apache/fop/fo/flow Block.java Log: Applied Luca Furini's patch from bugzilla entry 28021. Corrections to behaviour of whitespace-treatment property Revision ChangesPath 1.14 +404 -391 xml-fop/src/java/org/apache/fop/fo/flow/Block.java Uh, looks like there went something wrong with the linefeeds. And keyword substitution is wrong (ko instead of kkv) Uh Oh! You are right. Ive fixed the file, so now how do I fix this in CVS, just re-commit the file?? Chris
Re: cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Block.java
Chris Bowditch wrote: [..] Uh, looks like there went something wrong with the linefeeds. And keyword substitution is wrong (ko instead of kkv) Uh Oh! You are right. Ive fixed the file, so now how do I fix this in CVS, just re-commit the file?? Yes ;-) -- Christian
cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Block.java
cbowditch2004/04/02 07:01:05 Modified:src/java/org/apache/fop/fo/flow Block.java Log: corrected line endings. changed ko option to kkv Revision ChangesPath 1.15 +404 -404 xml-fop/src/java/org/apache/fop/fo/flow/Block.java Index: Block.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Block.java2 Apr 2004 13:50:52 - 1.14 +++ Block.java2 Apr 2004 15:01:05 - 1.15 @@ -1,404 +1,404 @@ -/* - * Copyright 1999-2004 The Apache Software Foundation. - * - * Licensed 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.fo.flow; - -// XML -import org.xml.sax.Attributes; - -// FOP -import org.apache.fop.apps.FOPException; -import org.apache.fop.datatypes.ColorType; -import org.apache.fop.fo.CharIterator; -import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; -import org.apache.fop.fo.FObjMixed; -import org.apache.fop.fo.RecursiveCharIterator; -import org.apache.fop.fo.FOTreeVisitor; -import org.apache.fop.fo.Constants; -import org.apache.fop.fo.properties.CommonAccessibility; -import org.apache.fop.fo.properties.CommonAural; -import org.apache.fop.fo.properties.CommonBackground; -import org.apache.fop.fo.properties.CommonBorderAndPadding; -import org.apache.fop.fo.properties.CommonHyphenation; -import org.apache.fop.fo.properties.CommonMarginBlock; -import org.apache.fop.fo.properties.CommonRelativePosition; -import org.apache.fop.util.CharUtilities; - -/* - Modified by Mark Lillywhite [EMAIL PROTECTED] The changes - here are based on memory profiling and do not change functionality. - Essentially, the Block object had a pointer to a BlockArea object - that it created. The BlockArea was not referenced after the Block - was finished except to determine the size of the BlockArea, however - a reference to the BlockArea was maintained and this caused a lot of - GC problems, and was a major reason for FOP memory leaks. So, - the reference to BlockArea was made local, the required information - is now stored (instead of a reference to the complex BlockArea object) - and it appears that there are a lot of changes in this file, in fact - there are only a few sematic changes; mostly I just got rid of - this. from blockArea since BlockArea is now local. - */ - /** - * Class modelling the fo:block object. See Sec. 6.5.2 of the XSL-FO Standard. - */ -public class Block extends FObjMixed { - -private int align; -private int alignLast; -private int breakAfter; -private int lineHeight; -private int startIndent; -private int endIndent; -private int spaceBefore; -private int spaceAfter; -private int textIndent; -private int keepWithNext; -private ColorType backgroundColor; -private int blockWidows; -private int blockOrphans; - -private String id; -private int span; -private int wsTreatment; //ENUMERATION -private int lfTreatment; //ENUMERATION -private boolean bWScollapse; //true if white-space-collapse=true - -// this may be helpful on other FOs too -private boolean anythingLaidOut = false; - -/** - * Index of first inline-type FO seen in a sequence. - * Used during FO tree building to do white-space handling. - */ -private FONode firstInlineChild = null; - -/** - * @param parent FONode that is the parent of this object - */ -public Block(FONode parent) { -super(parent); -} - -/** - * @see org.apache.fop.fo.FObj#handleAttrs - */ -public void handleAttrs(Attributes attlist) throws FOPException { -super.handleAttrs(attlist); -this.span = this.propertyList.get(PR_SPAN).getEnum(); -this.wsTreatment = - this.propertyList.get(PR_WHITE_SPACE_TREATMENT).getEnum(); -this.bWScollapse = - (this.propertyList.get(PR_WHITE_SPACE_COLLAPSE).getEnum() - == Constants.TRUE); -this.lfTreatment = -
cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Block.java
gmazza 2004/03/07 09:52:43 Modified:src/java/org/apache/fop/fo FOText.java src/java/org/apache/fop/fo/flow Block.java Log: Fix of leading-space problem in HEAD. (A single leading space of the first inline child of the block object was being incorrectly retained.) Revision ChangesPath 1.16 +0 -4 xml-fop/src/java/org/apache/fop/fo/FOText.java Index: FOText.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOText.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- FOText.java 1 Mar 2004 23:50:26 - 1.15 +++ FOText.java 7 Mar 2004 17:52:43 - 1.16 @@ -168,10 +168,6 @@ } else if (curIndex == length) { curIndex = --length; } -// Temporary until leading space problem in 1.0 fixed -// System.out.println(\n\nremove called: ca = \ + -// new String(ca) + \, length/node length: + length -// + , + ca.length); } 1.13 +17 -0 xml-fop/src/java/org/apache/fop/fo/flow/Block.java Index: Block.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Block.java27 Feb 2004 17:44:23 - 1.12 +++ Block.java7 Mar 2004 17:52:43 - 1.13 @@ -246,6 +246,11 @@ if (firstInlineChild != null) { boolean bInWS = false; boolean bPrevWasLF = false; + +/* bSeenNonWSYet is an indicator used for trimming all leading + whitespace for the first inline child of the block +*/ +boolean bSeenNonWSYet = false; RecursiveCharIterator charIter = new RecursiveCharIterator(this, firstInlineChild); LFchecker lfCheck = new LFchecker(charIter); @@ -279,7 +284,13 @@ (bPrevWasLF || lfCheck.nextIsLF( { charIter.remove(); } else { +// this is to retain a single space between words bInWS = true; +// remove the space if no word in block +// encountered yet +if (!bSeenNonWSYet) { +charIter.remove(); +} } } break; @@ -300,6 +311,11 @@ } else { if (bWScollapse) { bInWS = true; +// remove the linefeed if no word in block +// encountered yet +if (!bSeenNonWSYet) { +charIter.remove(); +} } charIter.replaceChar('\u0020'); } @@ -323,6 +339,7 @@ case CharUtilities.NONWHITESPACE: /* Any other character */ bInWS = bPrevWasLF = false; +bSeenNonWSYet = true; lfCheck.reset(); break; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Block.java BlockContainer.java Inline.java Marker.java
gmazza 2003/12/27 14:00:38 Modified:src/java/org/apache/fop/fo FObj.java GenericShorthandParser.java PropertyList.java PropertyManager.java src/java/org/apache/fop/fo/expr FromParentFunction.java src/java/org/apache/fop/fo/flow Block.java BlockContainer.java Inline.java Marker.java Log: *Partial* conversion of PropertyList.get(String propName) to new PropertyList.get(int propId) method. This method will remain overloaded until all calls converted to int constants. Work based on Finn Bock's patch. Revision ChangesPath 1.29 +4 -3 xml-fop/src/java/org/apache/fop/fo/FObj.java Index: FObj.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- FObj.java 26 Dec 2003 22:11:17 - 1.28 +++ FObj.java 27 Dec 2003 22:00:38 - 1.29 @@ -66,7 +66,7 @@ /** * Base class for representation of formatting objects and their processing. */ -public class FObj extends FONode { +public class FObj extends FONode implements Constants { private static final String FO_URI = http://www.w3.org/1999/XSL/Format;; public static Property.Maker[] propertyListTable = null; @@ -257,7 +257,8 @@ * @return the property */ public Property getProperty(String name) { -return (propertyList.get(name)); +int propId = FOPropertyMapping.getPropertyId(name); +return (propertyList.get(propId)); } /** @@ -267,7 +268,7 @@ * fo and sets the id attribute of this object. */ public void setupID() { -Property prop = this.propertyList.get(id); +Property prop = this.propertyList.get(PR_ID); if (prop != null) { String str = prop.getString(); if (str != null !str.equals()) { 1.4 +1 -3 xml-fop/src/java/org/apache/fop/fo/GenericShorthandParser.java Index: GenericShorthandParser.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/GenericShorthandParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- GenericShorthandParser.java 26 Dec 2003 23:41:47 - 1.3 +++ GenericShorthandParser.java 27 Dec 2003 22:00:38 - 1.4 @@ -52,7 +52,6 @@ import java.util.Vector; import java.util.Enumeration; -import org.apache.fop.fo.properties.FOPropertyMapping; public class GenericShorthandParser implements ShorthandParser { @@ -96,8 +95,7 @@ if (count() == 1) { String sval = ((Property)list.elementAt(0)).getString(); if (sval != null sval.equals(inherit)) { -String name = FOPropertyMapping.getPropertyName(propId); -return propertyList.getFromParent(name); +return propertyList.getFromParent(propId); } } return convertValueForProperty(propId, maker, propertyList); 1.11 +23 -6 xml-fop/src/java/org/apache/fop/fo/PropertyList.java Index: PropertyList.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyList.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- PropertyList.java 26 Dec 2003 23:41:47 - 1.10 +++ PropertyList.java 27 Dec 2003 22:00:38 - 1.11 @@ -229,7 +229,8 @@ public Property getInherited(String propertyName) { if (parentPropertyList != null isInherited(namespace, elementName, propertyName)) { -return parentPropertyList.get(propertyName); +int propertyId = FOPropertyMapping.getPropertyId(propertyName); +return parentPropertyList.get(propertyId); } else { // return the initial value try { @@ -290,14 +291,28 @@ * this will try to compute it based on other properties, or if it is * inheritable, to return the inherited value. If all else fails, it returns * the default value. - * @param propertyName property name + * @param propId The Constants ID of the property whose value is desired. * @return the Property corresponding to that name */ -public Property get(String propertyName) { +public Property get(int propId) { +String propertyName = FOPropertyMapping.getPropertyName(propId); return get(propertyName, true, true); } /** + * TEMPORARY until conversion to int's complete + * Return the property on the current FlowObject.