Commit 75bf8e69 authored by aroben@apple.com's avatar aroben@apple.com

Fill the WKView with white when the web process hasn't drawn anything yet

Fixes <http://webkit.org/b/52023> WKView accumulates pixel garbage
before web process has had a chance to draw anything (if Aero is
disabled)

Reviewed by Jon Honeycutt.

* UIProcess/ChunkedUpdateDrawingAreaProxy.cpp:
(WebKit::ChunkedUpdateDrawingAreaProxy::paint):
* UIProcess/ChunkedUpdateDrawingAreaProxy.h:
* UIProcess/DrawingAreaProxy.h:
* UIProcess/LayerBackedDrawingAreaProxy.cpp:
(WebKit::LayerBackedDrawingAreaProxy::paint):
* UIProcess/LayerBackedDrawingAreaProxy.h:
* UIProcess/TiledDrawingAreaProxy.cpp:
(WebKit::TiledDrawingAreaProxy::paint):
* UIProcess/TiledDrawingAreaProxy.h:
* UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm:
(WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint):
* UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp:
(WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint):
* UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp:
(WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint):
* UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp:
(WebKit::LayerBackedDrawingAreaProxy::paint):
Changed these functions to return a boolean indicating whether we
actually painted anything.

* UIProcess/win/WebView.cpp:
(WebKit::WebView::onPaintEvent): Fill with white (and don't call
didDraw) when the DrawingAreaProxy isn't able to paint.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fc0ee8b7
2011-01-06 Adam Roben <aroben@apple.com>
Fill the WKView with white when the web process hasn't drawn anything
yet
Fixes <http://webkit.org/b/52023> WKView accumulates pixel garbage
before web process has had a chance to draw anything (if Aero is
disabled)
Reviewed by Jon Honeycutt.
* UIProcess/ChunkedUpdateDrawingAreaProxy.cpp:
(WebKit::ChunkedUpdateDrawingAreaProxy::paint):
* UIProcess/ChunkedUpdateDrawingAreaProxy.h:
* UIProcess/DrawingAreaProxy.h:
* UIProcess/LayerBackedDrawingAreaProxy.cpp:
(WebKit::LayerBackedDrawingAreaProxy::paint):
* UIProcess/LayerBackedDrawingAreaProxy.h:
* UIProcess/TiledDrawingAreaProxy.cpp:
(WebKit::TiledDrawingAreaProxy::paint):
* UIProcess/TiledDrawingAreaProxy.h:
* UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm:
(WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint):
* UIProcess/qt/ChunkedUpdateDrawingAreaProxyQt.cpp:
(WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint):
* UIProcess/win/ChunkedUpdateDrawingAreaProxyWin.cpp:
(WebKit::ChunkedUpdateDrawingAreaProxy::platformPaint):
* UIProcess/win/LayerBackedDrawingAreaProxyWin.cpp:
(WebKit::LayerBackedDrawingAreaProxy::paint):
Changed these functions to return a boolean indicating whether we
actually painted anything.
* UIProcess/win/WebView.cpp:
(WebKit::WebView::onPaintEvent): Fill with white (and don't call
didDraw) when the DrawingAreaProxy isn't able to paint.
2011-01-06 Jessie Berlin <jberlin@apple.com>
Reviewed by Jon Honeycutt.
......@@ -55,22 +55,22 @@ ChunkedUpdateDrawingAreaProxy::~ChunkedUpdateDrawingAreaProxy()
{
}
void ChunkedUpdateDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
bool ChunkedUpdateDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
{
if (m_isWaitingForDidSetFrameNotification) {
WebPageProxy* page = this->page();
if (!page->isValid())
return;
return false;
if (page->process()->isLaunching())
return;
return false;
OwnPtr<CoreIPC::ArgumentDecoder> arguments = page->process()->connection()->waitFor(DrawingAreaProxyLegacyMessage::DidSetSize, page->pageID(), 0.04);
if (arguments)
didReceiveMessage(page->process()->connection(), CoreIPC::MessageID(DrawingAreaProxyLegacyMessage::DidSetSize), arguments.get());
}
platformPaint(rect, context);
return platformPaint(rect, context);
}
void ChunkedUpdateDrawingAreaProxy::sizeDidChange()
......
......@@ -68,13 +68,13 @@ private:
// DrawingAreaProxy
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
virtual void paint(const WebCore::IntRect&, PlatformDrawingContext);
virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext);
virtual void sizeDidChange();
virtual void setPageIsVisible(bool isVisible);
void ensureBackingStore();
void invalidateBackingStore();
void platformPaint(const WebCore::IntRect&, PlatformDrawingContext);
bool platformPaint(const WebCore::IntRect&, PlatformDrawingContext);
void drawUpdateChunkIntoBackingStore(UpdateChunk*);
void didSetSize(UpdateChunk*);
void update(UpdateChunk*);
......
......@@ -56,7 +56,9 @@ public:
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0;
virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*) { ASSERT_NOT_REACHED(); }
virtual void paint(const WebCore::IntRect&, PlatformDrawingContext) = 0;
// Returns true if painting was successful, false otherwise.
virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext) = 0;
virtual void sizeDidChange() = 0;
virtual void setPageIsVisible(bool isVisible) = 0;
......
......@@ -56,8 +56,9 @@ LayerBackedDrawingAreaProxy::~LayerBackedDrawingAreaProxy()
}
#if !PLATFORM(WIN)
void LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
bool LayerBackedDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
{
return true;
}
#endif
......
......@@ -67,7 +67,7 @@ private:
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
virtual void paint(const WebCore::IntRect&, PlatformDrawingContext);
virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext);
virtual void sizeDidChange();
virtual void setPageIsVisible(bool isVisible);
......
......@@ -315,15 +315,15 @@ void TiledDrawingAreaProxy::tileBufferUpdateComplete()
m_tileCreationTimer.startOneShot(0);
}
void TiledDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
bool TiledDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext context)
{
if (m_isWaitingForDidSetFrameNotification) {
WebPageProxy* page = this->page();
if (!page->isValid())
return;
return false;
if (page->process()->isLaunching())
return;
return false;
}
adjustVisibleRect();
......@@ -348,7 +348,9 @@ void TiledDrawingAreaProxy::paint(const IntRect& rect, PlatformDrawingContext co
currentTile->paint(&gc, dirtyRect);
}
}
gc.restore();
return true;
}
void TiledDrawingAreaProxy::adjustVisibleRect()
......
......@@ -115,7 +115,7 @@ private:
// DrawingAreaProxy
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder&);
virtual void paint(const WebCore::IntRect&, PlatformDrawingContext);
virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext);
virtual void sizeDidChange();
virtual void setPageIsVisible(bool isVisible);
......
......@@ -60,10 +60,10 @@ void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore()
m_bitmapContext = 0;
}
void ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, CGContextRef context)
bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, CGContextRef context)
{
if (!m_bitmapContext)
return;
return false;
CGContextSaveGState(context);
......@@ -79,6 +79,7 @@ void ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, CGContext
CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image.get()), CGImageGetHeight(image.get())), image.get());
CGContextRestoreGState(context);
return true;
}
void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
......
......@@ -56,12 +56,13 @@ void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore()
m_backingStoreImage = QImage();
}
void ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, QPainter* painter)
bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, QPainter* painter)
{
if (m_backingStoreImage.isNull())
return;
return false;
painter->drawImage(QPoint(0, 0), m_backingStoreImage);
return true;
}
void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
......
......@@ -64,13 +64,14 @@ void ChunkedUpdateDrawingAreaProxy::invalidateBackingStore()
m_backingStoreBitmap.clear();
}
void ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, HDC hdc)
bool ChunkedUpdateDrawingAreaProxy::platformPaint(const IntRect& rect, HDC hdc)
{
if (!m_backingStoreBitmap)
return;
return false;
// BitBlt from the backing-store to the passed in hdc.
::BitBlt(hdc, rect.x(), rect.y(), rect.width(), rect.height(), m_backingStoreDC.get(), rect.x(), rect.y(), SRCCOPY);
return true;
}
void ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
......
......@@ -55,8 +55,9 @@ void LayerBackedDrawingAreaProxy::detachCompositingContext()
{
}
void LayerBackedDrawingAreaProxy::paint(const IntRect&, PlatformDrawingContext)
bool LayerBackedDrawingAreaProxy::paint(const IntRect&, PlatformDrawingContext)
{
return false;
}
} // namespace WebKit
......
......@@ -387,10 +387,9 @@ LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& han
PAINTSTRUCT paintStruct;
HDC hdc = ::BeginPaint(m_window, &paintStruct);
if (m_page->isValid() && m_page->drawingArea()) {
m_page->drawingArea()->paint(IntRect(paintStruct.rcPaint), hdc);
if (m_page->isValid() && m_page->drawingArea() && m_page->drawingArea()->paint(IntRect(paintStruct.rcPaint), hdc))
m_page->didDraw();
} else {
else {
// Mac checks WebPageProxy::drawsBackground and
// WebPageProxy::drawsTransparentBackground here, but those are always false on Windows
// currently (see <http://webkit.org/b/52009>).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment