Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(886)

Unified Diff: Source/core/html/ImageDocument.cpp

Issue 1343493002: Fix progressive rendering of image documents (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/web/tests/DocumentLoadingRenderingTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/ImageDocument.cpp
diff --git a/Source/core/html/ImageDocument.cpp b/Source/core/html/ImageDocument.cpp
index 631409499fcda8b1e3ed845c6c8c2de6d9000840..3776a2b571c4f70c532c55ca6c46c393b46e1b11 100644
--- a/Source/core/html/ImageDocument.cpp
+++ b/Source/core/html/ImageDocument.cpp
@@ -146,13 +146,10 @@ void ImageDocumentParser::appendBytes(const char* data, size_t length)
document()->cachedImage()->appendData(data, length);
}
- if (!document())
- return;
-
- // Make sure the image layoutObject gets created because we need the layoutObject
- // to read the aspect ratio. See crbug.com/320244
- document()->updateLayoutTreeIfNeeded();
- document()->imageUpdated();
+ // TODO(esprehn): These null checks on Document don't make sense, document()
+ // will ASSERT if it was null. Do these want to check isDetached() ?
+ if (document())
+ document()->imageUpdated();
}
void ImageDocumentParser::finish()
@@ -177,6 +174,8 @@ void ImageDocumentParser::finish()
document()->imageUpdated();
}
+ // TODO(esprehn): These null checks on Document don't make sense, document()
+ // will ASSERT if it was null. Do these want to check isDetached() ?
if (document())
document()->finishedParsing();
}
@@ -225,6 +224,9 @@ void ImageDocument::createDocumentStructure(bool loadingMultipartContent)
RefPtrWillBeRawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*this);
body->setAttribute(styleAttr, "margin: 0px;");
+ if (frame())
+ frame()->loader().client()->dispatchWillInsertBody();
+
m_imageElement = HTMLImageElement::create(*this);
m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none");
// If the image is multipart, we neglect to mention to the HTMLImageElement that it's in an
@@ -315,6 +317,7 @@ void ImageDocument::imageUpdated()
if (m_imageSizeIsKnown)
return;
+ updateLayoutTreeIfNeeded();
if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->imageSizeForLayoutObject(m_imageElement->layoutObject(), pageZoomFactor(this)).isEmpty())
return;
@@ -324,9 +327,6 @@ void ImageDocument::imageUpdated()
// Force resizing of the image
windowSizeChanged(ScaleOnlyUnzoomedDocument);
}
-
- // Update layout as soon as image size is known. This enables large image files to render progressively or to animate.
- updateLayout();
}
void ImageDocument::restoreImageSize(ScaleType type)
« no previous file with comments | « no previous file | Source/web/tests/DocumentLoadingRenderingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698