src/blinkit/blink/renderer/core/layout/compositing/CompositedLayerMapping.cpp
bool CompositedLayerMapping::updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip)
{
    bool layersChanged = false;

    if (needsAncestorClip) {
        if (!m_ancestorClippingLayer) {
            m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayerForAncestorClip);
            m_ancestorClippingLayer->setMasksToBounds(true);
            m_ancestorClippingLayer->setShouldFlattenTransform(false);
            layersChanged = true;
        }
    } else if (m_ancestorClippingLayer) {
        m_ancestorClippingLayer->removeFromParent();
        m_ancestorClippingLayer = nullptr;
        layersChanged = true;
    }

    if (needsDescendantClip) {
        // We don't need a child containment layer if we're the main frame layout view
        // layer. It's redundant as the frame clip above us will handle this clipping.
        if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) {
            m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayerForDescendantClip);
            m_childContainmentLayer->setMasksToBounds(true);
            layersChanged = true;
        }
    } else if (hasClippingLayer()) {
        m_childContainmentLayer->removeFromParent();
        m_childContainmentLayer = nullptr;
        layersChanged = true;
    }

    return layersChanged;
}
// Return true if the layers changed.
Return true if the layers changed.
Return true if the layers changed .
bool CompositedLayerMapping::updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip)
{
    bool layersChanged = false;
    if (needsAncestorClip) {
        if (!m_ancestorClippingLayer) {
            m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayerForAncestorClip);
            m_ancestorClippingLayer->setMasksToBounds(true);
            m_ancestorClippingLayer->setShouldFlattenTransform(false);
            layersChanged = true;
        }
    } else if (m_ancestorClippingLayer) {
        m_ancestorClippingLayer->removeFromParent();
        m_ancestorClippingLayer = nullptr;
        layersChanged = true;
    }
    if (needsDescendantClip) {
        if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) {
            m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayerForDescendantClip);
            m_childContainmentLayer->setMasksToBounds(true);
            layersChanged = true;
        }
    } else if (hasClippingLayer()) {
        m_childContainmentLayer->removeFromParent();
        m_childContainmentLayer = nullptr;
        layersChanged = true;
    }
    return layersChanged;
}
bool CompositedLayerMapping :: updateClippingLayers ( bool needsAncestorClip , bool needsDescendantClip ) { bool layersChanged = false ; if ( needsAncestorClip ) { if ( ! m_ancestorClippingLayer ) { m_ancestorClippingLayer = createGraphicsLayer ( CompositingReasonLayerForAncestorClip ) ; m_ancestorClippingLayer -> setMasksToBounds ( true ) ; m_ancestorClippingLayer -> setShouldFlattenTransform ( false ) ; layersChanged = true ; } } else if ( m_ancestorClippingLayer ) { m_ancestorClippingLayer -> removeFromParent ( ) ; m_ancestorClippingLayer = nullptr ; layersChanged = true ; } if ( needsDescendantClip ) { if ( ! m_childContainmentLayer && ! m_isMainFrameLayoutViewLayer ) { m_childContainmentLayer = createGraphicsLayer ( CompositingReasonLayerForDescendantClip ) ; m_childContainmentLayer -> setMasksToBounds ( true ) ; layersChanged = true ; } } else if ( hasClippingLayer ( ) ) { m_childContainmentLayer -> removeFromParent ( ) ; m_childContainmentLayer = nullptr ; layersChanged = true ; } return layersChanged ; }
Return true if the layers changed.
Return true if the layers changed .
// We don't need a child containment layer if we're the main frame layout view // layer. It's redundant as the frame clip above us will handle this clipping.