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

Unified Diff: Source/WebCore/html/ImageInputType.cpp

Issue 12573007: Merge 145423 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 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 | « Source/WebCore/html/ImageInputType.h ('k') | Source/WebCore/html/InputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/html/ImageInputType.cpp
===================================================================
--- Source/WebCore/html/ImageInputType.cpp (revision 146140)
+++ Source/WebCore/html/ImageInputType.cpp (working copy)
@@ -119,42 +119,32 @@
{
if (!element()->renderer())
return;
- if (!m_imageLoader)
- m_imageLoader = adoptPtr(new HTMLImageLoader(element()));
- m_imageLoader->updateFromElementIgnoringPreviousError();
+ element()->imageLoader()->updateFromElementIgnoringPreviousError();
}
void ImageInputType::attach()
{
BaseButtonInputType::attach();
- if (!m_imageLoader)
- m_imageLoader = adoptPtr(new HTMLImageLoader(element()));
- m_imageLoader->updateFromElement();
+ HTMLImageLoader* imageLoader = element()->imageLoader();
+ imageLoader->updateFromElement();
RenderImage* renderer = toRenderImage(element()->renderer());
if (!renderer)
return;
- if (m_imageLoader->hasPendingBeforeLoadEvent())
+ if (imageLoader->hasPendingBeforeLoadEvent())
return;
RenderImageResource* imageResource = renderer->imageResource();
- imageResource->setCachedImage(m_imageLoader->image());
+ imageResource->setCachedImage(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 (!m_imageLoader->image() && !imageResource->cachedImage())
+ if (!imageLoader->image() && !imageResource->cachedImage())
renderer->setImageSizeForAltText();
}
-void ImageInputType::willMoveToNewOwnerDocument()
-{
- BaseButtonInputType::willMoveToNewOwnerDocument();
- if (m_imageLoader)
- m_imageLoader->elementDidMoveToNewDocument();
-}
-
bool ImageInputType::shouldRespectAlignAttribute()
{
return true;
@@ -191,8 +181,11 @@
return height;
// If the image is available, use its height.
- if (m_imageLoader && m_imageLoader->image())
- return m_imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height();
+ if (element->hasImageLoader()) {
+ HTMLImageLoader* imageLoader = element->imageLoader();
+ if (imageLoader->image())
+ return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height();
+ }
}
element->document()->updateLayout();
@@ -212,8 +205,11 @@
return width;
// If the image is available, use its width.
- if (m_imageLoader && m_imageLoader->image())
- return m_imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width();
+ if (element->hasImageLoader()) {
+ HTMLImageLoader* imageLoader = element->imageLoader();
+ if (imageLoader->image())
+ return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width();
+ }
}
element->document()->updateLayout();
« no previous file with comments | « Source/WebCore/html/ImageInputType.h ('k') | Source/WebCore/html/InputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698