summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderImage.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
commitdd91e772430dc294e3bf478c119ef8d43c0a3358 (patch)
tree6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebCore/rendering/RenderImage.cpp
parentad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff)
downloadqtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebCore/rendering/RenderImage.cpp')
-rw-r--r--Source/WebCore/rendering/RenderImage.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp
index de3e7e190..6406f6f66 100644
--- a/Source/WebCore/rendering/RenderImage.cpp
+++ b/Source/WebCore/rendering/RenderImage.cpp
@@ -264,10 +264,17 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
GraphicsContext* context = paintInfo.context;
+ Page* page = 0;
+ if (Frame* frame = this->frame())
+ page = frame->page();
+
if (!m_imageResource->hasImage() || m_imageResource->errorOccurred()) {
if (paintInfo.phase == PaintPhaseSelection)
return;
+ if (page && paintInfo.phase == PaintPhaseForeground)
+ page->addRelevantUnpaintedObject(this, visualOverflowRect());
+
if (cWidth > 2 && cHeight > 2) {
// Draw an outline rect where the image should be.
context->setStrokeStyle(SolidStroke);
@@ -325,13 +332,11 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
}
} else if (m_imageResource->hasImage() && cWidth > 0 && cHeight > 0) {
RefPtr<Image> img = m_imageResource->image(cWidth, cHeight);
- if (!img || img->isNull())
+ if (!img || img->isNull()) {
+ if (page && paintInfo.phase == PaintPhaseForeground)
+ page->addRelevantUnpaintedObject(this, visualOverflowRect());
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())
@@ -342,6 +347,15 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
LayoutPoint contentLocation = paintOffset;
contentLocation.move(leftBorder + leftPad, topBorder + topPad);
paintIntoRect(context, LayoutRect(contentLocation, contentSize));
+
+ if (cachedImage() && page && paintInfo.phase == PaintPhaseForeground) {
+ // For now, count images as unpainted if they are still progressively loading. We may want
+ // to refine this in the future to account for the portion of the image that has painted.
+ if (cachedImage()->isLoading())
+ page->addRelevantUnpaintedObject(this, LayoutRect(contentLocation, contentSize));
+ else
+ page->addRelevantRepaintedObject(this, LayoutRect(contentLocation, contentSize));
+ }
}
}
@@ -490,8 +504,8 @@ void RenderImage::updateAltText()
LayoutUnit RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const
{
- // If we've got an explicit width/height assigned, propagate it to the image resource.
- if (style()->logicalWidth().isFixed() && style()->logicalHeight().isFixed()) {
+ // If we've got an explicit width/height assigned, propagate it to the image resource.
+ if (style()->logicalWidth().isSpecified() && style()->logicalHeight().isSpecified()) {
LayoutUnit width = RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth);
m_imageResource->setContainerSizeForRenderer(IntSize(width, computeReplacedLogicalHeight()));
return width;