Skip to content

<tr> backgrounds aren't drawn correctly #19788

Closed

Description

@KwanEsq

Other browsers seem to render tr { background-color: black } the same as tr > th, tr > td { background-color: black }. Servo does not. (Not sure where that's spec'ed, or even if it is)

Testcase: http://kwan.perix.co.uk/mozilla/tableRowBackgroundTest.html
(Correct rendering emulated on hover using cell backgrounds)

Servo rendering:
screenshot from 2018-01-16 22-50-32

Firefox rendering:
screenshot from 2018-01-16 22-51-31

Activity

  1. emilio commented on Jan 16, 2018

    @emilio
    Member

    Thanks for the report @KwanEsq!

    Testcase for posterity, with some superfluous tag removal:

    <!doctype html>
    <meta charset="UTF-8">
    <title>Servo table row background test</title>
    <style>
      tr:not(:hover),
      tr:hover > td {
        background-color: black;
        color: white;
      }
    </style>
    </head>
    <table>
      <tr><td>testing</td></tr>
    </table>
    <table>
      <tr><td>testing</td><td>testing</td></tr>
    </table>
    <table>
      <tr><td>testing</td><td>testing</td><td>testing</td></tr>
    </table>
    <table>
      <tr><td>testing</td><td>testing</td><td>testing</td><td>testing</td></tr>
    </table>
  2. added
    I-wrong
    on Jan 16, 2018
  3. added
    C-has-manual-testcase
    on Jan 17, 2018
  4. mbrubeck commented on Feb 9, 2018

    @mbrubeck
    Contributor

    This behavior is specified here: https://drafts.csswg.org/css2/tables.html#table-layers

    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.

  5. mbrubeck commented on Feb 9, 2018

    @mbrubeck
    Contributor

    TableRow::build_display_list is currently responsible for drawing this background. It delegates to a BlockFlow method, which doesn't know about the special rules for table row/column/rowgroup/colgroup background areas.

    Perhaps FragmentDisplayListBuilding::build_display_list_for_background_if_applicable should not draw any background for table rows (or columns, or rowgroups, or colgroups). Instead, each table cell fragment could draw the backgrounds for each of these, in the layer order from the spec above. The TableCell flow would need access to the styles of its containing row/column flows (or at least their background properties).

  6. added 14 commits that reference this issue on Feb 15, 2018
    2390e18
    06326d8
    7657f6b
    144348c
    ae3e63f
    0c190f5
    cab411b
    73a1127
    c563e1a
    97ceaf6
    f5221ac
    512e783
    96f36f7
    0b4ea01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gfx/uncategorizedA-layout/tableC-has-manual-testcaseI-wrong

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions