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

Unified Diff: Source/core/html/shadow/TextControlInnerElements.cpp

Issue 16081007: Introduce toHTMLInputElement(Node*), and use it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
« no previous file with comments | « Source/core/html/RadioInputType.cpp ('k') | Source/core/html/shadow/TextFieldDecorationElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/TextControlInnerElements.cpp
diff --git a/Source/core/html/shadow/TextControlInnerElements.cpp b/Source/core/html/shadow/TextControlInnerElements.cpp
index fece33913683be57f8e9781b750b9479cf46a640..811f9944be3cb477471f9ecc2557974afb366164 100644
--- a/Source/core/html/shadow/TextControlInnerElements.cpp
+++ b/Source/core/html/shadow/TextControlInnerElements.cpp
@@ -156,7 +156,7 @@ const AtomicString& SearchFieldDecorationElement::shadowPseudoId() const
void SearchFieldDecorationElement::defaultEventHandler(Event* event)
{
// On mousedown, focus the search field
- HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
+ HTMLInputElement* input = toHTMLInputElement(shadowHost());
if (input && event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
input->focus();
input->select();
@@ -205,7 +205,7 @@ void SearchFieldCancelButtonElement::detach()
void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
{
// If the element is visible, on mouseup, clear the value, and set selection
- RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
+ RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost()));
if (!input || input->isDisabledOrReadOnly()) {
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
@@ -244,7 +244,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents()
{
- const HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
+ const HTMLInputElement* input = toHTMLInputElement(shadowHost());
if (input && !input->isDisabledOrReadOnly())
return true;
@@ -289,7 +289,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
// The call to focus() below dispatches a focus event, and an event handler in the page might
// remove the input element from DOM. To make sure it remains valid until we finish our work
// here, we take a temporary reference.
- RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
+ RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost()));
if (!input || input->isDisabledOrReadOnly()) {
if (!event->defaultHandled())
@@ -341,7 +341,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
bool InputFieldSpeechButtonElement::willRespondToMouseClickEvents()
{
- const HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
+ const HTMLInputElement* input = toHTMLInputElement(shadowHost());
if (input && !input->isDisabledOrReadOnly())
return true;
@@ -378,7 +378,7 @@ void InputFieldSpeechButtonElement::setRecognitionResult(int, const SpeechInputR
// The call to setValue() below dispatches an event, and an event handler in the page might
// remove the input element from DOM. To make sure it remains valid until we finish our work
// here, we take a temporary reference.
- RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
+ RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost()));
if (!input || input->isDisabledOrReadOnly())
return;
@@ -431,7 +431,7 @@ void InputFieldSpeechButtonElement::startSpeechInput()
if (m_state != Idle)
return;
- RefPtr<HTMLInputElement> input = static_cast<HTMLInputElement*>(shadowHost());
+ RefPtr<HTMLInputElement> input = toHTMLInputElement(shadowHost());
AtomicString language = input->computeInheritedLanguage();
String grammar = input->getAttribute(webkitgrammarAttr);
IntRect rect = document()->view()->contentsToRootView(pixelSnappedBoundingBox());
« no previous file with comments | « Source/core/html/RadioInputType.cpp ('k') | Source/core/html/shadow/TextFieldDecorationElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698