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

Unified Diff: Source/core/html/forms/ImageInputType.cpp

Issue 715633005: Rename HTMLInputElement::imageLoader() to ensureImageLoader() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing part Created 6 years, 1 month 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 | « Source/core/html/HTMLInputElement.cpp ('k') | Source/core/page/PageSerializer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/ImageInputType.cpp
diff --git a/Source/core/html/forms/ImageInputType.cpp b/Source/core/html/forms/ImageInputType.cpp
index fa98dce704df61032bdd12c58210ff8a249f80da..e4c64d83f6f7385dcfcd300ec271e9821d035c28 100644
--- a/Source/core/html/forms/ImageInputType.cpp
+++ b/Source/core/html/forms/ImageInputType.cpp
@@ -136,26 +136,26 @@ void ImageInputType::srcAttributeChanged()
{
if (!element().renderer())
return;
- element().imageLoader()->updateFromElement(ImageLoader::UpdateIgnorePreviousError);
+ element().ensureImageLoader().updateFromElement(ImageLoader::UpdateIgnorePreviousError);
}
void ImageInputType::startResourceLoading()
{
BaseButtonInputType::startResourceLoading();
- HTMLImageLoader* imageLoader = element().imageLoader();
- imageLoader->updateFromElement();
+ HTMLImageLoader& imageLoader = element().ensureImageLoader();
+ imageLoader.updateFromElement();
RenderImage* renderer = toRenderImage(element().renderer());
if (!renderer)
return;
RenderImageResource* imageResource = renderer->imageResource();
- imageResource->setImageResource(imageLoader->image());
+ imageResource->setImageResource(imageLoader.image());
// If we have no image at all because we have no src attribute, set
// image height and width for the alt text instead.
- if (!imageLoader->image() && !imageResource->cachedImage())
+ if (!imageLoader.image() && !imageResource->cachedImage())
renderer->setImageSizeForAltText();
}
@@ -190,11 +190,9 @@ unsigned ImageInputType::height() const
return height;
// If the image is available, use its height.
- if (element->hasImageLoader()) {
- HTMLImageLoader* imageLoader = element->imageLoader();
- if (imageLoader->image())
- return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height();
- }
+ HTMLImageLoader* imageLoader = element->imageLoader();
+ if (imageLoader && imageLoader->image())
+ return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height();
}
element->document().updateLayout();
@@ -214,11 +212,9 @@ unsigned ImageInputType::width() const
return width;
// If the image is available, use its width.
- if (element->hasImageLoader()) {
- HTMLImageLoader* imageLoader = element->imageLoader();
- if (imageLoader->image())
- return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width();
- }
+ HTMLImageLoader* imageLoader = element->imageLoader();
+ if (imageLoader && imageLoader->image())
+ return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width();
}
element->document().updateLayout();
« no previous file with comments | « Source/core/html/HTMLInputElement.cpp ('k') | Source/core/page/PageSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698