Bug 50403 - fo:table-cell is incorrectly inheriting margin
Summary: fo:table-cell is incorrectly inheriting margin
Status: CLOSED INVALID
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: page-master/layout (show other bugs)
Version: 1.0
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-02 15:20 UTC by Michael Graessle
Modified: 2012-04-01 13:42 UTC (History)
0 users



Attachments
Another Example (1.23 KB, text/plain)
2010-12-02 15:20 UTC, Michael Graessle
Details
Render of Attached Example (18.58 KB, image/png)
2010-12-02 15:21 UTC, Michael Graessle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Graessle 2010-12-02 15:20:33 UTC
Created attachment 26367 [details]
Another Example

When a fo:table-cell is embedded withing a fo:block with a margin set, the fo:table-cell will inherit the margin left from the fo:block.


Example:

<fo:block margin="30px">
  <fo:table width="100%" table-layout="fixed">
    <fo:table-column column-width="proportional-column-width(1)" />
    <fo:table-body>
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            Table Cell No Margin Defined
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
</fo:block>

When the above is rendered, the text "Table Cell No Margin Defined" will be rendered with a margin-left of 30.  This happens even if you add another fo:block outside the table with margin set to 0.  Adding a margin-left="0" to the fo:table-cell will fix the renderer.
Comment 1 Michael Graessle 2010-12-02 15:21:58 UTC
Created attachment 26368 [details]
Render of Attached Example
Comment 2 Pascal Sancho 2010-12-03 04:08:02 UTC
This behaviour is correct regarding REC XSL v1.1  (§5.3.2, see [1]).
In addition, there is a wiki page about this topic (see [2]).

[1] http://www.w3.org/TR/xsl/#refine-margin-space-indent
[2] http://wiki.apache.org/xmlgraphics-fop/IndentInheritance
Comment 3 Michael Graessle 2010-12-03 09:42:51 UTC
I don't believe the spec explains the behavior I am seeing.

1) In the attached example, margin-left is being inherited by the table-cell from the table's grandparent(margin="30px"), even though the table's parent has it set.(margin="0px")

2) Only margin-right and margin-left are being inherited, margin-top and margin-bottom are not.
Comment 4 Pascal Sancho 2010-12-03 11:23:36 UTC
As said in  REC XSL v1.1  §5.3.2, inheritance and computed values for *-indent are for start-* and end-* sides (left/right in a lr-tb context).

Since fo:block doesn't provide a reference area, inheritance mechanism is played.

A good practice to indent a table is:
 - use a fo:block-container (witch generates a reference area) to surround the table
 - set start-indent or end-indent properties on this fo:b-c
 - set *-indent properties to 0 on fo:table (or what ever content) to enforce the inherited *-indent to 0 (you can insert a fo:block for such thing between fo:b-c and fo:table.

In addition, FOP provides the ability to break the REC-XSL inheritance behaviour:
see the config option [break-indent-inheritance] at [1]


Note: for before-* and after-* properties, the strategy is quite different:
 - stacking areas is not the same problem.
 - see the .conditionality sub-property.


[1] http://xmlgraphics.apache.org/fop/1.0/configuration.html
Comment 5 Glenn Adams 2012-04-01 13:42:38 UTC
batch transition to closed for remaining resolved bugs