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

Unified Diff: Source/WebCore/rendering/RenderImage.cpp

Issue 10383163: Merge 116693 - Crash in computedCSSPadding* functions due to RenderImage::imageDimensionsChanged ca… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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 | « LayoutTests/fast/images/script-counter-imageDimensionChanged-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderImage.cpp
===================================================================
--- Source/WebCore/rendering/RenderImage.cpp (revision 116967)
+++ Source/WebCore/rendering/RenderImage.cpp (working copy)
@@ -188,29 +188,33 @@
void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* rect)
{
+ bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->imageSize(style()->effectiveZoom()), imageSizeChanged);
+
+ // In the case of generated image content using :before/:after/content, we might not be
+ // in the render tree yet. In that case, we just need to update our intrinsic size.
+ // layout() will be called after we are inserted in the tree which will take care of
+ // what we are doing here.
+ if (!containingBlock())
+ return;
+
bool shouldRepaint = true;
- if (updateIntrinsicSizeIfNeeded(m_imageResource->imageSize(style()->effectiveZoom()), imageSizeChanged)) {
- // In the case of generated image content using :before/:after, we might not be in the
- // render tree yet. In that case, we don't need to worry about check for layout, since we'll get a
- // layout when we get added in to the render tree hierarchy later.
- if (containingBlock()) {
- // lets see if we need to relayout at all..
- int oldwidth = width();
- int oldheight = height();
- if (!preferredLogicalWidthsDirty())
- setPreferredLogicalWidthsDirty(true);
- computeLogicalWidth();
- computeLogicalHeight();
+ if (intrinsicSizeChanged) {
+ // lets see if we need to relayout at all..
+ int oldwidth = width();
+ int oldheight = height();
+ if (!preferredLogicalWidthsDirty())
+ setPreferredLogicalWidthsDirty(true);
+ computeLogicalWidth();
+ computeLogicalHeight();
- if (imageSizeChanged || width() != oldwidth || height() != oldheight) {
- shouldRepaint = false;
- if (!selfNeedsLayout())
- setNeedsLayout(true);
- }
+ if (imageSizeChanged || width() != oldwidth || height() != oldheight) {
+ shouldRepaint = false;
+ if (!selfNeedsLayout())
+ setNeedsLayout(true);
+ }
- setWidth(oldwidth);
- setHeight(oldheight);
- }
+ setWidth(oldwidth);
+ setHeight(oldheight);
}
if (shouldRepaint) {
« no previous file with comments | « LayoutTests/fast/images/script-counter-imageDimensionChanged-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698