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

Unified Diff: Source/core/html/forms/SearchInputType.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/SearchInputType.h ('k') | Source/core/html/forms/SubmitInputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/SearchInputType.cpp
diff --git a/Source/core/html/forms/SearchInputType.cpp b/Source/core/html/forms/SearchInputType.cpp
index a2bd867997807a442074f7b3701fc2f2207a3ca5..081a532ec7377dd10f82a9ea9af686df39a7c7f4 100644
--- a/Source/core/html/forms/SearchInputType.cpp
+++ b/Source/core/html/forms/SearchInputType.cpp
@@ -46,13 +46,13 @@ namespace WebCore {
using namespace HTMLNames;
-inline SearchInputType::SearchInputType(HTMLInputElement* element)
+inline SearchInputType::SearchInputType(HTMLInputElement& element)
: BaseTextInputType(element)
, m_searchEventTimer(this, &SearchInputType::searchEventTimerFired)
{
}
-PassRefPtr<InputType> SearchInputType::create(HTMLInputElement* element)
+PassRefPtr<InputType> SearchInputType::create(HTMLInputElement& element)
{
return adoptRef(new SearchInputType(element));
}
@@ -64,7 +64,7 @@ void SearchInputType::countUsage()
RenderObject* SearchInputType::createRenderer(RenderStyle*) const
{
- return new RenderSearchField(element());
+ return new RenderSearchField(&element());
}
const AtomicString& SearchInputType::formControlType() const
@@ -91,24 +91,24 @@ void SearchInputType::createShadowSubtree()
{
TextFieldInputType::createShadowSubtree();
Element* container = containerElement();
- Element* viewPort = element()->userAgentShadowRoot()->getElementById(ShadowElementNames::editingViewPort());
+ Element* viewPort = element().userAgentShadowRoot()->getElementById(ShadowElementNames::editingViewPort());
ASSERT(container);
ASSERT(viewPort);
- container->insertBefore(SearchFieldDecorationElement::create(element()->document()), viewPort);
- container->insertBefore(SearchFieldCancelButtonElement::create(element()->document()), viewPort->nextSibling());
+ container->insertBefore(SearchFieldDecorationElement::create(element().document()), viewPort);
+ container->insertBefore(SearchFieldCancelButtonElement::create(element().document()), viewPort->nextSibling());
}
void SearchInputType::handleKeydownEvent(KeyboardEvent* event)
{
- if (element()->isDisabledOrReadOnly()) {
+ if (element().isDisabledOrReadOnly()) {
TextFieldInputType::handleKeydownEvent(event);
return;
}
const String& key = event->keyIdentifier();
if (key == "U+001B") {
- RefPtr<HTMLInputElement> input = element();
+ RefPtr<HTMLInputElement> input(element());
input->setValueForUser("");
input->onSearch();
event->setDefaultHandled();
@@ -119,12 +119,12 @@ void SearchInputType::handleKeydownEvent(KeyboardEvent* event)
void SearchInputType::startSearchEventTimer()
{
- ASSERT(element()->renderer());
- unsigned length = element()->innerTextValue().length();
+ ASSERT(element().renderer());
+ unsigned length = element().innerTextValue().length();
if (!length) {
stopSearchEventTimer();
- element()->onSearch();
+ element().onSearch();
return;
}
@@ -140,12 +140,12 @@ void SearchInputType::stopSearchEventTimer()
void SearchInputType::searchEventTimerFired(Timer<SearchInputType>*)
{
- element()->onSearch();
+ element().onSearch();
}
bool SearchInputType::searchEventsShouldBeDispatched() const
{
- return element()->hasAttribute(incrementalAttr);
+ return element().hasAttribute(incrementalAttr);
}
void SearchInputType::didSetValueByUserEdit(ValueChangeState state)
@@ -167,10 +167,10 @@ void SearchInputType::updateInnerTextValue()
void SearchInputType::updateCancelButtonVisibility()
{
- Element* button = element()->userAgentShadowRoot()->getElementById(ShadowElementNames::clearButton());
+ Element* button = element().userAgentShadowRoot()->getElementById(ShadowElementNames::clearButton());
if (!button)
return;
- if (element()->value().isEmpty())
+ if (element().value().isEmpty())
button->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHidden);
else
button->removeInlineStyleProperty(CSSPropertyVisibility);
« no previous file with comments | « Source/core/html/forms/SearchInputType.h ('k') | Source/core/html/forms/SubmitInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698