View | Details | Raw Unified | Return to bug 18801
Collapse All | Expand All

(-)a/src/codegen/fo/foproperties.xml (-2 / +9 lines)
Lines 2054-2063 Link Here
2054
    <default></default>
2054
    <default></default>
2055
  </property>
2055
  </property>
2056
  <property>
2056
  <property>
2057
    <!-- from https://issues.apache.org/bugzilla/show_bug.cgi?id=18801 -->
2057
    <name>visibility</name>
2058
    <name>visibility</name>
2058
    <inherited>false</inherited>
2059
    <inherited>true</inherited>
2059
    <datatype>ToBeImplemented</datatype>
2060
    <default>visible</default>
2060
    <default>visible</default>
2061
    <datatype>Enum</datatype>
2062
    <enumeration>
2063
      <value const="VISIBLE">visible</value>
2064
      <value const="HIDDEN">hidden</value>
2065
      <value const="COLLAPSE">collapse</value>
2066
      <value const="INHERIT">inherit</value>
2067
    </enumeration>
2061
  </property>
2068
  </property>
2062
  <property>
2069
  <property>
2063
    <name>z-index</name>
2070
    <name>z-index</name>
(-)a/src/java/org/apache/fop/area/Trait.java (-1 / +6 lines)
Lines 26-31 import org.apache.xmlgraphics.image.loader.ImageInfo; Link Here
26
26
27
import org.apache.fop.fonts.FontTriplet;
27
import org.apache.fop.fonts.FontTriplet;
28
import org.apache.fop.traits.BorderProps;
28
import org.apache.fop.traits.BorderProps;
29
import org.apache.fop.traits.Visibility;
29
import org.apache.fop.util.ColorUtil;
30
import org.apache.fop.util.ColorUtil;
30
31
31
import static org.apache.fop.fo.Constants.EN_REPEAT;
32
import static org.apache.fop.fo.Constants.EN_REPEAT;
Lines 156-163 public final class Trait implements Serializable { Link Here
156
    /** The ptr trait. Used for accessibility   */
157
    /** The ptr trait. Used for accessibility   */
157
    public static final Integer PTR = 37;
158
    public static final Integer PTR = 37;
158
159
160
    /** Used to disable the rendering of a Block http://www.w3.org/TR/xsl/#rend-vis */
161
    public static final Integer VISIBILITY = 38;
162
159
    /** Maximum value used by trait keys */
163
    /** Maximum value used by trait keys */
160
    public static final int MAX_TRAIT_KEY = 37;
164
    public static final int MAX_TRAIT_KEY = 38;
161
165
162
    private static final TraitInfo[] TRAIT_INFO = new TraitInfo[MAX_TRAIT_KEY + 1];
166
    private static final TraitInfo[] TRAIT_INFO = new TraitInfo[MAX_TRAIT_KEY + 1];
163
167
Lines 221-226 public final class Trait implements Serializable { Link Here
221
        put(SPACE_AFTER,    new TraitInfo("space-after", Integer.class));
225
        put(SPACE_AFTER,    new TraitInfo("space-after", Integer.class));
222
        put(IS_REFERENCE_AREA,  new TraitInfo("is-reference-area", Boolean.class));
226
        put(IS_REFERENCE_AREA,  new TraitInfo("is-reference-area", Boolean.class));
223
        put(IS_VIEWPORT_AREA,   new TraitInfo("is-viewport-area", Boolean.class));
227
        put(IS_VIEWPORT_AREA,   new TraitInfo("is-viewport-area", Boolean.class));
228
        put(VISIBILITY, new TraitInfo("visibility", Visibility.class));
224
229
225
    }
230
    }
226
231
(-)a/src/java/org/apache/fop/fo/flow/Block.java (-1 / +5 lines)
Lines 83-94 public class Block extends FObjMixed implements BreakPropertySet, StructurePoint Link Here
83
    private Numeric widows;
83
    private Numeric widows;
84
    private int wrapOption;
84
    private int wrapOption;
85
    private int disableColumnBalancing;
85
    private int disableColumnBalancing;
86
    private int visibility;
86
    // Unused but valid items, commented out for performance:
87
    // Unused but valid items, commented out for performance:
87
    //     private CommonAccessibility commonAccessibility;
88
    //     private CommonAccessibility commonAccessibility;
88
    //     private CommonAural commonAural;
89
    //     private CommonAural commonAural;
89
    //     private Length textDepth;
90
    //     private Length textDepth;
90
    //     private Length textAltitude;
91
    //     private Length textAltitude;
91
    //     private int visibility;
92
    // End of property values
92
    // End of property values
93
93
94
    /**
94
    /**
Lines 135-140 public class Block extends FObjMixed implements BreakPropertySet, StructurePoint Link Here
135
        widows = pList.get(PR_WIDOWS).getNumeric();
135
        widows = pList.get(PR_WIDOWS).getNumeric();
136
        wrapOption = pList.get(PR_WRAP_OPTION).getEnum();
136
        wrapOption = pList.get(PR_WRAP_OPTION).getEnum();
137
        disableColumnBalancing = pList.get(PR_X_DISABLE_COLUMN_BALANCING).getEnum();
137
        disableColumnBalancing = pList.get(PR_X_DISABLE_COLUMN_BALANCING).getEnum();
138
        visibility = pList.get(PR_VISIBILITY).getEnum();
138
    }
139
    }
139
140
140
    /** {@inheritDoc} */
141
    /** {@inheritDoc} */
Lines 356-359 public class Block extends FObjMixed implements BreakPropertySet, StructurePoint Link Here
356
        return FO_BLOCK;
357
        return FO_BLOCK;
357
    }
358
    }
358
359
360
    public int getVisibility() {
361
        return visibility;
362
    }
359
}
363
}
(-)a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (+1 lines)
Lines 332-337 public class BlockLayoutManager extends BlockStackingLayoutManager Link Here
332
        TraitSetter.addPtr(curBlockArea, getBlockFO().getPtr());  // used for accessibility
332
        TraitSetter.addPtr(curBlockArea, getBlockFO().getPtr());  // used for accessibility
333
        TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(),
333
        TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(),
334
                effSpaceBefore, effSpaceAfter);
334
                effSpaceBefore, effSpaceAfter);
335
        TraitSetter.setVisibility(curBlockArea, getBlockFO().getVisibility());
335
        flush();
336
        flush();
336
337
337
        curBlockArea = null;
338
        curBlockArea = null;
(-)a/src/java/org/apache/fop/layoutmgr/TraitSetter.java (+16 lines)
Lines 35-40 import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo; Link Here
35
import org.apache.fop.fonts.Font;
35
import org.apache.fop.fonts.Font;
36
import org.apache.fop.traits.BorderProps;
36
import org.apache.fop.traits.BorderProps;
37
import org.apache.fop.traits.MinOptMax;
37
import org.apache.fop.traits.MinOptMax;
38
import org.apache.fop.traits.Visibility;
38
39
39
/**
40
/**
40
 * This is a helper class used for setting common traits on areas.
41
 * This is a helper class used for setting common traits on areas.
Lines 612-615 public final class TraitSetter { Link Here
612
            area.addTrait(Trait.PROD_ID, id);
613
            area.addTrait(Trait.PROD_ID, id);
613
        }
614
        }
614
    }
615
    }
616
617
    public static void setVisibility(Area area, int visibility) {
618
        Visibility v;
619
        switch (visibility) {
620
            case Constants.EN_COLLAPSE:
621
                v = Visibility.COLLAPSE;
622
                break;
623
            case Constants.EN_HIDDEN:
624
                v = Visibility.HIDDEN;
625
                break;
626
            default:
627
                v = Visibility.VISIBLE;
628
        }
629
        area.addTrait(Trait.VISIBILITY, v);
630
    }
615
}
631
}
(-)a/src/java/org/apache/fop/render/AbstractRenderer.java (-1 / +3 lines)
Lines 69-74 import org.apache.fop.area.inline.InlineViewport; Link Here
69
import org.apache.fop.area.inline.WordArea;
69
import org.apache.fop.area.inline.WordArea;
70
import org.apache.fop.fo.Constants;
70
import org.apache.fop.fo.Constants;
71
import org.apache.fop.fonts.FontInfo;
71
import org.apache.fop.fonts.FontInfo;
72
import org.apache.fop.traits.Visibility;
72
73
73
/**
74
/**
74
 * Abstract base class for all renderers. The Abstract renderer does all the
75
 * Abstract base class for all renderers. The Abstract renderer does all the
Lines 579-585 public abstract class AbstractRenderer Link Here
579
580
580
            handleBlockTraits(block);
581
            handleBlockTraits(block);
581
582
582
            if (children != null) {
583
            if (children != null && block.getTrait(Trait.VISIBILITY) != Visibility.HIDDEN)
584
		    {
583
                renderBlocks(block, children);
585
                renderBlocks(block, children);
584
            }
586
            }
585
587
(-)a/src/java/org/apache/fop/traits/Visibility.java (+24 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.traits;
19
20
/**
21
 * http://www.w3.org/TR/xsl/#visibility
22
 * @author Jerome Robert
23
 */
24
public enum Visibility { VISIBLE, HIDDEN, COLLAPSE }

Return to bug 18801