InvalidationReason RenderLayerModelObject::invalidatePaintIfNeeded(const PaintInvalidationState& paintInvalidationState, const RenderLayerModelObject& newPaintInvalidationContainer)
{
    const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect();
    const LayoutPoint oldPositionFromPaintInvalidationContainer = previousPositionFromPaintInvalidationContainer();
    setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&newPaintInvalidationContainer, &paintInvalidationState));
    setPreviousPositionFromPaintInvalidationContainer(RenderLayer::positionFromPaintInvalidationContainer(this, &newPaintInvalidationContainer, &paintInvalidationState));

    // If we are set to do a full paint invalidation that means the RenderView will issue
    // paint invalidations. We can then skip issuing of paint invalidations for the child
    // renderers as they'll be covered by the RenderView.
    if (view()->doingFullPaintInvalidation())
        return InvalidationNone;

    return RenderObject::invalidatePaintIfNeeded(newPaintInvalidationContainer, oldPaintInvalidationRect, oldPositionFromPaintInvalidationContainer, paintInvalidationState);
}
Пример #2
0
void RenderReplaced::setSelectionState(SelectionState state)
{
    // The selection state for our containing block hierarchy is updated by the base class call.
    RenderBox::setSelectionState(state);

    if (!inlineBoxWrapper())
        return;

    // We only include the space below the baseline in our layer's cached paint invalidation rect if the
    // image is selected. Since the selection state has changed update the rect.
    if (hasLayer())
        setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containerForPaintInvalidation()));

    if (canUpdateSelectionOnRootLineBoxes())
        inlineBoxWrapper()->root().setHasSelectedChildren(isSelected());
}
void RenderSVGModelObject::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInvalidationContainer)
{
    // Note: This is a reduced version of RenderBox::invalidateTreeAfterLayout().
    // FIXME: Should share code with RenderBox::invalidateTreeAfterLayout().
    ASSERT(!needsLayout());

    if (!shouldCheckForPaintInvalidationAfterLayout())
        return;

    ForceHorriblySlowRectMapping slowRectMapping(*this);

    const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect();
    const LayoutPoint oldPositionFromPaintInvalidationContainer = previousPositionFromPaintInvalidationContainer();
    ASSERT(&paintInvalidationContainer == containerForPaintInvalidation());
    setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&paintInvalidationContainer));
    setPreviousPositionFromPaintInvalidationContainer(RenderLayer::positionFromPaintInvalidationContainer(this, &paintInvalidationContainer));

    // If an ancestor container had its transform changed, then we just
    // need to update the RenderSVGModelObject's repaint rect above. The invalidation
    // will be handled by the container where the transform changed. This essentially
    // means that we prune the entire branch for performance.
    if (!SVGRenderSupport::parentTransformDidChange(this))
        return;

    // If we are set to do a full paint invalidation that means the RenderView will be
    // issue paint invalidations. We can then skip issuing of paint invalidations for the child
    // renderers as they'll be covered by the RenderView.
    if (view()->doingFullRepaint()) {
        RenderObject::invalidateTreeAfterLayout(paintInvalidationContainer);
        return;
    }

    invalidatePaintIfNeeded(containerForPaintInvalidation(), oldPaintInvalidationRect, oldPositionFromPaintInvalidationContainer);

    RenderObject::invalidateTreeAfterLayout(paintInvalidationContainer);
}