RenderImageResource::hasImage is redundant and RenderImageResourceStyleImage's overri...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 May 2017 03:55:57 +0000 (03:55 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 May 2017 03:55:57 +0000 (03:55 +0000)
commit2f7b4f5765d25b0ef092ffda7a71d713a180009e
tree03e6bd3b0b4f0cfb0abd5cc653c8805b30054282
parent2ec2d9141ee135beb96530c966b67108491218b0
RenderImageResource::hasImage is redundant and RenderImageResourceStyleImage's override is incorrect.
https://bugs.webkit.org/show_bug.cgi?id=172010
<rdar://problem/31086735>

Reviewed by Simon Fraser.

Source/WebCore:

RenderImageResourceStyleImage::hasImage() always returns true even when ::cachedImage()
returns nullptr (e.g. image is pending).
Remove it and use cachedImage() instead.

Test: fast/images/missing-content-image-crash.html

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::didAttachRenderers):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::updateIntrinsicSizeIfNeeded):
(WebCore::RenderImage::isShowingMissingOrImageError):
(WebCore::RenderImage::hasNonBitmapImage):
(WebCore::RenderImage::paintReplaced):
(WebCore::RenderImage::paintIntoRect):
(WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
* rendering/RenderImageResource.h:
(WebCore::RenderImageResource::cachedImage):
(WebCore::RenderImageResource::hasImage): Deleted.
* rendering/RenderImageResourceStyleImage.h:
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::paint):
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::hasSingleSecurityOrigin):
(WebCore::SVGImageElement::didAttachRenderers):

LayoutTests:

* fast/images/missing-content-image-crash-expected.txt: Added.
* fast/images/missing-content-image-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216728 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/images/missing-content-image-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/images/missing-content-image-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderImageResource.h
Source/WebCore/rendering/RenderImageResourceStyleImage.h
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/svg/SVGImageElement.cpp