Skip to content

Commit 71f8242

Browse files
committed
Views should be made visible before painting in WM_PRINTCLIENT messages
https://bugs.webkit.org/show_bug.cgi?id=58676 <rdar://problem/9279211> Reviewed by Adam Roben. * UIProcess/win/WebView.cpp: (WebKit::WebView::onPrintClientEvent): If our view isn't currently visible set it to visible before painting, then reset it back to not visible after painting. (WebKit::WebView::onShowWindowEvent): Call setIsVisible instead of duplicating logic. (WebKit::WebView::setIsVisible): Set the m_isVisible flag and call viewStateDidChange. * UIProcess/win/WebView.h: Canonical link: https://commits.webkit.org/73762@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84019 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 118830d commit 71f8242

3 files changed

Lines changed: 40 additions & 5 deletions

File tree

Source/WebKit2/ChangeLog

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2011-04-15 Brian Weinstein <bweinstein@apple.com>
2+
3+
Reviewed by Adam Roben.
4+
5+
Views should be made visible before painting in WM_PRINTCLIENT messages
6+
https://bugs.webkit.org/show_bug.cgi?id=58676
7+
<rdar://problem/9279211>
8+
9+
* UIProcess/win/WebView.cpp:
10+
(WebKit::WebView::onPrintClientEvent): If our view isn't currently visible set it to visible
11+
before painting, then reset it back to not visible after painting.
12+
(WebKit::WebView::onShowWindowEvent): Call setIsVisible instead of duplicating logic.
13+
(WebKit::WebView::setIsVisible): Set the m_isVisible flag and call viewStateDidChange.
14+
* UIProcess/win/WebView.h:
15+
116
2011-04-15 Jon Lee <jonlee@apple.com>
217

318
Reviewed by Anders Carlsson.

Source/WebKit2/UIProcess/win/WebView.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,22 @@ LRESULT WebView::onPrintClientEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool
691691
RECT winRect;
692692
::GetClientRect(hWnd, &winRect);
693693

694+
// Twidding the visibility flags tells the DrawingArea to resume painting. Right now, the
695+
// the visible state of the view only affects whether or not painting happens, but in the
696+
// future it could affect more, which we wouldn't want to touch here.
697+
698+
// FIXME: We should have a better way of telling the WebProcess to draw even if we're
699+
// invisible than twiddling the visibility flag.
700+
701+
bool wasVisible = isViewVisible();
702+
if (!wasVisible)
703+
setIsVisible(true);
704+
694705
paint(hdc, winRect);
695706

707+
if (!wasVisible)
708+
setIsVisible(false);
709+
696710
handled = true;
697711
return 0;
698712
}
@@ -752,11 +766,8 @@ LRESULT WebView::onShowWindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARA
752766
// lParam is 0 when the message is sent because of a ShowWindow call.
753767
// FIXME: Since we don't get notified when an ancestor window is hidden or shown, we will keep
754768
// painting even when we have a hidden ancestor. <http://webkit.org/b/54104>
755-
if (!lParam) {
756-
m_isVisible = wParam;
757-
if (m_page)
758-
m_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
759-
}
769+
if (!lParam)
770+
setIsVisible(wParam);
760771

761772
handled = false;
762773
return 0;
@@ -1469,6 +1480,14 @@ void WebView::setIsInWindow(bool isInWindow)
14691480
m_page->viewStateDidChange(WebPageProxy::ViewIsInWindow);
14701481
}
14711482

1483+
void WebView::setIsVisible(bool isVisible)
1484+
{
1485+
m_isVisible = isVisible;
1486+
1487+
if (m_page)
1488+
m_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
1489+
}
1490+
14721491
#if USE(ACCELERATED_COMPOSITING)
14731492

14741493
void WebView::enterAcceleratedCompositingMode(const LayerTreeContext&)

Source/WebKit2/UIProcess/win/WebView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class WebView : public APIObject, public PageClient, WebCore::WindowMessageListe
6060
void setParentWindow(HWND);
6161
void windowAncestryDidChange();
6262
void setIsInWindow(bool);
63+
void setIsVisible(bool);
6364
void setOverrideCursor(HCURSOR);
6465
void setInitialFocus(bool forward);
6566
void setScrollOffsetOnNextResize(const WebCore::IntSize&);

0 commit comments

Comments
 (0)