Bug 8423 - html { display:table; } renders incorrectly (and underpaints)
Summary: html { display:table; } renders incorrectly (and underpaints)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction
: 11577 17314 18524 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-16 05:42 PDT by Thomas Steinacher
Modified: 2010-06-15 15:01 PDT (History)
8 users (show)

See Also:


Attachments
test case (101 bytes, text/html)
2008-02-20 12:21 PST, Robert Blaut
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Steinacher 2006-04-16 05:42:40 PDT
Safari doesn't display a website with html { display:table; } correctly.

Try the following example and resize the window:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
html {
	display:table;
}
</style>
</head>
<body>
</body>
</html>
Comment 1 Dave Hyatt 2006-09-12 23:36:42 PDT
We don't allow you to alter the display type of the root element, nor do we plan to, since the end results are too problematic to deal with.

Comment 2 mitz 2008-02-20 12:10:14 PST
(In reply to comment #1)
> We don't allow you to alter the display type of the root element, nor do we
> plan to, since the end results are too problematic to deal with.

I do not think this is enforced. The test case does lead to very broken rendering. Bug 17314 has another example (where the root element is not <html>).
Comment 3 mitz 2008-02-20 12:10:22 PST
*** Bug 17314 has been marked as a duplicate of this bug. ***
Comment 4 Robert Blaut 2008-02-20 12:21:38 PST
Created attachment 19233 [details]
test case
Comment 5 Ian 'Hixie' Hickson 2008-03-20 12:26:28 PDT
According to CSS2.1 'display' on the root element with any of the following values must be treated as 'block': inline, run-in, table-row-group, table-column, table-column-group, table-header-group, table-footer-group, table-row, table-cell, table-caption, inline-block.

However, 'table', 'block', 'list-item', and 'none' must (according to the spec) be supported.

(Also, 'inline-table' becomes 'table'.)

See CSS2.1, 9.7 Relationships between 'display', 'position', and 'float'.
Comment 6 Dave Hyatt 2008-03-20 14:40:04 PDT
Yeah we currently only allow the root element to be a block.
Comment 7 mitz 2008-03-20 14:45:24 PDT
(In reply to comment #6)
> Yeah we currently only allow the root element to be a block.
> 

See comment #2
Comment 8 Dave Hyatt 2008-03-20 15:15:57 PDT
Yeah, looks like we just require it to be a block-level element, so we're correct according to CSS2.1 (just with misrendering).

This code in adjustRenderStyle enforces that:

if (style->display() != BLOCK && style->display() != TABLE && style->display() != BOX &&
            (style->position() == AbsolutePosition || style->position() == FixedPosition || style->floating() != FNONE ||
             (e && e->document()->documentElement() == e))) {
            if (style->display() == INLINE_TABLE)
                style->setDisplay(TABLE);
            else if (style->display() == INLINE_BOX)
                style->setDisplay(BOX);
            else if (style->display() == LIST_ITEM) {
                // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk,
                // but only in quirks mode.
                if (!m_strictParsing && style->floating() != FNONE)
                    style->setDisplay(BLOCK);
            }
            else
                style->setDisplay(BLOCK);
        }
Comment 9 mitz 2008-04-16 00:13:42 PDT
*** Bug 11577 has been marked as a duplicate of this bug. ***
Comment 10 mitz 2008-04-16 00:13:49 PDT
*** Bug 18524 has been marked as a duplicate of this bug. ***
Comment 11 mitz 2010-03-16 07:40:59 PDT
See also bug 36163.
Comment 12 Simon Fraser (smfr) 2010-06-15 15:01:14 PDT
Fixed by http://trac.webkit.org/changeset/61215