Bug 36084

Summary: baseline of inline-block is not bottom margin edge for overflow other than visible
Product: WebKit Reporter: mackyle
Component: New BugsAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: cbiesinger, hyatt, mackyle, mmaxfield, phiw2
Priority: P2 Keywords: BlinkMergeCandidate
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
URL: https://bugs.webkit.org/attachment.cgi?id=50653
Description Flags
Simple HTML demonstrating bug
Better example. Shows bug and correct and incorrect samples. none

Description mackyle 2010-03-12 21:09:38 PST
CSS2.1 Section 10.8.1


# The baseline of an 'inline-block' is the baseline of its last line box in
# the normal flow, unless it has either no in-flow line boxes or if its
# 'overflow' property has a computed value other than 'visible', in which
# case the baseline is the bottom margin edge.

1. Nest two inline-block elements with borders in different colors (i.e.
border: 5px solid red and border: 5px solid blue).
2. The outside one should have padding:0
3. The inside one should have margin:0 and overflow:hidden (and use the default vertical-align setting of baseline)
4. Just click on the sample URL for a test case

Actual: The inner border touches the outer border on all four sides.

Expected:  The inner border should touch the outer border everywhere except along the bottom side.  Because the inner inline-block should have had its bottom margin placed on the text baseline of the outer inline-block leaving the space between the text baseline and the bottom border of the outer block empty producing a gap between the inner border and the outer border along the bottom side only.

Firefox and Opera render this correctly with the gap -- view it with one of these browsers to see the gap.

The problem seems to be that WebKit does not implement the quoted part of the specification above which says, "if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge."
Comment 1 mackyle 2010-03-12 21:11:28 PST
Created attachment 50652 [details]
Simple HTML demonstrating bug

View in Firefox to see the correct rendering.
Comment 2 mackyle 2010-03-13 00:07:34 PST
Created attachment 50653 [details]
Better example.  Shows bug and correct and incorrect samples.

This example shows the test displayed by the current browser along with browser independent examples of correct and incorrect rendering.
A 'passed' or 'failed' indication should also be shown indicating whether or not the test was correctly rendered.
Comment 3 Dave Hyatt 2010-11-02 15:41:30 PDT
Not sure what to do with this bug, since it will be a compatibility issue if we try to fix it.  inline-block is used heavily on OS X with text-overflow/overflow-hidden text, and losing the ability to baseline-align those blocks seems like a flaw in the spec to me.
Comment 4 Christian Biesinger 2013-08-01 09:42:40 PDT
Comment 5 Myles C. Maxfield 2016-06-08 11:44:12 PDT
I wrote an exhaustive description of what is going on here in https://bugs.webkit.org/show_bug.cgi?id=157293#c4

*** This bug has been marked as a duplicate of bug 157293 ***