You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Vincent Hennebert <vi...@anyware-tech.com> on 2007/06/29 11:04:13 UTC

Row backgrounds vs table background

Guys,

I believe there's a bug in the handling of table- and row-backgrounds.
See the following fo snippet:
<fo:table width="100%"
  table-layout="fixed"
  border-collapse="separate"
  border-separation="8pt"
  background-color="blue"
  border="4pt solid black">
  <fo:table-column number-columns-repeated="2"
    column-width="proportional-column-width(1)"/>
  <fo:table-body>
    <fo:table-row background-color="yellow">
      <fo:table-cell border="4pt solid red" number-rows-spanned="2">
        <fo:block>Cell 1.1</fo:block>
        <fo:block>Cell 1.1</fo:block>
        <fo:block>Cell 1.1</fo:block>
        <fo:block>Cell 1.1</fo:block>
        <fo:block>Cell 1.1</fo:block>
      </fo:table-cell>
      <fo:table-cell border="4pt solid red">
        <fo:block>Cell 1.2</fo:block>
        <fo:block>Cell 1.2</fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row background-color="green">
      <fo:table-cell border="4pt solid red">
        <fo:block>Cell 2.1</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-body>
</fo:table>

The result we get is on the left on the attached picture. I believe the
correct one should be the drawing on the right, because the area
corresponding to the border-separation should be painted with the
background of the table, not of the rows (see §6.7.3 of XSL-FO 1.1).
That's what Firefox is doing.

Any disagreements?
Vincent


Re: Row backgrounds vs table background

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 29.06.2007 16:29:49 Vincent Hennebert wrote:
> Jeremias Maerki a écrit :
> > Hmm, I don't find anything in XSL 1.1 or CSS 2 that would be clear
> > enough for either solution. So I can't say it's either left or right,
> > but my personal preference would be the left solution. Shrug.
> 
> Well, section 7.28.5 in XSL-FO 1.1 (description of the
> "border-separation" property) is actually pretty clear about this:
> 
>     "The "border-separation" property specifies the distance between the
>     borders of adjacent cells. This space is filled with the background
>     of the table element."

Yes, that's an important indicator. The absence of table-row references in
this context could (but doesn't have to!) mean that the backgrounds for
the table-rows do not extend beyond the cells. Still room for
interpretation if you ask me, but I like your latest
table-row_backgrounds3.png.

> The text is basically taken from section 17.6.1, "border-spacing" of
> CSS2.
> 
> We can imagine that border-separation shouldn't really apply /within/
> table-cells, even spanning ones, and thus that the corresponding rows or
> columns should be adjacent. That would give the attached result. Perhaps
> more what the user would expect, but doesn't really make sense IMO.
> 
> Anyway, another candidate request for clarification to xsl-editors@
> I guess...

<snip/>


Jeremias Maerki


Re: Row backgrounds vs table background

Posted by Adrian Cumiskey <ad...@gmail.com>.
I suppose when the spec is unclear common sense should prevail.  So no 
disagreements.

Adrian.

Jeremias Maerki wrote:
> Hmm, I don't find anything in XSL 1.1 or CSS 2 that would be clear
> enough for either solution. So I can't say it's either left or right,
> but my personal preference would be the left solution. Shrug.
> 
> On 29.06.2007 11:04:13 Vincent Hennebert wrote:
>> Guys,
>>
>> I believe there's a bug in the handling of table- and row-backgrounds.
>> See the following fo snippet:
>> <fo:table width="100%"
>>   table-layout="fixed"
>>   border-collapse="separate"
>>   border-separation="8pt"
>>   background-color="blue"
>>   border="4pt solid black">
>>   <fo:table-column number-columns-repeated="2"
>>     column-width="proportional-column-width(1)"/>
>>   <fo:table-body>
>>     <fo:table-row background-color="yellow">
>>       <fo:table-cell border="4pt solid red" number-rows-spanned="2">
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>       </fo:table-cell>
>>       <fo:table-cell border="4pt solid red">
>>         <fo:block>Cell 1.2</fo:block>
>>         <fo:block>Cell 1.2</fo:block>
>>       </fo:table-cell>
>>     </fo:table-row>
>>     <fo:table-row background-color="green">
>>       <fo:table-cell border="4pt solid red">
>>         <fo:block>Cell 2.1</fo:block>
>>       </fo:table-cell>
>>     </fo:table-row>
>>   </fo:table-body>
>> </fo:table>
>>
>> The result we get is on the left on the attached picture. I believe the
>> correct one should be the drawing on the right, because the area
>> corresponding to the border-separation should be painted with the
>> background of the table, not of the rows (see §6.7.3 of XSL-FO 1.1).
>> That's what Firefox is doing.
>>
>> Any disagreements?
>> Vincent
>>
> 
> 
> 
> Jeremias Maerki
> 
> 


Re: Row backgrounds vs table background

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Jeremias Maerki a écrit :
> Hmm, I don't find anything in XSL 1.1 or CSS 2 that would be clear
> enough for either solution. So I can't say it's either left or right,
> but my personal preference would be the left solution. Shrug.

Well, section 7.28.5 in XSL-FO 1.1 (description of the
"border-separation" property) is actually pretty clear about this:

    "The "border-separation" property specifies the distance between the
    borders of adjacent cells. This space is filled with the background
    of the table element."

The text is basically taken from section 17.6.1, "border-spacing" of
CSS2.

We can imagine that border-separation shouldn't really apply /within/
table-cells, even spanning ones, and thus that the corresponding rows or
columns should be adjacent. That would give the attached result. Perhaps
more what the user would expect, but doesn't really make sense IMO.

Anyway, another candidate request for clarification to xsl-editors@
I guess...

Vincent


> On 29.06.2007 11:04:13 Vincent Hennebert wrote:
>> Guys,
>>
>> I believe there's a bug in the handling of table- and row-backgrounds.
>> See the following fo snippet:
>> <fo:table width="100%"
>>   table-layout="fixed"
>>   border-collapse="separate"
>>   border-separation="8pt"
>>   background-color="blue"
>>   border="4pt solid black">
>>   <fo:table-column number-columns-repeated="2"
>>     column-width="proportional-column-width(1)"/>
>>   <fo:table-body>
>>     <fo:table-row background-color="yellow">
>>       <fo:table-cell border="4pt solid red" number-rows-spanned="2">
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>       </fo:table-cell>
>>       <fo:table-cell border="4pt solid red">
>>         <fo:block>Cell 1.2</fo:block>
>>         <fo:block>Cell 1.2</fo:block>
>>       </fo:table-cell>
>>     </fo:table-row>
>>     <fo:table-row background-color="green">
>>       <fo:table-cell border="4pt solid red">
>>         <fo:block>Cell 2.1</fo:block>
>>       </fo:table-cell>
>>     </fo:table-row>
>>   </fo:table-body>
>> </fo:table>
>>
>> The result we get is on the left on the attached picture. I believe the
>> correct one should be the drawing on the right, because the area
>> corresponding to the border-separation should be painted with the
>> background of the table, not of the rows (see §6.7.3 of XSL-FO 1.1).
>> That's what Firefox is doing.
>>
>> Any disagreements?
>> Vincent
>>
>
>
>
> Jeremias Maerki


Re: Row backgrounds vs table background

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Hmm, I don't find anything in XSL 1.1 or CSS 2 that would be clear
enough for either solution. So I can't say it's either left or right,
but my personal preference would be the left solution. Shrug.

On 29.06.2007 11:04:13 Vincent Hennebert wrote:
> Guys,
> 
> I believe there's a bug in the handling of table- and row-backgrounds.
> See the following fo snippet:
> <fo:table width="100%"
>   table-layout="fixed"
>   border-collapse="separate"
>   border-separation="8pt"
>   background-color="blue"
>   border="4pt solid black">
>   <fo:table-column number-columns-repeated="2"
>     column-width="proportional-column-width(1)"/>
>   <fo:table-body>
>     <fo:table-row background-color="yellow">
>       <fo:table-cell border="4pt solid red" number-rows-spanned="2">
>         <fo:block>Cell 1.1</fo:block>
>         <fo:block>Cell 1.1</fo:block>
>         <fo:block>Cell 1.1</fo:block>
>         <fo:block>Cell 1.1</fo:block>
>         <fo:block>Cell 1.1</fo:block>
>       </fo:table-cell>
>       <fo:table-cell border="4pt solid red">
>         <fo:block>Cell 1.2</fo:block>
>         <fo:block>Cell 1.2</fo:block>
>       </fo:table-cell>
>     </fo:table-row>
>     <fo:table-row background-color="green">
>       <fo:table-cell border="4pt solid red">
>         <fo:block>Cell 2.1</fo:block>
>       </fo:table-cell>
>     </fo:table-row>
>   </fo:table-body>
> </fo:table>
> 
> The result we get is on the left on the attached picture. I believe the
> correct one should be the drawing on the right, because the area
> corresponding to the border-separation should be painted with the
> background of the table, not of the rows (see §6.7.3 of XSL-FO 1.1).
> That's what Firefox is doing.
> 
> Any disagreements?
> Vincent
> 



Jeremias Maerki


Re: Row backgrounds vs table background

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
And the attachment illustrating the final rendering.

Vincent Hennebert wrote:
> I decided not to send a request for clarification for this one, since 
> the latest CSS 2.1 [1] Candidate Recommendation clears up that issue 
> [2]. Excerpt from [2]:
>     “Each row is as wide as the row groups and as tall as a normal 
>     (single-row-spanning) cell in the row. As with columns, the 
>     background covers exactly the full area of all cells that originate 
>     in the row, even if they span outside the row, but this difference 
>     in area does not affect background image positioning.”
> 
> This is trivial to handle for coloured background, but won’t ease life 
> when it comes to image backgrounds I think.
> 
> Vincent
> 
> 
> [1] http://www.w3.org/TR/CSS21/
> [2] http://www.w3.org/TR/CSS21/tables.html#table-layers
> 
> 
> Vincent Hennebert wrote:
>> Guys,
>>
>> I believe there's a bug in the handling of table- and row-backgrounds.
>> See the following fo snippet:
>> <fo:table width="100%"
>>   table-layout="fixed"
>>   border-collapse="separate"
>>   border-separation="8pt"
>>   background-color="blue"
>>   border="4pt solid black">
>>   <fo:table-column number-columns-repeated="2"
>>     column-width="proportional-column-width(1)"/>
>>   <fo:table-body>
>>     <fo:table-row background-color="yellow">
>>       <fo:table-cell border="4pt solid red" number-rows-spanned="2">
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>         <fo:block>Cell 1.1</fo:block>
>>       </fo:table-cell>
>>       <fo:table-cell border="4pt solid red">
>>         <fo:block>Cell 1.2</fo:block>
>>         <fo:block>Cell 1.2</fo:block>
>>       </fo:table-cell>
>>     </fo:table-row>
>>     <fo:table-row background-color="green">
>>       <fo:table-cell border="4pt solid red">
>>         <fo:block>Cell 2.1</fo:block>
>>       </fo:table-cell>
>>     </fo:table-row>
>>   </fo:table-body>
>> </fo:table>
>>
>> The result we get is on the left on the attached picture. I believe the
>> correct one should be the drawing on the right, because the area
>> corresponding to the border-separation should be painted with the
>> background of the table, not of the rows (see §6.7.3 of XSL-FO 1.1).
>> That's what Firefox is doing.
>>
>> Any disagreements?
>> Vincent
> 

-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Re: Row backgrounds vs table background

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
I decided not to send a request for clarification for this one, since 
the latest CSS 2.1 [1] Candidate Recommendation clears up that issue 
[2]. Excerpt from [2]:
    “Each row is as wide as the row groups and as tall as a normal 
    (single-row-spanning) cell in the row. As with columns, the 
    background covers exactly the full area of all cells that originate 
    in the row, even if they span outside the row, but this difference 
    in area does not affect background image positioning.”

This is trivial to handle for coloured background, but won’t ease life 
when it comes to image backgrounds I think.

Vincent


[1] http://www.w3.org/TR/CSS21/
[2] http://www.w3.org/TR/CSS21/tables.html#table-layers


Vincent Hennebert wrote:
> Guys,
> 
> I believe there's a bug in the handling of table- and row-backgrounds.
> See the following fo snippet:
> <fo:table width="100%"
>   table-layout="fixed"
>   border-collapse="separate"
>   border-separation="8pt"
>   background-color="blue"
>   border="4pt solid black">
>   <fo:table-column number-columns-repeated="2"
>     column-width="proportional-column-width(1)"/>
>   <fo:table-body>
>     <fo:table-row background-color="yellow">
>       <fo:table-cell border="4pt solid red" number-rows-spanned="2">
>         <fo:block>Cell 1.1</fo:block>
>         <fo:block>Cell 1.1</fo:block>
>         <fo:block>Cell 1.1</fo:block>
>         <fo:block>Cell 1.1</fo:block>
>         <fo:block>Cell 1.1</fo:block>
>       </fo:table-cell>
>       <fo:table-cell border="4pt solid red">
>         <fo:block>Cell 1.2</fo:block>
>         <fo:block>Cell 1.2</fo:block>
>       </fo:table-cell>
>     </fo:table-row>
>     <fo:table-row background-color="green">
>       <fo:table-cell border="4pt solid red">
>         <fo:block>Cell 2.1</fo:block>
>       </fo:table-cell>
>     </fo:table-row>
>   </fo:table-body>
> </fo:table>
> 
> The result we get is on the left on the attached picture. I believe the
> correct one should be the drawing on the right, because the area
> corresponding to the border-separation should be painted with the
> background of the table, not of the rows (see §6.7.3 of XSL-FO 1.1).
> That's what Firefox is doing.
> 
> Any disagreements?
> Vincent

-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting