Bug 16828 - WebView never paints if first page load is canceled after being committed but before layout
Summary: WebView never paints if first page load is canceled after being committed but...
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Adam Roben (:aroben)
Keywords: InRadar
Depends on:
Reported: 2008-01-10 15:32 PST by Adam Roben (:aroben)
Modified: 2008-01-11 13:06 PST (History)
1 user (show)

See Also:

patch 1/2 (2.82 KB, patch)
2008-01-11 12:34 PST, Adam Roben (:aroben)
hyatt: review+
Details | Formatted Diff | Diff
patch 2/2 (1.49 KB, patch)
2008-01-11 12:40 PST, Adam Roben (:aroben)
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
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

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

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