bool WebGraphicsLayer::setChildren(const Vector<GraphicsLayer*>& children)
{
    bool ok = GraphicsLayer::setChildren(children);
    if (!ok)
        return false;
    for (int i = 0; i < children.size(); ++i) {
        WebGraphicsLayer* child = toWebGraphicsLayer(children[i]);
        child->setContentsScale(m_contentsScale);
        child->notifyChange();
    }
    notifyChange();
    return true;
}
void WebGraphicsLayer::setMaskLayer(GraphicsLayer* layer)
{
    if (layer == maskLayer())
        return;

    GraphicsLayer::setMaskLayer(layer);

    if (!layer)
        return;

    layer->setSize(size());
    WebGraphicsLayer* webGraphicsLayer = toWebGraphicsLayer(layer);
    webGraphicsLayer->setLayerTreeTileClient(layerTreeTileClient());
    webGraphicsLayer->setMaskTarget(this);
    webGraphicsLayer->setContentsScale(m_contentsScale);
    webGraphicsLayer->notifyChange();
    notifyChange();

}
void WebGraphicsLayer::setContentsScale(float scale)
{
    for (size_t i = 0; i < children().size(); ++i) {
        WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
        layer->setContentsScale(scale);
    }

    if (WebGraphicsLayer* mask = toWebGraphicsLayer(maskLayer()))
        mask->setContentsScale(scale);

    m_contentsScale = scale;
    if (m_mainBackingStore && m_mainBackingStore->contentsScale() == scale)
        return;

    notifyChange();

    m_previousBackingStore = m_mainBackingStore.release();
    m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
    m_mainBackingStore->setContentsScale(scale);
}