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

Unified Diff: Source/core/html/HTMLImageElement.cpp

Issue 320253002: Oilpan: Prepare to move ImageLoader and its subclasses to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 6 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
Index: Source/core/html/HTMLImageElement.cpp
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index 64266a6c5754f0a5a2b1ffbd9ed80835e2033b80..434646d406bf4441709f87946366a9b361007ec6 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -51,7 +51,7 @@ using namespace HTMLNames;
HTMLImageElement::HTMLImageElement(Document& document, HTMLFormElement* form, bool createdByParser)
: HTMLElement(imgTag, document)
- , m_imageLoader(this)
+ , m_imageLoader(HTMLImageLoader::create(this))
, m_compositeOperator(CompositeSourceOver)
, m_imageDevicePixelRatio(1.0f)
, m_formWasSetByParser(false)
@@ -90,6 +90,7 @@ HTMLImageElement::~HTMLImageElement()
void HTMLImageElement::trace(Visitor* visitor)
{
+ visitor->trace(m_imageLoader);
visitor->trace(m_form);
HTMLElement::trace(visitor);
}
@@ -296,10 +297,10 @@ void HTMLImageElement::attach(const AttachContext& context)
// 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() && !renderImageResource->cachedImage())
+ if (!imageLoader().image() && !renderImageResource->cachedImage())
renderImage->setImageSizeForAltText();
else
- renderImageResource->setImageResource(m_imageLoader.image());
+ renderImageResource->setImageResource(imageLoader().image());
}
}
@@ -320,8 +321,8 @@ Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
// If we have been inserted from a renderer-less document,
// our loader may have not fetched the image, so do it now.
- if ((insertionPoint->inDocument() && !m_imageLoader.image()) || imageWasModified)
- m_imageLoader.updateFromElement(m_elementCreatedByParser ? ImageLoader::ForceLoadImmediately : ImageLoader::LoadNormally);
+ if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModified)
+ imageLoader().updateFromElement(m_elementCreatedByParser ? ImageLoader::ForceLoadImmediately : ImageLoader::LoadNormally);
return HTMLElement::insertedInto(insertionPoint);
}
@@ -343,8 +344,8 @@ int HTMLImageElement::width(bool ignorePendingStylesheets)
return width;
// if the image is available, use its width
- if (m_imageLoader.image())
- return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).width();
+ if (imageLoader().image())
+ return imageLoader().image()->imageSizeForRenderer(renderer(), 1.0f).width();
}
if (ignorePendingStylesheets)
@@ -366,8 +367,8 @@ int HTMLImageElement::height(bool ignorePendingStylesheets)
return height;
// if the image is available, use its height
- if (m_imageLoader.image())
- return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).height();
+ if (imageLoader().image())
+ return imageLoader().image()->imageSizeForRenderer(renderer(), 1.0f).height();
}
if (ignorePendingStylesheets)
@@ -381,18 +382,18 @@ int HTMLImageElement::height(bool ignorePendingStylesheets)
int HTMLImageElement::naturalWidth() const
{
- if (!m_imageLoader.image())
+ if (!imageLoader().image())
return 0;
- return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).width();
+ return imageLoader().image()->imageSizeForRenderer(renderer(), 1.0f).width();
}
int HTMLImageElement::naturalHeight() const
{
- if (!m_imageLoader.image())
+ if (!imageLoader().image())
return 0;
- return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).height();
+ return imageLoader().image()->imageSizeForRenderer(renderer(), 1.0f).height();
}
const AtomicString& HTMLImageElement::currentSrc() const
@@ -474,12 +475,12 @@ int HTMLImageElement::y() const
bool HTMLImageElement::complete() const
{
- return m_imageLoader.imageComplete();
+ return imageLoader().imageComplete();
}
void HTMLImageElement::didMoveToNewDocument(Document& oldDocument)
{
- m_imageLoader.elementDidMoveToNewDocument();
+ imageLoader().elementDidMoveToNewDocument();
HTMLElement::didMoveToNewDocument(oldDocument);
}
@@ -499,10 +500,10 @@ bool HTMLImageElement::isServerMap() const
Image* HTMLImageElement::imageContents()
{
- if (!m_imageLoader.imageComplete())
+ if (!imageLoader().imageComplete())
return 0;
- return m_imageLoader.image()->image();
+ return imageLoader().image()->image();
}
bool HTMLImageElement::isInteractiveContent() const
@@ -582,9 +583,9 @@ void HTMLImageElement::selectSourceURL(UpdateFromElementBehavior behavior)
setBestFitURLAndDPRFromImageCandidate(candidate);
}
if (behavior == UpdateIgnorePreviousError)
- m_imageLoader.updateFromElementIgnoringPreviousError();
+ imageLoader().updateFromElementIgnoringPreviousError();
else
- m_imageLoader.updateFromElement();
+ imageLoader().updateFromElement();
}
const KURL& HTMLImageElement::sourceURL() const

Powered by Google App Engine
This is Rietveld 408576698