Changeset 152149 in webkit


Ignore:
Timestamp:
Jun 27, 2013 7:26:41 PM (11 years ago)
Author:
kangil.han@samsung.com
Message:

Adopt is/toHTMLInputElement for code cleanup
https://bugs.webkit.org/show_bug.cgi?id=118130

Reviewed by Antti Koivisto.

To enhance readability, this patch adopts is/toHTMLInputElement.
This also helps out to reduce duplicated use of static_cast.

Source/WebCore:

  • accessibility/AccessibilityMediaControls.cpp:

(WebCore::AccessibilityMediaTimeline::valueDescription):

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::determineAccessibilityRole):
(WebCore::AccessibilityNodeObject::isNativeTextControl):
(WebCore::AccessibilityNodeObject::isNativeImage):
(WebCore::AccessibilityNodeObject::isInputImage):
(WebCore::AccessibilityNodeObject::isReadOnly):
(WebCore::AccessibilityNodeObject::valueForRange):
(WebCore::AccessibilityNodeObject::maxValueForRange):
(WebCore::AccessibilityNodeObject::minValueForRange):
(WebCore::AccessibilityNodeObject::actionElement):
(WebCore::AccessibilityNodeObject::titleElementText):
(WebCore::AccessibilityNodeObject::visibleText):
(WebCore::AccessibilityNodeObject::title):
(WebCore::AccessibilityNodeObject::text):
(WebCore::AccessibilityNodeObject::colorValue):
(WebCore::accessibleNameForNode):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::isFileUploadButton):
(WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
(WebCore::AccessibilityRenderObject::url):
(WebCore::AccessibilityRenderObject::setValue):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
(WebCore::AccessibilityRenderObject::addTextFieldChildren):

  • accessibility/AccessibilitySlider.cpp:

(WebCore::AccessibilitySlider::element):

  • accessibility/ios/AccessibilityObjectIOS.mm:

(WebCore::AccessibilityObject::accessibilityPasswordFieldLength):

  • bindings/js/JSHTMLInputElementCustom.cpp:

(WebCore::JSHTMLInputElement::selectionStart):
(WebCore::JSHTMLInputElement::setSelectionStart):
(WebCore::JSHTMLInputElement::selectionEnd):
(WebCore::JSHTMLInputElement::setSelectionEnd):
(WebCore::JSHTMLInputElement::selectionDirection):
(WebCore::JSHTMLInputElement::setSelectionDirection):
(WebCore::JSHTMLInputElement::setSelectionRange):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::adjustRenderStyle):

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::isInPasswordField):

  • editing/ReplaceSelectionCommand.cpp:

(WebCore::ReplaceSelectionCommand::shouldPerformSmartReplace):

  • html/HTMLFormControlElement.cpp:

(WebCore::shouldAutofocus):

  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::getTextFieldValues):

  • html/HTMLInputElement.h:

(WebCore::isHTMLInputElement):
(WebCore::toHTMLInputElement):

  • html/RadioInputType.cpp:

(WebCore::RadioInputType::handleKeydownEvent):
(WebCore::RadioInputType::isKeyboardFocusable):

  • html/shadow/MediaControlElementTypes.cpp:

(WebCore::mediaControlElementType):

  • html/shadow/TextControlInnerElements.cpp:

(WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
(WebCore::SearchFieldCancelButtonElement::defaultEventHandler):
(WebCore::SearchFieldCancelButtonElement::willRespondToMouseClickEvents):
(WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
(WebCore::InputFieldSpeechButtonElement::willRespondToMouseClickEvents):
(WebCore::InputFieldSpeechButtonElement::setRecognitionResult):
(WebCore::InputFieldSpeechButtonElement::startSpeechInput):

  • loader/FormSubmission.cpp:

(WebCore::FormSubmission::create):

  • page/Chrome.cpp:

(WebCore::Chrome::setToolTip):

  • page/EventHandler.cpp:

(WebCore::isSubmitImage):
(WebCore::EventHandler::handleMousePressEvent):

  • page/FocusController.cpp:

(WebCore::clearSelectionIfNeeded):

  • platform/gtk/PasteboardGtk.cpp:

(WebCore::getURLForImageNode):

  • platform/qt/RenderThemeQt.cpp:

(WebCore::RenderThemeQt::paintMediaVolumeSliderTrack):

  • platform/qt/RenderThemeQtMobile.cpp:

(WebCore::RenderThemeQtMobile::paintSliderTrack):

  • rendering/HitTestResult.cpp:

(WebCore::HitTestResult::altDisplayString):
(WebCore::HitTestResult::absoluteImageURL):
(WebCore::HitTestResult::isContentEditable):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::hasLineIfEmpty):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::sizesLogicalWidthToFitContent):

  • rendering/RenderButton.cpp:

(WebCore::RenderButton::updateFromElement):
(WebCore::RenderButton::canHaveGeneratedChildren):

  • rendering/RenderDetailsMarker.cpp:

(WebCore::RenderDetailsMarker::isOpen):

  • rendering/RenderFileUploadControl.cpp:

(WebCore::RenderFileUploadControl::updateFromElement):
(WebCore::RenderFileUploadControl::maxFilenameWidth):
(WebCore::RenderFileUploadControl::paintObject):
(WebCore::RenderFileUploadControl::uploadButton):
(WebCore::RenderFileUploadControl::fileTextValue):

  • rendering/RenderImage.cpp:

(WebCore::RenderImage::updateAltText):

  • testing/Internals.cpp:

(WebCore::Internals::selectColorInColorChooser):

Source/WebKit/blackberry:

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::webContext):
(BlackBerry::WebKit::WebPagePrivate::blockZoomRectForNode):

  • WebCoreSupport/CredentialTransformData.cpp:

(WebCore::CredentialTransformData::findPasswordFormFields):

  • WebCoreSupport/EditorClientBlackBerry.cpp:

(WebCore::EditorClientBlackBerry::shouldSpellCheckFocusedField):

  • WebKitSupport/DOMSupport.cpp:

(BlackBerry::WebKit::DOMSupport::isPasswordElement):
(BlackBerry::WebKit::DOMSupport::inputElementText):
(BlackBerry::WebKit::DOMSupport::isDateTimeInputField):
(BlackBerry::WebKit::DOMSupport::isColorInputField):
(BlackBerry::WebKit::DOMSupport::elementIdOrNameIndicatesNoAutocomplete):

  • WebKitSupport/InputHandler.cpp:

(BlackBerry::WebKit::InputHandler::elementType):
(BlackBerry::WebKit::InputHandler::setInputValue):
(BlackBerry::WebKit::InputHandler::extractedTextRequest):
(BlackBerry::WebKit::InputHandler::showTextInputTypeSuggestionBox):

Source/WebKit/efl:

  • ewk/ewk_view.cpp:

(ewk_view_input_method_state_set):

Source/WebKit/mac:

  • DOM/WebDOMOperations.mm:

(-[DOMHTMLInputElement _setAutofilled:]):

  • WebCoreSupport/WebChromeClient.mm:

(WebChromeClient::focusedNodeChanged):

  • WebCoreSupport/WebEditorClient.mm:

(WebEditorClient::textFieldDidBeginEditing):
(WebEditorClient::textFieldDidEndEditing):
(WebEditorClient::textDidChangeInTextField):
(WebEditorClient::doTextFieldCommandFromEvent):
(WebEditorClient::textWillBeDeletedInTextField):

  • WebView/WebHTMLRepresentation.mm:

(inputElementFromDOMElement):

Source/WebKit/qt:

  • WebCoreSupport/EditorClientQt.cpp:

(WebCore::EditorClientQt::setInputMethodState):

  • WebCoreSupport/QWebPageAdapter.cpp:

(QWebPageAdapter::inputMethodQuery):

Source/WebKit/win:

  • DOMCoreClasses.cpp:

(DOMElement::createInstance):

  • DOMHTMLClasses.cpp:

(DOMHTMLInputElement::form):
(DOMHTMLInputElement::disabled):
(DOMHTMLInputElement::readOnly):
(DOMHTMLInputElement::setType):
(DOMHTMLInputElement::value):
(DOMHTMLInputElement::setValue):
(DOMHTMLInputElement::setValueForUser):
(DOMHTMLInputElement::select):
(DOMHTMLInputElement::setSelectionStart):
(DOMHTMLInputElement::selectionStart):
(DOMHTMLInputElement::setSelectionEnd):
(DOMHTMLInputElement::selectionEnd):
(DOMHTMLInputElement::isTextField):
(DOMHTMLInputElement::rectOnScreen):
(DOMHTMLInputElement::replaceCharactersInRange):
(DOMHTMLInputElement::selectedRange):
(DOMHTMLInputElement::setAutofilled):
(DOMHTMLInputElement::isAutofilled):
(DOMHTMLInputElement::isUserEdited):

  • WebFrame.cpp:

(inputElementFromDOMElement):

Source/WebKit2:

  • WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:

(WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser):
(WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled):
(WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled):
(WebKit::InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit):

  • WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:

(WebKit::PDFPluginTextAnnotation::createAnnotationElement):

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::focusedNodeChanged):

  • WebProcess/WebCoreSupport/WebEditorClient.cpp:

(WebKit::WebEditorClient::textFieldDidBeginEditing):
(WebKit::WebEditorClient::textFieldDidEndEditing):
(WebKit::WebEditorClient::textDidChangeInTextField):
(WebKit::WebEditorClient::doTextFieldCommandFromEvent):
(WebKit::WebEditorClient::textWillBeDeletedInTextField):

  • WebProcess/WebPage/WebFrame.cpp:

(WebKit::WebFrame::containsAnyFormControls):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::editorState):

Location:
trunk/Source
Files:
58 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r152148 r152149  
     12013-06-27  Kangil Han  <kangil.han@samsung.com>
     2
     3        Adopt is/toHTMLInputElement for code cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=118130
     5
     6        Reviewed by Antti Koivisto.
     7
     8        To enhance readability, this patch adopts is/toHTMLInputElement.
     9        This also helps out to reduce duplicated use of static_cast.
     10
     11        * accessibility/AccessibilityMediaControls.cpp:
     12        (WebCore::AccessibilityMediaTimeline::valueDescription):
     13        * accessibility/AccessibilityNodeObject.cpp:
     14        (WebCore::AccessibilityNodeObject::determineAccessibilityRole):
     15        (WebCore::AccessibilityNodeObject::isNativeTextControl):
     16        (WebCore::AccessibilityNodeObject::isNativeImage):
     17        (WebCore::AccessibilityNodeObject::isInputImage):
     18        (WebCore::AccessibilityNodeObject::isReadOnly):
     19        (WebCore::AccessibilityNodeObject::valueForRange):
     20        (WebCore::AccessibilityNodeObject::maxValueForRange):
     21        (WebCore::AccessibilityNodeObject::minValueForRange):
     22        (WebCore::AccessibilityNodeObject::actionElement):
     23        (WebCore::AccessibilityNodeObject::titleElementText):
     24        (WebCore::AccessibilityNodeObject::visibleText):
     25        (WebCore::AccessibilityNodeObject::title):
     26        (WebCore::AccessibilityNodeObject::text):
     27        (WebCore::AccessibilityNodeObject::colorValue):
     28        (WebCore::accessibleNameForNode):
     29        * accessibility/AccessibilityRenderObject.cpp:
     30        (WebCore::AccessibilityRenderObject::isFileUploadButton):
     31        (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
     32        (WebCore::AccessibilityRenderObject::url):
     33        (WebCore::AccessibilityRenderObject::setValue):
     34        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
     35        (WebCore::AccessibilityRenderObject::addTextFieldChildren):
     36        * accessibility/AccessibilitySlider.cpp:
     37        (WebCore::AccessibilitySlider::element):
     38        * accessibility/ios/AccessibilityObjectIOS.mm:
     39        (WebCore::AccessibilityObject::accessibilityPasswordFieldLength):
     40        * bindings/js/JSHTMLInputElementCustom.cpp:
     41        (WebCore::JSHTMLInputElement::selectionStart):
     42        (WebCore::JSHTMLInputElement::setSelectionStart):
     43        (WebCore::JSHTMLInputElement::selectionEnd):
     44        (WebCore::JSHTMLInputElement::setSelectionEnd):
     45        (WebCore::JSHTMLInputElement::selectionDirection):
     46        (WebCore::JSHTMLInputElement::setSelectionDirection):
     47        (WebCore::JSHTMLInputElement::setSelectionRange):
     48        * css/StyleResolver.cpp:
     49        (WebCore::StyleResolver::adjustRenderStyle):
     50        * editing/FrameSelection.cpp:
     51        (WebCore::FrameSelection::isInPasswordField):
     52        * editing/ReplaceSelectionCommand.cpp:
     53        (WebCore::ReplaceSelectionCommand::shouldPerformSmartReplace):
     54        * html/HTMLFormControlElement.cpp:
     55        (WebCore::shouldAutofocus):
     56        * html/HTMLFormElement.cpp:
     57        (WebCore::HTMLFormElement::getTextFieldValues):
     58        * html/HTMLInputElement.h:
     59        (WebCore::isHTMLInputElement):
     60        (WebCore::toHTMLInputElement):
     61        * html/RadioInputType.cpp:
     62        (WebCore::RadioInputType::handleKeydownEvent):
     63        (WebCore::RadioInputType::isKeyboardFocusable):
     64        * html/shadow/MediaControlElementTypes.cpp:
     65        (WebCore::mediaControlElementType):
     66        * html/shadow/TextControlInnerElements.cpp:
     67        (WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
     68        (WebCore::SearchFieldCancelButtonElement::defaultEventHandler):
     69        (WebCore::SearchFieldCancelButtonElement::willRespondToMouseClickEvents):
     70        (WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
     71        (WebCore::InputFieldSpeechButtonElement::willRespondToMouseClickEvents):
     72        (WebCore::InputFieldSpeechButtonElement::setRecognitionResult):
     73        (WebCore::InputFieldSpeechButtonElement::startSpeechInput):
     74        * loader/FormSubmission.cpp:
     75        (WebCore::FormSubmission::create):
     76        * page/Chrome.cpp:
     77        (WebCore::Chrome::setToolTip):
     78        * page/EventHandler.cpp:
     79        (WebCore::isSubmitImage):
     80        (WebCore::EventHandler::handleMousePressEvent):
     81        * page/FocusController.cpp:
     82        (WebCore::clearSelectionIfNeeded):
     83        * platform/gtk/PasteboardGtk.cpp:
     84        (WebCore::getURLForImageNode):
     85        * platform/qt/RenderThemeQt.cpp:
     86        (WebCore::RenderThemeQt::paintMediaVolumeSliderTrack):
     87        * platform/qt/RenderThemeQtMobile.cpp:
     88        (WebCore::RenderThemeQtMobile::paintSliderTrack):
     89        * rendering/HitTestResult.cpp:
     90        (WebCore::HitTestResult::altDisplayString):
     91        (WebCore::HitTestResult::absoluteImageURL):
     92        (WebCore::HitTestResult::isContentEditable):
     93        * rendering/RenderBlock.cpp:
     94        (WebCore::RenderBlock::hasLineIfEmpty):
     95        * rendering/RenderBox.cpp:
     96        (WebCore::RenderBox::sizesLogicalWidthToFitContent):
     97        * rendering/RenderButton.cpp:
     98        (WebCore::RenderButton::updateFromElement):
     99        (WebCore::RenderButton::canHaveGeneratedChildren):
     100        * rendering/RenderDetailsMarker.cpp:
     101        (WebCore::RenderDetailsMarker::isOpen):
     102        * rendering/RenderFileUploadControl.cpp:
     103        (WebCore::RenderFileUploadControl::updateFromElement):
     104        (WebCore::RenderFileUploadControl::maxFilenameWidth):
     105        (WebCore::RenderFileUploadControl::paintObject):
     106        (WebCore::RenderFileUploadControl::uploadButton):
     107        (WebCore::RenderFileUploadControl::fileTextValue):
     108        * rendering/RenderImage.cpp:
     109        (WebCore::RenderImage::updateAltText):
     110        * testing/Internals.cpp:
     111        (WebCore::Internals::selectColorInColorChooser):
     112
    11132013-06-27  Antti Koivisto  <antti@apple.com>
    2114
  • trunk/Source/WebCore/accessibility/AccessibilityMediaControls.cpp

    r145988 r152149  
    278278{
    279279    Node* node = m_renderer->node();
    280     if (!node->hasTagName(inputTag))
     280    if (!isHTMLInputElement(node))
    281281        return String();
    282282
    283     float time = static_cast<HTMLInputElement*>(node)->value().toFloat();
     283    float time = toHTMLInputElement(node)->value().toFloat();
    284284    return localizedMediaTimeDescription(time);
    285285}
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r152088 r152149  
    283283    if (node()->hasTagName(buttonTag))
    284284        return buttonRoleType();
    285     if (node()->hasTagName(inputTag)) {
    286         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     285    if (isHTMLInputElement(node())) {
     286        HTMLInputElement* input = toHTMLInputElement(node());
    287287        if (input->isCheckbox())
    288288            return CheckBoxRole;
     
    445445        return true;
    446446
    447     if (node->hasTagName(inputTag)) {
    448         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     447    if (isHTMLInputElement(node)) {
     448        HTMLInputElement* input = toHTMLInputElement(node);
    449449        return input->isText() || input->isNumberField();
    450450    }
     
    495495        return true;
    496496
    497     if (node->hasTagName(inputTag)) {
    498         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     497    if (isHTMLInputElement(node)) {
     498        HTMLInputElement* input = toHTMLInputElement(node);
    499499        return input->isImageButton();
    500500    }
     
    530530        return false;
    531531 
    532     if (roleValue() == ButtonRole && node->hasTagName(inputTag)) {
    533         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     532    if (roleValue() == ButtonRole && isHTMLInputElement(node)) {
     533        HTMLInputElement* input = toHTMLInputElement(node);
    534534        return input->isImageButton();
    535535    }
     
    698698        return toHTMLFormControlElement(node)->isReadOnly();
    699699
    700     if (node->hasTagName(inputTag)) {
    701         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     700    if (isHTMLInputElement(node)) {
     701        HTMLInputElement* input = toHTMLInputElement(node);
    702702        if (input->isTextField())
    703703            return input->isReadOnly();
     
    787787float AccessibilityNodeObject::valueForRange() const
    788788{
    789     if (node() && node()->hasTagName(inputTag)) {
    790         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     789    if (node() && isHTMLInputElement(node())) {
     790        HTMLInputElement* input = toHTMLInputElement(node());
    791791        if (input->isRangeControl())
    792792            return input->valueAsNumber();
     
    801801float AccessibilityNodeObject::maxValueForRange() const
    802802{
    803     if (node() && node()->hasTagName(inputTag)) {
    804         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     803    if (node() && isHTMLInputElement(node())) {
     804        HTMLInputElement* input = toHTMLInputElement(node());
    805805        if (input->isRangeControl())
    806806            return input->maximum();
     
    815815float AccessibilityNodeObject::minValueForRange() const
    816816{
    817     if (node() && node()->hasTagName(inputTag)) {
    818         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     817    if (node() && isHTMLInputElement(node())) {
     818        HTMLInputElement* input = toHTMLInputElement(node());
    819819        if (input->isRangeControl())
    820820            return input->minimum();
     
    934934        return 0;
    935935
    936     if (node->hasTagName(inputTag)) {
    937         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     936    if (isHTMLInputElement(node)) {
     937        HTMLInputElement* input = toHTMLInputElement(node);
    938938        if (!input->isDisabledFormControl() && (isCheckboxOrRadio() || input->isTextButton()))
    939939            return input;
     
    11781178        return;
    11791179   
    1180     bool isInputTag = node->hasTagName(inputTag);
     1180    bool isInputTag = isHTMLInputElement(node);
    11811181    if (isInputTag || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl()) {
    11821182        HTMLLabelElement* label = labelForElement(toElement(node));
     
    12381238        return;
    12391239   
    1240     bool isInputTag = node->hasTagName(inputTag);
     1240    bool isInputTag = isHTMLInputElement(node);
    12411241    if (isInputTag) {
    1242         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     1242        HTMLInputElement* input = toHTMLInputElement(node);
    12431243        if (input->isTextButton()) {
    12441244            textOrder.append(AccessibilityText(input->valueWithDefault(), VisibleText));
     
    15811581        return String();
    15821582
    1583     bool isInputTag = node->hasTagName(inputTag);
     1583    bool isInputTag = isHTMLInputElement(node);
    15841584    if (isInputTag) {
    1585         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     1585        HTMLInputElement* input = toHTMLInputElement(node);
    15861586        if (input->isTextButton())
    15871587            return input->valueWithDefault();
     
    16441644        return String();
    16451645
    1646     if (isNativeTextControl() && (node->hasTagName(textareaTag) || node->hasTagName(inputTag)))
     1646    if (isNativeTextControl() && (node->hasTagName(textareaTag) || isHTMLInputElement(node)))
    16471647        return toHTMLTextFormControlElement(node)->value();
    16481648
     
    17021702        return;
    17031703
    1704     if (!node() || !node()->hasTagName(inputTag))
     1704    if (!node() || !isHTMLInputElement(node()))
    17051705        return;
    17061706
    1707     HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     1707    HTMLInputElement* input = toHTMLInputElement(node());
    17081708    const AtomicString& type = input->getAttribute(typeAttr);
    17091709    if (!equalIgnoringCase(type, "color"))
     
    17241724        return toText(node)->data();
    17251725
    1726     if (node->hasTagName(inputTag))
    1727         return static_cast<HTMLInputElement*>(node)->value();
     1726    if (isHTMLInputElement(node))
     1727        return toHTMLInputElement(node)->value();
    17281728
    17291729    if (node->isHTMLElement()) {
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r152105 r152149  
    518518bool AccessibilityRenderObject::isFileUploadButton() const
    519519{
    520     if (m_renderer && m_renderer->node() && m_renderer->node()->hasTagName(inputTag)) {
    521         HTMLInputElement* input = static_cast<HTMLInputElement*>(m_renderer->node());
     520    if (m_renderer && m_renderer->node() && isHTMLInputElement(m_renderer->node())) {
     521        HTMLInputElement* input = toHTMLInputElement(m_renderer->node());
    522522        return input->isFileUpload();
    523523    }
     
    925925   
    926926    Node* node = m_renderer->node();
    927     if (!node || !node->hasTagName(inputTag))
     927    if (!node || !isHTMLInputElement(node))
    928928        return;
    929929   
    930     HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     930    HTMLInputElement* input = toHTMLInputElement(node);
    931931    // if there's a form, then this is easy
    932932    if (input->form()) {
     
    944944        unsigned len = list->length();
    945945        for (unsigned i = 0; i < len; ++i) {
    946             if (list->item(i)->hasTagName(inputTag)) {
    947                 HTMLInputElement* associateElement = static_cast<HTMLInputElement*>(list->item(i));
     946            if (isHTMLInputElement(list->item(i))) {
     947                HTMLInputElement* associateElement = toHTMLInputElement(list->item(i));
    948948                if (associateElement->isRadioButton() && associateElement->name() == input->name()) {
    949949                    if (AccessibilityObject* object = axObjectCache()->getOrCreate(associateElement))
     
    14721472   
    14731473    if (isInputImage())
    1474         return static_cast<HTMLInputElement*>(m_renderer->node())->src();
     1474        return toHTMLInputElement(m_renderer->node())->src();
    14751475   
    14761476    return KURL();
     
    16421642    if (renderer->isTextField()) {
    16431643        // FIXME: This is not safe!  Other elements could have a TextField renderer.
    1644         static_cast<HTMLInputElement*>(element)->setValue(string);
     1644        toHTMLInputElement(element)->setValue(string);
    16451645    } else if (renderer->isTextArea()) {
    16461646        // FIXME: This is not safe!  Other elements could have a TextArea renderer.
     
    24492449        return StaticTextRole;
    24502450    if (cssBox && cssBox->isImage()) {
    2451         if (node && node->hasTagName(inputTag))
     2451        if (node && isHTMLInputElement(node))
    24522452            return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
    24532453        if (isSVGImage())
     
    24722472        return TextAreaRole;
    24732473
    2474     if (node && node->hasTagName(inputTag)) {
    2475         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     2474    if (node && isHTMLInputElement(node)) {
     2475        HTMLInputElement* input = toHTMLInputElement(node);
    24762476        if (input->isCheckbox())
    24772477            return CheckBoxRole;
     
    27712771{
    27722772    Node* node = this->node();
    2773     if (!node || !node->hasTagName(inputTag))
     2773    if (!node || !isHTMLInputElement(node))
    27742774        return;
    27752775   
    2776     HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     2776    HTMLInputElement* input = toHTMLInputElement(node);
    27772777    HTMLElement* spinButtonElement = input->innerSpinButtonElement();
    27782778    if (!spinButtonElement || !spinButtonElement->isSpinButtonElement())
  • trunk/Source/WebCore/accessibility/AccessibilitySlider.cpp

    r145988 r152149  
    144144HTMLInputElement* AccessibilitySlider::element() const
    145145{
    146     return static_cast<HTMLInputElement*>(m_renderer->node());
     146    return toHTMLInputElement(m_renderer->node());
    147147}
    148148
  • trunk/Source/WebCore/accessibility/ios/AccessibilityObjectIOS.mm

    r143263 r152149  
    6868        return false;
    6969   
    70     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(renderObject->node());
     70    HTMLInputElement* inputElement = toHTMLInputElement(renderObject->node());
    7171    if (!inputElement)
    7272        return false;
  • trunk/Source/WebCore/bindings/js/JSHTMLInputElementCustom.cpp

    r127191 r152149  
    3636JSValue JSHTMLInputElement::selectionStart(ExecState* exec) const
    3737{
    38     HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
     38    HTMLInputElement* input = toHTMLInputElement(impl());
    3939    if (!input->canHaveSelection())
    4040        return throwTypeError(exec);
     
    4545void JSHTMLInputElement::setSelectionStart(ExecState* exec, JSValue value)
    4646{
    47     HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
     47    HTMLInputElement* input = toHTMLInputElement(impl());
    4848    if (!input->canHaveSelection())
    4949        throwTypeError(exec);
     
    5454JSValue JSHTMLInputElement::selectionEnd(ExecState* exec) const
    5555{
    56     HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
     56    HTMLInputElement* input = toHTMLInputElement(impl());
    5757    if (!input->canHaveSelection())
    5858        return throwTypeError(exec);
     
    6363void JSHTMLInputElement::setSelectionEnd(ExecState* exec, JSValue value)
    6464{
    65     HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
     65    HTMLInputElement* input = toHTMLInputElement(impl());
    6666    if (!input->canHaveSelection())
    6767        throwTypeError(exec);
     
    7272JSValue JSHTMLInputElement::selectionDirection(ExecState* exec) const
    7373{
    74     HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
     74    HTMLInputElement* input = toHTMLInputElement(impl());
    7575    if (!input->canHaveSelection())
    7676        return throwTypeError(exec);
     
    8181void JSHTMLInputElement::setSelectionDirection(ExecState* exec, JSValue value)
    8282{
    83     HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
     83    HTMLInputElement* input = toHTMLInputElement(impl());
    8484    if (!input->canHaveSelection()) {
    8585        throwTypeError(exec);
     
    9292JSValue JSHTMLInputElement::setSelectionRange(ExecState* exec)
    9393{
    94     HTMLInputElement* input = static_cast<HTMLInputElement*>(impl());
     94    HTMLInputElement* input = toHTMLInputElement(impl());
    9595    if (!input->canHaveSelection())
    9696        return throwTypeError(exec);
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r152006 r152149  
    15391539        // Don't apply intrinsic margins to image buttons. The designer knows how big the images are,
    15401540        // so we have to treat all image buttons as though they were explicitly sized.
    1541         if (!e->hasTagName(inputTag) || !static_cast<HTMLInputElement*>(e)->isImageButton())
     1541        if (!isHTMLInputElement(e) || !toHTMLInputElement(e)->isImageButton())
    15421542            addIntrinsicMargins(style);
    15431543    }
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r151949 r152149  
    16981698{
    16991699    HTMLTextFormControlElement* textControl = enclosingTextFormControl(start());
    1700     return textControl && textControl->hasTagName(inputTag) && static_cast<HTMLInputElement*>(textControl)->isPasswordField();
     1700    return textControl && isHTMLInputElement(textControl) && toHTMLInputElement(textControl)->isPasswordField();
    17011701}
    17021702
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r151698 r152149  
    12501250
    12511251    Element* textControl = enclosingTextFormControl(positionAtStartOfInsertedContent().deepEquivalent());
    1252     if (textControl && textControl->hasTagName(inputTag) && static_cast<HTMLInputElement*>(textControl)->isPasswordField())
     1252    if (textControl && isHTMLInputElement(textControl) && toHTMLInputElement(textControl)->isPasswordField())
    12531253        return false; // Disable smart replace for password fields.
    12541254
  • trunk/Source/WebCore/html/HTMLFormControlElement.cpp

    r151282 r152149  
    189189    // FIXME: Should this set of hasTagName checks be replaced by a
    190190    // virtual member function?
    191     if (element->hasTagName(inputTag))
    192         return !static_cast<HTMLInputElement*>(element)->isInputTypeHidden();
     191    if (isHTMLInputElement(element))
     192        return !toHTMLInputElement(element)->isInputTypeHidden();
    193193    if (element->hasTagName(selectTag))
    194194        return true;
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r151947 r152149  
    301301        FormAssociatedElement* control = m_associatedElements[i];
    302302        HTMLElement* element = toHTMLElement(control);
    303         if (!element->hasLocalName(inputTag))
     303        if (!isHTMLInputElement(element))
    304304            continue;
    305305
    306         HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
     306        HTMLInputElement* input = toHTMLInputElement(element);
    307307        if (!input->isTextField())
    308308            continue;
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r151572 r152149  
    440440};
    441441
     442inline bool isHTMLInputElement(Node* node)
     443{
     444    return node->hasTagName(HTMLNames::inputTag);
     445}
     446
     447inline HTMLInputElement* toHTMLInputElement(Node* node)
     448{
     449    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLInputElement(node));
     450    return static_cast<HTMLInputElement*>(node);
     451}
     452
    442453} //namespace
    443454#endif
  • trunk/Source/WebCore/html/RadioInputType.cpp

    r151986 r152149  
    9292            break;
    9393        // Look for more radio buttons.
    94         if (!node->hasTagName(inputTag))
     94        if (!isHTMLInputElement(node))
    9595            continue;
    96         RefPtr<HTMLInputElement> inputElement = static_cast<HTMLInputElement*>(node);
     96        RefPtr<HTMLInputElement> inputElement = toHTMLInputElement(node);
    9797        if (inputElement->form() != element()->form())
    9898            break;
     
    130130    // skip any other elements in the group.
    131131    Element* currentFocusedNode = element()->document()->focusedElement();
    132     if (currentFocusedNode && currentFocusedNode->hasTagName(inputTag)) {
    133         HTMLInputElement* focusedInput = static_cast<HTMLInputElement*>(currentFocusedNode);
     132    if (currentFocusedNode && isHTMLInputElement(currentFocusedNode)) {
     133        HTMLInputElement* focusedInput = toHTMLInputElement(currentFocusedNode);
    134134        if (focusedInput->isRadioButton() && focusedInput->form() == element()->form() && focusedInput->name() == element()->name())
    135135            return false;
  • trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp

    r148131 r152149  
    7070    ASSERT_WITH_SECURITY_IMPLICATION(node->isMediaControlElement());
    7171    HTMLElement* element = toHTMLElement(node);
    72     if (element->hasTagName(inputTag))
     72    if (isHTMLInputElement(element))
    7373        return static_cast<MediaControlInputElement*>(element)->displayType();
    7474    return static_cast<MediaControlDivElement*>(element)->displayType();
  • trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp

    r151947 r152149  
    156156{
    157157    // On mousedown, bring up a menu, if needed
    158     HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
     158    HTMLInputElement* input = toHTMLInputElement(shadowHost());
    159159    if (input && event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
    160160        input->focus();
     
    209209{
    210210    // If the element is visible, on mouseup, clear the value, and set selection
    211     RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
     211    RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost()));
    212212    if (!input || input->isDisabledOrReadOnly()) {
    213213        if (!event->defaultHandled())
     
    248248bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents()
    249249{
    250     const HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
     250    const HTMLInputElement* input = toHTMLInputElement(shadowHost());
    251251    if (input && !input->isDisabledOrReadOnly())
    252252        return true;
     
    293293    // remove the input element from DOM. To make sure it remains valid until we finish our work
    294294    // here, we take a temporary reference.
    295     RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
     295    RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost()));
    296296
    297297    if (!input || input->isDisabledOrReadOnly()) {
     
    345345bool InputFieldSpeechButtonElement::willRespondToMouseClickEvents()
    346346{
    347     const HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
     347    const HTMLInputElement* input = toHTMLInputElement(shadowHost());
    348348    if (input && !input->isDisabledOrReadOnly())
    349349        return true;
     
    382382    // remove the input element from DOM. To make sure it remains valid until we finish our work
    383383    // here, we take a temporary reference.
    384     RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
     384    RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost()));
    385385    if (!input || input->isDisabledOrReadOnly())
    386386        return;
     
    435435        return;
    436436
    437     RefPtr<HTMLInputElement> input = static_cast<HTMLInputElement*>(shadowHost());
     437    RefPtr<HTMLInputElement> input = toHTMLInputElement(shadowHost());
    438438    AtomicString language = input->computeInheritedLanguage();
    439439    String grammar = input->getAttribute(webkitgrammarAttr);
  • trunk/Source/WebCore/loader/FormSubmission.cpp

    r147135 r152149  
    190190        if (!element->isDisabledFormControl())
    191191            control->appendFormData(*domFormData, isMultiPartForm);
    192         if (element->hasLocalName(inputTag)) {
    193             HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
     192        if (isHTMLInputElement(element)) {
     193            HTMLInputElement* input = toHTMLInputElement(element);
    194194            if (input->isTextField()) {
    195195                formValues.append(pair<String, String>(input->name().string(), input->value()));
  • trunk/Source/WebCore/page/Chrome.cpp

    r151926 r152149  
    408408        if (Node* node = result.innerNonSharedNode()) {
    409409            // Get tooltip representing form action, if relevant
    410             if (node->hasTagName(inputTag)) {
    411                 HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     410            if (isHTMLInputElement(node)) {
     411                HTMLInputElement* input = toHTMLInputElement(node);
    412412                if (input->isSubmitButton())
    413413                    if (HTMLFormElement* form = input->form()) {
     
    440440    if (toolTip.isEmpty()) {
    441441        if (Node* node = result.innerNonSharedNode()) {
    442             if (node->hasTagName(inputTag)) {
    443                 HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
     442            if (isHTMLInputElement(node)) {
     443                HTMLInputElement* input = toHTMLInputElement(node);
    444444                toolTip = input->defaultToolTip();
    445445
  • trunk/Source/WebCore/page/EventHandler.cpp

    r151840 r152149  
    11981198static bool isSubmitImage(Node* node)
    11991199{
    1200     return node && node->hasTagName(inputTag) && static_cast<HTMLInputElement*>(node)->isImageButton();
     1200    return node && isHTMLInputElement(node) && toHTMLInputElement(node)->isImageButton();
    12011201}
    12021202
     
    16231623        // we'd like to EventHandler::handleMousePressEvent to pass the event to the widget and thus the
    16241624        // event target node can't still be the shadow node.
    1625         if (mev.targetNode()->isShadowRoot() && toShadowRoot(mev.targetNode())->host()->hasTagName(inputTag)) {
     1625        if (mev.targetNode()->isShadowRoot() && isHTMLInputElement(toShadowRoot(mev.targetNode())->host())) {
    16261626            HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
    16271627            mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
  • trunk/Source/WebCore/page/FocusController.cpp

    r151996 r152149  
    4545#include "HTMLAreaElement.h"
    4646#include "HTMLImageElement.h"
     47#include "HTMLInputElement.h"
    4748#include "HTMLNames.h"
    4849#include "HitTestResult.h"
     
    584585
    585586            if (Node* shadowAncestorNode = root->deprecatedShadowAncestorNode()) {
    586                 if (!shadowAncestorNode->hasTagName(inputTag) && !shadowAncestorNode->hasTagName(textareaTag))
     587                if (!isHTMLInputElement(shadowAncestorNode) && !shadowAncestorNode->hasTagName(textareaTag))
    587588                    return;
    588589            }
  • trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp

    r150334 r152149  
    2626#include "Editor.h"
    2727#include "Frame.h"
     28#include "HTMLInputElement.h"
    2829#include "HTMLNames.h"
    2930#include "HTMLParserIdioms.h"
     
    199200    // FIXME: Later this code should be shared with Chromium somehow. Chances are all platforms want it.
    200201    AtomicString urlString;
    201     if (node->hasTagName(HTMLNames::imgTag) || node->hasTagName(HTMLNames::inputTag))
     202    if (node->hasTagName(HTMLNames::imgTag) || isHTMLInputElement(node))
    202203        urlString = toElement(node)->getAttribute(HTMLNames::srcAttr);
    203204#if ENABLE(SVG)
  • trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp

    r151783 r152149  
    742742    p->painter->drawRect(left, top, width, height);
    743743
    744     if (!o->node() || !o->node()->hasTagName(inputTag))
    745         return false;
    746 
    747     HTMLInputElement* slider = static_cast<HTMLInputElement*>(o->node());
     744    if (!o->node() || !isHTMLInputElement(o->node()))
     745        return false;
     746
     747    HTMLInputElement* slider = toHTMLInputElement(o->node());
    748748
    749749    // Position the inner rectangle
  • trunk/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp

    r145596 r152149  
    867867        return true;
    868868
    869     HTMLInputElement* slider = static_cast<HTMLInputElement*>(o->node());
     869    HTMLInputElement* slider = toHTMLInputElement(o->node());
    870870
    871871    const double min = slider->minimum();
  • trunk/Source/WebCore/rendering/HitTestResult.cpp

    r151996 r152149  
    277277    }
    278278   
    279     if (m_innerNonSharedNode->hasTagName(inputTag)) {
    280         HTMLInputElement* input = static_cast<HTMLInputElement*>(m_innerNonSharedNode.get());
     279    if (isHTMLInputElement(m_innerNonSharedNode.get())) {
     280        HTMLInputElement* input = toHTMLInputElement(m_innerNonSharedNode.get());
    281281        return displayString(input->alt(), m_innerNonSharedNode.get());
    282282    }
     
    318318    if (m_innerNonSharedNode->hasTagName(embedTag)
    319319        || m_innerNonSharedNode->hasTagName(imgTag)
    320         || m_innerNonSharedNode->hasTagName(inputTag)
    321         || m_innerNonSharedNode->hasTagName(objectTag)   
     320        || isHTMLInputElement(m_innerNonSharedNode.get())
     321        || m_innerNonSharedNode->hasTagName(objectTag)
    322322#if ENABLE(SVG)
    323323        || m_innerNonSharedNode->hasTagName(SVGNames::imageTag)
     
    572572        return true;
    573573
    574     if (m_innerNonSharedNode->hasTagName(inputTag))
    575         return static_cast<HTMLInputElement*>(m_innerNonSharedNode.get())->isTextField();
     574    if (isHTMLInputElement(m_innerNonSharedNode.get()))
     575        return toHTMLInputElement(m_innerNonSharedNode.get())->isTextField();
    576576
    577577    return m_innerNonSharedNode->rendererIsEditable();
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r152122 r152149  
    3535#include "FrameView.h"
    3636#include "GraphicsContext.h"
     37#include "HTMLInputElement.h"
    3738#include "HTMLNames.h"
    3839#include "HitTestLocation.h"
     
    64836484        return true;
    64846485   
    6485     if (node()->isShadowRoot() && toShadowRoot(node())->host()->hasTagName(inputTag))
     6486    if (node()->isShadowRoot() && isHTMLInputElement(toShadowRoot(node())->host()))
    64866487        return true;
    64876488   
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r152122 r152149  
    3535#include "HTMLElement.h"
    3636#include "HTMLFrameOwnerElement.h"
     37#include "HTMLInputElement.h"
    3738#include "HTMLNames.h"
    3839#include "FloatQuad.h"
     
    23032304    // FIXME: Think about block-flow here.
    23042305    // https://bugs.webkit.org/show_bug.cgi?id=46473
    2305     if (logicalWidth.type() == Auto && !isStretchingColumnFlexItem(this) && node() && (node()->hasTagName(inputTag) || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || node()->hasTagName(textareaTag) || node()->hasTagName(legendTag)))
     2306    if (logicalWidth.type() == Auto && !isStretchingColumnFlexItem(this) && node() && (isHTMLInputElement(node()) || node()->hasTagName(selectTag) || node()->hasTagName(buttonTag) || node()->hasTagName(textareaTag) || node()->hasTagName(legendTag)))
    23062307        return true;
    23072308
  • trunk/Source/WebCore/rendering/RenderButton.cpp

    r147261 r152149  
    123123{
    124124    // If we're an input element, we may need to change our button text.
    125     if (node()->hasTagName(inputTag)) {
    126         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     125    if (isHTMLInputElement(node())) {
     126        HTMLInputElement* input = toHTMLInputElement(node());
    127127        String value = input->valueWithDefault();
    128128        setText(value);
     
    158158    // write the code assuming any other button types that might emerge in the future
    159159    // can also have children.
    160     return !node()->hasTagName(inputTag);
     160    return !isHTMLInputElement(node());
    161161}
    162162
  • trunk/Source/WebCore/rendering/RenderDetailsMarker.cpp

    r150876 r152149  
    2525#include "Element.h"
    2626#include "GraphicsContext.h"
     27#include "HTMLInputElement.h"
    2728#include "HTMLNames.h"
    2829#include "PaintInfo.h"
     
    145146        if (renderer->node()->hasTagName(detailsTag))
    146147            return !toElement(renderer->node())->getAttribute(openAttr).isNull();
    147         if (renderer->node()->hasTagName(inputTag))
     148        if (isHTMLInputElement(renderer->node()))
    148149            return true;
    149150    }
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r149549 r152149  
    6969void RenderFileUploadControl::updateFromElement()
    7070{
    71     HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     71    HTMLInputElement* input = toHTMLInputElement(node());
    7272    ASSERT(input->isFileUpload());
    7373
     
    9595int RenderFileUploadControl::maxFilenameWidth() const
    9696{
    97     HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     97    HTMLInputElement* input = toHTMLInputElement(node());
    9898    return max(0, contentBoxRect().pixelSnappedWidth() - nodeWidth(uploadButton()) - afterButtonSpacing
    9999        - (input->icon() ? iconWidth + iconFilenameSpacing : 0));
     
    128128            return;
    129129
    130         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     130        HTMLInputElement* input = toHTMLInputElement(node());
    131131        LayoutUnit buttonWidth = nodeWidth(button);
    132132        LayoutUnit buttonAndIconWidth = buttonWidth + afterButtonSpacing
     
    227227HTMLInputElement* RenderFileUploadControl::uploadButton() const
    228228{
    229     HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     229    HTMLInputElement* input = toHTMLInputElement(node());
    230230
    231231    ASSERT(input->shadow());
    232232
    233233    Node* buttonNode = input->shadow()->shadowRoot()->firstChild();
    234     return buttonNode && buttonNode->isHTMLElement() && buttonNode->hasTagName(inputTag) ? static_cast<HTMLInputElement*>(buttonNode) : 0;
     234    return buttonNode && buttonNode->isHTMLElement() && isHTMLInputElement(buttonNode) ? toHTMLInputElement(buttonNode) : 0;
    235235}
    236236
     
    245245String RenderFileUploadControl::fileTextValue() const
    246246{
    247     HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     247    HTMLInputElement* input = toHTMLInputElement(node());
    248248    ASSERT(input->files());
    249249    return theme()->fileListNameForWidth(input->files(), style()->font(), maxFilenameWidth(), input->multiple());
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r151996 r152149  
    558558        return;
    559559
    560     if (node()->hasTagName(inputTag))
    561         m_altText = static_cast<HTMLInputElement*>(node())->altText();
     560    if (isHTMLInputElement(node()))
     561        m_altText = toHTMLInputElement(node())->altText();
    562562    else if (node()->hasTagName(imgTag))
    563563        m_altText = static_cast<HTMLImageElement*>(node())->altText();
  • trunk/Source/WebCore/testing/Internals.cpp

    r151727 r152149  
    704704void Internals::selectColorInColorChooser(Element* element, const String& colorValue)
    705705{
    706     if (!element->hasTagName(inputTag))
     706    if (!isHTMLInputElement(element))
    707707        return;
    708708    HTMLInputElement* inputElement = element->toInputElement();
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r151996 r152149  
    22302230            }
    22312231            context.setFlag(Platform::WebContext::IsInput);
    2232             if (element->hasTagName(HTMLNames::inputTag))
     2232            if (isHTMLInputElement(element))
    22332233                context.setFlag(Platform::WebContext::IsSingleLine);
    22342234            if (DOMSupport::isPasswordElement(element))
     
    28322832    double blockExpansionRatio = 5.0 * blockToPageRatio * blockToPageRatio;
    28332833
    2834     if (!tnode->hasTagName(HTMLNames::imgTag) && !tnode->hasTagName(HTMLNames::inputTag) && !tnode->hasTagName(HTMLNames::textareaTag)) {
     2834    if (!tnode->hasTagName(HTMLNames::imgTag) && !isHTMLInputElement(tnode) && !tnode->hasTagName(HTMLNames::textareaTag)) {
    28352835        while ((tnode = tnode->parentNode())) {
    28362836            ASSERT(tnode);
  • trunk/Source/WebKit/blackberry/ChangeLog

    r152102 r152149  
     12013-06-27  Kangil Han  <kangil.han@samsung.com>
     2
     3        Adopt is/toHTMLInputElement for code cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=118130
     5
     6        Reviewed by Antti Koivisto.
     7
     8        To enhance readability, this patch adopts is/toHTMLInputElement.
     9        This also helps out to reduce duplicated use of static_cast.
     10
     11        * Api/WebPage.cpp:
     12        (BlackBerry::WebKit::WebPagePrivate::webContext):
     13        (BlackBerry::WebKit::WebPagePrivate::blockZoomRectForNode):
     14        * WebCoreSupport/CredentialTransformData.cpp:
     15        (WebCore::CredentialTransformData::findPasswordFormFields):
     16        * WebCoreSupport/EditorClientBlackBerry.cpp:
     17        (WebCore::EditorClientBlackBerry::shouldSpellCheckFocusedField):
     18        * WebKitSupport/DOMSupport.cpp:
     19        (BlackBerry::WebKit::DOMSupport::isPasswordElement):
     20        (BlackBerry::WebKit::DOMSupport::inputElementText):
     21        (BlackBerry::WebKit::DOMSupport::isDateTimeInputField):
     22        (BlackBerry::WebKit::DOMSupport::isColorInputField):
     23        (BlackBerry::WebKit::DOMSupport::elementIdOrNameIndicatesNoAutocomplete):
     24        * WebKitSupport/InputHandler.cpp:
     25        (BlackBerry::WebKit::InputHandler::elementType):
     26        (BlackBerry::WebKit::InputHandler::setInputValue):
     27        (BlackBerry::WebKit::InputHandler::extractedTextRequest):
     28        (BlackBerry::WebKit::InputHandler::showTextInputTypeSuggestionBox):
     29
    1302013-06-27  Nima Ghanavatian  <nghanavatian@blackberry.com>
    231
  • trunk/Source/WebKit/blackberry/WebCoreSupport/CredentialTransformData.cpp

    r151514 r152149  
    145145            continue;
    146146        HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement*>(formElements[i]);
    147         if (!formElement->hasTagName(HTMLNames::inputTag))
     147        if (!isHTMLInputElement(formElement))
    148148            continue;
    149149
     
    167167                continue;
    168168            HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement*>(formElements[i]);
    169             if (!formElement->hasTagName(HTMLNames::inputTag))
     169            if (!isHTMLInputElement(formElement))
    170170                continue;
    171171
  • trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp

    r152102 r152149  
    111111    if (node->isElementNode()) {
    112112        const Element* element = toElement(node);
    113         if (element->hasTagName(HTMLNames::inputTag) && !DOMSupport::elementSupportsAutocomplete(element))
     113        if (isHTMLInputElement(element) && !DOMSupport::elementSupportsAutocomplete(element))
    114114            return false;
    115115    }
  • trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp

    r150140 r152149  
    110110bool isPasswordElement(const Element* element)
    111111{
    112     return element && element->hasTagName(HTMLNames::inputTag)
    113         && static_cast<const HTMLInputElement*>(element)->isPasswordField();
     112    return element && isHTMLInputElement(element)
     113        && toHTMLInputElement(element)->isPasswordField();
    114114}
    115115
     
    120120
    121121    WTF::String elementText;
    122     if (element->hasTagName(HTMLNames::inputTag)) {
    123         const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(element);
     122    if (isHTMLInputElement(element)) {
     123        const HTMLInputElement* inputElement = toHTMLInputElement(element);
    124124        elementText = inputElement->value();
    125125    } else if (element->hasTagName(HTMLNames::textareaTag)) {
     
    181181bool isDateTimeInputField(const Element* element)
    182182{
    183     if (!element->hasTagName(HTMLNames::inputTag))
    184         return false;
    185 
    186     const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(element);
     183    if (!isHTMLInputElement(element))
     184        return false;
     185
     186    const HTMLInputElement* inputElement = toHTMLInputElement(element);
    187187
    188188    // The following types have popup's.
     
    199199bool isColorInputField(const Element* element)
    200200{
    201     if (!element->hasTagName(HTMLNames::inputTag))
    202         return false;
    203 
    204     const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(element);
     201    if (!isHTMLInputElement(element))
     202        return false;
     203
     204    const HTMLInputElement* inputElement = toHTMLInputElement(element);
    205205
    206206#if ENABLE(INPUT_TYPE_COLOR)
     
    395395bool elementIdOrNameIndicatesNoAutocomplete(const Element* element)
    396396{
    397     if (!element->hasTagName(HTMLNames::inputTag))
     397    if (!isHTMLInputElement(element))
    398398        return false;
    399399
  • trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp

    r151809 r152149  
    411411BlackBerryInputType InputHandler::elementType(Element* element) const
    412412{
    413     if (const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(element->toInputElement()))
     413    if (const HTMLInputElement* inputElement = toHTMLInputElement(element))
    414414        return convertInputType(inputElement);
    415415
     
    13211321        return;
    13221322
    1323     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_currentFocusElement.get());
     1323    HTMLInputElement* inputElement = toHTMLInputElement(m_currentFocusElement.get());
    13241324    inputElement->setValue(value);
    13251325    clearCurrentFocusElement();
     
    23402340    // selectionActive is not limited to inside the extracted text.
    23412341    bool selectionActive = extractedText->selection_start != extractedText->selection_end;
    2342     bool singleLine = m_currentFocusElement->hasTagName(HTMLNames::inputTag);
     2342    bool singleLine = isHTMLInputElement(m_currentFocusElement);
    23432343
    23442344    // FIXME flags has two values in doc, enum not in header yet.
     
    27022702        return;
    27032703
    2704     HTMLInputElement* focusedInputElement = static_cast<HTMLInputElement*>(m_currentFocusElement->toInputElement());
     2704    HTMLInputElement* focusedInputElement = toHTMLInputElement(m_currentFocusElement->toInputElement());
    27052705    if (!focusedInputElement)
    27062706        return;
  • trunk/Source/WebKit/efl/ChangeLog

    r152071 r152149  
     12013-06-27  Kangil Han  <kangil.han@samsung.com>
     2
     3        Adopt is/toHTMLInputElement for code cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=118130
     5
     6        Reviewed by Antti Koivisto.
     7
     8        To enhance readability, this patch adopts is/toHTMLInputElement.
     9        This also helps out to reduce duplicated use of static_cast.
     10
     11        * ewk/ewk_view.cpp:
     12        (ewk_view_input_method_state_set):
     13
    1142013-06-26  Ryuan Choi  <ryuan.choi@samsung.com>
    215
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r152071 r152149  
    29632963        && focusedFrame->document()
    29642964        && focusedFrame->document()->focusedElement()
    2965         && focusedFrame->document()->focusedElement()->hasTagName(WebCore::HTMLNames::inputTag)) {
     2965        && isHTMLInputElement(focusedFrame->document()->focusedElement())) {
    29662966        WebCore::HTMLInputElement* inputElement;
    29672967
  • trunk/Source/WebKit/mac/ChangeLog

    r151981 r152149  
     12013-06-27  Kangil Han  <kangil.han@samsung.com>
     2
     3        Adopt is/toHTMLInputElement for code cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=118130
     5
     6        Reviewed by Antti Koivisto.
     7
     8        To enhance readability, this patch adopts is/toHTMLInputElement.
     9        This also helps out to reduce duplicated use of static_cast.
     10
     11        * DOM/WebDOMOperations.mm:
     12        (-[DOMHTMLInputElement _setAutofilled:]):
     13        * WebCoreSupport/WebChromeClient.mm:
     14        (WebChromeClient::focusedNodeChanged):
     15        * WebCoreSupport/WebEditorClient.mm:
     16        (WebEditorClient::textFieldDidBeginEditing):
     17        (WebEditorClient::textFieldDidEndEditing):
     18        (WebEditorClient::textDidChangeInTextField):
     19        (WebEditorClient::doTextFieldCommandFromEvent):
     20        (WebEditorClient::textWillBeDeletedInTextField):
     21        * WebView/WebHTMLRepresentation.mm:
     22        (inputElementFromDOMElement):
     23
    1242013-06-26  Kangil Han  <kangil.han@samsung.com>
    225
  • trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm

    r151070 r152149  
    200200- (void)_setAutofilled:(BOOL)autofilled
    201201{
    202     static_cast<HTMLInputElement*>(core((DOMElement *)self))->setAutofilled(autofilled);
     202    toHTMLInputElement(core((DOMElement *)self))->setAutofilled(autofilled);
    203203}
    204204
  • trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm

    r151804 r152149  
    201201    if (!node)
    202202        return;
    203     if (!node->hasTagName(inputTag))
     203    if (!isHTMLInputElement(node))
    204204        return;
    205205
    206     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(node);
     206    HTMLInputElement* inputElement = toHTMLInputElement(node);
    207207    if (!inputElement->isText())
    208208        return;
  • trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm

    r150230 r152149  
    633633void WebEditorClient::textFieldDidBeginEditing(Element* element)
    634634{
    635     if (!element->hasTagName(inputTag))
     635    if (!isHTMLInputElement(element))
    636636        return;
    637637
    638     DOMHTMLInputElement* inputElement = kit(static_cast<HTMLInputElement*>(element));
     638    DOMHTMLInputElement* inputElement = kit(toHTMLInputElement(element));
    639639    FormDelegateLog(inputElement);
    640640    CallFormDelegate(m_webView, @selector(textFieldDidBeginEditing:inFrame:), inputElement, kit(element->document()->frame()));
     
    643643void WebEditorClient::textFieldDidEndEditing(Element* element)
    644644{
    645     if (!element->hasTagName(inputTag))
     645    if (!isHTMLInputElement(element))
    646646        return;
    647647
    648     DOMHTMLInputElement* inputElement = kit(static_cast<HTMLInputElement*>(element));
     648    DOMHTMLInputElement* inputElement = kit(toHTMLInputElement(element));
    649649    FormDelegateLog(inputElement);
    650650    CallFormDelegate(m_webView, @selector(textFieldDidEndEditing:inFrame:), inputElement, kit(element->document()->frame()));
     
    653653void WebEditorClient::textDidChangeInTextField(Element* element)
    654654{
    655     if (!element->hasTagName(inputTag))
     655    if (!isHTMLInputElement(element))
    656656        return;
    657657
     
    659659        return;
    660660
    661     DOMHTMLInputElement* inputElement = kit(static_cast<HTMLInputElement*>(element));
     661    DOMHTMLInputElement* inputElement = kit(toHTMLInputElement(element));
    662662    FormDelegateLog(inputElement);
    663663    CallFormDelegate(m_webView, @selector(textDidChangeInTextField:inFrame:), inputElement, kit(element->document()->frame()));
     
    689689bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event)
    690690{
    691     if (!element->hasTagName(inputTag))
     691    if (!isHTMLInputElement(element))
    692692        return NO;
    693693
    694     DOMHTMLInputElement* inputElement = kit(static_cast<HTMLInputElement*>(element));
     694    DOMHTMLInputElement* inputElement = kit(toHTMLInputElement(element));
    695695    FormDelegateLog(inputElement);
    696696    if (SEL commandSelector = selectorForKeyEvent(event))
     
    701701void WebEditorClient::textWillBeDeletedInTextField(Element* element)
    702702{
    703     if (!element->hasTagName(inputTag))
     703    if (!isHTMLInputElement(element))
    704704        return;
    705705
    706     DOMHTMLInputElement* inputElement = kit(static_cast<HTMLInputElement*>(element));
     706    DOMHTMLInputElement* inputElement = kit(toHTMLInputElement(element));
    707707    FormDelegateLog(inputElement);
    708708    // We're using the deleteBackward selector for all deletion operations since the autofill code treats all deletions the same way.
  • trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm

    r150140 r152149  
    304304{
    305305    Element* node = core(element);
    306     return node && node->hasTagName(inputTag) ? static_cast<HTMLInputElement*>(node) : 0;
     306    return node && isHTMLInputElement(node) ? toHTMLInputElement(node) : 0;
    307307}
    308308
  • trunk/Source/WebKit/qt/ChangeLog

    r152080 r152149  
     12013-06-27  Kangil Han  <kangil.han@samsung.com>
     2
     3        Adopt is/toHTMLInputElement for code cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=118130
     5
     6        Reviewed by Antti Koivisto.
     7
     8        To enhance readability, this patch adopts is/toHTMLInputElement.
     9        This also helps out to reduce duplicated use of static_cast.
     10
     11        * WebCoreSupport/EditorClientQt.cpp:
     12        (WebCore::EditorClientQt::setInputMethodState):
     13        * WebCoreSupport/QWebPageAdapter.cpp:
     14        (QWebPageAdapter::inputMethodQuery):
     15
    1162013-06-26  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    217
  • trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp

    r150796 r152149  
    620620        Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
    621621        if (frame && frame->document() && frame->document()->focusedElement())
    622             if (frame->document()->focusedElement()->hasTagName(HTMLNames::inputTag))
    623                 inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedElement());
     622            if (isHTMLInputElement(frame->document()->focusedElement()))
     623                inputElement = toHTMLInputElement(frame->document()->focusedElement());
    624624
    625625        if (inputElement) {
  • trunk/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp

    r150796 r152149  
    711711        if (frame->selection()->isContentEditable()) {
    712712            if (frame->document() && frame->document()->focusedElement()) {
    713                 if (frame->document()->focusedElement()->hasTagName(HTMLNames::inputTag)) {
    714                     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedElement());
     713                if (isHTMLInputElement(frame->document()->focusedElement())) {
     714                    HTMLInputElement* inputElement = toHTMLInputElement(frame->document()->focusedElement());
    715715                    return QVariant(inputElement->maxLength());
    716716                }
  • trunk/Source/WebKit/win/ChangeLog

    r152143 r152149  
     12013-06-27  Kangil Han  <kangil.han@samsung.com>
     2
     3        Adopt is/toHTMLInputElement for code cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=118130
     5
     6        Reviewed by Antti Koivisto.
     7
     8        To enhance readability, this patch adopts is/toHTMLInputElement.
     9        This also helps out to reduce duplicated use of static_cast.
     10
     11        * DOMCoreClasses.cpp:
     12        (DOMElement::createInstance):
     13        * DOMHTMLClasses.cpp:
     14        (DOMHTMLInputElement::form):
     15        (DOMHTMLInputElement::disabled):
     16        (DOMHTMLInputElement::readOnly):
     17        (DOMHTMLInputElement::setType):
     18        (DOMHTMLInputElement::value):
     19        (DOMHTMLInputElement::setValue):
     20        (DOMHTMLInputElement::setValueForUser):
     21        (DOMHTMLInputElement::select):
     22        (DOMHTMLInputElement::setSelectionStart):
     23        (DOMHTMLInputElement::selectionStart):
     24        (DOMHTMLInputElement::setSelectionEnd):
     25        (DOMHTMLInputElement::selectionEnd):
     26        (DOMHTMLInputElement::isTextField):
     27        (DOMHTMLInputElement::rectOnScreen):
     28        (DOMHTMLInputElement::replaceCharactersInRange):
     29        (DOMHTMLInputElement::selectedRange):
     30        (DOMHTMLInputElement::setAutofilled):
     31        (DOMHTMLInputElement::isAutofilled):
     32        (DOMHTMLInputElement::isUserEdited):
     33        * WebFrame.cpp:
     34        (inputElementFromDOMElement):
     35
    1362013-06-27  Anders Carlsson  <andersca@apple.com>
    237
  • trunk/Source/WebKit/win/DOMCoreClasses.cpp

    r151949 r152149  
    15011501        DOMHTMLIFrameElement* newElement = new DOMHTMLIFrameElement(e);
    15021502        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    1503     } else if (e->hasTagName(inputTag)) {
     1503    } else if (isHTMLInputElement(e)) {
    15041504        DOMHTMLInputElement* newElement = new DOMHTMLInputElement(e);
    15051505        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
  • trunk/Source/WebKit/win/DOMHTMLClasses.cpp

    r151949 r152149  
    996996        return E_POINTER;
    997997    *result = 0;
    998     ASSERT(m_element && m_element->hasTagName(inputTag));
    999     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     998    ASSERT(m_element && isHTMLInputElement(m_element));
     999    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    10001000    COMPtr<IDOMElement> domElement;
    10011001    domElement.adoptRef(DOMHTMLElement::createInstance(inputElement->form()));
     
    10781078        /* [retval][out] */ BOOL* result)
    10791079{
    1080     ASSERT(m_element && m_element->hasTagName(inputTag));
    1081     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1080    ASSERT(m_element && isHTMLInputElement(m_element));
     1081    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    10821082    *result = inputElement->isDisabledFormControl() ? TRUE : FALSE;
    10831083    return S_OK;
     
    11221122        /* [retval][out] */ BOOL* result)
    11231123{
    1124     ASSERT(m_element && m_element->hasTagName(inputTag));
    1125     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1124    ASSERT(m_element && isHTMLInputElement(m_element));
     1125    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    11261126    *result = inputElement->isReadOnly() ? TRUE : FALSE;
    11271127    return S_OK;
     
    11871187        /* [in] */ BSTR type)
    11881188{
    1189     ASSERT(m_element && m_element->hasTagName(inputTag));
    1190     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1189    ASSERT(m_element && isHTMLInputElement(m_element));
     1190    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    11911191    WTF::String typeString(type, SysStringLen(type));
    11921192    inputElement->setType(typeString);
     
    12111211        /* [retval][out] */ BSTR* result)
    12121212{
    1213     ASSERT(m_element && m_element->hasTagName(inputTag));
    1214     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1213    ASSERT(m_element && isHTMLInputElement(m_element));
     1214    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12151215    WTF::String valueString = inputElement->value();
    12161216    *result = BString(valueString.characters(), valueString.length()).release();
     
    12231223        /* [in] */ BSTR value)
    12241224{
    1225     ASSERT(m_element && m_element->hasTagName(inputTag));
    1226     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1225    ASSERT(m_element && isHTMLInputElement(m_element));
     1226    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12271227    inputElement->setValue(String((UChar*) value, SysStringLen(value)));
    12281228    return S_OK;
     
    12331233{
    12341234    ASSERT(m_element);
    1235     ASSERT(m_element->hasTagName(inputTag));
    1236     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1235    ASSERT(isHTMLInputElement(m_element));
     1236    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12371237    inputElement->setValueForUser(String(static_cast<UChar*>(value), SysStringLen(value)));
    12381238    return S_OK;
     
    12411241HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::select( void)
    12421242{
    1243     ASSERT(m_element && m_element->hasTagName(inputTag));
    1244     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1243    ASSERT(m_element && isHTMLInputElement(m_element));
     1244    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12451245    inputElement->select();
    12461246    return S_OK;
     
    12561256    /* [in] */ long start)
    12571257{
    1258     ASSERT(m_element && m_element->hasTagName(inputTag));
    1259     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1258    ASSERT(m_element && isHTMLInputElement(m_element));
     1259    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12601260    inputElement->setSelectionStart(start);
    12611261    return S_OK;
     
    12651265    /* [retval][out] */ long *start)
    12661266{
    1267     ASSERT(m_element && m_element->hasTagName(inputTag));
    1268     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1267    ASSERT(m_element && isHTMLInputElement(m_element));
     1268    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12691269    *start = inputElement->selectionStart();
    12701270    return S_OK;
     
    12741274    /* [in] */ long end)
    12751275{
    1276     ASSERT(m_element && m_element->hasTagName(inputTag));
    1277     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1276    ASSERT(m_element && isHTMLInputElement(m_element));
     1277    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12781278    inputElement->setSelectionEnd(end);
    12791279    return S_OK;
     
    12831283    /* [retval][out] */ long *end)
    12841284{
    1285     ASSERT(m_element && m_element->hasTagName(inputTag));
    1286     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1285    ASSERT(m_element && isHTMLInputElement(m_element));
     1286    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12871287    *end = inputElement->selectionEnd();
    12881288    return S_OK;
     
    12951295{
    12961296    ASSERT(m_element);
    1297     ASSERT(m_element->hasTagName(inputTag));
    1298     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1297    ASSERT(isHTMLInputElement(m_element));
     1298    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    12991299    *result = inputElement->isTextField() ? TRUE : FALSE;
    13001300    return S_OK;
     
    13051305{
    13061306    ASSERT(m_element);
    1307     ASSERT(m_element->hasTagName(inputTag));
     1307    ASSERT(isHTMLInputElement(m_element));
    13081308    rect->left = rect->top = rect->right = rect->bottom = 0;
    13091309    RenderObject* renderer = m_element->renderer();
     
    13311331
    13321332    ASSERT(m_element);
    1333     ASSERT(m_element->hasTagName(inputTag));
    1334     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1333    ASSERT(isHTMLInputElement(m_element));
     1334    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    13351335
    13361336    String newValue = inputElement->value();
     
    13481348{
    13491349    ASSERT(m_element);
    1350     ASSERT(m_element->hasTagName(inputTag));
    1351     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1350    ASSERT(isHTMLInputElement(m_element));
     1351    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    13521352    *start = inputElement->selectionStart();
    13531353    *end = inputElement->selectionEnd();
     
    13591359{
    13601360    ASSERT(m_element);
    1361     ASSERT(m_element->hasTagName(inputTag));
    1362     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1361    ASSERT(isHTMLInputElement(m_element));
     1362    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    13631363    inputElement->setAutofilled(!!filled);
    13641364    return S_OK;
     
    13691369{
    13701370    ASSERT(m_element);
    1371     ASSERT(m_element->hasTagName(inputTag));
    1372     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
     1371    ASSERT(isHTMLInputElement(m_element));
     1372    HTMLInputElement* inputElement = toHTMLInputElement(m_element);
    13731373    *result = inputElement->isAutofilled() ? TRUE : FALSE;
    13741374    return S_OK;
     
    13841384
    13851385    *result = FALSE;
    1386     ASSERT(m_element && m_element->hasTagName(inputTag));
     1386    ASSERT(m_element && isHTMLInputElement(m_element));
    13871387    BOOL textField = FALSE;
    13881388    if (FAILED(isTextField(&textField)) || !textField)
    13891389        return S_OK;
    1390     if (static_cast<HTMLInputElement*>(m_element)->lastChangeWasUserEdit())
     1390    if (toHTMLInputElement(m_element)->lastChangeWasUserEdit())
    13911391        *result = TRUE;
    13921392    return S_OK;
  • trunk/Source/WebKit/win/WebFrame.cpp

    r151949 r152149  
    222222        hr = elePriv->coreElement((void**)&ele);
    223223        elePriv->Release();
    224         if (SUCCEEDED(hr) && ele && ele->hasTagName(inputTag))
    225             return static_cast<HTMLInputElement*>(ele);
     224        if (SUCCEEDED(hr) && ele && isHTMLInputElement(ele))
     225            return toHTMLInputElement(ele);
    226226    }
    227227    return 0;
  • trunk/Source/WebKit2/ChangeLog

    r152147 r152149  
     12013-06-27  Kangil Han  <kangil.han@samsung.com>
     2
     3        Adopt is/toHTMLInputElement for code cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=118130
     5
     6        Reviewed by Antti Koivisto.
     7
     8        To enhance readability, this patch adopts is/toHTMLInputElement.
     9        This also helps out to reduce duplicated use of static_cast.
     10
     11        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
     12        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser):
     13        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled):
     14        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled):
     15        (WebKit::InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit):
     16        * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
     17        (WebKit::PDFPluginTextAnnotation::createAnnotationElement):
     18        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     19        (WebKit::WebChromeClient::focusedNodeChanged):
     20        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
     21        (WebKit::WebEditorClient::textFieldDidBeginEditing):
     22        (WebKit::WebEditorClient::textFieldDidEndEditing):
     23        (WebKit::WebEditorClient::textDidChangeInTextField):
     24        (WebKit::WebEditorClient::doTextFieldCommandFromEvent):
     25        (WebKit::WebEditorClient::textWillBeDeletedInTextField):
     26        * WebProcess/WebPage/WebFrame.cpp:
     27        (WebKit::WebFrame::containsAnyFormControls):
     28        * WebProcess/WebPage/WebPage.cpp:
     29        (WebKit::WebPage::editorState):
     30
    1312013-06-27  Eunmi Lee  <eunmi15.lee@samsung.com>
    232
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp

    r150282 r152149  
    181181void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& value)
    182182{
    183     if (!m_node->hasTagName(inputTag))
     183    if (!isHTMLInputElement(m_node.get()))
    184184        return;
    185185
    186     static_cast<HTMLInputElement*>(m_node.get())->setValueForUser(value);
     186    toHTMLInputElement(m_node.get())->setValueForUser(value);
    187187}
    188188
    189189bool InjectedBundleNodeHandle::isHTMLInputElementAutofilled() const
    190190{
    191     if (!m_node->hasTagName(inputTag))
     191    if (!isHTMLInputElement(m_node.get()))
    192192        return false;
    193193   
    194     return static_cast<HTMLInputElement*>(m_node.get())->isAutofilled();
     194    return toHTMLInputElement(m_node.get())->isAutofilled();
    195195}
    196196
    197197void InjectedBundleNodeHandle::setHTMLInputElementAutofilled(bool filled)
    198198{
    199     if (!m_node->hasTagName(inputTag))
     199    if (!isHTMLInputElement(m_node.get()))
    200200        return;
    201201
    202     static_cast<HTMLInputElement*>(m_node.get())->setAutofilled(filled);
     202    toHTMLInputElement(m_node.get())->setAutofilled(filled);
    203203}
    204204
    205205bool InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit()
    206206{
    207     if (!m_node->hasTagName(inputTag))
     207    if (!isHTMLInputElement(m_node.get()))
    208208        return false;
    209209
    210     return static_cast<HTMLInputElement*>(m_node.get())->lastChangeWasUserEdit();
     210    return toHTMLInputElement(m_node.get())->lastChangeWasUserEdit();
    211211}
    212212
  • trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm

    r148912 r152149  
    108108        static_cast<HTMLTextAreaElement*>(styledElement)->setValue(textAnnotation.stringValue);
    109109    else
    110         static_cast<HTMLInputElement*>(styledElement)->setValue(textAnnotation.stringValue);
     110        toHTMLInputElement(styledElement)->setValue(textAnnotation.stringValue);
    111111
    112112    return element;
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r151530 r152149  
    165165    if (!node)
    166166        return;
    167     if (!node->hasTagName(inputTag))
     167    if (!isHTMLInputElement(node))
    168168        return;
    169169
    170     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(node);
     170    HTMLInputElement* inputElement = toHTMLInputElement(node);
    171171    if (!inputElement->isText())
    172172        return;
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r150289 r152149  
    317317void WebEditorClient::textFieldDidBeginEditing(Element* element)
    318318{
    319     if (!element->hasTagName(inputTag))
     319    if (!isHTMLInputElement(element))
    320320        return;
    321321
     
    324324    ASSERT(webFrame);
    325325
    326     m_page->injectedBundleFormClient().textFieldDidBeginEditing(m_page, static_cast<HTMLInputElement*>(element), webFrame);
     326    m_page->injectedBundleFormClient().textFieldDidBeginEditing(m_page, toHTMLInputElement(element), webFrame);
    327327}
    328328
    329329void WebEditorClient::textFieldDidEndEditing(Element* element)
    330330{
    331     if (!element->hasTagName(inputTag))
     331    if (!isHTMLInputElement(element))
    332332        return;
    333333
     
    336336    ASSERT(webFrame);
    337337
    338     m_page->injectedBundleFormClient().textFieldDidEndEditing(m_page, static_cast<HTMLInputElement*>(element), webFrame);
     338    m_page->injectedBundleFormClient().textFieldDidEndEditing(m_page, toHTMLInputElement(element), webFrame);
    339339}
    340340
    341341void WebEditorClient::textDidChangeInTextField(Element* element)
    342342{
    343     if (!element->hasTagName(inputTag))
     343    if (!isHTMLInputElement(element))
    344344        return;
    345345
     
    351351    ASSERT(webFrame);
    352352
    353     m_page->injectedBundleFormClient().textDidChangeInTextField(m_page, static_cast<HTMLInputElement*>(element), webFrame);
     353    m_page->injectedBundleFormClient().textDidChangeInTextField(m_page, toHTMLInputElement(element), webFrame);
    354354}
    355355
     
    390390bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event)
    391391{
    392     if (!element->hasTagName(inputTag))
     392    if (!isHTMLInputElement(element))
    393393        return false;
    394394
     
    401401    ASSERT(webFrame);
    402402
    403     return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), actionType, webFrame);
     403    return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, toHTMLInputElement(element), actionType, webFrame);
    404404}
    405405
    406406void WebEditorClient::textWillBeDeletedInTextField(Element* element)
    407407{
    408     if (!element->hasTagName(inputTag))
     408    if (!isHTMLInputElement(element))
    409409        return;
    410410
     
    413413    ASSERT(webFrame);
    414414
    415     m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), WKInputFieldActionTypeInsertDelete, webFrame);
     415    m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, toHTMLInputElement(element), WKInputFieldActionTypeInsertDelete, webFrame);
    416416}
    417417
  • trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

    r151949 r152149  
    5151#include <WebCore/HTMLFormElement.h>
    5252#include <WebCore/HTMLFrameOwnerElement.h>
     53#include <WebCore/HTMLInputElement.h>
    5354#include <WebCore/HTMLNames.h>
    5455#include <WebCore/JSCSSStyleDeclaration.h>
     
    617618        if (!node->isElementNode())
    618619            continue;
    619         if (toElement(node)->hasTagName(HTMLNames::inputTag) || toElement(node)->hasTagName(HTMLNames::selectTag) || toElement(node)->hasTagName(HTMLNames::textareaTag))
     620        if (isHTMLInputElement(node) || toElement(node)->hasTagName(HTMLNames::selectTag) || toElement(node)->hasTagName(HTMLNames::textareaTag))
    620621            return true;
    621622    }
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r151926 r152149  
    613613        return result;
    614614
    615     if (scope->hasTagName(HTMLNames::inputTag)) {
    616         HTMLInputElement* input = static_cast<HTMLInputElement*>(scope);
     615    if (isHTMLInputElement(scope)) {
     616        HTMLInputElement* input = toHTMLInputElement(scope);
    617617        if (input->isTelephoneField())
    618618            result.inputMethodHints |= Qt::ImhDialableCharactersOnly;
Note: See TracChangeset for help on using the changeset viewer.