示例#1
0
void GraphicsLayerAndroid::gatherRootLayers(Vector<const RenderLayer*>& list)
{
    RenderLayer* renderLayer = renderLayerFromClient(m_client);
    if (renderLayer) {
        const RenderLayer* rootLayer = renderLayer->root();
        bool found = false;
        for (unsigned int i = 0; i < list.size(); i++) {
            const RenderLayer* current = list[i];
            if (current == rootLayer) {
                found = true;
                break;
            }
        }
        if (!found)
            list.append(rootLayer);
    }

    for (unsigned int i = 0; i < m_children.size(); i++) {
        GraphicsLayerAndroid* layer = static_cast<GraphicsLayerAndroid*>(m_children[i]);
        layer->gatherRootLayers(list);
    }
}
示例#2
0
WebCore::GraphicsLayer* ChromeClientAndroid::layersSync()
{
    if (m_rootGraphicsLayer && m_needsLayerSync && m_webFrame) {
        // We may have more than one frame, so let's first update all of them
        // (webkit may want to update the GraphicsLayer tree, and we do *not* want
        // to find this out when we are painting, as it means we could be summarily
        // deallocated while painting...)
        GraphicsLayerAndroid* rootLayer = static_cast<GraphicsLayerAndroid*>(m_rootGraphicsLayer);
        Vector<const RenderLayer*> listRootLayers;
        rootLayer->gatherRootLayers(listRootLayers);

        for (unsigned int i = 0; i < listRootLayers.size(); i++) {
            RenderLayer* layer = const_cast<RenderLayer*>(listRootLayers[i]);
            layer->compositor()->updateCompositingLayers();
        }

        Frame* frame = m_webFrame->page()->mainFrame();
        if (FrameView* frameView = frame->view())
            frameView->syncCompositingStateIncludingSubframes();
    }
    m_needsLayerSync = false;
    return m_rootGraphicsLayer;
}