diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderImage.cpp')
| -rw-r--r-- | Source/WebCore/rendering/RenderImage.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp index 441722e91..9a0e576ad 100644 --- a/Source/WebCore/rendering/RenderImage.cpp +++ b/Source/WebCore/rendering/RenderImage.cpp @@ -328,6 +328,11 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf if (!img || img->isNull()) return; + if (Frame* frame = this->frame()) { + if (Page* page = frame->page()) + page->addRelevantRepaintedObject(this, paintInfo.rect); + } + #if PLATFORM(MAC) if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled()) paintCustomHighlight(toPoint(paintOffset - location()), style()->highlight(), true); @@ -492,12 +497,8 @@ LayoutUnit RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const return width; } - RenderBox* contentRenderer = embeddedContentBox(); - bool hasRelativeWidth = contentRenderer ? contentRenderer->style()->width().isPercent() : m_imageResource->imageHasRelativeWidth(); - bool hasRelativeHeight = contentRenderer ? contentRenderer->style()->height().isPercent() : m_imageResource->imageHasRelativeHeight(); - IntSize containerSize; - if (hasRelativeWidth || hasRelativeHeight) { + if (m_imageResource->imageHasRelativeWidth() || m_imageResource->imageHasRelativeHeight()) { // Propagate the containing block size to the image resource, otherwhise we can't compute our own intrinsic size, if it's relative. RenderObject* containingBlock = isPositioned() ? container() : this->containingBlock(); if (containingBlock->isBox()) { @@ -523,14 +524,16 @@ LayoutUnit RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const return RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth); } -void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicRatio, bool& isPercentageIntrinsicSize) const +void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const { // Assure this method is never used for SVGImages. ASSERT(!embeddedContentBox()); isPercentageIntrinsicSize = false; CachedImage* cachedImage = m_imageResource ? m_imageResource->cachedImage() : 0; - if (cachedImage && cachedImage->image()) - intrinsicRatio = cachedImage->image()->size(); + if (!cachedImage || !cachedImage->image()) + return; + intrinsicSize = cachedImage->image()->size(); + intrinsicRatio = intrinsicSize.width() / static_cast<double>(intrinsicSize.height()); } bool RenderImage::needsPreferredWidthsRecalculation() const |
