void RenderImage::layout() { LayoutRect oldContentRect = replacedContentRect(); RenderReplaced::layout(); if (replacedContentRect() != oldContentRect) { updateInnerContentRect(); } }
void RenderImage::layout() { LayoutRect oldContentRect = replacedContentRect(); RenderReplaced::layout(); if (replacedContentRect() != oldContentRect) { setShouldDoFullPaintInvalidation(true); updateInnerContentRect(); } }
void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { GraphicsContext* context = paintInfo.context; LayoutRect contentRect = contentBoxRect(); contentRect.moveBy(paintOffset); LayoutRect paintRect = replacedContentRect(); paintRect.moveBy(paintOffset); bool clip = !contentRect.contains(paintRect); if (clip) { // Not allowed to overflow the content box. paintInfo.context->save(); paintInfo.context->clip(pixelSnappedIntRect(contentRect)); } // FIXME: InterpolationNone should be used if ImageRenderingOptimizeContrast is set. // See bug for more details: crbug.com/353716. InterpolationQuality interpolationQuality = style()->imageRendering() == ImageRenderingOptimizeContrast ? InterpolationLow : CanvasDefaultInterpolationQuality; HTMLCanvasElement* canvas = toHTMLCanvasElement(node()); LayoutSize layoutSize = contentRect.size(); if (style()->imageRendering() == ImageRenderingPixelated && (layoutSize.width() > canvas->width() || layoutSize.height() > canvas->height() || layoutSize == canvas->size())) { interpolationQuality = InterpolationNone; } InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality(); context->setImageInterpolationQuality(interpolationQuality); canvas->paint(context, paintRect); context->setImageInterpolationQuality(previousInterpolationQuality); if (clip) context->restore(); }
void RenderImage::updateInnerContentRect() { // Propagate container size to the image resource. LayoutRect containerRect = replacedContentRect(); IntSize containerSize(containerRect.width(), containerRect.height()); if (!containerSize.isEmpty()) m_imageResource->setContainerSizeForRenderer(containerSize); }
void RenderReplaced::layout() { ASSERT(needsLayout()); LayoutRect oldContentRect = replacedContentRect(); setHeight(minimumReplacedHeight()); updateLogicalWidth(); updateLogicalHeight(); m_overflow.clear(); addVisualEffectOverflow(); updateLayerTransformAfterLayout(); invalidateBackgroundObscurationStatus(); clearNeedsLayout(); if (replacedContentRect() != oldContentRect) setShouldDoFullPaintInvalidation(); }
void LayoutReplaced::layout() { ASSERT(needsLayout()); LayoutAnalyzer::Scope analyzer(*this); LayoutRect oldContentRect = replacedContentRect(); setHeight(minimumReplacedHeight()); updateLogicalWidth(); updateLogicalHeight(); m_overflow.clear(); addVisualEffectOverflow(); updateLayerTransformAfterLayout(); invalidateBackgroundObscurationStatus(); clearNeedsLayout(); if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && replacedContentRect() != oldContentRect) setShouldDoFullPaintInvalidation(); }
void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { GraphicsContext* context = paintInfo.context; if (m_imageResource->hasImage() && contentWidth() > 0 && contentHeight() > 0) { LayoutRect contentRect = contentBoxRect(); contentRect.moveBy(paintOffset); LayoutRect paintRect = replacedContentRect(); paintRect.moveBy(paintOffset); bool clip = !contentRect.contains(paintRect); if (clip) { context->save(); context->clip(contentRect); } paintIntoRect(context, paintRect); if (clip) context->restore(); } }