Percentages and Properties

This is an attempt to summarise in an understandable fashion the rules related to the resolution of percentages in property values. The page is organised such that the major subheadings group a set of related rules together. Rules are considered related if the underlying resolution algorithm is logically the same. Under each subheading the individual rules using the text as stated in the XSL-FO specification and the properties they apply to are shown.

For each property the current status of the implementation is shown.

The construction of this page was driven by the need to look at and improve the current implementation of the percentage resolution mechanism (see http://marc.theaimsgroup.com/?l=fop-dev&m=110630658730554&w=2).

The XSL-FO rules related to determining the base value on which to perform percentage calculations can be put into 3 broad classes:

  1. Rules referring to properties in the fo element or its parent 2. Rules referring to area dimensions 3. Other rules not covered by 1. or 2.

1. Rules referring to properties in the fo element or parent fo element

Percentage values in this group are resolved relative to properties on the same or the parent element. These values can be resolved during fo tree construction as they do not require any input from the area tree.

Suggestion: Change the percentage implementation such that these properties are resolved at fo tree construction time. This would allow to dispose of the property lists earlier (see also http://marc.theaimsgroup.com/?l=fop-dev&m=110442946030972&w=2).

XSL-FO Rule: refer to the font size of the element itself

Properties

  • line-height

XSL-FO Rule: refer to font's em-height

Properties

  • text-altitude: Percentage support not configured
  • text-depth: Percentage support not configured

XSL-FO Rule: refer to parent element's font size

Properties

  • font-size

XSL-FO Rule: refer to the "line-height" of the element itself

Properties

  • vertical-align: Percentage support not configured

XSL-FO Rule: refer to the corresponding height or width of the page-viewport-area

Although this rule refers to an area, the dimensions of a page-viewport-area are taken straight from the corresponding page-width / page-height properties. Therefore it should be possible to calculate these during fo tree construction.

Properties

  • extent: Percentage support not configured

XSL-FO Rule: refer to the "line-height" of the parent area

Not sure about this one - I assume taking the line-height from the parent fo element would be OK?

Properties

  • baseline-shift: Percentage support not configured

2. Rules referring to dimensions of an area

The rules in this class fall into the following groups:

  1. Rules referring to the 'closest ancestor block area' 2. Rules referring to the 'parent area' 3. Rules referring to the 'reference area' 4. Rules referring to the 'area created by the element' 5. Rules referring to tables

To resolve percentages on property values for any properties in this class access to the area tree and the dimensions on those areas is required.

2.1 Rules referring to the 'closest ancestor block area'

The XSL-FO specification uses the definitions 'containing block' and 'closest ancestor block area that is not a line area' interchangebly. The term 'containing block' is used in the context of CSS derived properties while 'closest ancestor block area that is not a line area' is used for XSL-FO properties. Care must be taking that the design for this rule group handles the exceptions noted in http://www.w3.org/TR/xsl/slice7.html#percrule correctly.

XSL-FO Rule: refer to inline-progression-dimension of closest ancestor block area that is not a line area

Properties

  • last-line-end-indent: Percentage support not configured
  • provisional-distance-between-starts: Percentage support not configured
  • provisional-label-separation: Percentage support not configured
  • space-end: Percentage support not configured
  • space-start: Percentage support not configured

XSL-FO Rule: refer to width of containing block

Properties

  • left: Percentage support not configured
  • right: Percentage support not configured
  • margin, margin-bottom, margin-left, margin-right, margin-top
  • max-width, min-width: Properties not implemented
  • padding, padding-after, padding-before, padding-bottom, padding-end, padding-left, padding-right, padding-start, padding-top
  • text-indent
  • width

XSL-FO Rule: refer to height of containing block

Properties

  • max-height, min-height: Properties not implemented
  • top: Percentage support not configured
  • bottom: Percentage support not configured

XSL-FO Rule: calculated with respect to the height of the generated box's containing block

Properties

  • height: Not sure its implemented correctly - XSL-FO: If the height of the containing block is not specified explicitly (i.e., it depends on content height), the value is interpreted like "auto".

XSL-FO Rule: corresponding dimension of the closest area ancestor that was generated by a block-level formatting object

I assume 'closest area ancestor that was generated by a block-level formatting object' is the same as 'closest ancestor block area that is not a line area'.

Properties

  • inline-progression-dimension
  • block-progression-dimension

2.2 Rules referring to the 'parent area'

The difference to 'containing block' is that the 'parent area' could be a 'line area' Therefore 'parent area' and 'containing block' may not be the same.

XSL-FO Rule: refer to inline-progression-dimension of content-rectangle of parent area

Properties

  • leader-length: Percentage support not implemented
  • leader-pattern-width: Percentage support not implemented

2.3 Rules referring to the containing reference area

XSL-FO Rule: refer to inline-progression-dimension of containing reference area

Properties

  • end-indent: Percentage support not configured
  • start-indent: Percentage support not configured

2.4 Rules refering to the area generated by the fo element itself

XSL-FO Rule: refer to size of padding-rectangle

Actually percentages for these properties do refer to both the size of the padding rectangle AND the intrinsic size of the background image.

Properties

  • background-position-horizontal
  • background-position-vertical

XSL-FO Rule: see prose

Properties

  • alignment-adjust: Percentage support not configured
    • XSL-FO: The computed value of the property is this percentage multiplied by the area's computed "height" if the area is generated by an fo:external-graphic or fo:instream-foreign-object, the "font-size" if the area was generated by an fo:character, and the "line-height" otherwise.

2.5 Rules related to tables

The only rule in this group refers the table width. It should be possible to obtain this through the area tree. However, the actual percentage calculation is a fairly special case.

XSL-FO Rule: refer to width of table

Properties

  • column-width

3. Other rules not covered above

Rules refering to an elements intrinsic sizes

These apply to external-graphic and instream-foreign-object objects only. They can be calculated the moment the intrinsic dimensions of the e-g or i-f-o are known.

XSL-FO Rule: refer to intrinsic height

Properties

  • content-height

XSL-FO Rule: refer to intrinsic width

Properties

  • content-width

Rules related to regions

XSL-FO Rule: refer to width of the region being divided into columns

The value is a percentage of the inline-progression-dimension of the content-rectangle of the region.

Properties

  • column-gap: Percentage support not configured
  • No labels