void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&) { // Check to see if we are enclosed by a layer that requires complex painting rules. If so, we cannot blit // when scrolling, and we need to use slow repaints. Examples of layers that require this are transparent layers, // layers with reflections, or transformed layers. // FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being inside // a transform, transparency layer, etc. Element* elt; for (elt = document()->ownerElement(); view() && elt && elt->renderer(); elt = elt->document()->ownerElement()) { RenderLayer* layer = elt->renderer()->enclosingLayer(); if (layer->cannotBlitToWindow()) { frameView()->setCannotBlitToWindow(); break; } #if USE(ACCELERATED_COMPOSITING) if (RenderLayer* compositingLayer = layer->enclosingCompositingLayerForRepaint()) { if (!compositingLayer->backing()->paintsIntoWindow()) { frameView()->setCannotBlitToWindow(); break; } } #endif } if (document()->ownerElement() || !view()) return; bool rootFillsViewport = false; Node* documentElement = document()->documentElement(); if (RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0) { // The document element's renderer is currently forced to be a block, but may not always be. RenderBox* rootBox = rootRenderer->isBox() ? toRenderBox(rootRenderer) : 0; rootFillsViewport = rootBox && !rootBox->x() && !rootBox->y() && rootBox->width() >= width() && rootBox->height() >= height(); } Page* page = document()->page(); float pageScaleFactor = page ? page->pageScaleFactor() : 1; // If painting will entirely fill the view, no need to fill the background. if (rootFillsViewport && rendererObscuresBackground(firstChild()) && pageScaleFactor >= 1) return; // This code typically only executes if the root element's visibility has been set to hidden, // if there is a transform on the <html>, or if there is a page scale factor less than 1. // Only fill with the base background color (typically white) if we're the root document, // since iframes/frames with no background in the child document should show the parent's background. if (frameView()->isTransparent()) // FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being transparent. frameView()->setCannotBlitToWindow(); // The parent must show behind the child. else { Color baseColor = frameView()->baseBackgroundColor(); if (baseColor.alpha() > 0) { CompositeOperator previousOperator = paintInfo.context->compositeOperation(); paintInfo.context->setCompositeOperation(CompositeCopy); paintInfo.context->fillRect(paintInfo.rect, baseColor, style()->colorSpace()); paintInfo.context->setCompositeOperation(previousOperator); } else paintInfo.context->clearRect(paintInfo.rect); } }
void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&) { // Check to see if we are enclosed by a layer that requires complex painting rules. If so, we cannot blit // when scrolling, and we need to use slow repaints. Examples of layers that require this are transparent layers, // layers with reflections, or transformed layers. // FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being inside // a transform, transparency layer, etc. Element* elt; for (elt = document().ownerElement(); view() && elt && elt->renderer(); elt = elt->document().ownerElement()) { RenderLayer* layer = elt->renderer()->enclosingLayer(); if (layer->cannotBlitToWindow()) { frameView()->setCannotBlitToWindow(); break; } if (layer->enclosingCompositingLayerForRepaint()) { frameView()->setCannotBlitToWindow(); break; } } if (document().ownerElement() || !view()) return; if (paintInfo.skipRootBackground()) return; bool shouldPaintBackground = true; Node* documentElement = document().documentElement(); if (RenderBox* rootBox = documentElement ? toRenderBox(documentElement->renderer()) : 0) shouldPaintBackground = !rootFillsViewportBackground(rootBox) || !rendererObscuresBackground(rootBox); // If painting will entirely fill the view, no need to fill the background. if (!shouldPaintBackground) return; // This code typically only executes if the root element's visibility has been set to hidden, // if there is a transform on the <html>, or if there is a page scale factor less than 1. // Only fill with the base background color (typically white) if we're the root document, // since iframes/frames with no background in the child document should show the parent's background. if (frameView()->isTransparent()) // FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being transparent. frameView()->setCannotBlitToWindow(); // The parent must show behind the child. else { Color baseColor = frameView()->baseBackgroundColor(); if (baseColor.alpha()) { CompositeOperator previousOperator = paintInfo.context->compositeOperation(); paintInfo.context->setCompositeOperation(CompositeCopy); paintInfo.context->fillRect(paintInfo.rect, baseColor); paintInfo.context->setCompositeOperation(previousOperator); } else { paintInfo.context->clearRect(paintInfo.rect); } } }