Bug 181115

Summary: REGRESSION(r224460): Text fields sometimes get "messed up"
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Blocker CC: bfulgham, bugs-noreply, cgarcia, koivisto, mcatanzaro, simon.fraser, webkit-bug-importer, zalan, zan
Priority: P1 Keywords: InRadar
Version: Other   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Screencast showing problem
none
Another screencast
none
Another screencast
none
Patch
zalan: review+
Patch for landing none

Description Michael Catanzaro 2017-12-21 18:55:36 PST
Created attachment 330089 [details]
Screencast showing problem

Text fields sometimes get "messed up" in 2.19.3. This is a regression from 2.18, but unfortunately I have no clue when it was introduced. This problem is hard to describe, so refer to the attached screencast. It looks like some graphics tiling problem. Text is being rendered in the wrong place. In the screencast, I hit the Enter key. I don't type a period: it just appears in the wrong place. Then I press the down arrow key, and then the right arrow key several times.

Unfortunately I do not know how to reproduce this problem.
Comment 1 Michael Catanzaro 2017-12-21 19:00:20 PST
Created attachment 330091 [details]
Another screencast
Comment 2 Michael Catanzaro 2017-12-21 19:00:33 PST
Created attachment 330092 [details]
Another screencast
Comment 3 Zan Dobersek 2017-12-22 23:07:40 PST
Bisected this down to r224460, bug #179279.

The regression is due to m_paintOffset now being adjusted for scroll position in case of an overflow clip in computeOffsets() before it's then used to calculate the clip rect in computeClipRect(), while before this was done in reverse order.

Not sure whether this is intentional or not, so input from Zalan or Antti is welcome in order to get this addressed.
Comment 4 Zan Dobersek 2017-12-22 23:07:56 PST
(In reply to Zan Dobersek from comment #3)
> Bisected this down to r224460, bug #179279.

https://trac.webkit.org/changeset/224460/webkit
Comment 5 zalan 2017-12-23 08:52:04 PST
(In reply to Zan Dobersek from comment #3)
> Bisected this down to r224460, bug #179279.
> 
> The regression is due to m_paintOffset now being adjusted for scroll
> position in case of an overflow clip in computeOffsets() before it's then
> used to calculate the clip rect in computeClipRect(), while before this was
> done in reverse order.
> 
> Not sure whether this is intentional or not, so input from Zalan or Antti is
> welcome in order to get this addressed.
No, it's definitely not intentional. Do you happen to have a cross platform test reduction? I could take a look at it.
Comment 6 Michael Catanzaro 2017-12-23 09:58:43 PST
(In reply to Zan Dobersek from comment #3)
> Bisected this down to r224460, bug #179279.

Wow, that must have taken a while... thank you.
Comment 7 Michael Catanzaro 2018-01-02 15:43:10 PST
(In reply to zalan from comment #5)
> No, it's definitely not intentional. Do you happen to have a cross platform
> test reduction? I could take a look at it.

I think all text entries are broken for GTK, including the comment entry on this Bugzilla. But even though I've been frustrated by this bug for several weeks, I'm still not quite sure what exactly is needed to trigger the bug. Zan must have figured it out in order to bisect it.
Comment 8 Michael Catanzaro 2018-01-05 07:56:07 PST
(I don't normally use Bugzilla priorities, but I will here, because we really can't release 2.20 until we figure out how to fix this.)
Comment 9 Carlos Garcia Campos 2018-01-08 01:05:38 PST
Created attachment 330671 [details]
Patch
Comment 10 Michael Catanzaro 2018-01-08 05:52:40 PST
Thanks a bunch!

Maybe Zalan will review it?
Comment 11 zalan 2018-01-08 07:23:47 PST
(In reply to Michael Catanzaro from comment #10)
> Thanks a bunch!
> 
> Maybe Zalan will review it?
will surely do today.
Comment 12 Simon Fraser (smfr) 2018-01-08 08:25:46 PST
Comment on attachment 330671 [details]
Patch

Is it possible to make a test case? It's odd that this broke GTK but not mac, and having a test case for mac would be good.
Comment 13 zalan 2018-01-08 08:52:44 PST
Comment on attachment 330671 [details]
Patch

I think having paintOffsetForClipRect = m_paintOffset + renderer.scrollPosition(); is more correct/explicit than what we had pre r224460. Also, with this patch, computeOffsets() does not actually computes all the offsets and could lead to incorrect assumptions in the future.
Comment 14 Carlos Garcia Campos 2018-01-09 00:20:32 PST
(In reply to Simon Fraser (smfr) from comment #12)
> Comment on attachment 330671 [details]
> Patch
> 
> Is it possible to make a test case? It's odd that this broke GTK but not
> mac, and having a test case for mac would be good.

Antti suggested the same yesterday and I tried to write a test, but I was unable to reproduce the issue with a tests case. I don't know if it is because there are force repaints/layouts in WTR that don't normally happen.
Comment 15 Carlos Garcia Campos 2018-01-09 02:14:58 PST
Created attachment 330801 [details]
Patch for landing

This makes more sense now, thanks Zalan, Antti!
Comment 16 Carlos Garcia Campos 2018-01-09 02:57:14 PST
Committed r226623: <https://trac.webkit.org/changeset/226623>
Comment 17 Radar WebKit Bug Importer 2018-01-09 02:58:18 PST
<rdar://problem/36372780>
Comment 18 zalan 2018-01-09 06:59:50 PST
(In reply to Carlos Garcia Campos from comment #15)
> Created attachment 330801 [details]
> Patch for landing
> 
> This makes more sense now, thanks Zalan, Antti!

Thanks for fixing it.