Bug 122549

Summary: [Win] BeginPaint should only be called in response to WM_PAINT.
Product: WebKit Reporter: peavo
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description peavo 2013-10-09 06:17:03 PDT
According to the documentation (http://msdn.microsoft.com/en-us/library/windows/desktop/dd183362(v=vs.85).aspx), the Win32 api functions BeginPaint and EndPaint should only be called in response to a WM_PAINT message. Currently, the WebView window procedure might call these functions (via WebView::paint(0, 0)) for all types of messages. Also, there is potential double drawing. If some message is dispatched before WM_PAINT, WebView::paint(0, 0) will be called. This call does not validate the area drawn, so later the WM_PAINT will arrive, drawing the same area.
Comment 1 peavo 2013-10-09 06:28:52 PDT
Created attachment 213770 [details]
Patch
Comment 2 Brent Fulgham 2013-10-09 09:10:10 PDT
Comment on attachment 213770 [details]
Patch

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

> Source/WebKit/win/WebView.cpp:2467
> +        ::UpdateWindow(hWnd);

Will this trigger the logic in webView->performLayeredWIndowUpdate()?
Comment 3 peavo 2013-10-09 09:36:54 PDT
(In reply to comment #2)
> (From update of attachment 213770 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=213770&action=review
> 
> > Source/WebKit/win/WebView.cpp:2467
> > +        ::UpdateWindow(hWnd);
> 
> Will this trigger the logic in webView->performLayeredWIndowUpdate()?

Yes, UpdateWindow will send the WM_PAINT message (synchronously) if there is an invalid area.
Comment 4 Brent Fulgham 2013-10-09 09:40:24 PDT
Comment on attachment 213770 [details]
Patch

r=me
Comment 5 Radar WebKit Bug Importer 2013-10-09 09:41:06 PDT
<rdar://problem/15187300>
Comment 6 peavo 2013-10-09 09:44:18 PDT
(In reply to comment #4)
> (From update of attachment 213770 [details])
> r=me

Thanks for reviewing!
Comment 7 WebKit Commit Bot 2013-10-09 10:04:10 PDT
Comment on attachment 213770 [details]
Patch

Clearing flags on attachment: 213770

Committed r157174: <http://trac.webkit.org/changeset/157174>
Comment 8 WebKit Commit Bot 2013-10-09 10:04:12 PDT
All reviewed patches have been landed.  Closing bug.