Bug 16828

Summary: WebView never paints if first page load is canceled after being committed but before layout
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: WebKit Misc.Assignee: Adam Roben (:aroben) <aroben>
Status: RESOLVED FIXED    
Severity: Normal CC: hyatt
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
patch 1/2
hyatt: review+
patch 2/2 hyatt: review+

Description Adam Roben (:aroben) 2008-01-10 15:32:24 PST
WebView never paints if the first page load is canceled after the load is committed but before the first layout occurs.

To reproduce:
1. Run a WebKit nightly <http://nightly.webkit.org/>
2. Set your Safari preferences to open new windows with a web page that loads slowly
3. Press Ctrl-N to create a new window
4. Quickly press Esc to cancel the load

The result is that the WebView portion of the Safari window never paints until you load a new page. Dragging another window over the WebView area leaves behind garbage pixels. Resizing the window doesn't help.
Comment 1 Adam Roben (:aroben) 2008-01-10 15:33:39 PST
The problem line of code seems to be this <http://trac.webkit.org/projects/webkit/browser/trunk/WebKit/win/WebView.cpp?rev=29369#L1590>:

            if (!webView->isPainting() && (!dataSource || coreFrame && (coreFrame->view()->didFirstLayout() || !coreFrame->loader()->committedFirstRealDocumentLoad())))

didFirstLayout() is returning false and committedFirstRealDocumentLoad() is returning true.
Comment 2 Adam Roben (:aroben) 2008-01-10 15:34:15 PST
<rdar://problem/5682402>
Comment 3 Dave Hyatt 2008-01-10 15:35:33 PST
firstLayout was a hack put in on Windows prior to having the full networking layer (with its notion of being "committed") ported over from Mac.  I suspect the firstLayout check is no longer needed (and does not match Mac anyway).

Comment 4 Adam Roben (:aroben) 2008-01-10 15:38:14 PST
Hyatt also says we should make sure the Windows and Mac agree on when painting should be suppressed.
Comment 5 Adam Roben (:aroben) 2008-01-11 12:25:29 PST
I have a fix for this.
Comment 6 Adam Roben (:aroben) 2008-01-11 12:34:30 PST
Created attachment 18399 [details]
patch 1/2
Comment 7 Adam Roben (:aroben) 2008-01-11 12:40:14 PST
Created attachment 18400 [details]
patch 2/2
Comment 8 Dave Hyatt 2008-01-11 12:41:21 PST
Comment on attachment 18399 [details]
patch 1/2

r=me
Comment 9 Dave Hyatt 2008-01-11 12:42:01 PST
Comment on attachment 18400 [details]
patch 2/2

r=me
Comment 10 Adam Roben (:aroben) 2008-01-11 13:06:39 PST
Landed as r29415 and r29416