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

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

Issue 19510005: [oilpan] Completely move HTMLFormControlElement's hierarchy to the managed heap Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 5 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/HTMLInputElement.h ('k') | Source/core/html/HTMLInputElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index ab81796e20251134050b8a56de6f02cbdcfbfae9..176f7d9d63768bc50d7ed73df1f3aaef2cb1a209 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -92,12 +92,13 @@ using namespace HTMLNames;
class ListAttributeTargetObserver : IdTargetObserver {
WTF_MAKE_FAST_ALLOCATED;
public:
- static PassOwnPtr<ListAttributeTargetObserver> create(const AtomicString& id, HTMLInputElement*);
+ static PassOwnPtr<ListAttributeTargetObserver> create(const AtomicString& id, Handle<HTMLInputElement>);
virtual void idTargetChanged() OVERRIDE;
private:
- ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*);
+ ListAttributeTargetObserver(const AtomicString& id, Handle<HTMLInputElement>);
+ // FIXME(oilpan): This creates a cycle if we use a Persistent. Implement a weak handle.
HTMLInputElement* m_element;
};
#endif
@@ -131,7 +132,7 @@ HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* docum
, m_wasModifiedByUser(false)
, m_canReceiveDroppedFiles(false)
, m_hasTouchEventHandler(false)
- , m_inputType(InputType::createText(this))
+ , m_inputType(InputType::createText(Handle<HTMLInputElement>(this)))
{
ASSERT(hasTagName(inputTag) || hasTagName(isindexTag));
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
@@ -140,11 +141,11 @@ HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* docum
ScriptWrappable::init(this);
}
-PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser)
+Result<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser)
{
- RefPtr<HTMLInputElement> inputElement = adoptRef(new HTMLInputElement(tagName, document, form, createdByParser));
+ Handle<HTMLInputElement> inputElement = adoptNode(new HTMLInputElement(tagName, document, form, createdByParser));
inputElement->ensureUserAgentShadowRoot();
- return inputElement.release();
+ return inputElement;
}
HTMLImageLoader* HTMLInputElement::imageLoader()
@@ -167,7 +168,7 @@ HTMLInputElement::~HTMLInputElement()
// setForm(0) may register this to a document-level radio button group.
// We should unregister it to avoid accessing a deleted object.
if (isRadioButton())
- document()->formController()->checkedRadioButtons().removeButton(this);
+ document()->formController()->checkedRadioButtons().removeButton(Handle<HTMLInputElement>(this));
if (m_hasTouchEventHandler)
document()->didRemoveEventTargetNode(this);
}
@@ -448,7 +449,7 @@ void HTMLInputElement::setType(const String& type)
void HTMLInputElement::updateType()
{
- OwnPtr<InputType> newType = InputType::create(this, fastGetAttribute(typeAttr));
+ OwnPtr<InputType> newType = InputType::create(Handle<HTMLInputElement>(this), fastGetAttribute(typeAttr));
bool hadType = m_hasType;
m_hasType = true;
if (m_inputType->formControlType() == newType->formControlType())
@@ -856,7 +857,7 @@ void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
setNeedsStyleRecalc();
if (CheckedRadioButtons* buttons = checkedRadioButtons())
- buttons->updateCheckedState(this);
+ buttons->updateCheckedState(Handle<HTMLInputElement>(this));
if (renderer() && renderer()->style()->hasAppearance())
renderer()->theme()->stateChanged(renderer(), CheckedState);
setNeedsValidityCheck();
@@ -1254,17 +1255,17 @@ static Vector<String> parseAcceptAttribute(const String& acceptString, bool (*pr
Vector<String> HTMLInputElement::acceptMIMETypes()
{
- return parseAcceptAttribute(fastGetAttribute(acceptAttr), isValidMIMEType);
+ return parseAcceptAttribute(fastGetAttribute(accept_Attr), isValidMIMEType);
}
Vector<String> HTMLInputElement::acceptFileExtensions()
{
- return parseAcceptAttribute(fastGetAttribute(acceptAttr), isValidFileExtension);
+ return parseAcceptAttribute(fastGetAttribute(accept_Attr), isValidFileExtension);
}
-String HTMLInputElement::accept() const
+String HTMLInputElement::acceptAttribute() const
{
- return fastGetAttribute(acceptAttr);
+ return fastGetAttribute(accept_Attr);
}
String HTMLInputElement::alt() const
@@ -1459,7 +1460,7 @@ void HTMLInputElement::didMoveToNewDocument(Document* oldDocument)
if (oldDocument) {
if (isRadioButton())
- oldDocument->formController()->checkedRadioButtons().removeButton(this);
+ oldDocument->formController()->checkedRadioButtons().removeButton(Handle<HTMLInputElement>(this));
if (m_hasTouchEventHandler)
oldDocument->didRemoveEventTargetNode(this);
}
@@ -1486,7 +1487,7 @@ void HTMLInputElement::requiredAttributeChanged()
{
HTMLTextFormControlElement::requiredAttributeChanged();
if (CheckedRadioButtons* buttons = checkedRadioButtons())
- buttons->requiredAttributeChanged(this);
+ buttons->requiredAttributeChanged(Handle<HTMLInputElement>(this));
m_inputType->requiredAttributeChanged();
}
@@ -1525,7 +1526,7 @@ HTMLDataListElement* HTMLInputElement::dataList() const
void HTMLInputElement::resetListAttributeTargetObserver()
{
if (inDocument())
- m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fastGetAttribute(listAttr), this);
+ m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fastGetAttribute(listAttr), Handle<HTMLInputElement>(this));
else
m_listAttributeTargetObserver = nullptr;
}
@@ -1748,15 +1749,15 @@ bool HTMLInputElement::isInRequiredRadioButtonGroup()
{
ASSERT(isRadioButton());
if (CheckedRadioButtons* buttons = checkedRadioButtons())
- return buttons->isInRequiredGroup(this);
+ return buttons->isInRequiredGroup(Handle<HTMLInputElement>(this));
return false;
}
-HTMLInputElement* HTMLInputElement::checkedRadioButtonForGroup() const
+Result<HTMLInputElement> HTMLInputElement::checkedRadioButtonForGroup() const
{
if (CheckedRadioButtons* buttons = checkedRadioButtons())
return buttons->checkedButtonForGroup(name());
- return 0;
+ return nullptr;
}
CheckedRadioButtons* HTMLInputElement::checkedRadioButtons() const
@@ -1773,13 +1774,13 @@ CheckedRadioButtons* HTMLInputElement::checkedRadioButtons() const
inline void HTMLInputElement::addToRadioButtonGroup()
{
if (CheckedRadioButtons* buttons = checkedRadioButtons())
- buttons->addButton(this);
+ buttons->addButton(Handle<HTMLInputElement>(this));
}
inline void HTMLInputElement::removeFromRadioButtonGroup()
{
if (CheckedRadioButtons* buttons = checkedRadioButtons())
- buttons->removeButton(this);
+ buttons->removeButton(Handle<HTMLInputElement>(this));
}
unsigned HTMLInputElement::height() const
@@ -1803,14 +1804,14 @@ void HTMLInputElement::setWidth(unsigned width)
}
#if ENABLE(DATALIST_ELEMENT)
-PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(const AtomicString& id, HTMLInputElement* element)
+PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(const AtomicString& id, Handle<HTMLInputElement> element)
{
return adoptPtr(new ListAttributeTargetObserver(id, element));
}
-ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement* element)
+ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id, Handle<HTMLInputElement> element)
: IdTargetObserver(element->treeScope()->idTargetObserverRegistry(), id)
- , m_element(element)
+ , m_element(element.raw())
{
}
@@ -1903,4 +1904,9 @@ PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
}
#endif
+void HTMLInputElement::acceptHeapVisitor(Visitor* visitor) const
+{
+ HTMLTextFormControlElement::acceptHeapVisitor(visitor);
+}
+
} // namespace
« no previous file with comments | « Source/core/html/HTMLInputElement.h ('k') | Source/core/html/HTMLInputElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698