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

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

Issue 27746003: Have InputType factories take an HTMLInputElement reference in parameter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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/core/html/forms/ImageInputType.h ('k') | Source/core/html/forms/InputType.h » ('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 adcd181a3e9f6722731e1edcc99b88aa2352c925..f116d6ead2d4dd61c5f326738670bf06c9bd7c0c 100644
--- a/Source/core/html/forms/ImageInputType.cpp
+++ b/Source/core/html/forms/ImageInputType.cpp
@@ -39,12 +39,12 @@ namespace WebCore {
using namespace HTMLNames;
-inline ImageInputType::ImageInputType(HTMLInputElement* element)
+inline ImageInputType::ImageInputType(HTMLInputElement& element)
: BaseButtonInputType(element)
{
}
-PassRefPtr<InputType> ImageInputType::create(HTMLInputElement* element)
+PassRefPtr<InputType> ImageInputType::create(HTMLInputElement& element)
{
return adoptRef(new ImageInputType(element));
}
@@ -61,9 +61,9 @@ bool ImageInputType::isFormDataAppendable() const
bool ImageInputType::appendFormData(FormDataList& encoding, bool) const
{
- if (!element()->isActivatedSubmit())
+ if (!element().isActivatedSubmit())
return false;
- const AtomicString& name = element()->name();
+ const AtomicString& name = element().name();
if (name.isEmpty()) {
encoding.appendData("x", m_clickLocation.x());
encoding.appendData("y", m_clickLocation.y());
@@ -75,8 +75,8 @@ bool ImageInputType::appendFormData(FormDataList& encoding, bool) const
encoding.appendData(name + dotXString, m_clickLocation.x());
encoding.appendData(name + dotYString, m_clickLocation.y());
- if (!element()->value().isEmpty())
- encoding.appendData(name, element()->value());
+ if (!element().value().isEmpty())
+ encoding.appendData(name, element().value());
return true;
}
@@ -97,7 +97,7 @@ static IntPoint extractClickLocation(Event* event)
void ImageInputType::handleDOMActivateEvent(Event* event)
{
- RefPtr<HTMLInputElement> element = this->element();
+ RefPtr<HTMLInputElement> element(this->element());
if (element->isDisabledFormControl() || !element->form())
return;
element->setActivatedSubmit(true);
@@ -109,14 +109,14 @@ void ImageInputType::handleDOMActivateEvent(Event* event)
RenderObject* ImageInputType::createRenderer(RenderStyle*) const
{
- RenderImage* image = new RenderImage(element());
+ RenderImage* image = new RenderImage(&element());
image->setImageResource(RenderImageResource::create());
return image;
}
void ImageInputType::altAttributeChanged()
{
- RenderImage* image = toRenderImage(element()->renderer());
+ RenderImage* image = toRenderImage(element().renderer());
if (!image)
return;
image->updateAltText();
@@ -124,19 +124,19 @@ void ImageInputType::altAttributeChanged()
void ImageInputType::srcAttributeChanged()
{
- if (!element()->renderer())
+ if (!element().renderer())
return;
- element()->imageLoader()->updateFromElementIgnoringPreviousError();
+ element().imageLoader()->updateFromElementIgnoringPreviousError();
}
void ImageInputType::attach()
{
BaseButtonInputType::attach();
- HTMLImageLoader* imageLoader = element()->imageLoader();
+ HTMLImageLoader* imageLoader = element().imageLoader();
imageLoader->updateFromElement();
- RenderImage* renderer = toRenderImage(element()->renderer());
+ RenderImage* renderer = toRenderImage(element().renderer());
if (!renderer)
return;
@@ -179,7 +179,7 @@ bool ImageInputType::shouldRespectHeightAndWidthAttributes()
unsigned ImageInputType::height() const
{
- RefPtr<HTMLInputElement> element = this->element();
+ RefPtr<HTMLInputElement> element(this->element());
if (!element->renderer()) {
// Check the attribute first for an explicit pixel value.
@@ -203,7 +203,7 @@ unsigned ImageInputType::height() const
unsigned ImageInputType::width() const
{
- RefPtr<HTMLInputElement> element = this->element();
+ RefPtr<HTMLInputElement> element(this->element());
if (!element->renderer()) {
// Check the attribute first for an explicit pixel value.
« no previous file with comments | « Source/core/html/forms/ImageInputType.h ('k') | Source/core/html/forms/InputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698