Bug 22771 - table with display: inline; does not work with proper DOCTYPE
Summary: table with display: inline; does not work with proper DOCTYPE
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tables (show other bugs)
Version: 525.x (Safari 3.2)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2008-12-09 17:04 PST by jasneet
Modified: 2012-10-02 11:33 PDT (History)
6 users (show)

See Also:


Attachments
testcase (728 bytes, application/zip)
2008-12-09 17:04 PST, jasneet
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jasneet 2008-12-09 17:04:17 PST
I Steps:
Go to attached testcase

II Issue:
The table should be next to the input because it has "display: inline;"

III Other Browsers:
IE7: ok
FF3: ok

IV Nightly tested: 39088

Bug in Chromium : http://code.google.com/p/chromium/issues/detail?id=2032
Comment 1 jasneet 2008-12-09 17:04:36 PST
Created attachment 25905 [details]
testcase
Comment 2 Mustafizur Rahaman (rahaman) 2011-05-24 23:20:52 PDT
The issue description (Bug in Chromium : http://code.google.com/p/chromium/issues/detail?id=2032 ) mentions that the issue is present if we have the DOCTYPE, removing the DOCTYPE renders the table inline as expected.

Upon investigation, it is found that RenderStyle for RenderObject (Table element ) is noninherited_flags._effectiveDisplay = 7 (INLINE_TABLE) , when DOCTYPE is NOT mentioned & table renders inline. 

But when DOCTYPE is mentioned, the same property has value 0 (INLINE) & the table does not render inline. The display type setting is done in 

CSSStyleSelector::adjustRenderStyle()
{
    if (style->display() != NONE) {
        // If we have a <td> that specifies a float property, in quirks mode we just drop the float
        // property.
        // Sites also commonly use display:inline/block on <td>s and <table>s.  In quirks mode we force
        // these tags to retain their display types.
        if (!m_checker.m_strictParsing && e) {
            if (e->hasTagName(tdTag)) {
                style->setDisplay(TABLE_CELL);
                style->setFloating(FNONE);
            }
            else if (e->hasTagName(tableTag))
                style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
        }
}

Further analysis found that when DOCTYPE is mentioned, the document m_compatibilityMode = LimitedQuirksMode, therefore m_checker.m_strictParsing = TRUE. When DOCTYPE is NOT mentioned m_compatibilityMode == QuirksMode, therefore m_checker.m_strictParsing = FALSE

So, as we can see from above, when m_checker.m_strictParsing = FALSE, we set the display for table element as INLINE_TABLE. If m_checker.m_strictParsing == TRUE (DOCTYPE is mentioned), the if block is ommitted & the display is NOT set to INLINE.

Can any one help me understand why this code is present in CSSStyleSelector::adjustRenderStyle(), I think if we remove this, the issue would be fixed.
Comment 3 Alexey Proskuryakov 2011-05-25 14:19:14 PDT
Did you try following svn blame to find out when this code was added?
Comment 4 Mustafizur Rahaman (rahaman) 2011-05-25 21:25:22 PDT
Thanks Alexey. I got some info as to when this code was added by using svn blame.

However, I finally found that it is the problem with the test case. To make a table display inline, "display:inline" is not enough, we have to specify "display:inline-table" (enum INLINE_TABLE in the code). Please refer to 
http://www.webkit.org/blog/115/webcore-rendering-ii-blocks-and-inlines/ as well
http://www.w3schools.com/css/pr_class_display.asp

When DOCTYPE is not mentioned i.e. in Quirk mode, the code applies lesser strictness, therefore allow "display:inline" to be displayed as inline table. But when we mention DOCTYPE, applying of style becomes more strict & it displays an inline table if & only if we mention "display:inline-table".

I have verified by making the following changes in the test case & now the table is rendered inline in Winlauncher & Safari.

<table style="display:inline-table">

Therefore, it is a test case issue, no problem with the code.

Can I change the status of the bug & How?
Comment 5 Mustafizur Rahaman( :rahaman) 2012-01-29 21:53:50 PST
Based on the discussion above, can someone please mark the issue as RESOLVED WONTFIX?