[webkit-help] Unfinished Webkit2 Callbacks

Nick Guenther Nick.Guenther at dossierview.com
Mon Jan 31 12:41:09 PST 2011


Hello webkit-help@,

 I'm using WebKit2 and trying to capture when it's drawn. The trouble is I want to do this to an offscreen window. I'm sending WM_PRINTCLIENT but after some digging I found that while the WM_PAINT handler emits a didDraw(), the WM_PRINTCLIENT one does not:

Source\WebKit2\UIProcess\win:

LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled)
{
    PAINTSTRUCT paintStruct;
    HDC hdc = ::BeginPaint(m_window, &paintStruct);

    if (m_page->isValid() && m_page->drawingArea() && m_page->drawingArea()->paint(IntRect(paintStruct.rcPaint), hdc))
        m_page->didDraw();
    else {
        // Mac checks WebPageProxy::drawsBackground and
        // WebPageProxy::drawsTransparentBackground here, but those are always false on Windows
        // currently (see <http://webkit.org/b/52009>).
        ::FillRect(hdc, &paintStruct.rcPaint, reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1));
    }

    ::EndPaint(m_window, &paintStruct);

    handled = true;
    return 0;
}

LRESULT WebView::onPrintClientEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled)
{
    HDC hdc = reinterpret_cast<HDC>(wParam);
    RECT winRect;
    ::GetClientRect(hWnd, &winRect);
    IntRect rect = winRect;

    m_page->drawingArea()->paint(rect, hdc);

    handled = true;
    return 0;
}

Would it be reasonable to add didDraw() to onPrintClientEvent()? Actually I noticed a whole bunch of callbacks actually aren't called, in WebPageProxy.h are declared private, even, like setWindowFrame. What's the plan for all these, is anyone working on them?

-Nick Guenther
DossierView.com


More information about the webkit-help mailing list