throws PropertyException {
Property p = super.get(0, propertyList, tryInherit, tryDefault);
+ FObj fo = propertyList.getFObj();
+ String fallbackValue = (propId == Constants.PR_PAGE_HEIGHT)
+ ? fo.getFOEventHandler().getUserAgent().getPageHeight()
+ : fo.getFOEventHandler().getUserAgent().getPageWidth();
- //TODO: add check for both height and width being specified as indefinite
- // and use the fallback value (= set to "auto")
+ if (p.getEnum() == Constants.EN_INDEFINITE) {
+ int otherId = (propId == Constants.PR_PAGE_HEIGHT)
+ ? Constants.PR_PAGE_WIDTH : Constants.PR_PAGE_HEIGHT;
+ int writingMode = propertyList.get(Constants.PR_WRITING_MODE).getEnum();
+ int refOrientation = propertyList.get(Constants.PR_REFERENCE_ORIENTATION)
+ .getNumeric().getValue();
+ if (propertyList.getExplicit(otherId) != null
+ && propertyList.getExplicit(otherId).getEnum() == Constants.EN_INDEFINITE) {
+ //both set to "indefinite":
+ //determine which one of the two defines the dimension
+ //in block-progression-direction, and set the other to
+ //"auto"
+ if ((writingMode != Constants.EN_TB_RL
+ && (refOrientation == 0
+ || refOrientation == 180
+ || refOrientation == -180))
+ || (writingMode == Constants.EN_TB_RL
+ && (refOrientation == 90
+ || refOrientation == 270
+ || refOrientation == -270))) {
+ //set page-width to "auto" = use the fallback from FOUserAgent
+ if (propId == Constants.PR_PAGE_WIDTH) {
+ return make(propertyList, fallbackValue, fo);
+ }
+ } else {
+ //set page-height to "auto" = use fallback from FOUserAgent
+ if (propId == Constants.PR_PAGE_HEIGHT) {
+ return make(propertyList, fallbackValue, fo);
+ }
+ }
+ }
+ }
if (p.isAuto()) {
- FObj fo = propertyList.getFObj();
-
- String fallbackValue = (propId == Constants.PR_PAGE_HEIGHT)
- ? fo.getFOEventHandler().getUserAgent().getPageHeight()
- : fo.getFOEventHandler().getUserAgent().getPageWidth();
return make(propertyList, fallbackValue, fo);
}
return p;
- }
-
+ }
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ Copyright 2005 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$ -->
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:test="http://xmlgraphics.apache.org/fop/test">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="lr-tb-0"
+ page-width="indefinite" page-height="indefinite"
+ writing-mode="lr-tb"
+ margin="20pt">
+ <!-- page-width should properly fall back to 8.26 * 72000 -->
+ <test:assert property="page-width" expected="594720mpt" />
+ <fo:region-body />
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="lr-tb-90"
+ page-width="indefinite" page-height="indefinite"
+ writing-mode="lr-tb" reference-orientation="90"
+ margin="20pt">
+ <!-- page-height should properly fall back to 11 * 72000 -->
+ <test:assert property="page-height" expected="792000mpt" />
+ <fo:region-body />
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="tb-rl-0"
+ page-width="indefinite" page-height="indefinite"
+ writing-mode="tb-rl" reference-orientation="0"
+ margin="20pt">
+ <!-- page-height should properly fall back to 11 * 72000 -->
+ <test:assert property="page-height" expected="792000mpt" />
+ <fo:region-body />
+ </fo:simple-page-master>
+ <fo:simple-page-master master-name="tb-rl-90"
+ page-width="indefinite" page-height="indefinite"
+ writing-mode="tb-rl" reference-orientation="90"
+ margin="20pt">
+ <!-- page-width should properly fall back to 8.26 * 72000 -->
+ <test:assert property="page-width" expected="594720mpt" />
+ <fo:region-body />
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="lr-tb-0">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>Testing page-height and page-width both "indefinite"</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="lr-tb-90">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>Testing page-height and page-width both "indefinite"</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="tb-rl-0">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>Testing page-height and page-width both "indefinite"</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="tb-rl-90">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>Testing page-height and page-width both "indefinite"</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+</fo:root>