Bug 61768 - REGRESSION (r87067): Text overflows from short height text field
Summary: REGRESSION (r87067): Text overflows from short height text field
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Normal
Assignee: Kent Tamura
URL:
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2011-05-31 00:38 PDT by Yuzo Fujishima
Modified: 2011-07-04 18:28 PDT (History)
6 users (show)

See Also:


Attachments
Reduction (315 bytes, text/html)
2011-05-31 00:38 PDT, Yuzo Fujishima
no flags Details
Screenshot (13.20 KB, image/png)
2011-05-31 00:39 PDT, Yuzo Fujishima
no flags Details
Patch (13.54 KB, patch)
2011-05-31 06:05 PDT, Yuzo Fujishima
no flags Details | Formatted Diff | Diff
Patch 2 (6.30 KB, patch)
2011-05-31 22:52 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch (8.43 KB, patch)
2011-07-04 01:22 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-01 (1.58 MB, application/zip)
2011-07-04 01:53 PDT, WebKit Review Bot
no flags Details
Patch 4 (9.32 KB, patch)
2011-07-04 01:57 PDT, Kent Tamura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuzo Fujishima 2011-05-31 00:38:44 PDT
Created attachment 95400 [details]
Reduction

Text typed into a short height text field overflows from the field to below.

Reproduction steps:
1. Open the attached reduction with Safari (WebKit 87713).
2. Observe the text field.

Firefox 4.0.1 and Opera 11.11 behave correctly -- they render text only inside the text field.
Comment 1 Yuzo Fujishima 2011-05-31 00:39:20 PDT
Created attachment 95401 [details]
Screenshot
Comment 2 Kent Tamura 2011-05-31 03:28:06 PDT
I think we need to add overflow-y:hidden or something to the UA stylesheet for <input>.
Comment 3 Yuzo Fujishima 2011-05-31 06:05:15 PDT
Created attachment 95424 [details]
Patch
Comment 4 mitz 2011-05-31 08:36:16 PDT
This is a fairly recent regression (the bug doesn’t occur in r86179). I expect the lightweight control clip mechanism to do this automatically. I think it’s important to understand how the regression occurred before attempting this fix.
Comment 5 mitz 2011-05-31 08:39:18 PDT
Specifically, it seems likely that this was caused by r87067.
Comment 6 mitz 2011-05-31 08:46:42 PDT
<rdar://problem/9527476>
Comment 7 mitz 2011-05-31 09:16:00 PDT
Comment on attachment 95424 [details]
Patch

This should be handled by hasControlClip() / controlClipRect().
Comment 8 Kent Tamura 2011-05-31 18:07:43 PDT
(In reply to comment #4)
> I think it’s important to understand how the regression occurred before attempting this fix.

At the beginning of RenderTextControlSingleLine::layout(), we change the inner text height to 1 by innerTextRenderer->style()->setHeight(Length(desiredheight, Fixed)) in this case.  I confirmed this was called on ToT, but it was not effective?
Comment 9 mitz 2011-05-31 18:29:58 PDT
I would investigate whether hasControlClip() and controlClipRect() are still consulted and what values they return. This is something that happens at paint time, not layout time.
Comment 10 Kent Tamura 2011-05-31 19:07:28 PDT
Well, I found the root cause.

As I wrote in Comment #8, RenderTextControlSingleLine::layout() adjusts the height of the inner text block. However TextControlInnerTextElement::styleForRenderer() resets the RenderStyle since r87067. It shows the problem in a case that:
 1. RenderTextControlSingleLine::layout() is done.
    RenderStyle for the inner text has height=1.
 2. HTMLInputElement::value is updated.
    So, TextControlInnerTextElement::styleForRenderer() resets the RenderStyle.  It has no height.
 3. The inner text is laid out and it has a natural height such as 13px,
   but RenderTextControlSingleLine::layout() is not called (is it normal?)



> I would investigate whether hasControlClip() and controlClipRect() are still consulted and what values they return.

We have never used the control clip to clip the inner text of <input> AFAIK.
Comment 11 Kent Tamura 2011-05-31 21:32:35 PDT
(In reply to comment #10)
> Well, I found the root cause.
> 
> As I wrote in Comment #8, RenderTextControlSingleLine::layout() adjusts the height of the inner text block. However TextControlInnerTextElement::styleForRenderer() resets the RenderStyle since r87067. It shows the problem in a case that:
>  1. RenderTextControlSingleLine::layout() is done.
>     RenderStyle for the inner text has height=1.
>  2. HTMLInputElement::value is updated.
>     So, TextControlInnerTextElement::styleForRenderer() resets the RenderStyle.  It has no height.
>  3. The inner text is laid out and it has a natural height such as 13px,
>    but RenderTextControlSingleLine::layout() is not called (is it normal?)

Correction: RenderTextControlSingleLine::layout() was called. But the RenderBlock for the inner text still has an old small height.  So setHeight() is not called.
Comment 12 Kent Tamura 2011-05-31 22:52:10 PDT
Created attachment 95547 [details]
Patch 2
Comment 13 Kent Tamura 2011-06-28 03:59:48 PDT
I found the patch causes another problem.
Comment 14 Kent Tamura 2011-07-04 01:22:26 PDT
Created attachment 99607 [details]
Patch
Comment 15 WebKit Review Bot 2011-07-04 01:53:19 PDT
Comment on attachment 99607 [details]
Patch

Attachment 99607 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/8979717

New failing tests:
fast/forms/textfield-overflow-by-value-update.html
Comment 16 WebKit Review Bot 2011-07-04 01:53:24 PDT
Created attachment 99608 [details]
Archive of layout-test-results from ec2-cr-linux-01

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-01  Port: Chromium  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 17 Kent Tamura 2011-07-04 01:57:33 PDT
Created attachment 99609 [details]
Patch 4

The test fails on Chromium expectedly
Comment 18 Dimitri Glazkov (Google) 2011-07-04 09:50:57 PDT
Comment on attachment 99609 [details]
Patch 4

View in context: https://bugs.webkit.org/attachment.cgi?id=99609&action=review

> LayoutTests/fast/forms/textfield-overflow-by-value-update.html:15
> +     So, the test result should be just white. -->

That's pretty clever :)
Comment 19 Kent Tamura 2011-07-04 17:34:47 PDT
Comment on attachment 99609 [details]
Patch 4

Thank you for r+!
Comment 20 WebKit Review Bot 2011-07-04 18:27:59 PDT
Comment on attachment 99609 [details]
Patch 4

Clearing flags on attachment: 99609

Committed r90379: <http://trac.webkit.org/changeset/90379>
Comment 21 WebKit Review Bot 2011-07-04 18:28:07 PDT
All reviewed patches have been landed.  Closing bug.