Changeset 94142 in webkit


Ignore:
Timestamp:
Aug 30, 2011 6:20:24 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

Get rid of toInputElement()
https://bugs.webkit.org/show_bug.cgi?id=67175

Reviewed by Darin Adler.

Source/WebCore:

Got rid of Node::toInputElement and HTMLInputElement::toInputElement and replaced them by
a global toHTMLInputElement.

  • WebCore.order:
  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::textMarkerDataForVisiblePosition):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::isPasswordField):
(WebCore::AccessibilityRenderObject::isIndeterminate):
(WebCore::AccessibilityRenderObject::isNativeCheckboxOrRadio):
(WebCore::AccessibilityRenderObject::isChecked):

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::canShareStyleWithControl):
(WebCore::CSSStyleSelector::adjustRenderStyle):
(WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):
(WebCore::CSSStyleSelector::applyProperty):

  • dom/CheckedRadioButtons.cpp:

(WebCore::CheckedRadioButtons::addButton):
(WebCore::CheckedRadioButtons::removeButton):

  • dom/Node.cpp:
  • dom/Node.h:
  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::isInPasswordField):

  • html/HTMLInputElement.h:

(WebCore::toHTMLInputElement):

  • html/shadow/SliderThumbElement.cpp:

(WebCore::sliderThumbElementOf):
(WebCore::RenderSliderThumb::layout):
(WebCore::RenderSliderContainer::layout):
(WebCore::SliderThumbElement::hostInput):
(WebCore::trackLimiterElementOf):

  • html/shadow/TextControlInnerElements.cpp:

(WebCore::SearchFieldResultsButtonElement::shadowPseudoId):
(WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
(WebCore::SearchFieldCancelButtonElement::defaultEventHandler):
(WebCore::SpinButtonElement::defaultEventHandler):
(WebCore::SpinButtonElement::repeatingTimerFired):
(WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
(WebCore::InputFieldSpeechButtonElement::setRecognitionResult):

  • page/DragController.cpp:

(WebCore::asFileInput):

  • platform/efl/RenderThemeEfl.cpp:

(WebCore::RenderThemeEfl::paintThemePart):

  • rendering/RenderTextControlSingleLine.cpp:

(WebCore::RenderTextControlSingleLine::RenderTextControlSingleLine):
(WebCore::RenderTextControlSingleLine::inputElement):

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::isChecked):
(WebCore::RenderTheme::isIndeterminate):

Source/WebKit/chromium:

  • src/WebInputElement.cpp:

(WebKit::toWebInputElement):

Source/WebKit/qt:

  • WebCoreSupport/DumpRenderTreeSupportQt.cpp:

(DumpRenderTreeSupportQt::setAutofilled):
(DumpRenderTreeSupportQt::setValueForUser):
(DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId):

Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r94138 r94142  
     12011-08-30  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Get rid of toInputElement()
     4        https://bugs.webkit.org/show_bug.cgi?id=67175
     5
     6        Reviewed by Darin Adler.
     7
     8        Got rid of Node::toInputElement and HTMLInputElement::toInputElement and replaced them by
     9        a global toHTMLInputElement.
     10
     11        * WebCore.order:
     12        * accessibility/AXObjectCache.cpp:
     13        (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
     14        * accessibility/AccessibilityRenderObject.cpp:
     15        (WebCore::AccessibilityRenderObject::isPasswordField):
     16        (WebCore::AccessibilityRenderObject::isIndeterminate):
     17        (WebCore::AccessibilityRenderObject::isNativeCheckboxOrRadio):
     18        (WebCore::AccessibilityRenderObject::isChecked):
     19        * css/CSSStyleSelector.cpp:
     20        (WebCore::CSSStyleSelector::canShareStyleWithControl):
     21        (WebCore::CSSStyleSelector::adjustRenderStyle):
     22        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):
     23        (WebCore::CSSStyleSelector::applyProperty):
     24        * dom/CheckedRadioButtons.cpp:
     25        (WebCore::CheckedRadioButtons::addButton):
     26        (WebCore::CheckedRadioButtons::removeButton):
     27        * dom/Node.cpp:
     28        * dom/Node.h:
     29        * editing/FrameSelection.cpp:
     30        (WebCore::FrameSelection::isInPasswordField):
     31        * html/HTMLInputElement.h:
     32        (WebCore::toHTMLInputElement):
     33        * html/shadow/SliderThumbElement.cpp:
     34        (WebCore::sliderThumbElementOf):
     35        (WebCore::RenderSliderThumb::layout):
     36        (WebCore::RenderSliderContainer::layout):
     37        (WebCore::SliderThumbElement::hostInput):
     38        (WebCore::trackLimiterElementOf):
     39        * html/shadow/TextControlInnerElements.cpp:
     40        (WebCore::SearchFieldResultsButtonElement::shadowPseudoId):
     41        (WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
     42        (WebCore::SearchFieldCancelButtonElement::defaultEventHandler):
     43        (WebCore::SpinButtonElement::defaultEventHandler):
     44        (WebCore::SpinButtonElement::repeatingTimerFired):
     45        (WebCore::InputFieldSpeechButtonElement::defaultEventHandler):
     46        (WebCore::InputFieldSpeechButtonElement::setRecognitionResult):
     47        * page/DragController.cpp:
     48        (WebCore::asFileInput):
     49        * platform/efl/RenderThemeEfl.cpp:
     50        (WebCore::RenderThemeEfl::paintThemePart):
     51        * rendering/RenderTextControlSingleLine.cpp:
     52        (WebCore::RenderTextControlSingleLine::RenderTextControlSingleLine):
     53        (WebCore::RenderTextControlSingleLine::inputElement):
     54        * rendering/RenderTheme.cpp:
     55        (WebCore::RenderTheme::isChecked):
     56        (WebCore::RenderTheme::isIndeterminate):
     57
    1582011-08-30  Ryosuke Niwa  <rniwa@webkit.org>
    259
  • trunk/Source/WebCore/WebCore.order

    r92284 r94142  
    32243224__ZN7WebCore11CSSSelector8pseudoIdENS0_10PseudoTypeE
    32253225__ZNK7WebCore22HTMLFormControlElement20isFormControlElementEv
    3226 __ZN7WebCore16HTMLInputElement14toInputElementEv
    32273226__ZNK7WebCore22HTMLFormControlElement20isEnabledFormControlEv
    32283227__ZNK7WebCore22HTMLFormControlElement8disabledEv
     
    42434242__ZN3WTF9HashTableINS_6StringESt4pairIS1_N7WebCore17AccessibilityRoleEENS_18PairFirstExtractorIS5_EENS_15CaseFoldingHashENS_14PairHashTraitsINS_10HashTraitsIS1_EENSA_IS4_EEEESB_E6lookupIS1_NS_22IdentityHashTranslatorIS1_S5_S8_EEEEPS5_RKT_
    42444243__ZN3WTF9HashTableINS_6StringESt4pairIS1_N7WebCore17AccessibilityRoleEENS_18PairFirstExtractorIS5_EENS_15CaseFoldingHashENS_14PairHashTraitsINS_10HashTraitsIS1_EENSA_IS4_EEEESB_E6rehashEi
    4245 __ZN7WebCore4Node14toInputElementEv
    42464244__ZNK7WebCore13RootInlineBox19lineBreakBidiStatusEv
    42474245__ZNK7WebCore13InlineFlowBox13lastLeafChildEv
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r89609 r94142  
    616616        return;
    617617   
    618     if (domNode->isHTMLElement()) {
    619         HTMLInputElement* inputElement = domNode->toInputElement();
    620         if (inputElement && inputElement->isPasswordField())
    621             return;
    622     }
     618    if (domNode->isHTMLElement() && domNode->hasTagName(inputTag) && toHTMLInputElement(domNode)->isPasswordField())
     619        return;
    623620   
    624621    // locate the renderer, which must exist for a visible dom node
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r94134 r94142  
    495495{
    496496    ASSERT(m_renderer);
    497     if (!m_renderer->node() || !m_renderer->node()->isHTMLElement())
     497    if (!m_renderer->node() || !m_renderer->node()->hasTagName(inputTag))
    498498        return false;
    499499    if (ariaRoleAttribute() != UnknownRole)
    500500        return false;
    501501
    502     HTMLInputElement* inputElement = m_renderer->node()->toInputElement();
    503     if (!inputElement)
    504         return false;
    505 
    506     return inputElement->isPasswordField();
     502    return toHTMLInputElement(m_renderer->node())->isPasswordField();
    507503}
    508504   
     
    590586{
    591587    ASSERT(m_renderer);
    592     if (!m_renderer->node())
    593         return false;
    594 
    595     HTMLInputElement* inputElement = m_renderer->node()->toInputElement();
    596     if (!inputElement)
    597         return false;
    598 
    599     return inputElement->isIndeterminate();
     588    if (!m_renderer->node() || !m_renderer->node()->hasTagName(inputTag))
     589        return false;
     590
     591    return toHTMLInputElement(m_renderer->node())->isIndeterminate();
    600592}
    601593
    602594bool AccessibilityRenderObject::isNativeCheckboxOrRadio() const
    603595{
    604     Node* elementNode = node();
    605     if (elementNode) {
    606         HTMLInputElement* input = elementNode->toInputElement();
    607         if (input)
    608             return input->isCheckbox() || input->isRadioButton();
    609     }
    610    
    611     return false;
     596    ASSERT(m_renderer);
     597    if (!m_renderer->node() || !m_renderer->node()->hasTagName(inputTag))
     598        return false;
     599
     600    HTMLInputElement* input = toHTMLInputElement(m_renderer->node());
     601    return input->isCheckbox() || input->isRadioButton();
    612602}
    613603   
     
    619609
    620610    // First test for native checkedness semantics
    621     HTMLInputElement* inputElement = m_renderer->node()->toInputElement();
    622     if (inputElement)
    623         return inputElement->shouldAppearChecked();
     611    if (m_renderer->node()->hasTagName(inputTag))
     612        return toHTMLInputElement(m_renderer->node())->shouldAppearChecked();
    624613
    625614    // Else, if this is an ARIA checkbox or radio, respect the aria-checked attribute
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r94104 r94142  
    960960    }
    961961#endif
    962    
    963     HTMLInputElement* thisInputElement = element->toInputElement();
    964     HTMLInputElement* otherInputElement = m_element->toInputElement();
    965    
    966     if (!thisInputElement || !otherInputElement)
     962
     963    ASSERT(element);
     964    ASSERT(m_element);
     965    if (!element->hasTagName(inputTag) || !m_element->hasTagName(inputTag))
    967966        return false;
     967   
     968    HTMLInputElement* thisInputElement = toHTMLInputElement(element);
     969    HTMLInputElement* otherInputElement = toHTMLInputElement(m_element);
    968970   
    969971    if (thisInputElement->isAutofilled() != otherInputElement->isAutofilled())
     
    18941896        // Don't apply intrinsic margins to image buttons.  The designer knows how big the images are,
    18951897        // so we have to treat all image buttons as though they were explicitly sized.
    1896         if (!e->hasTagName(inputTag) || !static_cast<HTMLInputElement*>(e)->isImageButton())
     1898        if (!e->hasTagName(inputTag) || !toHTMLInputElement(e)->isImageButton())
    18971899            addIntrinsicMargins(style);
    18981900    }
     
    27582760                break;
    27592761            case CSSSelector::PseudoAutofill: {
    2760                 if (!e || !e->isFormControlElement())
     2762                if (!e || !e->isFormControlElement() || !e->hasTagName(inputTag))
    27612763                    break;
    2762                 if (HTMLInputElement* inputElement = e->toInputElement())
    2763                     return inputElement->isAutofilled();
     2764                return toHTMLInputElement(e)->isAutofilled();
    27642765                break;
    27652766            }
     
    28482849                return (e->willValidate() && !e->isValidFormControlElement()) || e->hasUnacceptableValue();
    28492850            } case CSSSelector::PseudoChecked: {
    2850                 if (!e || !e->isFormControlElement())
     2851                if (!e || !e->isFormControlElement() || !e->hasTagName(inputTag))
    28512852                    break;
    28522853                // Even though WinIE allows checked and indeterminate to co-exist, the CSS selector spec says that
    28532854                // you can't be both checked and indeterminate.  We will behave like WinIE behind the scenes and just
    28542855                // obey the CSS spec here in the test for matching the pseudo.
    2855                 HTMLInputElement* inputElement = e->toInputElement();
    2856                 if (inputElement && inputElement->shouldAppearChecked() && !inputElement->isIndeterminate())
     2856                HTMLInputElement* inputElement = toHTMLInputElement(e);
     2857                if (inputElement->shouldAppearChecked() && !inputElement->isIndeterminate())
    28572858                    return true;
    28582859                break;
     
    28612862                if (!e || !e->isFormControlElement())
    28622863                    break;
    2863                
     2864
    28642865#if ENABLE(PROGRESS_TAG)
    28652866                if (e->hasTagName(progressTag)) {
     
    28702871                }
    28712872#endif
    2872                
    2873                 HTMLInputElement* inputElement = e->toInputElement();
    2874                 if (inputElement && inputElement->isIndeterminate())
     2873
     2874                if (e->hasTagName(inputTag) && toHTMLInputElement(e)->isIndeterminate())
    28752875                    return true;
    28762876                break;
     
    48454845        if (primitiveValue && m_element->hasTagName(WebCore::inputTag)) {
    48464846            String mask = primitiveValue->getStringValue();
    4847             static_cast<HTMLInputElement*>(m_element)->setWapInputFormat(mask);
     4847            toHTMLInputElement(m_element)->setWapInputFormat(mask);
    48484848        }
    48494849        return;
  • trunk/Source/WebCore/dom/CheckedRadioButtons.cpp

    r91049 r94142  
    3636        return;
    3737
    38     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element);
     38    HTMLInputElement* inputElement = toHTMLInputElement(element);
    3939
    4040    // We only track checked buttons.
     
    7878        return;
    7979   
    80     HTMLInputElement* inputElement = element->toInputElement();
     80    HTMLInputElement* inputElement = toHTMLInputElement(element);
    8181    ASSERT_UNUSED(inputElement, inputElement);
    8282    ASSERT(inputElement->shouldAppearChecked());
  • trunk/Source/WebCore/dom/Node.cpp

    r94089 r94142  
    578578}
    579579
    580 HTMLInputElement* Node::toInputElement()
    581 {
    582     // If one of the below ASSERTs trigger, you are calling this function
    583     // directly or indirectly from a constructor or destructor of this object.
    584     // Don't do this!
    585     ASSERT(!(isHTMLElement() && hasTagName(inputTag)));
    586     return 0;
    587 }
    588 
    589580short Node::tabIndex() const
    590581{
  • trunk/Source/WebCore/dom/Node.h

    r93481 r94142  
    534534    virtual Node* toNode() { return this; }
    535535
    536     virtual HTMLInputElement* toInputElement();
    537 
    538536    virtual ScriptExecutionContext* scriptExecutionContext() const;
    539537
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r93531 r94142  
    15231523{
    15241524    HTMLTextFormControlElement* textControl = enclosingTextFormControl(start());
    1525     return textControl && textControl->hasTagName(inputTag) && static_cast<HTMLInputElement*>(textControl)->isPasswordField();
     1525    return textControl && textControl->hasTagName(inputTag) && toHTMLInputElement(textControl)->isPasswordField();
    15261526}
    15271527
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r94047 r94142  
    2525#define HTMLInputElement_h
    2626
     27#include "HTMLNames.h"
    2728#include "HTMLTextFormControlElement.h"
    2829
     
    4243
    4344    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitspeechchange);
    44 
    45     virtual HTMLInputElement* toInputElement() { return this; }
    4645
    4746    virtual bool shouldAutocomplete() const;
     
    358357};
    359358
     359inline HTMLInputElement* toHTMLInputElement(Node* node)
     360{
     361    ASSERT(!node || node->hasTagName(HTMLNames::inputTag));
     362    return static_cast<HTMLInputElement*>(node);
     363}
     364
    360365} //namespace
    361366
  • trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp

    r93279 r94142  
    3838#include "Frame.h"
    3939#include "HTMLInputElement.h"
     40#include "HTMLNames.h"
    4041#include "HTMLParserIdioms.h"
    4142#include "MouseEvent.h"
     
    6768{
    6869    ASSERT(node);
    69     ShadowRoot* shadow = node->toInputElement()->shadowRoot();
     70    ASSERT(node->hasTagName(HTMLNames::inputTag));
     71    ShadowRoot* shadow = toHTMLInputElement(node)->shadowRoot();
    7072    ASSERT(shadow);
    7173    Node* thumb = shadow->firstChild()->firstChild()->firstChild();
     
    104106    // Do not cast node() to SliderThumbElement. This renderer is used for
    105107    // TrackLimitElement too.
    106     HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement();
     108    ASSERT(node()->shadowAncestorNode()->hasTagName(HTMLNames::inputTag));
     109    HTMLInputElement* input = toHTMLInputElement(node()->shadowAncestorNode());
    107110    bool isVertical = style()->appearance() == SliderThumbVerticalPart || style()->appearance() == MediaVolumeSliderThumbPart;
    108111
     
    133136void RenderSliderContainer::layout()
    134137{
    135     HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement();
     138    ASSERT(node()->shadowAncestorNode()->hasTagName(HTMLNames::inputTag));
     139    HTMLInputElement* input = toHTMLInputElement(node()->shadowAncestorNode());
    136140    bool isVertical = hasVerticalAppearance(input);
    137141    style()->setBoxOrient(isVertical ? VERTICAL : HORIZONTAL);
     
    314318    // Only HTMLInputElement creates SliderThumbElement instances as its shadow nodes.
    315319    // So, shadowAncestorNode() must be an HTMLInputElement.
    316     return shadowAncestorNode()->toInputElement();
     320    ASSERT(shadowAncestorNode()->hasTagName(HTMLNames::inputTag));
     321    return toHTMLInputElement(shadowAncestorNode());
    317322}
    318323
     
    352357{
    353358    ASSERT(node);
    354     ShadowRoot* shadow = node->toInputElement()->shadowRoot();
     359    ASSERT(node->hasTagName(HTMLNames::inputTag));
     360    ShadowRoot* shadow = toHTMLInputElement(node)->shadowRoot();
    355361    ASSERT(shadow);
    356362    Node* limiter = shadow->firstChild()->lastChild();
  • trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp

    r91988 r94142  
    129129    DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration"));
    130130    Node* host = shadowAncestorNode();
    131     if (!host)
     131    if (!host || !host->hasTagName(inputTag))
    132132        return resultsId;
    133     if (HTMLInputElement* input = host->toInputElement()) {
    134         if (input->maxResults() < 0)
    135             return decorationId;
    136         if (input->maxResults() > 0)
    137             return resultsId;
    138         return resultsDecorationId;
    139     }
    140     return resultsId;
     133
     134    int maxResults = toHTMLInputElement(host)->maxResults();
     135    if (maxResults < 0)
     136        return decorationId;
     137    if (maxResults > 0)
     138        return resultsId;
     139    return resultsDecorationId;
    141140}
    142141
     
    144143{
    145144    // On mousedown, bring up a menu, if needed
    146     HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
     145    HTMLInputElement* input = toHTMLInputElement(shadowAncestorNode());
    147146    if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
    148147        input->focus();
     
    192191{
    193192    // If the element is visible, on mouseup, clear the value, and set selection
    194     RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowAncestorNode()));
     193    RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowAncestorNode()));
    195194    if (input->disabled() || input->isReadOnlyFormControl()) {
    196195        if (!event->defaultHandled())
     
    272271    }
    273272
    274     RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowAncestorNode()));
     273    RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowAncestorNode()));
    275274    if (input->disabled() || input->isReadOnlyFormControl()) {
    276275        if (!event->defaultHandled())
     
    343342void SpinButtonElement::repeatingTimerFired(Timer<SpinButtonElement>*)
    344343{
    345     HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
     344    HTMLInputElement* input = toHTMLInputElement(shadowAncestorNode());
    346345    if (input->disabled() || input->isReadOnlyFormControl())
    347346        return;
     
    402401    // remove the input element from DOM. To make sure it remains valid until we finish our work
    403402    // here, we take a temporary reference.
    404     RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowAncestorNode()));
     403    RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowAncestorNode()));
    405404
    406405    if (input->disabled() || input->isReadOnlyFormControl()) {
     
    487486    // remove the input element from DOM. To make sure it remains valid until we finish our work
    488487    // here, we take a temporary reference.
    489     RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowAncestorNode()));
     488    RefPtr<HTMLInputElement> input(toHTMLInputElement(shadowAncestorNode()));
    490489    if (input->disabled() || input->isReadOnlyFormControl())
    491490        return;
  • trunk/Source/WebCore/page/DragController.cpp

    r91222 r94142  
    255255{
    256256    ASSERT(node);
    257 
    258     HTMLInputElement* inputElement = node->toInputElement();
     257   
     258    if (!node->hasTagName(HTMLNames::inputTag))
     259        return 0;
     260
     261    HTMLInputElement* inputElement = toHTMLInputElement(node);
    259262
    260263    // If this is a button inside of the a file input, move up to the file input.
    261     if (inputElement && inputElement->isTextButton() && inputElement->treeScope()->isShadowRoot())
    262         inputElement = inputElement->treeScope()->shadowHost()->toInputElement();
    263 
    264     return inputElement && inputElement->isFileUpload() ? inputElement : 0;
     264    if (inputElement->isTextButton() && inputElement->treeScope()->isShadowRoot()) {
     265        node = inputElement->treeScope()->shadowHost();
     266        if (!node->hasTagName(HTMLNames::inputTag))
     267            return 0;
     268        inputElement = toHTMLInputElement(node);
     269    }
     270
     271    return inputElement->isFileUpload() ? inputElement : 0;
    265272}
    266273
  • trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp

    r92347 r94142  
    3333#include "GraphicsContext.h"
    3434#include "HTMLInputElement.h"
     35#include "HTMLNames.h"
    3536#include "NotImplemented.h"
    3637#include "Page.h"
     
    311312    if (type == SliderVertical || type == SliderHorizontal) {
    312313        RenderSlider* renderSlider = toRenderSlider(object);
    313         HTMLInputElement* input = renderSlider->node()->toInputElement();
     314        HTMLInputElement* input = renderSlider->node()->hasTagName(HTMLNames::inputTag) ? toHTMLInputElement(renderSlider->node()) : 0;
    314315        Edje_Message_Float_Set* msg;
    315316        double valueRange = input->maximum() - input->minimum();
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r94047 r94142  
    7676{
    7777    ASSERT(node->isHTMLElement());
    78     ASSERT(node->toInputElement());
     78    ASSERT(node->hasTagName(inputTag));
    7979}
    8080
     
    789789HTMLInputElement* RenderTextControlSingleLine::inputElement() const
    790790{
    791     return node()->toInputElement();
    792 }
    793 
    794 }
     791    return toHTMLInputElement(node());
     792}
     793
     794}
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r91049 r94142  
    739739bool RenderTheme::isChecked(const RenderObject* o) const
    740740{
    741     if (!o->node())
    742         return false;
    743 
    744     HTMLInputElement* inputElement = o->node()->toInputElement();
    745     if (!inputElement)
    746         return false;
    747 
    748     return inputElement->shouldAppearChecked();
     741    if (!o->node() || !o->node()->hasTagName(inputTag))
     742        return false;
     743
     744    return toHTMLInputElement(o->node())->shouldAppearChecked();
    749745}
    750746
    751747bool RenderTheme::isIndeterminate(const RenderObject* o) const
    752748{
    753     if (!o->node())
    754         return false;
    755 
    756     HTMLInputElement* inputElement = o->node()->toInputElement();
    757     if (!inputElement)
    758         return false;
    759 
    760     return inputElement->isIndeterminate();
     749    if (!o->node() || !o->node()->hasTagName(inputTag))
     750        return false;
     751
     752    return toHTMLInputElement(o->node())->isIndeterminate();
    761753}
    762754
  • trunk/Source/WebKit/chromium/ChangeLog

    r94133 r94142  
     12011-08-30  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Get rid of toInputElement()
     4        https://bugs.webkit.org/show_bug.cgi?id=67175
     5
     6        Reviewed by Darin Adler.
     7
     8        * src/WebInputElement.cpp:
     9        (WebKit::toWebInputElement):
     10
    1112011-08-30  Nat Duca  <nduca@chromium.org>
    212
  • trunk/Source/WebKit/chromium/src/WebInputElement.cpp

    r91004 r94142  
    174174WebInputElement* toWebInputElement(WebElement* webElement)
    175175{
    176     HTMLInputElement* inputElement = webElement->unwrap<Element>()->toInputElement();
    177     if (!inputElement)
     176    Element* element = webElement->unwrap<Element>();
     177    if (!element->hasTagName(HTMLNames::inputTag))
    178178        return 0;
    179179
  • trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp

    r89682 r94142  
    3838#include "GraphicsContext.h"
    3939#include "HTMLInputElement.h"
     40#include "HTMLNames.h"
    4041#include "JSDOMWindow.h"
    4142#include "JSDocument.h"
     
    756757    JSC::ExecState* exec = toJS(context);
    757758    Element* element = toElement(toJS(exec, nodeObject));
    758     if (!element)
    759         return;
    760     HTMLInputElement* inputElement = element->toInputElement();
    761     if (!inputElement)
    762         return;
    763 
    764     inputElement->setAutofilled(autofilled);
     759    if (!element || !element->hasTagName(HTMLNames::inputTag))
     760        return;
     761
     762    toHTMLInputElement(inputElement)->setAutofilled(autofilled);
    765763}
    766764
     
    769767    JSC::ExecState* exec = toJS(context);
    770768    Element* element = toElement(toJS(exec, nodeObject));
    771     if (!element)
    772         return;
    773     HTMLInputElement* inputElement = element->toInputElement();
    774     if (!inputElement)
     769    if (!element || !element->hasTagName(HTMLNames::inputTag))
    775770        return;
    776771
     
    778773    GOwnPtr<gchar> valueBuffer(static_cast<gchar*>(g_malloc(bufferSize)));
    779774    JSStringGetUTF8CString(value, valueBuffer.get(), bufferSize);
    780     inputElement->setValueForUser(String::fromUTF8(valueBuffer.get()));
     775    toHTMLInputElement(inputElement)->setValueForUser(String::fromUTF8(valueBuffer.get()));
    781776}
    782777
  • trunk/Source/WebKit/qt/ChangeLog

    r94105 r94142  
     12011-08-30  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Get rid of toInputElement()
     4        https://bugs.webkit.org/show_bug.cgi?id=67175
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
     9        (DumpRenderTreeSupportQt::setAutofilled):
     10        (DumpRenderTreeSupportQt::setValueForUser):
     11        (DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId):
     12
    1132011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
    214
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

    r94105 r94142  
    5757#include "HistoryItem.h"
    5858#include "HTMLInputElement.h"
     59#include "HTMLNames.h"
    5960#include "InspectorController.h"
    6061#include "NodeList.h"
     
    233234{
    234235    WebCore::Element* webElement = element.m_element;
    235     if (!webElement)
    236         return;
    237     HTMLInputElement* inputElement = webElement->toInputElement();
    238     if (!inputElement)
    239         return;
    240 
    241     inputElement->setAutofilled(isAutofilled);
     236    if (!webElement || !webElement->hasTagName(HTMLNames::inputTag))
     237        return;
     238
     239    toHTMLInputElement(webElement)->setAutofilled(isAutofilled);
    242240}
    243241
     
    259257{
    260258    WebCore::Element* webElement = element.m_element;
    261     if (!webElement)
    262         return;
    263     HTMLInputElement* inputElement = webElement->toInputElement();
    264     if (!inputElement)
    265         return;
    266 
    267     inputElement->setValueForUser(value);
     259    if (!webElement || !webElement->hasTagName(HTMLNames::inputTag))
     260        return;
     261
     262    toHTMLInputElement(webElement)->setValueForUser(value);
    268263}
    269264
     
    642637        return false;
    643638
    644     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(coreNode);
     639    HTMLInputElement* inputElement = toHTMLInputElement(coreNode);
    645640
    646641    return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete();
Note: See TracChangeset for help on using the changeset viewer.