I figured for more “development” talk, we could have ourselves a little forum topic. If you develop on haikuwebkit’s webkit2 port feel free to ask questions, or provide answers.
But please keep any user supports questions out of this thread.
So I’ll start:
I’m investigating the function
WebViewBase::Draw()
Currently this is the most “critical” flaw, Drawing still looks quite bad in MiniBrowser, with frequent flashes of the background (panel) color. I figure this somehow means the background view is beeing redrawn, and then webkit above it. (?)
void WebViewBase::Draw(BRect update)
{
#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
auto drawingArea = static_cast<DrawingAreaProxyCoordinatedGraphics*>(page()->drawingArea());
if (!drawingArea)
return;
IntRect updateArea(update);
callOnMainRunLoop([this, drawingArea, updateArea](){
LockLooper();
WebCore::Region unpainted;
// TODO: Is it possible to make this not require being called from the
// main thread?
drawingArea->paint(this, updateArea, unpainted);
UnlockLooper();
});
#endif
}
Interestingly enough, moving the drawingArea- > Paint() out of the callOnMainLoop and into the function body makes drawing a bit faster. I’m not sure what the rationale is for the TODO, why it didn’t work then. Or is this related to locking perhaps? It feels “faster” in the function body directly.
The actual drawing, that is the paint() goes through a proxy, and at the end ends up in our backing store, pretty straightforward
void BackingStore::paint(BView* into, const WebCore::IntRect& rect)
{
// Paint the contents of our bitmap into the BView.
into->PushState();
into->SetDrawingMode(B_OP_COPY);
into->DrawBitmap(&m_bitmap, rect, rect);
into->PopState();
// TODO: Would SetViewBitmap work instead? We probably would only need
// to call it once from the WebView. Is it faster?
}
Now my question is, what is the original reason it was called from the runloop, is this architectural in nature?