Bug 30846

Summary: display: inline-block + vertical-align: text-bottom causes misalignment.
Product: WebKit Reporter: HIRANO Takahito <hiranotaka>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, commit-queue, darin, eric, hamaji, hyatt, mitz, yutak
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Test Case
none
Fix alignment of vertical-align: text-bottom inside an inline-block.
abarth: review-
inline-block-vertical-align-2-expected.png
none
Fix alignment of vertical-align: text-bottom inside an inline-block. (v2)
none
Fix alignment of vertical-align: text-bottom inside an inline-block. (v3: fixed comment)
none
calculate bottom using JS
none
Test case for inline-table and inline-box
none
Test case for inline-table
none
Test case for display: inline-table + vertical-align: baseline
none
Fix alignment of vertical-align: text-bottom inside an inline-block. (v4: fixed test)
none
Patch (v5: apply hamaji's comment) none

HIRANO Takahito
Reported 2009-10-28 01:11:35 PDT
Created attachment 42005 [details] Test Case See the attachment. Expected: The bottom of the inline block should be aligned with the bottom of the text. Actual: The baseline of the inline block is aligned with the bottom of the text. The condition at WebCore/rendering/InlineFlowBox.cpp line 493 doesn't seem to be enough. !isReplaced() should be !IsReplaced() || style()->display() == INLINE_BLOCK. yutak, could you attach the patch to this bug?
Attachments
Test Case (383 bytes, text/html)
2009-10-28 01:11 PDT, HIRANO Takahito
no flags
Fix alignment of vertical-align: text-bottom inside an inline-block. (5.49 KB, patch)
2009-11-02 00:16 PST, Yuta Kitamura
abarth: review-
inline-block-vertical-align-2-expected.png (15.67 KB, image/png)
2009-11-02 00:17 PST, Yuta Kitamura
no flags
Fix alignment of vertical-align: text-bottom inside an inline-block. (v2) (26.93 KB, patch)
2009-11-16 00:24 PST, Yuta Kitamura
no flags
Fix alignment of vertical-align: text-bottom inside an inline-block. (v3: fixed comment) (27.08 KB, patch)
2009-11-18 02:00 PST, Yuta Kitamura
no flags
calculate bottom using JS (556 bytes, text/html)
2010-01-14 01:28 PST, Shinichiro Hamaji
no flags
Test case for inline-table and inline-box (590 bytes, text/html)
2010-01-14 18:49 PST, Yuta Kitamura
no flags
Test case for inline-table (496 bytes, text/html)
2010-01-14 19:09 PST, HIRANO Takahito
no flags
Test case for display: inline-table + vertical-align: baseline (496 bytes, text/html)
2010-01-14 19:13 PST, HIRANO Takahito
no flags
Fix alignment of vertical-align: text-bottom inside an inline-block. (v4: fixed test) (4.63 KB, patch)
2010-01-14 21:41 PST, Yuta Kitamura
no flags
Patch (v5: apply hamaji's comment) (4.61 KB, patch)
2010-02-22 00:40 PST, Yuta Kitamura
no flags
Yuta Kitamura
Comment 1 2009-11-02 00:16:13 PST
Created attachment 42306 [details] Fix alignment of vertical-align: text-bottom inside an inline-block.
Yuta Kitamura
Comment 2 2009-11-02 00:17:44 PST
Created attachment 42307 [details] inline-block-vertical-align-2-expected.png
Adam Barth
Comment 3 2009-11-14 22:28:49 PST
Comment on attachment 42306 [details] Fix alignment of vertical-align: text-bottom inside an inline-block. Missing binary file in patch. This patch cannot physically be landed.
Yuta Kitamura
Comment 4 2009-11-15 18:54:51 PST
(In reply to comment #3) > (From update of attachment 42306 [details]) > Missing binary file in patch. This patch cannot physically be landed. Sorry for that, I'll add it.
Yuta Kitamura
Comment 5 2009-11-16 00:24:31 PST
Created attachment 43272 [details] Fix alignment of vertical-align: text-bottom inside an inline-block. (v2)
Darin Adler
Comment 6 2009-11-16 13:54:00 PST
Comment on attachment 43272 [details] Fix alignment of vertical-align: text-bottom inside an inline-block. (v2) > - if (!isReplaced()) // lineHeight - baselinePosition is always 0 for replaced elements, so don't bother wasting time in that case. > + if (!isReplaced() || style()->display() == INLINE_BLOCK) // lineHeight - baselinePosition is always 0 for replaced elements, so don't bother wasting time in that case. We'll need someone more familiar with the rendering code to review the substance of this patch. But the comment needs to be changed. It's now definitely wrong.
Yuta Kitamura
Comment 7 2009-11-16 18:19:58 PST
(In reply to comment #6) > (From update of attachment 43272 [details]) > > - if (!isReplaced()) // lineHeight - baselinePosition is always 0 for replaced elements, so don't bother wasting time in that case. > > + if (!isReplaced() || style()->display() == INLINE_BLOCK) // lineHeight - baselinePosition is always 0 for replaced elements, so don't bother wasting time in that case. > > We'll need someone more familiar with the rendering code to review the > substance of this patch. But the comment needs to be changed. It's now > definitely wrong. Sure - I'll fix this. Thanks for your review!
Yuta Kitamura
Comment 8 2009-11-18 02:00:54 PST
Created attachment 43415 [details] Fix alignment of vertical-align: text-bottom inside an inline-block. (v3: fixed comment)
Adam Barth
Comment 9 2009-11-30 12:25:52 PST
Attachment 43415 [details] passed the style-queue
Shinichiro Hamaji
Comment 10 2010-01-14 01:28:37 PST
Created attachment 46546 [details] calculate bottom using JS I cannot determine if the code change is correct either (maybe we can ask Dan to review the code change?). Two comments on the layout tests. I'm not sure, but I guess this can be tested by dumpAsText(). Please see the attachment. I think no red should be seen in passing tests. How about changing the color of underline of the inner span?
Yuta Kitamura
Comment 11 2010-01-14 02:39:58 PST
(In reply to comment #10) > I cannot determine if the code change is correct either (maybe we can ask Dan > to review the code change?). Two comments on the layout tests. I'm not sure, > but I guess this can be tested by dumpAsText(). Please see the attachment. I > think no red should be seen in passing tests. How about changing the color of > underline of the inner span? Thank you for your suggestion. Sounds convincing. I'd like to fix the test.
mitz
Comment 12 2010-01-14 07:43:39 PST
Do we need the same fix for inline-table and inline-box?
Yuta Kitamura
Comment 13 2010-01-14 18:49:50 PST
Created attachment 46634 [details] Test case for inline-table and inline-box inline-table and inline-box cases look fine to me.
HIRANO Takahito
Comment 14 2010-01-14 19:09:45 PST
Created attachment 46635 [details] Test case for inline-table No. inline-table is also misaligned. http://www.w3.org/TR/CSS21/visudet.html#leading says: The baseline of an 'inline-table' is the baseline of the first row of the table. However, this should be a different issue from this.
HIRANO Takahito
Comment 15 2010-01-14 19:13:12 PST
Created attachment 46636 [details] Test case for display: inline-table + vertical-align: baseline Ah, that specification was for display: inline-table + vertical-align: baseline. So display: inline-table + vertical-align: text-bottom works fine.
Yuta Kitamura
Comment 16 2010-01-14 21:41:49 PST
Created attachment 46641 [details] Fix alignment of vertical-align: text-bottom inside an inline-block. (v4: fixed test)
Eric Seidel (no email)
Comment 17 2010-01-26 14:54:15 PST
Looks like this just needs one more look from mitz.
Eric Seidel (no email)
Comment 18 2010-02-17 14:45:03 PST
Emailed mitz requesting review.
Shinichiro Hamaji
Comment 19 2010-02-18 19:44:38 PST
Comment on attachment 46641 [details] Fix alignment of vertical-align: text-bottom inside an inline-block. (v4: fixed test) > +if (outerBottom >= innerBottom) { > + result.innerHTML = 'PASS'; > + result.style.color = 'green'; > +} else { > + result.innerHTML = 'FAIL'; > + result.style.color = 'red'; > +} > +result.innerHTML += ' (outerBottom = ' + outerBottom + ', innerBottom = ' + innerBottom + ')'; I think we should output these values (this is platform dependent value, isn't it?) only when the test fails. Otherwise, we need to have expectations for all platforms.
Yuta Kitamura
Comment 20 2010-02-18 19:55:21 PST
(In reply to comment #19) > (From update of attachment 46641 [details]) > > +if (outerBottom >= innerBottom) { > > + result.innerHTML = 'PASS'; > > + result.style.color = 'green'; > > +} else { > > + result.innerHTML = 'FAIL'; > > + result.style.color = 'red'; > > +} > > +result.innerHTML += ' (outerBottom = ' + outerBottom + ', innerBottom = ' + innerBottom + ')'; > > I think we should output these values (this is platform dependent value, isn't > it?) only when the test fails. Otherwise, we need to have expectations for all > platforms. Indeed. I'll fix it.
Yuta Kitamura
Comment 21 2010-02-22 00:40:15 PST
Created attachment 49190 [details] Patch (v5: apply hamaji's comment)
Shinichiro Hamaji
Comment 22 2010-02-22 00:53:34 PST
(In reply to comment #21) > Created an attachment (id=49190) [details] > Patch (v5: apply hamaji's comment) The change for the test looks good, thanks for the fix! mitz, could you check the updated patch?
Yuta Kitamura
Comment 23 2010-02-22 21:19:05 PST
Comment on attachment 49190 [details] Patch (v5: apply hamaji's comment) Thank you for your review! Setting cq-?.
WebKit Commit Bot
Comment 24 2010-02-23 04:04:45 PST
Comment on attachment 49190 [details] Patch (v5: apply hamaji's comment) Clearing flags on attachment: 49190 Committed r55141: <http://trac.webkit.org/changeset/55141>
WebKit Commit Bot
Comment 25 2010-02-23 04:04:51 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.