diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-03 09:55:33 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-03 09:55:33 +0100 |
| commit | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch) | |
| tree | 8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebCore/rendering/RenderImage.cpp | |
| parent | d11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff) | |
| download | qtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz | |
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
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 |
