Let RenderImage construct its RenderImageResource.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jan 2014 17:27:08 +0000 (17:27 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jan 2014 17:27:08 +0000 (17:27 +0000)
commit089a49c43a7d31e1d2cf474dfa7f915e2ae0fa80
tree6f2d9675194c37934d946741222eb1646b0ab72c
parent505da8e0825892520a991adc9bd437fd5e2a21cd
Let RenderImage construct its RenderImageResource.
<https://webkit.org/b/127290>

Everyone who creates a RenderImage immediately follows up with
creating a RenderImageResource and assigning it to the image.

Let the RenderImage constructor do this instead, and make the
imageResource() accessors return references. This exposed a
number of unnecessary null checks.

Also modernized the touched code with std::unique_ptr.

Reviewed by Antti Koivisto.

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::createElementRenderer):
(WebCore::HTMLImageElement::didAttachRenderers):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::createElementRenderer):
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::didAttachRenderers):
(WebCore::HTMLVideoElement::parseAttribute):
* html/ImageInputType.cpp:
(WebCore::ImageInputType::createInputRenderer):
(WebCore::ImageInputType::attach):
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::renderImageResource):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::createFor):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::RenderImage):
(WebCore::RenderImage::~RenderImage):
(WebCore::RenderImage::styleDidChange):
(WebCore::RenderImage::imageChanged):
(WebCore::RenderImage::updateIntrinsicSizeIfNeeded):
(WebCore::RenderImage::updateInnerContentRect):
(WebCore::RenderImage::imageDimensionsChanged):
(WebCore::RenderImage::notifyFinished):
(WebCore::RenderImage::paintReplaced):
(WebCore::RenderImage::paintIntoRect):
(WebCore::RenderImage::foregroundIsKnownToBeOpaqueInRect):
(WebCore::RenderImage::minimumReplacedHeight):
(WebCore::RenderImage::computeIntrinsicRatioInformation):
(WebCore::RenderImage::embeddedContentBox):
* rendering/RenderImage.h:
(WebCore::RenderImage::imageResource):
(WebCore::RenderImage::cachedImage):
* rendering/RenderImageResource.h:
* rendering/RenderImageResourceStyleImage.h:
* rendering/RenderMedia.cpp:
(WebCore::RenderMedia::RenderMedia):
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn):
* rendering/RenderSnapshottedPlugIn.h:
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::calculateIntrinsicSize):
* rendering/style/ContentData.cpp:
(WebCore::ImageContentData::createContentRenderer):
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::RenderSVGImage):
(WebCore::RenderSVGImage::~RenderSVGImage):
(WebCore::RenderSVGImage::updateImageViewport):
(WebCore::RenderSVGImage::paint):
(WebCore::RenderSVGImage::paintForeground):
* rendering/svg/RenderSVGImage.h:
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::didAttachRenderers):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/ImageInputType.cpp
Source/WebCore/loader/ImageLoader.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderImage.h
Source/WebCore/rendering/RenderImageResource.h
Source/WebCore/rendering/RenderImageResourceStyleImage.h
Source/WebCore/rendering/RenderMedia.cpp
Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
Source/WebCore/rendering/RenderSnapshottedPlugIn.h
Source/WebCore/rendering/RenderVideo.cpp
Source/WebCore/rendering/style/ContentData.cpp
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/rendering/svg/RenderSVGImage.h
Source/WebCore/svg/SVGImageElement.cpp