设置 webkit 背景透明的几种办法

来源:互联网 发布:linux设置jdk环境变量 编辑:程序博客网 时间:2024/06/05 14:50

1.

    FrameLoaderClientGtk.cpp:

  
void FrameLoaderClient::transitionToCommittedForNewPage()
{
    WebKitWebView* containingWindow = getViewFromFrame(m_frame);
    IntSize size = IntSize(GTK_WIDGET(containingWindow)->allocation.width,
                           GTK_WIDGET(containingWindow)->allocation.height);
    bool transparent = webkit_web_view_get_transparent(containingWindow); //modify by raulli 20110922
    Color backgroundColor = transparent ? WebCore::Color::transparent : WebCore::Color::white;
    Frame* frame = core(m_frame);
    ASSERT(frame);

    frame->createView(size, backgroundColor, transparent, IntSize(), false);

    // We need to do further manipulation on the FrameView if it was the mainFrame
    if (frame != frame->page()->mainFrame())
        return;

    postCommitFrameViewSetup(m_frame, frame->view(), true);
}

2.

FrameView.cpp
void FrameView::setBaseBackgroundColor(Color bc)
{
    printf("###### %s:%s:%d bc=0x%0x m_baseBackgroundColor=0x%0x\n",__FILE__,__FUNCTION__,__LINE__,bc.rgb(),m_baseBackgroundColor.rgb());
    if (!bc.isValid())
    {
        printf("###### %s:%s:%d bc=0x%0x m_baseBackgroundColor=0x%0x\n",__FILE__,__FUNCTION__,__LINE__,bc.rgb(),m_baseBackgroundColor.rgb());
        bc = Color::white;
    }
    printf("###### %s:%s:%d bc=0x%0x m_baseBackgroundColor=0x%0x\n",__FILE__,__FUNCTION__,__LINE__,bc.rgb(),m_baseBackgroundColor.rgb());
    m_baseBackgroundColor = bc;
}


以上两处改成你自己需要的颜色就可以了



原创粉丝点击