Пример #1
0
void WebViewPrivate::onExpose(BalEventExpose eventExpose)
{
    //OWB_PRINTF("WebViewPrivate::onExpose\n");
    Frame* frame = core(m_webView->mainFrame());
    if (!frame)
        return;

    if(!isInitialized) {
        //OWB_PRINTF("not isInitialized\n");
        isInitialized = true;
        frame->view()->resize(m_rect.width(), m_rect.height());
        frame->forceLayout();
        frame->view()->adjustViewSize();
    }

    GraphicsContext ctx(m_webView->viewWindow());
    ctx.setBalExposeEvent(&eventExpose);
    if (frame->contentRenderer() && frame->view() && !m_webView->dirtyRegion().isEmpty()) {
        frame->view()->layoutIfNeededRecursive();
        IntRect dirty = m_webView->dirtyRegion();
        
        // Notify the user of the draw start event.
        EA::WebKit::ViewNotification* pVN = EA::WebKit::GetViewNotification();

        EA::WebKit::View* pView = EA::WebKit::GetView(m_webView);
        
        // Clip to the main view surface and not just the dirty rect for notification.    
        int w=0;
        int h=0;
        if(pView)
            pView->GetSize(w,h);
        IntRect rect(0,0,w,h);
        rect.intersect(dirty);

        EA::WebKit::ViewUpdateInfo vui = { pView, rect.x(), rect.y(), rect.width(), rect.height(), EA::WebKit::ViewUpdateInfo::kViewDrawStart};
        if(pVN)
            pVN->DrawEvent(vui);

        frame->view()->paint(&ctx, dirty);

       // Notify the user of end draw event     
        if(pVN) {
            vui.mDrawEvent = EA::WebKit::ViewUpdateInfo::kViewDrawEnd;
            pVN->DrawEvent(vui);
            
           // TODO: Deprecate this view update 
          pVN->ViewUpdate(vui);
        }

        m_webView->clearDirtyRegion();
    }
}