Use is<HTML*Element>() instead of isHTML*Element() - Part 1
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Sep 2014 21:25:22 +0000 (21:25 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Sep 2014 21:25:22 +0000 (21:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137068

Reviewed by Ryosuke Niwa.

Start using is<HTML*Element>() instead of isHTML*Element().
Remaining usages will be updated in a follow-up patch to
reduce the size of the change.

Source/WebCore:

No new tests, no behavior change.

* accessibility/AccessibilityListBoxOption.cpp:
(WebCore::AccessibilityListBoxOption::isSelected):
(WebCore::AccessibilityListBoxOption::canSetSelectedAttribute):
(WebCore::AccessibilityListBoxOption::stringValue):
(WebCore::AccessibilityListBoxOption::listBoxOptionParentNode):
* accessibility/AccessibilityMediaControls.cpp:
(WebCore::AccessibilityMediaTimeline::valueDescription):
* accessibility/AccessibilityMenuListOption.cpp:
(WebCore::AccessibilityMenuListOption::setElement):
* accessibility/AccessibilityMenuListPopup.cpp:
(WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject):
* 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::isNodeActionElement):
(WebCore::AccessibilityNodeObject::titleElementText):
(WebCore::AccessibilityNodeObject::visibleText):
(WebCore::AccessibilityNodeObject::title):
(WebCore::AccessibilityNodeObject::colorValue):
(WebCore::accessibleNameForNode):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isFileUploadButton):
(WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
(WebCore::AccessibilityRenderObject::setValue):
(WebCore::AccessibilityRenderObject::accessibilityHitTest):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
(WebCore::AccessibilityRenderObject::addTextFieldChildren):
* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::notifyChildrenSelectionChange):
* css/SelectorCheckerTestFunctions.h:
(WebCore::isDisabled):
(WebCore::isEnabled):
(WebCore::isChecked):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchEvent):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::selectAll):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::shouldPerformSmartReplace):
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::isInPasswordField):
* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::_processElement):
* editing/gtk/EditorGtk.cpp:
(WebCore::elementURL):
* editing/ios/EditorIOS.mm:
(WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection):
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::appendText):
(WebCore::isPlainTextMarkup):
(WebCore::collectElementsToRemoveFromFragment):
* html/HTMLCollection.cpp:
(WebCore::isMatchingElement):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::rendererIsNeeded):
* html/HTMLFormControlElement.cpp:
(WebCore::shouldAutofocus):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::getTextFieldValues):
(WebCore::HTMLFormElement::formElementIndex):
* html/HTMLImageLoader.cpp:
(WebCore::HTMLImageLoader::dispatchLoadEvent):
(WebCore::HTMLImageLoader::notifyFinished):
* html/HTMLNameCollection.cpp:
(WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
(WebCore::DocumentNameCollection::elementMatchesIfNameAttributeMatch):
(WebCore::DocumentNameCollection::elementMatches):
* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::recalcSelectOptions):
(WebCore::HTMLOptGroupElement::ownerSelectElement):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::index):
(WebCore::HTMLOptionElement::ownerSelectElement):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::add):
(WebCore::HTMLSelectElement::value):
(WebCore::HTMLSelectElement::setValue):
(WebCore::HTMLSelectElement::childShouldCreateRenderer):
(WebCore::HTMLSelectElement::setLength):
(WebCore::HTMLSelectElement::nextValidIndex):
(WebCore::HTMLSelectElement::saveLastSelection):
(WebCore::HTMLSelectElement::setActiveSelectionAnchorIndex):
(WebCore::HTMLSelectElement::updateListBoxSelection):
(WebCore::HTMLSelectElement::listBoxOnChange):
(WebCore::HTMLSelectElement::recalcListItems):
(WebCore::HTMLSelectElement::selectedIndex):
(WebCore::HTMLSelectElement::selectOption):
(WebCore::HTMLSelectElement::optionToListIndex):
(WebCore::HTMLSelectElement::listToOptionIndex):
(WebCore::HTMLSelectElement::deselectItemsWithoutValidation):
(WebCore::HTMLSelectElement::saveFormControlState):
(WebCore::HTMLSelectElement::searchOptionsForValue):
(WebCore::HTMLSelectElement::restoreFormControlState):
(WebCore::HTMLSelectElement::appendFormData):
(WebCore::HTMLSelectElement::reset):
(WebCore::HTMLSelectElement::updateSelectedState):
(WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
(WebCore::HTMLSelectElement::lastSelectedListIndex):
(WebCore::HTMLSelectElement::optionAtIndex):
(WebCore::HTMLSelectElement::accessKeySetSelectedIndex):
(WebCore::HTMLSelectElement::length):
* html/HTMLTagNames.in:
* html/RadioInputType.cpp:
(WebCore::RadioInputType::handleKeydownEvent):
(WebCore::RadioInputType::isKeyboardFocusable):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::hasImpliedEndTag):
* html/parser/HTMLElementStack.cpp:
(WebCore::HTMLNames::isSelectScopeMarker):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTagForInBody):
(WebCore::HTMLTreeBuilder::processStartTag):
(WebCore::HTMLTreeBuilder::processEndTag):
* html/shadow/MediaControlElementTypes.cpp:
(WebCore::mediaControlElementType):
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::handleFallbackContent):
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::dispatchPendingBeforeLoadEvent):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::requestObject):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* page/Chrome.cpp:
(WebCore::Chrome::setToolTip):
* page/EventHandler.cpp:
(WebCore::isSubmitImage):
(WebCore::EventHandler::handleMousePressEvent):
* page/FocusController.cpp:
(WebCore::clearSelectionIfNeeded):
* page/FrameView.cpp:
(WebCore::FrameView::addEmbeddedObjectToUpdate):
(WebCore::FrameView::updateEmbeddedObject):
* page/PageSerializer.cpp:
(WebCore::frameOwnerURLAttributeName):
* page/SpatialNavigation.cpp:
(WebCore::canScrollInDirection):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::altDisplayString):
(WebCore::HitTestResult::absoluteImageURL):
(WebCore::HitTestResult::absolutePDFURL):
(WebCore::HitTestResult::isContentEditable):
* rendering/RenderBlockFlow.cpp:
(WebCore::resizeTextPermitted):
* 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::uploadButton):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::updateAltText):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::addFocusRingRects):
(WebCore::RenderListBox::paintItemForeground):
(WebCore::RenderListBox::paintItemBackground):
* rendering/RenderMenuList.cpp:
(WebCore::selectedOptionCount):
(RenderMenuList::updateOptionsWidth):
(RenderMenuList::setTextFromOption):
(RenderMenuList::itemText):
(RenderMenuList::itemIsEnabled):
(RenderMenuList::itemIsSelected):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paintSliderTicks):
* testing/Internals.cpp:
(WebCore::Internals::selectColorInColorChooser):
(WebCore::Internals::wasLastChangeUserEdit):
(WebCore::Internals::isSelectPopupVisible):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::startElementNs):

Source/WebKit/ios:

* WebCoreSupport/WebChromeClientIOS.mm:
(WebChromeClientIOS::focusedElementChanged):

Source/WebKit/mac:

* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::focusedElementChanged):
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::textFieldDidBeginEditing):
(WebEditorClient::textFieldDidEndEditing):
(WebEditorClient::textDidChangeInTextField):
(WebEditorClient::doTextFieldCommandFromEvent):
(WebEditorClient::textWillBeDeletedInTextField):
(WebEditorClient::textDidChangeInTextArea):
* WebView/WebHTMLRepresentation.mm:
(inputElementFromDOMElement):

Source/WebKit/win:

* DOMCoreClasses.cpp:
(DOMElement::createInstance):
* DOMHTMLClasses.cpp:
(DOMHTMLOptionElement::text):
(DOMHTMLOptionElement::label):
(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):
(DOMHTMLTextAreaElement::form):
(DOMHTMLTextAreaElement::value):
(DOMHTMLTextAreaElement::setValue):
(DOMHTMLTextAreaElement::select):
(DOMHTMLTextAreaElement::isUserEdited):
* WebFrame.cpp:
(inputElementFromDOMElement):

Source/WebKit2:

* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser):
(WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled):
(WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled):
(WebKit::InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit):
(WebKit::InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit):
(WebKit::InjectedBundleNodeHandle::isTextField):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::focusedElementChanged):
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::textFieldDidBeginEditing):
(WebKit::WebEditorClient::textFieldDidEndEditing):
(WebKit::WebEditorClient::textDidChangeInTextField):
(WebKit::WebEditorClient::textDidChangeInTextArea):
(WebKit::WebEditorClient::doTextFieldCommandFromEvent):
(WebKit::WebEditorClient::textWillBeDeletedInTextField):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::containsAnyFormControls):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setAssistedNodeValue):
(WebKit::WebPage::setAssistedNodeValueAsNumber):
(WebKit::WebPage::setAssistedNodeSelectedIndex):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173932 268f45cc-cd09-0410-ab3c-d52691b4dbfc

72 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityListBoxOption.cpp
Source/WebCore/accessibility/AccessibilityMediaControls.cpp
Source/WebCore/accessibility/AccessibilityMenuListOption.cpp
Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
Source/WebCore/css/SelectorCheckerTestFunctions.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/ReplaceSelectionCommand.cpp
Source/WebCore/editing/VisibleSelection.cpp
Source/WebCore/editing/cocoa/HTMLConverter.mm
Source/WebCore/editing/gtk/EditorGtk.cpp
Source/WebCore/editing/ios/EditorIOS.mm
Source/WebCore/editing/markup.cpp
Source/WebCore/html/HTMLCollection.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLImageLoader.cpp
Source/WebCore/html/HTMLNameCollection.cpp
Source/WebCore/html/HTMLOptGroupElement.cpp
Source/WebCore/html/HTMLOptionElement.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLTagNames.in
Source/WebCore/html/RadioInputType.cpp
Source/WebCore/html/parser/HTMLConstructionSite.cpp
Source/WebCore/html/parser/HTMLElementStack.cpp
Source/WebCore/html/parser/HTMLTreeBuilder.cpp
Source/WebCore/html/shadow/MediaControlElementTypes.cpp
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/ImageLoader.cpp
Source/WebCore/loader/SubframeLoader.cpp
Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
Source/WebCore/page/Chrome.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/FocusController.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/page/SpatialNavigation.cpp
Source/WebCore/rendering/HitTestResult.cpp
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderButton.cpp
Source/WebCore/rendering/RenderDetailsMarker.cpp
Source/WebCore/rendering/RenderFileUploadControl.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/WebCoreSupport/WebChromeClientIOS.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
Source/WebKit/mac/WebView/WebHTMLRepresentation.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/DOMCoreClasses.cpp
Source/WebKit/win/DOMHTMLClasses.cpp
Source/WebKit/win/WebFrame.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index 87dfc46..f0d159a 100644 (file)
@@ -1,3 +1,202 @@
+2014-09-24  Christophe Dumez  <cdumez@apple.com>
+
+        Use is<HTML*Element>() instead of isHTML*Element() - Part 1
+        https://bugs.webkit.org/show_bug.cgi?id=137068
+
+        Reviewed by Ryosuke Niwa.
+
+        Start using is<HTML*Element>() instead of isHTML*Element().
+        Remaining usages will be updated in a follow-up patch to
+        reduce the size of the change.
+
+        No new tests, no behavior change.
+
+        * accessibility/AccessibilityListBoxOption.cpp:
+        (WebCore::AccessibilityListBoxOption::isSelected):
+        (WebCore::AccessibilityListBoxOption::canSetSelectedAttribute):
+        (WebCore::AccessibilityListBoxOption::stringValue):
+        (WebCore::AccessibilityListBoxOption::listBoxOptionParentNode):
+        * accessibility/AccessibilityMediaControls.cpp:
+        (WebCore::AccessibilityMediaTimeline::valueDescription):
+        * accessibility/AccessibilityMenuListOption.cpp:
+        (WebCore::AccessibilityMenuListOption::setElement):
+        * accessibility/AccessibilityMenuListPopup.cpp:
+        (WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject):
+        * 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::isNodeActionElement):
+        (WebCore::AccessibilityNodeObject::titleElementText):
+        (WebCore::AccessibilityNodeObject::visibleText):
+        (WebCore::AccessibilityNodeObject::title):
+        (WebCore::AccessibilityNodeObject::colorValue):
+        (WebCore::accessibleNameForNode):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::isFileUploadButton):
+        (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers):
+        (WebCore::AccessibilityRenderObject::setValue):
+        (WebCore::AccessibilityRenderObject::accessibilityHitTest):
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
+        (WebCore::AccessibilityRenderObject::addTextFieldChildren):
+        * accessibility/atk/AXObjectCacheAtk.cpp:
+        (WebCore::notifyChildrenSelectionChange):
+        * css/SelectorCheckerTestFunctions.h:
+        (WebCore::isDisabled):
+        (WebCore::isEnabled):
+        (WebCore::isChecked):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventDispatcher::dispatchEvent):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::selectAll):
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::shouldPerformSmartReplace):
+        * editing/VisibleSelection.cpp:
+        (WebCore::VisibleSelection::isInPasswordField):
+        * editing/cocoa/HTMLConverter.mm:
+        (HTMLConverter::_processElement):
+        * editing/gtk/EditorGtk.cpp:
+        (WebCore::elementURL):
+        * editing/ios/EditorIOS.mm:
+        (WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection):
+        * editing/markup.cpp:
+        (WebCore::StyledMarkupAccumulator::appendText):
+        (WebCore::isPlainTextMarkup):
+        (WebCore::collectElementsToRemoveFromFragment):
+        * html/HTMLCollection.cpp:
+        (WebCore::isMatchingElement):
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::rendererIsNeeded):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::shouldAutofocus):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::getTextFieldValues):
+        (WebCore::HTMLFormElement::formElementIndex):
+        * html/HTMLImageLoader.cpp:
+        (WebCore::HTMLImageLoader::dispatchLoadEvent):
+        (WebCore::HTMLImageLoader::notifyFinished):
+        * html/HTMLNameCollection.cpp:
+        (WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
+        (WebCore::DocumentNameCollection::elementMatchesIfNameAttributeMatch):
+        (WebCore::DocumentNameCollection::elementMatches):
+        * html/HTMLOptGroupElement.cpp:
+        (WebCore::HTMLOptGroupElement::recalcSelectOptions):
+        (WebCore::HTMLOptGroupElement::ownerSelectElement):
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::index):
+        (WebCore::HTMLOptionElement::ownerSelectElement):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::add):
+        (WebCore::HTMLSelectElement::value):
+        (WebCore::HTMLSelectElement::setValue):
+        (WebCore::HTMLSelectElement::childShouldCreateRenderer):
+        (WebCore::HTMLSelectElement::setLength):
+        (WebCore::HTMLSelectElement::nextValidIndex):
+        (WebCore::HTMLSelectElement::saveLastSelection):
+        (WebCore::HTMLSelectElement::setActiveSelectionAnchorIndex):
+        (WebCore::HTMLSelectElement::updateListBoxSelection):
+        (WebCore::HTMLSelectElement::listBoxOnChange):
+        (WebCore::HTMLSelectElement::recalcListItems):
+        (WebCore::HTMLSelectElement::selectedIndex):
+        (WebCore::HTMLSelectElement::selectOption):
+        (WebCore::HTMLSelectElement::optionToListIndex):
+        (WebCore::HTMLSelectElement::listToOptionIndex):
+        (WebCore::HTMLSelectElement::deselectItemsWithoutValidation):
+        (WebCore::HTMLSelectElement::saveFormControlState):
+        (WebCore::HTMLSelectElement::searchOptionsForValue):
+        (WebCore::HTMLSelectElement::restoreFormControlState):
+        (WebCore::HTMLSelectElement::appendFormData):
+        (WebCore::HTMLSelectElement::reset):
+        (WebCore::HTMLSelectElement::updateSelectedState):
+        (WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
+        (WebCore::HTMLSelectElement::lastSelectedListIndex):
+        (WebCore::HTMLSelectElement::optionAtIndex):
+        (WebCore::HTMLSelectElement::accessKeySetSelectedIndex):
+        (WebCore::HTMLSelectElement::length):
+        * html/HTMLTagNames.in:
+        * html/RadioInputType.cpp:
+        (WebCore::RadioInputType::handleKeydownEvent):
+        (WebCore::RadioInputType::isKeyboardFocusable):
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::hasImpliedEndTag):
+        * html/parser/HTMLElementStack.cpp:
+        (WebCore::HTMLNames::isSelectScopeMarker):
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processStartTagForInBody):
+        (WebCore::HTMLTreeBuilder::processStartTag):
+        (WebCore::HTMLTreeBuilder::processEndTag):
+        * html/shadow/MediaControlElementTypes.cpp:
+        (WebCore::mediaControlElementType):
+        * loader/FormSubmission.cpp:
+        (WebCore::FormSubmission::create):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::handleFallbackContent):
+        * loader/ImageLoader.cpp:
+        (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent):
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::requestObject):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        * page/Chrome.cpp:
+        (WebCore::Chrome::setToolTip):
+        * page/EventHandler.cpp:
+        (WebCore::isSubmitImage):
+        (WebCore::EventHandler::handleMousePressEvent):
+        * page/FocusController.cpp:
+        (WebCore::clearSelectionIfNeeded):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::addEmbeddedObjectToUpdate):
+        (WebCore::FrameView::updateEmbeddedObject):
+        * page/PageSerializer.cpp:
+        (WebCore::frameOwnerURLAttributeName):
+        * page/SpatialNavigation.cpp:
+        (WebCore::canScrollInDirection):
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::altDisplayString):
+        (WebCore::HitTestResult::absoluteImageURL):
+        (WebCore::HitTestResult::absolutePDFURL):
+        (WebCore::HitTestResult::isContentEditable):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::resizeTextPermitted):
+        * 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::uploadButton):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::updateAltText):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::updateFromElement):
+        (WebCore::RenderListBox::addFocusRingRects):
+        (WebCore::RenderListBox::paintItemForeground):
+        (WebCore::RenderListBox::paintItemBackground):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::selectedOptionCount):
+        (RenderMenuList::updateOptionsWidth):
+        (RenderMenuList::setTextFromOption):
+        (RenderMenuList::itemText):
+        (RenderMenuList::itemIsEnabled):
+        (RenderMenuList::itemIsSelected):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::paintSliderTicks):
+        * testing/Internals.cpp:
+        (WebCore::Internals::selectColorInColorChooser):
+        (WebCore::Internals::wasLastChangeUserEdit):
+        (WebCore::Internals::isSelectPopupVisible):
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLDocumentParser::startElementNs):
+
 2014-09-24  Eric Carlson  <eric.carlson@apple.com>
 
         [iOS] Remove MediaPlayer::setHasPlaybackTargetAvailabilityListeners
index d865c89..c327008 100644 (file)
@@ -81,7 +81,7 @@ bool AccessibilityListBoxOption::isSelected() const
     if (!m_optionElement)
         return false;
 
-    if (!isHTMLOptionElement(m_optionElement))
+    if (!is<HTMLOptionElement>(m_optionElement))
         return false;
 
     return downcast<HTMLOptionElement>(*m_optionElement).selected();
@@ -134,7 +134,7 @@ bool AccessibilityListBoxOption::canSetSelectedAttribute() const
     if (!m_optionElement)
         return false;
     
-    if (!isHTMLOptionElement(m_optionElement))
+    if (!is<HTMLOptionElement>(m_optionElement))
         return false;
     
     if (m_optionElement->isDisabledFormControl())
@@ -156,7 +156,7 @@ String AccessibilityListBoxOption::stringValue() const
     if (!ariaLabel.isNull())
         return ariaLabel;
     
-    if (isHTMLOptionElement(m_optionElement))
+    if (is<HTMLOptionElement>(m_optionElement))
         return downcast<HTMLOptionElement>(*m_optionElement).text();
     
     if (isHTMLOptGroupElement(m_optionElement))
@@ -202,7 +202,7 @@ HTMLSelectElement* AccessibilityListBoxOption::listBoxOptionParentNode() const
     if (!m_optionElement)
         return nullptr;
 
-    if (isHTMLOptionElement(m_optionElement))
+    if (is<HTMLOptionElement>(m_optionElement))
         return downcast<HTMLOptionElement>(*m_optionElement).ownerSelectElement();
 
     if (isHTMLOptGroupElement(m_optionElement))
index deb0920..ee35efa 100644 (file)
@@ -274,7 +274,7 @@ PassRefPtr<AccessibilityObject> AccessibilityMediaTimeline::create(RenderObject*
 String AccessibilityMediaTimeline::valueDescription() const
 {
     Node* node = m_renderer->node();
-    if (!isHTMLInputElement(node))
+    if (!is<HTMLInputElement>(node))
         return String();
 
     float time = downcast<HTMLInputElement>(*node).value().toFloat();
index c69211a..f629dcd 100644 (file)
@@ -41,7 +41,7 @@ AccessibilityMenuListOption::AccessibilityMenuListOption()
 
 void AccessibilityMenuListOption::setElement(HTMLElement* element)
 {
-    ASSERT_ARG(element, isHTMLOptionElement(element));
+    ASSERT_ARG(element, is<HTMLOptionElement>(element));
     m_element = element;
 }
 
index fc2585d..350da0d 100644 (file)
@@ -70,7 +70,7 @@ bool AccessibilityMenuListPopup::computeAccessibilityIsIgnored() const
 
 AccessibilityMenuListOption* AccessibilityMenuListPopup::menuListOptionAccessibilityObject(HTMLElement* element) const
 {
-    if (!element || !isHTMLOptionElement(element) || !element->inRenderedDocument())
+    if (!element || !is<HTMLOptionElement>(element) || !element->inRenderedDocument())
         return nullptr;
 
     AccessibilityObject* object = document()->axObjectCache()->getOrCreate(MenuListOptionRole);
index 67088f1..34b532f 100644 (file)
@@ -290,7 +290,7 @@ AccessibilityRole AccessibilityNodeObject::determineAccessibilityRole()
         return StaticTextRole;
     if (node()->hasTagName(buttonTag))
         return buttonRoleType();
-    if (isHTMLInputElement(node())) {
+    if (is<HTMLInputElement>(node())) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node());
         if (input.isCheckbox())
             return CheckBoxRole;
@@ -313,7 +313,7 @@ AccessibilityRole AccessibilityNodeObject::determineAccessibilityRole()
         HTMLSelectElement& selectElement = downcast<HTMLSelectElement>(*node());
         return selectElement.multiple() ? ListBoxRole : PopUpButtonRole;
     }
-    if (isHTMLTextAreaElement(node()))
+    if (is<HTMLTextAreaElement>(node()))
         return TextAreaRole;
     if (headingLevel())
         return HeadingRole;
@@ -465,10 +465,10 @@ bool AccessibilityNodeObject::isNativeTextControl() const
     if (!node)
         return false;
 
-    if (isHTMLTextAreaElement(node))
+    if (is<HTMLTextAreaElement>(node))
         return true;
 
-    if (isHTMLInputElement(node)) {
+    if (is<HTMLInputElement>(node)) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         return input.isText() || input.isNumberField();
     }
@@ -518,7 +518,7 @@ bool AccessibilityNodeObject::isNativeImage() const
     if (node->hasTagName(appletTag) || node->hasTagName(embedTag) || node->hasTagName(objectTag))
         return true;
 
-    if (isHTMLInputElement(node)) {
+    if (is<HTMLInputElement>(node)) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         return input.isImageButton();
     }
@@ -553,7 +553,7 @@ bool AccessibilityNodeObject::isInputImage() const
     if (!node)
         return false;
  
-    if (roleValue() == ButtonRole && isHTMLInputElement(node)) {
+    if (roleValue() == ButtonRole && is<HTMLInputElement>(node)) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         return input.isImageButton();
     }
@@ -738,10 +738,10 @@ bool AccessibilityNodeObject::isReadOnly() const
     if (!node)
         return true;
 
-    if (isHTMLTextAreaElement(node))
+    if (is<HTMLTextAreaElement>(node))
         return toHTMLFormControlElement(node)->isReadOnly();
 
-    if (isHTMLInputElement(node)) {
+    if (is<HTMLInputElement>(node)) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         if (input.isTextField())
             return input.isReadOnly();
@@ -837,7 +837,7 @@ String AccessibilityNodeObject::valueDescription() const
 
 float AccessibilityNodeObject::valueForRange() const
 {
-    if (node() && isHTMLInputElement(node())) {
+    if (node() && is<HTMLInputElement>(node())) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node());
         if (input.isRangeControl())
             return input.valueAsNumber();
@@ -851,7 +851,7 @@ float AccessibilityNodeObject::valueForRange() const
 
 float AccessibilityNodeObject::maxValueForRange() const
 {
-    if (node() && isHTMLInputElement(node())) {
+    if (node() && is<HTMLInputElement>(node())) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node());
         if (input.isRangeControl())
             return input.maximum();
@@ -865,7 +865,7 @@ float AccessibilityNodeObject::maxValueForRange() const
 
 float AccessibilityNodeObject::minValueForRange() const
 {
-    if (node() && isHTMLInputElement(node())) {
+    if (node() && is<HTMLInputElement>(node())) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node());
         if (input.isRangeControl())
             return input.minimum();
@@ -973,7 +973,7 @@ Element* AccessibilityNodeObject::anchorElement() const
 
 static bool isNodeActionElement(Node* node)
 {
-    if (isHTMLInputElement(node)) {
+    if (is<HTMLInputElement>(node)) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         if (!input.isDisabledFormControl() && (input.isRadioButton() || input.isCheckbox() || input.isTextButton() || input.isFileUpload() || input.isImageButton()))
             return true;
@@ -1251,7 +1251,7 @@ void AccessibilityNodeObject::titleElementText(Vector<AccessibilityText>& textOr
     if (!node)
         return;
     
-    bool isInputTag = isHTMLInputElement(node);
+    bool isInputTag = is<HTMLInputElement>(node);
     if (isInputTag || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl()) {
         HTMLLabelElement* label = labelForElement(toElement(node));
         if (label) {
@@ -1328,7 +1328,7 @@ void AccessibilityNodeObject::visibleText(Vector<AccessibilityText>& textOrder)
     if (!node)
         return;
     
-    bool isInputTag = isHTMLInputElement(node);
+    bool isInputTag = is<HTMLInputElement>(node);
     if (isInputTag) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         if (input.isTextButton()) {
@@ -1683,7 +1683,7 @@ String AccessibilityNodeObject::title() const
     if (!node)
         return String();
 
-    bool isInputTag = isHTMLInputElement(node);
+    bool isInputTag = is<HTMLInputElement>(node);
     if (isInputTag) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         if (input.isTextButton())
@@ -1809,7 +1809,7 @@ void AccessibilityNodeObject::colorValue(int& r, int& g, int& b) const
     if (!isColorWell())
         return;
 
-    if (!node() || !isHTMLInputElement(node()))
+    if (!node() || !is<HTMLInputElement>(node()))
         return;
 
     HTMLInputElement& input = downcast<HTMLInputElement>(*node());
@@ -1841,7 +1841,7 @@ static String accessibleNameForNode(Node* node)
     if (!alt.isEmpty())
         return alt;
     
-    if (isHTMLInputElement(node))
+    if (is<HTMLInputElement>(node))
         return downcast<HTMLInputElement>(*node).value();
     
     // If the node can be turned into an AX object, we can use standard name computation rules.
index b596f8d..3e2a8f7 100644 (file)
@@ -523,7 +523,7 @@ bool AccessibilityRenderObject::isAttachment() const
 
 bool AccessibilityRenderObject::isFileUploadButton() const
 {
-    if (m_renderer && m_renderer->node() && isHTMLInputElement(m_renderer->node())) {
+    if (m_renderer && m_renderer->node() && is<HTMLInputElement>(m_renderer->node())) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*m_renderer->node());
         return input.isFileUpload();
     }
@@ -950,7 +950,7 @@ void AccessibilityRenderObject::addRadioButtonGroupMembers(AccessibilityChildren
         return;
     
     Node* node = m_renderer->node();
-    if (!node || !isHTMLInputElement(node))
+    if (!node || !is<HTMLInputElement>(node))
         return;
     
     HTMLInputElement& input = downcast<HTMLInputElement>(*node);
@@ -968,7 +968,7 @@ void AccessibilityRenderObject::addRadioButtonGroupMembers(AccessibilityChildren
         unsigned length = list->length();
         for (unsigned i = 0; i < length; ++i) {
             Node* item = list->item(i);
-            if (isHTMLInputElement(item)) {
+            if (is<HTMLInputElement>(item)) {
                 HTMLInputElement& associateElement = downcast<HTMLInputElement>(*item);
                 if (associateElement.isRadioButton() && associateElement.name() == input.name()) {
                     if (AccessibilityObject* object = axObjectCache()->getOrCreate(&associateElement))
@@ -1687,9 +1687,9 @@ void AccessibilityRenderObject::setValue(const String& string)
     RenderBoxModelObject* renderer = toRenderBoxModelObject(m_renderer);
 
     // FIXME: Do we want to do anything here for ARIA textboxes?
-    if (renderer->isTextField() && isHTMLInputElement(element))
+    if (renderer->isTextField() && is<HTMLInputElement>(element))
         downcast<HTMLInputElement>(element).setValue(string);
-    else if (renderer->isTextArea() && isHTMLTextAreaElement(element))
+    else if (renderer->isTextArea() && is<HTMLTextAreaElement>(element))
         downcast<HTMLTextAreaElement>(element).setValue(string);
 }
 
@@ -2211,7 +2211,7 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityHitTest(const IntPo
     if (isHTMLAreaElement(node))
         return accessibilityImageMapHitTest(downcast<HTMLAreaElement>(node), point);
     
-    if (isHTMLOptionElement(node))
+    if (is<HTMLOptionElement>(node))
         node = downcast<HTMLOptionElement>(*node).ownerSelectElement();
     
     RenderObject* obj = node->renderer();
@@ -2483,7 +2483,7 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
     if (m_renderer->isText())
         return StaticTextRole;
     if (cssBox && cssBox->isImage()) {
-        if (node && isHTMLInputElement(node))
+        if (node && is<HTMLInputElement>(node))
             return ariaHasPopup() ? PopUpButtonRole : ButtonRole;
         if (isSVGImage())
             return SVGRootRole;
@@ -2502,7 +2502,7 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
     if (cssBox && cssBox->isTextArea())
         return TextAreaRole;
 
-    if (node && isHTMLInputElement(node)) {
+    if (node && is<HTMLInputElement>(node)) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*node);
         if (input.isCheckbox())
             return CheckBoxRole;
@@ -2836,7 +2836,7 @@ void AccessibilityRenderObject::updateChildrenIfNecessary()
 void AccessibilityRenderObject::addTextFieldChildren()
 {
     Node* node = this->node();
-    if (!node || !isHTMLInputElement(node))
+    if (!node || !is<HTMLInputElement>(node))
         return;
     
     HTMLInputElement& input = downcast<HTMLInputElement>(*node);
index b865118..20b1458 100644 (file)
@@ -133,7 +133,7 @@ static void notifyChildrenSelectionChange(AccessibilityObject* object)
 
     // Only support HTML select elements so far (ARIA selectors not supported).
     Node* node = object->node();
-    if (!node || !isHTMLSelectElement(node))
+    if (!node || !is<HTMLSelectElement>(node))
         return;
 
     // Emit signal from the listbox's point of view first.
index 7fa4dc5..546ecae 100644 (file)
@@ -58,7 +58,7 @@ ALWAYS_INLINE bool isDefaultButtonForForm(const Element* element)
 
 ALWAYS_INLINE bool isDisabled(const Element* element)
 {
-    if (element->isFormControlElement() || isHTMLOptionElement(element) || isHTMLOptGroupElement(element))
+    if (element->isFormControlElement() || is<HTMLOptionElement>(element) || is<HTMLOptGroupElement>(element))
         return element->isDisabledFormControl();
     return false;
 }
@@ -66,10 +66,10 @@ ALWAYS_INLINE bool isDisabled(const Element* element)
 ALWAYS_INLINE bool isEnabled(const Element* element)
 {
     bool isEnabled = false;
-    if (element->isFormControlElement() || isHTMLOptionElement(element) || isHTMLOptGroupElement(element))
+    if (element->isFormControlElement() || is<HTMLOptionElement>(element) || is<HTMLOptGroupElement>(element))
         isEnabled = !element->isDisabledFormControl();
     else if (element->isLink())
-        isEnabled = isHTMLAnchorElement(element) || isHTMLAreaElement(element);
+        isEnabled = is<HTMLAnchorElement>(element) || is<HTMLAreaElement>(element);
     return isEnabled;
 }
 
@@ -86,7 +86,7 @@ ALWAYS_INLINE bool isChecked(Element* element)
     const HTMLInputElement* inputElement = element->toInputElement();
     if (inputElement && inputElement->shouldAppearChecked() && !inputElement->shouldAppearIndeterminate())
         return true;
-    if (isHTMLOptionElement(element) && downcast<HTMLOptionElement>(*element).selected())
+    if (is<HTMLOptionElement>(element) && downcast<HTMLOptionElement>(*element).selected())
         return true;
     return false;
 }
index 2eaed53..068732c 100644 (file)
@@ -1270,7 +1270,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par
         style.setZIndex(0);
 
     // Textarea considers overflow visible as auto.
-    if (e && isHTMLTextAreaElement(e)) {
+    if (e && is<HTMLTextAreaElement>(e)) {
         style.setOverflowX(style.overflowX() == OVISIBLE ? OAUTO : style.overflowX());
         style.setOverflowY(style.overflowY() == OVISIBLE ? OAUTO : style.overflowY());
     }
@@ -1338,7 +1338,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par
     if (e && e->isFormControlElement() && style.fontSize() >= 11) {
         // Don't apply intrinsic margins to image buttons. The designer knows how big the images are,
         // so we have to treat all image buttons as though they were explicitly sized.
-        if (!isHTMLInputElement(e) || !downcast<HTMLInputElement>(*e).isImageButton())
+        if (!is<HTMLInputElement>(e) || !downcast<HTMLInputElement>(*e).isImageButton())
             addIntrinsicMargins(style);
     }
 
index 4094f33..a0f9630 100644 (file)
@@ -356,7 +356,7 @@ bool EventDispatcher::dispatchEvent(Node* origin, PassRefPtr<Event> prpEvent)
     WindowEventContext windowEventContext(node.get(), eventPath.lastContextIfExists());
 
     InputElementClickState clickHandlingState;
-    if (isHTMLInputElement(node.get()))
+    if (is<HTMLInputElement>(node.get()))
         downcast<HTMLInputElement>(*node).willDispatchEvent(*event, clickHandlingState);
 
     if (!event->propagationStopped() && !eventPath.isEmpty())
index 20112ca..b7629cf 100644 (file)
@@ -1670,7 +1670,7 @@ void FrameSelection::selectAll()
     Document* document = m_frame->document();
 
     Element* focusedElement = document->focusedElement();
-    if (focusedElement && isHTMLSelectElement(focusedElement)) {
+    if (focusedElement && is<HTMLSelectElement>(focusedElement)) {
         HTMLSelectElement& selectElement = downcast<HTMLSelectElement>(*focusedElement);
         if (selectElement.canSelectAll()) {
             selectElement.selectAll();
index bd536f0..3113af3 100644 (file)
@@ -1273,7 +1273,7 @@ bool ReplaceSelectionCommand::shouldPerformSmartReplace() const
         return false;
 
     Element* textControl = enclosingTextFormControl(positionAtStartOfInsertedContent().deepEquivalent());
-    if (textControl && isHTMLInputElement(textControl) && downcast<HTMLInputElement>(*textControl).isPasswordField())
+    if (textControl && is<HTMLInputElement>(textControl) && downcast<HTMLInputElement>(*textControl).isPasswordField())
         return false; // Disable smart replace for password fields.
 
     return true;
index ba8325f..612080d 100644 (file)
@@ -664,7 +664,7 @@ Node* VisibleSelection::nonBoundaryShadowTreeRootNode() const
 bool VisibleSelection::isInPasswordField() const
 {
     HTMLTextFormControlElement* textControl = enclosingTextFormControl(start());
-    return textControl && isHTMLInputElement(textControl) && downcast<HTMLInputElement>(*textControl).isPasswordField();
+    return textControl && is<HTMLInputElement>(textControl) && downcast<HTMLInputElement>(*textControl).isPasswordField();
 }
 
 #ifndef NDEBUG
index 24ba5e1..3bca947 100644 (file)
@@ -2042,7 +2042,7 @@ BOOL HTMLConverter::_processElement(Element& element, NSInteger depth)
     } else if (element.hasTagName(qTag)) {
         _addQuoteForElement(element, YES, _quoteLevel++);
     } else if (element.hasTagName(inputTag)) {
-        if (isHTMLInputElement(element)) {
+        if (is<HTMLInputElement>(element)) {
             HTMLInputElement& inputElement = downcast<HTMLInputElement>(element);
             if (inputElement.type() == "text") {
                 NSString *value = inputElement.value();
@@ -2051,7 +2051,7 @@ BOOL HTMLConverter::_processElement(Element& element, NSInteger depth)
             }
         }
     } else if (element.hasTagName(textareaTag)) {
-        if (isHTMLTextAreaElement(element)) {
+        if (is<HTMLTextAreaElement>(element)) {
             HTMLTextAreaElement& textAreaElement = downcast<HTMLTextAreaElement>(element);
             NSString *value = textAreaElement.value();
             if (value && [value length] > 0)
index fe0b1da..0644cfa 100644 (file)
@@ -82,11 +82,11 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText, Ma
 
 static const AtomicString& elementURL(Element& element)
 {
-    if (isHTMLImageElement(element) || isHTMLInputElement(element))
+    if (is<HTMLImageElement>(element) || is<HTMLInputElement>(element))
         return element.fastGetAttribute(HTMLNames::srcAttr);
     if (is<SVGImageElement>(element))
         return element.fastGetAttribute(XLinkNames::hrefAttr);
-    if (isHTMLEmbedElement(element) || isHTMLObjectElement(element))
+    if (is<HTMLEmbedElement>(element) || is<HTMLObjectElement>(element))
         return element.imageSourceURL();
     return nullAtom;
 }
index e0eb369..3192822 100644 (file)
@@ -181,7 +181,7 @@ void Editor::setTextAlignmentForChangedBaseWritingDirection(WritingDirection dir
         return;
 
     Element* focusedElement = m_frame.document()->focusedElement();
-    if (focusedElement && (isHTMLTextAreaElement(focusedElement) || (isHTMLInputElement(focusedElement)
+    if (focusedElement && (is<HTMLTextAreaElement>(focusedElement) || (is<HTMLInputElement>(focusedElement)
         && (downcast<HTMLInputElement>(*focusedElement).isTextField()
             || downcast<HTMLInputElement>(*focusedElement).isSearchField())))) {
         if (direction == NaturalWritingDirection)
index abedc4b..56c7007 100644 (file)
@@ -234,7 +234,7 @@ String StyledMarkupAccumulator::takeResults()
 
 void StyledMarkupAccumulator::appendText(StringBuilder& out, const Text& text)
 {    
-    const bool parentIsTextarea = text.parentElement() && isHTMLTextAreaElement(text.parentElement());
+    const bool parentIsTextarea = text.parentElement() && is<HTMLTextAreaElement>(text.parentElement());
     const bool wrappingSpan = shouldApplyWrappingStyle(text) && !parentIsTextarea;
     if (wrappingSpan) {
         RefPtr<EditingStyle> wrappingStyle = m_wrappingStyle->copy();
@@ -743,7 +743,7 @@ static void fillContainerFromString(ContainerNode* paragraph, const String& stri
 
 bool isPlainTextMarkup(Node* node)
 {
-    if (!isHTMLDivElement(node))
+    if (!is<HTMLDivElement>(node))
         return false;
 
     HTMLDivElement& element = downcast<HTMLDivElement>(*node);
@@ -929,7 +929,7 @@ static Vector<Ref<HTMLElement>> collectElementsToRemoveFromFragment(ContainerNod
 {
     Vector<Ref<HTMLElement>> toRemove;
     for (auto& element : childrenOfType<HTMLElement>(container)) {
-        if (isHTMLHtmlElement(element)) {
+        if (is<HTMLHtmlElement>(element)) {
             toRemove.append(element);
             collectElementsToRemoveFromFragment(element);
             continue;
index 91bb281..e76093f 100644 (file)
@@ -191,9 +191,9 @@ inline bool isMatchingElement(const HTMLCollection& htmlCollection, Element& ele
     case SelectOptions:
         return element.hasTagName(optionTag);
     case SelectedOptions:
-        return isHTMLOptionElement(element) && downcast<HTMLOptionElement>(element).selected();
+        return is<HTMLOptionElement>(element) && downcast<HTMLOptionElement>(element).selected();
     case DataListOptions:
-        if (isHTMLOptionElement(element)) {
+        if (is<HTMLOptionElement>(element)) {
             HTMLOptionElement& option = downcast<HTMLOptionElement>(element);
             if (!option.isDisabledFormControl() && !option.value().isEmpty())
                 return true;
@@ -202,7 +202,7 @@ inline bool isMatchingElement(const HTMLCollection& htmlCollection, Element& ele
     case MapAreas:
         return element.hasTagName(areaTag);
     case DocApplets:
-        return element.hasTagName(appletTag) || (isHTMLObjectElement(element) && downcast<HTMLObjectElement>(element).containsJavaApplet());
+        return is<HTMLAppletElement>(element) || (is<HTMLObjectElement>(element) && downcast<HTMLObjectElement>(element).containsJavaApplet());
     case DocEmbeds:
         return element.hasTagName(embedTag);
     case DocLinks:
index 3642b85..4ada725 100644 (file)
@@ -189,7 +189,7 @@ bool HTMLEmbedElement::rendererIsNeeded(const RenderStyle& style)
     // If my parent is an <object> and is not set to use fallback content, I
     // should be ignored and not get a renderer.
     ContainerNode* parent = parentNode();
-    if (parent && isHTMLObjectElement(parent)) {
+    if (parent && is<HTMLObjectElement>(parent)) {
         if (!parent->renderer())
             return false;
         if (!downcast<HTMLObjectElement>(*parent).useFallbackContent()) {
index 12acfb3..bcad276 100644 (file)
@@ -192,7 +192,7 @@ static bool shouldAutofocus(HTMLFormControlElement* element)
 
     // FIXME: Should this set of hasTagName checks be replaced by a
     // virtual member function?
-    if (isHTMLInputElement(element))
+    if (is<HTMLInputElement>(element))
         return !downcast<HTMLInputElement>(*element).isInputTypeHidden();
     if (element->hasTagName(selectTag))
         return true;
@@ -200,7 +200,7 @@ static bool shouldAutofocus(HTMLFormControlElement* element)
         return true;
     if (element->hasTagName(buttonTag))
         return true;
-    if (isHTMLTextAreaElement(element))
+    if (is<HTMLTextAreaElement>(element))
         return true;
 
     return false;
index 4589b47..e39c84f 100644 (file)
@@ -316,7 +316,7 @@ void HTMLFormElement::getTextFieldValues(StringPairVector& fieldNamesAndValues)
     for (unsigned i = 0; i < m_associatedElements.size(); ++i) {
         FormAssociatedElement& control = *m_associatedElements[i];
         HTMLElement& element = control.asHTMLElement();
-        if (!isHTMLInputElement(element))
+        if (!is<HTMLInputElement>(element))
             continue;
         HTMLInputElement& input = downcast<HTMLInputElement>(element);
         if (!input.isTextField())
@@ -592,7 +592,7 @@ unsigned HTMLFormElement::formElementIndex(FormAssociatedElement* associatedElem
     for (auto& element : descendants) {
         if (&element == &associatedHTMLElement)
             return i;
-        if (!isHTMLFormControlElement(element) && !isHTMLObjectElement(element))
+        if (!isHTMLFormControlElement(element) && !is<HTMLObjectElement>(element))
             continue;
         if (element.form() != this)
             continue;
index fb34c8c..29fbcde 100644 (file)
@@ -54,7 +54,7 @@ void HTMLImageLoader::dispatchLoadEvent()
 
     bool errorOccurred = image()->errorOccurred();
     if (!errorOccurred && image()->response().httpStatusCode() >= 400)
-        errorOccurred = isHTMLObjectElement(element()); // An <object> considers a 404 to be an error and should fire onerror.
+        errorOccurred = is<HTMLObjectElement>(element()); // An <object> considers a 404 to be an error and should fire onerror.
     element().dispatchEvent(Event::create(errorOccurred ? eventNames().errorEvent : eventNames().loadEvent, false, false));
 }
 
@@ -85,7 +85,7 @@ void HTMLImageLoader::notifyFinished(CachedResource*)
         }
     }
 
-    if (loadError && isHTMLObjectElement(element()))
+    if (loadError && is<HTMLObjectElement>(element()))
         downcast<HTMLObjectElement>(element()).renderFallbackContent();
 }
 
index fef41fd..af3c363 100644 (file)
@@ -66,15 +66,15 @@ bool WindowNameCollection::elementMatches(const Element& element, const AtomicSt
 bool DocumentNameCollection::elementMatchesIfIdAttributeMatch(const Element& element)
 {
     // FIXME: we need to fix HTMLImageElement to update the hash map for us when name attribute has been removed.
-    return element.hasTagName(appletTag) || (isHTMLObjectElement(element) && downcast<HTMLObjectElement>(element).isDocNamedItem())
-        || (isHTMLImageElement(element) && element.hasName());
+    return is<HTMLAppletElement>(element) || (is<HTMLObjectElement>(element) && downcast<HTMLObjectElement>(element).isDocNamedItem())
+        || (is<HTMLImageElement>(element) && element.hasName());
 }
 
 bool DocumentNameCollection::elementMatchesIfNameAttributeMatch(const Element& element)
 {
-    return isHTMLFormElement(element) || element.hasTagName(embedTag) || element.hasTagName(iframeTag)
-        || element.hasTagName(appletTag) || (isHTMLObjectElement(element) && downcast<HTMLObjectElement>(element).isDocNamedItem())
-        || isHTMLImageElement(element);
+    return is<HTMLFormElement>(element) || is<HTMLEmbedElement>(element) || is<HTMLIFrameElement>(element)
+        || is<HTMLAppletElement>(element) || (is<HTMLObjectElement>(element) && downcast<HTMLObjectElement>(element).isDocNamedItem())
+        || is<HTMLImageElement>(element);
 }
 
 bool DocumentNameCollection::elementMatches(const Element& element, const AtomicStringImpl* name)
@@ -85,7 +85,7 @@ bool DocumentNameCollection::elementMatches(const Element& element, const Atomic
         return element.getNameAttribute().impl() == name;
     if (element.hasTagName(appletTag))
         return element.getNameAttribute().impl() == name || element.getIdAttribute().impl() == name;
-    if (isHTMLObjectElement(element))
+    if (is<HTMLObjectElement>(element))
         return (element.getNameAttribute().impl() == name || element.getIdAttribute().impl() == name) && downcast<HTMLObjectElement>(element).isDocNamedItem();
     if (isHTMLImageElement(element))
         return element.getNameAttribute().impl() == name || (element.getIdAttribute().impl() == name && element.hasName());
index 95d6abc..d7bd6cc 100644 (file)
@@ -86,7 +86,7 @@ void HTMLOptGroupElement::parseAttribute(const QualifiedName& name, const Atomic
 void HTMLOptGroupElement::recalcSelectOptions()
 {
     ContainerNode* select = parentNode();
-    while (select && !isHTMLSelectElement(select))
+    while (select && !is<HTMLSelectElement>(select))
         select = select->parentNode();
     if (select)
         downcast<HTMLSelectElement>(*select).setRecalcListItems();
@@ -107,7 +107,7 @@ String HTMLOptGroupElement::groupLabelText() const
 HTMLSelectElement* HTMLOptGroupElement::ownerSelectElement() const
 {
     ContainerNode* select = parentNode();
-    while (select && !isHTMLSelectElement(select))
+    while (select && !is<HTMLSelectElement>(select))
         select = select->parentNode();
     
     if (!select)
index 1ab7a04..ce65127 100644 (file)
@@ -160,7 +160,7 @@ int HTMLOptionElement::index() const
     const Vector<HTMLElement*>& items = selectElement->listItems();
     size_t length = items.size();
     for (size_t i = 0; i < length; ++i) {
-        if (!isHTMLOptionElement(items[i]))
+        if (!is<HTMLOptionElement>(items[i]))
             continue;
         if (items[i] == this)
             return optionIndex;
@@ -267,7 +267,7 @@ HTMLDataListElement* HTMLOptionElement::ownerDataListElement() const
 HTMLSelectElement* HTMLOptionElement::ownerSelectElement() const
 {
     ContainerNode* select = parentNode();
-    while (select && !isHTMLSelectElement(select))
+    while (select && !is<HTMLSelectElement>(select))
         select = select->parentNode();
 
     if (!select)
index 482b82f..c963262 100644 (file)
@@ -220,7 +220,7 @@ int HTMLSelectElement::activeSelectionEndListIndex() const
 
 void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, ExceptionCode& ec)
 {
-    if (!element || !(isHTMLOptionElement(*element) || element->hasTagName(hrTag)))
+    if (!element || !(is<HTMLOptionElement>(*element) || element->hasTagName(hrTag)))
         return;
 
     // Make sure the element is ref'd and deref'd so we don't leak it.
@@ -250,7 +250,7 @@ void HTMLSelectElement::remove(HTMLOptionElement* option)
 String HTMLSelectElement::value() const
 {
     for (auto* item : listItems()) {
-        if (isHTMLOptionElement(*item)) {
+        if (is<HTMLOptionElement>(*item)) {
             HTMLOptionElement& option = downcast<HTMLOptionElement>(*item);
             if (option.selected())
                 return option.value();
@@ -270,7 +270,7 @@ void HTMLSelectElement::setValue(const String &value)
     // Find the option with value() matching the given parameter and make it the current selection.
     unsigned optionIndex = 0;
     for (auto* item : listItems()) {
-        if (isHTMLOptionElement(*item)) {
+        if (is<HTMLOptionElement>(*item)) {
             if (downcast<HTMLOptionElement>(*item).value() == value) {
                 setSelectedIndex(optionIndex);
                 return;
@@ -363,7 +363,7 @@ bool HTMLSelectElement::childShouldCreateRenderer(const Node& child) const
         return false;
 #if !PLATFORM(IOS)
     if (!usesMenuList())
-        return isHTMLOptionElement(child) || isHTMLOptGroupElement(child) || validationMessageShadowTreeContains(child);
+        return is<HTMLOptionElement>(child) || is<HTMLOptGroupElement>(child) || validationMessageShadowTreeContains(child);
 #endif
     return validationMessageShadowTreeContains(child);
 }
@@ -483,7 +483,7 @@ void HTMLSelectElement::setLength(unsigned newLen, ExceptionCode& ec)
         Vector<RefPtr<Element>> itemsToRemove;
         size_t optionIndex = 0;
         for (auto& item : items) {
-            if (isHTMLOptionElement(*item) && optionIndex++ >= newLen) {
+            if (is<HTMLOptionElement>(*item) && optionIndex++ >= newLen) {
                 ASSERT(item->parentNode());
                 itemsToRemove.append(item);
             }
@@ -521,7 +521,7 @@ int HTMLSelectElement::nextValidIndex(int listIndex, SkipDirection direction, in
     int size = listItems.size();
     for (listIndex += direction; listIndex >= 0 && listIndex < size; listIndex += direction) {
         --skip;
-        if (!listItems[listIndex]->isDisabledFormControl() && isHTMLOptionElement(listItems[listIndex])) {
+        if (!listItems[listIndex]->isDisabledFormControl() && is<HTMLOptionElement>(listItems[listIndex])) {
             lastGoodIndex = listIndex;
             if (skip <= 0)
                 break;
@@ -605,7 +605,7 @@ void HTMLSelectElement::saveLastSelection()
     const Vector<HTMLElement*>& items = listItems();
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        m_lastOnChangeSelection.append(isHTMLOptionElement(element) && downcast<HTMLOptionElement>(element)->selected());
+        m_lastOnChangeSelection.append(is<HTMLOptionElement>(element) && downcast<HTMLOptionElement>(element)->selected());
     }
 }
 
@@ -620,7 +620,7 @@ void HTMLSelectElement::setActiveSelectionAnchorIndex(int index)
     const Vector<HTMLElement*>& items = listItems();
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        m_cachedStateForActiveSelection.append(isHTMLOptionElement(element) && downcast<HTMLOptionElement>(element)->selected());
+        m_cachedStateForActiveSelection.append(is<HTMLOptionElement>(element) && downcast<HTMLOptionElement>(element)->selected());
     }
 }
 
@@ -644,7 +644,7 @@ void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions)
     const Vector<HTMLElement*>& items = listItems();
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        if (!isHTMLOptionElement(element) || downcast<HTMLOptionElement>(*element).isDisabledFormControl())
+        if (!is<HTMLOptionElement>(element) || downcast<HTMLOptionElement>(*element).isDisabledFormControl())
             continue;
 
         if (i >= start && i <= end)
@@ -676,7 +676,7 @@ void HTMLSelectElement::listBoxOnChange()
     bool fireOnChange = false;
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        bool selected = isHTMLOptionElement(element) && downcast<HTMLOptionElement>(*element).selected();
+        bool selected = is<HTMLOptionElement>(element) && downcast<HTMLOptionElement>(*element).selected();
         if (selected != m_lastOnChangeSelection[i])
             fireOnChange = true;
         m_lastOnChangeSelection[i] = selected;
@@ -798,7 +798,7 @@ void HTMLSelectElement::recalcListItems(bool updateSelectedStates) const
             }
         }
 
-        if (isHTMLOptionElement(current)) {
+        if (is<HTMLOptionElement>(current)) {
             m_listItems.append(current);
 
             if (updateSelectedStates && !m_multiple) {
@@ -840,7 +840,7 @@ int HTMLSelectElement::selectedIndex() const
     const Vector<HTMLElement*>& items = listItems();
     for (size_t i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        if (isHTMLOptionElement(element)) {
+        if (is<HTMLOptionElement>(element)) {
             if (downcast<HTMLOptionElement>(*element).selected())
                 return index;
             ++index;
@@ -876,7 +876,7 @@ void HTMLSelectElement::selectOption(int optionIndex, SelectOptionFlags flags)
     HTMLElement* element = nullptr;
     if (listIndex >= 0) {
         element = items[listIndex];
-        if (isHTMLOptionElement(element)) {
+        if (is<HTMLOptionElement>(element)) {
             if (m_activeSelectionAnchorIndex < 0 || shouldDeselect)
                 setActiveSelectionAnchorIndex(listIndex);
             if (m_activeSelectionEndIndex < 0 || shouldDeselect)
@@ -918,7 +918,7 @@ int HTMLSelectElement::optionToListIndex(int optionIndex) const
 
     int optionIndex2 = -1;
     for (int listIndex = 0; listIndex < listSize; ++listIndex) {
-        if (isHTMLOptionElement(items[listIndex])) {
+        if (is<HTMLOptionElement>(items[listIndex])) {
             ++optionIndex2;
             if (optionIndex2 == optionIndex)
                 return listIndex;
@@ -931,13 +931,13 @@ int HTMLSelectElement::optionToListIndex(int optionIndex) const
 int HTMLSelectElement::listToOptionIndex(int listIndex) const
 {
     const Vector<HTMLElement*>& items = listItems();
-    if (listIndex < 0 || listIndex >= static_cast<int>(items.size()) || !isHTMLOptionElement(items[listIndex]))
+    if (listIndex < 0 || listIndex >= static_cast<int>(items.size()) || !is<HTMLOptionElement>(items[listIndex]))
         return -1;
 
     // Actual index of option not counting OPTGROUP entries that may be in list.
     int optionIndex = 0;
     for (int i = 0; i < listIndex; ++i) {
-        if (isHTMLOptionElement(items[i]))
+        if (is<HTMLOptionElement>(items[i]))
             ++optionIndex;
     }
 
@@ -968,7 +968,7 @@ void HTMLSelectElement::deselectItemsWithoutValidation(HTMLElement* excludeEleme
     const Vector<HTMLElement*>& items = listItems();
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        if (element != excludeElement && isHTMLOptionElement(element))
+        if (element != excludeElement && is<HTMLOptionElement>(element))
             downcast<HTMLOptionElement>(*element).setSelectedState(false);
     }
 }
@@ -979,7 +979,7 @@ FormControlState HTMLSelectElement::saveFormControlState() const
     size_t length = items.size();
     FormControlState state;
     for (unsigned i = 0; i < length; ++i) {
-        if (!isHTMLOptionElement(items[i]))
+        if (!is<HTMLOptionElement>(items[i]))
             continue;
         HTMLOptionElement& option = downcast<HTMLOptionElement>(*items[i]);
         if (!option.selected())
@@ -996,7 +996,7 @@ size_t HTMLSelectElement::searchOptionsForValue(const String& value, size_t list
     const Vector<HTMLElement*>& items = listItems();
     size_t loopEndIndex = std::min(items.size(), listIndexEnd);
     for (size_t i = listIndexStart; i < loopEndIndex; ++i) {
-        if (!isHTMLOptionElement(items[i]))
+        if (!is<HTMLOptionElement>(items[i]))
             continue;
         if (downcast<HTMLOptionElement>(*items[i]).value() == value)
             return i;
@@ -1014,7 +1014,7 @@ void HTMLSelectElement::restoreFormControlState(const FormControlState& state)
         return;
 
     for (size_t i = 0; i < itemsSize; ++i) {
-        if (!isHTMLOptionElement(items[i]))
+        if (!is<HTMLOptionElement>(items[i]))
             continue;
         downcast<HTMLOptionElement>(*items[i]).setSelectedState(false);
     }
@@ -1061,7 +1061,7 @@ bool HTMLSelectElement::appendFormData(FormDataList& list, bool)
 
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        if (isHTMLOptionElement(element) && downcast<HTMLOptionElement>(*element).selected() && !downcast<HTMLOptionElement>(*element).isDisabledFormControl()) {
+        if (is<HTMLOptionElement>(element) && downcast<HTMLOptionElement>(*element).selected() && !downcast<HTMLOptionElement>(*element).isDisabledFormControl()) {
             list.appendData(name, downcast<HTMLOptionElement>(*element).value());
             successful = true;
         }
@@ -1081,7 +1081,7 @@ void HTMLSelectElement::reset()
     const Vector<HTMLElement*>& items = listItems();
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        if (!isHTMLOptionElement(element))
+        if (!is<HTMLOptionElement>(element))
             continue;
 
         HTMLOptionElement& option = downcast<HTMLOptionElement>(*element);
@@ -1297,7 +1297,7 @@ void HTMLSelectElement::updateSelectedState(int listIndex, bool multi, bool shif
     bool multiSelect = m_multiple && multi && !shift;
 
     HTMLElement* clickedElement = listItems()[listIndex];
-    if (isHTMLOptionElement(clickedElement)) {
+    if (is<HTMLOptionElement>(clickedElement)) {
         // Keep track of whether an active selection (like during drag
         // selection), should select or deselect.
         if (downcast<HTMLOptionElement>(*clickedElement).selected() && multiSelect)
@@ -1318,7 +1318,7 @@ void HTMLSelectElement::updateSelectedState(int listIndex, bool multi, bool shif
         setActiveSelectionAnchorIndex(selectedIndex());
 
     // Set the selection state of the clicked option.
-    if (isHTMLOptionElement(clickedElement) && !downcast<HTMLOptionElement>(*clickedElement).isDisabledFormControl())
+    if (is<HTMLOptionElement>(clickedElement) && !downcast<HTMLOptionElement>(*clickedElement).isDisabledFormControl())
         downcast<HTMLOptionElement>(*clickedElement).setSelectedState(true);
 
     // If there was no selectedIndex() for the previous initialization, or If
@@ -1494,7 +1494,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
             m_activeSelectionState = !m_activeSelectionState;
             ASSERT(m_activeSelectionEndIndex >= 0);
             ASSERT(m_activeSelectionEndIndex < static_cast<int>(listItems.size()));
-            ASSERT(isHTMLOptionElement(*listItems[m_activeSelectionEndIndex]));
+            ASSERT(is<HTMLOptionElement>(*listItems[m_activeSelectionEndIndex]));
             updateSelectedState(m_activeSelectionEndIndex, true /*multi*/, false /*shift*/);
             listBoxOnChange();
             event->setDefaultHandled();
@@ -1539,7 +1539,7 @@ int HTMLSelectElement::lastSelectedListIndex() const
     const Vector<HTMLElement*>& items = listItems();
     for (size_t i = items.size(); i;) {
         HTMLElement* element = items[--i];
-        if (isHTMLOptionElement(element) && downcast<HTMLOptionElement>(*element).selected())
+        if (is<HTMLOptionElement>(element) && downcast<HTMLOptionElement>(*element).selected())
             return i;
     }
     return -1;
@@ -1560,7 +1560,7 @@ String HTMLSelectElement::optionAtIndex(int index) const
     const Vector<HTMLElement*>& items = listItems();
     
     HTMLElement* element = items[index];
-    if (!isHTMLOptionElement(element) || downcast<HTMLOptionElement>(*element).isDisabledFormControl())
+    if (!is<HTMLOptionElement>(element) || downcast<HTMLOptionElement>(*element).isDisabledFormControl())
         return String();
     return downcast<HTMLOptionElement>(*element).textIndentedToRespectGroupLabel();
 }
@@ -1596,7 +1596,7 @@ void HTMLSelectElement::accessKeySetSelectedIndex(int index)
     int listIndex = optionToListIndex(index);
     if (listIndex >= 0) {
         HTMLElement* element = items[listIndex];
-        if (isHTMLOptionElement(element)) {
+        if (is<HTMLOptionElement>(element)) {
             if (downcast<HTMLOptionElement>(*element).selected())
                 downcast<HTMLOptionElement>(*element).setSelectedState(false);
             else
@@ -1618,7 +1618,7 @@ unsigned HTMLSelectElement::length() const
 
     const Vector<HTMLElement*>& items = listItems();
     for (unsigned i = 0; i < items.size(); ++i) {
-        if (isHTMLOptionElement(items[i]))
+        if (is<HTMLOptionElement>(items[i]))
             ++options;
     }
 
index eca25ee..12a5c0f 100644 (file)
@@ -22,7 +22,7 @@ big interfaceName=HTMLElement
 blockquote interfaceName=HTMLQuoteElement
 body generateTypeHelpers
 br interfaceName=HTMLBRElement
-button constructorNeedsFormElement
+button constructorNeedsFormElement, generateTypeHelpers
 canvas generateTypeHelpers
 caption interfaceName=HTMLTableCaptionElement, generateTypeHelpers
 center interfaceName=HTMLElement
index 6edc0e9..8a5e885 100644 (file)
@@ -84,7 +84,7 @@ void RadioInputType::handleKeydownEvent(KeyboardEvent* event)
         if (isHTMLFormElement(node))
             break;
         // Look for more radio buttons.
-        if (!isHTMLInputElement(node))
+        if (!is<HTMLInputElement>(node))
             continue;
         RefPtr<HTMLInputElement> inputElement = downcast<HTMLInputElement>(node);
         if (inputElement->form() != element().form())
@@ -122,7 +122,7 @@ bool RadioInputType::isKeyboardFocusable(KeyboardEvent* event) const
     // Never allow keyboard tabbing to leave you in the same radio group.  Always
     // skip any other elements in the group.
     Element* currentFocusedNode = element().document().focusedElement();
-    if (currentFocusedNode && isHTMLInputElement(currentFocusedNode)) {
+    if (currentFocusedNode && is<HTMLInputElement>(currentFocusedNode)) {
         HTMLInputElement& focusedInput = downcast<HTMLInputElement>(*currentFocusedNode);
         if (focusedInput.isRadioButton() && focusedInput.form() == element().form() && focusedInput.name() == element().name())
             return false;
index 9390557..a7be21f 100644 (file)
@@ -61,7 +61,7 @@ static bool hasImpliedEndTag(const HTMLStackItem* item)
     return item->hasTagName(ddTag)
         || item->hasTagName(dtTag)
         || item->hasTagName(liTag)
-        || isHTMLOptionElement(item->node())
+        || is<HTMLOptionElement>(item->node())
         || isHTMLOptGroupElement(item->node())
         || item->hasTagName(pTag)
         || item->hasTagName(rbTag)
index e581841..ada20cd 100644 (file)
@@ -120,7 +120,7 @@ inline bool isButtonScopeMarker(HTMLStackItem* item)
 
 inline bool isSelectScopeMarker(HTMLStackItem* item)
 {
-    return !isHTMLOptGroupElement(item->node()) && !isHTMLOptionElement(item->node());
+    return !is<HTMLOptGroupElement>(item->node()) && !is<HTMLOptionElement>(item->node());
 }
 
 }
index b9368df..5805cf0 100644 (file)
@@ -868,7 +868,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token)
         return;
     }
     if (token->name() == optgroupTag || token->name() == optionTag) {
-        if (isHTMLOptionElement(m_tree.currentStackItem()->node())) {
+        if (is<HTMLOptionElement>(m_tree.currentStackItem()->node())) {
             AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName());
             processEndTag(&endOption);
         }
@@ -1359,7 +1359,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
             return;
         }
         if (token->name() == optionTag) {
-            if (isHTMLOptionElement(m_tree.currentStackItem()->node())) {
+            if (is<HTMLOptionElement>(m_tree.currentStackItem()->node())) {
                 AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName());
                 processEndTag(&endOption);
             }
@@ -1367,7 +1367,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
             return;
         }
         if (token->name() == optgroupTag) {
-            if (isHTMLOptionElement(m_tree.currentStackItem()->node())) {
+            if (is<HTMLOptionElement>(m_tree.currentStackItem()->node())) {
                 AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName());
                 processEndTag(&endOption);
             }
@@ -2233,7 +2233,7 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token)
     case InsertionMode::InSelect:
         ASSERT(insertionMode() == InsertionMode::InSelect || insertionMode() == InsertionMode::InSelectInTable);
         if (token->name() == optgroupTag) {
-            if (isHTMLOptionElement(m_tree.currentStackItem()->node()) && m_tree.oneBelowTop() && isHTMLOptGroupElement(m_tree.oneBelowTop()->node()))
+            if (is<HTMLOptionElement>(m_tree.currentStackItem()->node()) && m_tree.oneBelowTop() && isHTMLOptGroupElement(m_tree.oneBelowTop()->node()))
                 processFakeEndTag(optionTag);
             if (isHTMLOptGroupElement(m_tree.currentStackItem()->node())) {
                 m_tree.openElements()->pop();
@@ -2243,7 +2243,7 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken* token)
             return;
         }
         if (token->name() == optionTag) {
-            if (isHTMLOptionElement(m_tree.currentStackItem()->node())) {
+            if (is<HTMLOptionElement>(m_tree.currentStackItem()->node())) {
                 m_tree.openElements()->pop();
                 return;
             }
index 59f2d09..ce7de9b 100644 (file)
@@ -62,7 +62,7 @@ MediaControlElementType mediaControlElementType(Node* node)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(node->isMediaControlElement());
     HTMLElement* element = toHTMLElement(node);
-    if (isHTMLInputElement(element))
+    if (is<HTMLInputElement>(element))
         return static_cast<MediaControlInputElement*>(element)->displayType();
     return static_cast<MediaControlDivElement*>(element)->displayType();
 }
index e06b56d..50ab814 100644 (file)
@@ -189,7 +189,7 @@ PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A
         HTMLElement& element = control.asHTMLElement();
         if (!element.isDisabledFormControl())
             control.appendFormData(*domFormData, isMultiPartForm);
-        if (isHTMLInputElement(element)) {
+        if (is<HTMLInputElement>(element)) {
             HTMLInputElement& input = downcast<HTMLInputElement>(element);
             if (input.isTextField()) {
                 formValues.append(std::pair<String, String>(input.name().string(), input.value()));
index cc4037a..8946cfe 100644 (file)
@@ -1033,7 +1033,7 @@ void FrameLoader::setOpener(Frame* opener)
 void FrameLoader::handleFallbackContent()
 {
     HTMLFrameOwnerElement* owner = m_frame.ownerElement();
-    if (!owner || !isHTMLObjectElement(owner))
+    if (!owner || !is<HTMLObjectElement>(owner))
         return;
     downcast<HTMLObjectElement>(*owner).renderFallbackContent();
 }
index 975497a..f8f4f43 100644 (file)
@@ -412,7 +412,7 @@ void ImageLoader::dispatchPendingBeforeLoadEvent()
     loadEventSender().cancelEvent(*this);
     m_hasPendingLoadEvent = false;
     
-    if (isHTMLObjectElement(element()))
+    if (is<HTMLObjectElement>(element()))
         downcast<HTMLObjectElement>(element()).renderFallbackContent();
 
     // Only consider updating the protection ref-count of the Element immediately before returning
index 97bdac1..d94d72a 100644 (file)
@@ -213,7 +213,7 @@ bool SubframeLoader::requestObject(HTMLPlugInImageElement& ownerElement, const S
     if (!url.isEmpty())
         completedURL = completeURL(url);
 
-    bool hasFallbackContent = isHTMLObjectElement(ownerElement) && downcast<HTMLObjectElement>(ownerElement).hasFallbackContent();
+    bool hasFallbackContent = is<HTMLObjectElement>(ownerElement) && downcast<HTMLObjectElement>(ownerElement).hasFallbackContent();
 
     bool useFallback;
     if (shouldUsePlugin(completedURL, mimeType, ownerElement.shouldPreferPlugInsForImages(), hasFallbackContent, useFallback)) {
index e848e3b..d122083 100644 (file)
@@ -516,7 +516,7 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString
     for (size_t i = 0; i < nodesSize; ++i) {
         Node& node = *nodes[i];
         Frame* childFrame;
-        if ((isHTMLFrameElement(node) || isHTMLIFrameElement(node) || isHTMLObjectElement(node))
+        if ((is<HTMLFrameElement>(node) || is<HTMLIFrameElement>(node) || is<HTMLObjectElement>(node))
             && (childFrame = toHTMLFrameOwnerElement(node).contentFrame())) {
             if (frameFilter && !frameFilter(*childFrame))
                 continue;
index d32d369..3a84ad6 100644 (file)
@@ -408,7 +408,7 @@ void Chrome::setToolTip(const HitTestResult& result)
     if (toolTip.isEmpty() && m_page.settings().showsURLsInToolTips()) {
         if (Element* element = result.innerNonSharedElement()) {
             // Get tooltip representing form action, if relevant
-            if (isHTMLInputElement(element)) {
+            if (is<HTMLInputElement>(element)) {
                 HTMLInputElement& input = downcast<HTMLInputElement>(*element);
                 if (input.isSubmitButton()) {
                     if (HTMLFormElement* form = input.form()) {
@@ -441,7 +441,7 @@ void Chrome::setToolTip(const HitTestResult& result)
     // Lastly, for <input type="file"> that allow multiple files, we'll consider a tooltip for the selected filenames
     if (toolTip.isEmpty()) {
         if (Element* element = result.innerNonSharedElement()) {
-            if (isHTMLInputElement(element)) {
+            if (is<HTMLInputElement>(element)) {
                 toolTip = downcast<HTMLInputElement>(*element).defaultToolTip();
 
                 // FIXME: We should obtain text direction of tooltip from
index cef181f..d94e406 100644 (file)
@@ -1267,7 +1267,7 @@ Frame* EventHandler::subframeForTargetNode(Node* node)
 #if ENABLE(CURSOR_SUPPORT)
 static bool isSubmitImage(Node* node)
 {
-    return node && isHTMLInputElement(node) && downcast<HTMLInputElement>(*node).isImageButton();
+    return node && is<HTMLInputElement>(node) && downcast<HTMLInputElement>(*node).isImageButton();
 }
 
 // Returns true if the node's editable block is not current focused for editing
@@ -1761,7 +1761,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& platformMouse
         // If a mouse event handler changes the input element type to one that has a widget associated,
         // we'd like to EventHandler::handleMousePressEvent to pass the event to the widget and thus the
         // event target node can't still be the shadow node.
-        if (mouseEvent.targetNode()->isShadowRoot() && isHTMLInputElement(toShadowRoot(mouseEvent.targetNode())->hostElement()))
+        if (mouseEvent.targetNode()->isShadowRoot() && is<HTMLInputElement>(toShadowRoot(mouseEvent.targetNode())->hostElement()))
             mouseEvent = m_frame.document()->prepareMouseEvent(HitTestRequest(), documentPoint, platformMouseEvent);
 
         FrameView* view = m_frame.view();
index a03aa0d..f7bd722 100644 (file)
@@ -574,7 +574,7 @@ static void clearSelectionIfNeeded(Frame* oldFocusedFrame, Frame* newFocusedFram
                 return;
 
             if (Node* shadowAncestorNode = root->deprecatedShadowAncestorNode()) {
-                if (!isHTMLInputElement(shadowAncestorNode) && !isHTMLTextAreaElement(shadowAncestorNode))
+                if (!is<HTMLInputElement>(shadowAncestorNode) && !is<HTMLTextAreaElement>(shadowAncestorNode))
                     return;
             }
         }
index f5a0dde..df6fee4 100644 (file)
@@ -1414,7 +1414,7 @@ void FrameView::addEmbeddedObjectToUpdate(RenderEmbeddedObject& embeddedObject)
         m_embeddedObjectsToUpdate = std::make_unique<ListHashSet<RenderEmbeddedObject*>>();
 
     HTMLFrameOwnerElement& element = embeddedObject.frameOwnerElement();
-    if (isHTMLObjectElement(element) || isHTMLEmbedElement(element)) {
+    if (is<HTMLObjectElement>(element) || is<HTMLEmbedElement>(element)) {
         // Tell the DOM element that it needs a widget update.
         HTMLPlugInImageElement& pluginElement = toHTMLPlugInImageElement(element);
         if (!pluginElement.needsCheckForSizeChange())
@@ -2788,7 +2788,7 @@ void FrameView::updateEmbeddedObject(RenderEmbeddedObject& embeddedObject)
     HTMLFrameOwnerElement& element = embeddedObject.frameOwnerElement();
 
     if (embeddedObject.isSnapshottedPlugIn()) {
-        if (isHTMLObjectElement(element) || isHTMLEmbedElement(element)) {
+        if (is<HTMLObjectElement>(element) || is<HTMLEmbedElement>(element)) {
             HTMLPlugInImageElement& pluginElement = toHTMLPlugInImageElement(element);
             pluginElement.checkSnapshotStatus();
         }
@@ -2799,7 +2799,7 @@ void FrameView::updateEmbeddedObject(RenderEmbeddedObject& embeddedObject)
 
     // FIXME: This could turn into a real virtual dispatch if we defined
     // updateWidget(PluginCreationOption) on HTMLElement.
-    if (isHTMLObjectElement(element) || isHTMLEmbedElement(element) || isHTMLAppletElement(element)) {
+    if (is<HTMLObjectElement>(element) || is<HTMLEmbedElement>(element) || is<HTMLAppletElement>(element)) {
         HTMLPlugInImageElement& pluginElement = toHTMLPlugInImageElement(element);
         if (pluginElement.needsCheckForSizeChange()) {
             pluginElement.checkSnapshotStatus();
index 890938c..8cc68e9 100644 (file)
@@ -91,7 +91,7 @@ static bool shouldIgnoreElement(const Element& element)
 static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerElement& frameOwner)
 {
     // FIXME: We should support all frame owners including applets.
-    return isHTMLObjectElement(frameOwner) ? HTMLNames::dataAttr : HTMLNames::srcAttr;
+    return is<HTMLObjectElement>(frameOwner) ? HTMLNames::dataAttr : HTMLNames::srcAttr;
 }
 
 class SerializerMarkupAccumulator final : public WebCore::MarkupAccumulator {
index 9d623a1..d56c9f0 100644 (file)
@@ -448,7 +448,7 @@ bool canScrollInDirection(const Node* container, FocusDirection direction)
 {
     ASSERT(container);
 
-    if (isHTMLSelectElement(container))
+    if (is<HTMLSelectElement>(container))
         return false;
 
     if (container->isDocumentNode())
index 0cc4550..063789c 100644 (file)
@@ -278,7 +278,7 @@ String HitTestResult::altDisplayString() const
         return displayString(image.fastGetAttribute(altAttr), m_innerNonSharedNode.get());
     }
     
-    if (isHTMLInputElement(*m_innerNonSharedNode)) {
+    if (is<HTMLInputElement>(*m_innerNonSharedNode)) {
         HTMLInputElement& input = downcast<HTMLInputElement>(*m_innerNonSharedNode);
         return displayString(input.alt(), m_innerNonSharedNode.get());
     }
@@ -317,14 +317,12 @@ URL HitTestResult::absoluteImageURL() const
         return URL();
 
     AtomicString urlString;
-    if (m_innerNonSharedNode->hasTagName(embedTag)
-        || isHTMLImageElement(m_innerNonSharedNode.get())
-        || isHTMLInputElement(m_innerNonSharedNode.get())
-        || m_innerNonSharedNode->hasTagName(objectTag)
-        || is<SVGImageElement>(m_innerNonSharedNode.get()))
-        {
-        Element* element = toElement(m_innerNonSharedNode.get());
-        urlString = element->imageSourceURL();
+    if (is<HTMLEmbedElement>(*m_innerNonSharedNode)
+        || is<HTMLImageElement>(*m_innerNonSharedNode)
+        || is<HTMLInputElement>(*m_innerNonSharedNode)
+        || is<HTMLObjectElement>(*m_innerNonSharedNode)
+        || is<SVGImageElement>(*m_innerNonSharedNode)) {
+        urlString = toElement(*m_innerNonSharedNode).imageSourceURL();
     } else
         return URL();
 
@@ -336,7 +334,7 @@ URL HitTestResult::absolutePDFURL() const
     if (!m_innerNonSharedNode)
         return URL();
 
-    if (!isHTMLEmbedElement(*m_innerNonSharedNode) && !isHTMLObjectElement(*m_innerNonSharedNode))
+    if (!is<HTMLEmbedElement>(*m_innerNonSharedNode) && !is<HTMLObjectElement>(*m_innerNonSharedNode))
         return URL();
 
     HTMLPlugInImageElement& element = toHTMLPlugInImageElement(*m_innerNonSharedNode);
@@ -556,10 +554,10 @@ bool HitTestResult::isContentEditable() const
     if (!m_innerNonSharedNode)
         return false;
 
-    if (isHTMLTextAreaElement(*m_innerNonSharedNode))
+    if (is<HTMLTextAreaElement>(*m_innerNonSharedNode))
         return true;
 
-    if (isHTMLInputElement(*m_innerNonSharedNode))
+    if (is<HTMLInputElement>(*m_innerNonSharedNode))
         return downcast<HTMLInputElement>(*m_innerNonSharedNode).isTextField();
 
     return m_innerNonSharedNode->hasEditableStyle();
index 42dfbca..19aa99b 100644 (file)
@@ -3569,7 +3569,7 @@ inline static bool resizeTextPermitted(RenderObject* render)
         // Get the first non-shadow HTMLElement and see if it's an input.
         if (renderer->element() && renderer->element()->isHTMLElement() && !renderer->element()->isInShadowTree()) {
             const HTMLElement& element = toHTMLElement(*renderer->element());
-            return !isHTMLInputElement(element) && !isHTMLTextAreaElement(element);
+            return !is<HTMLInputElement>(element) && !is<HTMLTextAreaElement>(element);
         }
         renderer = renderer->parent();
     }
index ed7e012..13a1a4d 100644 (file)
@@ -34,6 +34,7 @@
 #include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
+#include "HTMLButtonElement.h"
 #include "HTMLElement.h"
 #include "HTMLFrameOwnerElement.h"
 #include "HTMLInputElement.h"
@@ -2477,7 +2478,7 @@ bool RenderBox::sizesLogicalWidthToFitContent(SizeType widthType) const
     // stretching column flexbox.
     // FIXME: Think about block-flow here.
     // https://bugs.webkit.org/show_bug.cgi?id=46473
-    if (logicalWidth.type() == Auto && !isStretchingColumnFlexItem(*this) && element() && (isHTMLInputElement(element()) || element()->hasTagName(selectTag) || element()->hasTagName(buttonTag) || isHTMLTextAreaElement(element()) || element()->hasTagName(legendTag)))
+    if (logicalWidth.type() == Auto && !isStretchingColumnFlexItem(*this) && element() && (is<HTMLInputElement>(element()) || is<HTMLSelectElement>(element()) || is<HTMLButtonElement>(element()) || is<HTMLTextAreaElement>(element()) || is<HTMLLegendElement>(element())))
         return true;
 
     if (isHorizontalWritingMode() != containingBlock()->isHorizontalWritingMode())
index 139cb97..c0c2580 100644 (file)
@@ -144,7 +144,7 @@ void RenderButton::setupInnerStyle(RenderStyle* innerStyle)
 void RenderButton::updateFromElement()
 {
     // If we're an input element, we may need to change our button text.
-    if (isHTMLInputElement(formControlElement())) {
+    if (is<HTMLInputElement>(formControlElement())) {
         HTMLInputElement& input = downcast<HTMLInputElement>(formControlElement());
         String value = input.valueWithDefault();
         setText(value);
@@ -178,7 +178,7 @@ bool RenderButton::canHaveGeneratedChildren() const
     // Input elements can't have generated children, but button elements can. We'll
     // write the code assuming any other button types that might emerge in the future
     // can also have children.
-    return !isHTMLInputElement(formControlElement());
+    return !is<HTMLInputElement>(formControlElement());
 }
 
 LayoutRect RenderButton::controlClipRect(const LayoutPoint& additionalOffset) const
index c08455b..93f06b2 100644 (file)
@@ -145,7 +145,7 @@ bool RenderDetailsMarker::isOpen() const
             continue;
         if (renderer->node()->hasTagName(detailsTag))
             return !toElement(renderer->node())->getAttribute(openAttr).isNull();
-        if (isHTMLInputElement(renderer->node()))
+        if (is<HTMLInputElement>(renderer->node()))
             return true;
     }
 
index 2951cfa..a5c2b06 100644 (file)
@@ -255,7 +255,7 @@ HTMLInputElement* RenderFileUploadControl::uploadButton() const
 {
     ASSERT(inputElement().shadowRoot());
     Node* buttonNode = inputElement().shadowRoot()->firstChild();
-    return buttonNode && buttonNode->isHTMLElement() && isHTMLInputElement(buttonNode) ? downcast<HTMLInputElement>(buttonNode) : nullptr;
+    return buttonNode && is<HTMLInputElement>(buttonNode) ? downcast<HTMLInputElement>(buttonNode) : nullptr;
 }
 
 String RenderFileUploadControl::buttonValue()
index e858582..42f329c 100644 (file)
@@ -655,7 +655,7 @@ void RenderImage::updateAltText()
     if (!element())
         return;
 
-    if (isHTMLInputElement(*element()))
+    if (is<HTMLInputElement>(*element()))
         m_altText = downcast<HTMLInputElement>(*element()).altText();
     else if (isHTMLImageElement(*element()))
         m_altText = downcast<HTMLImageElement>(*element()).altText();
index 62aedc3..c1e8445 100644 (file)
@@ -116,7 +116,7 @@ void RenderListBox::updateFromElement()
             HTMLElement* element = listItems[i];
             String text;
             Font itemFont = style().font();
-            if (isHTMLOptionElement(element))
+            if (is<HTMLOptionElement>(element))
                 text = downcast<HTMLOptionElement>(*element).textIndentedToRespectGroupLabel();
             else if (isHTMLOptGroupElement(element)) {
                 text = downcast<HTMLOptGroupElement>(*element).groupLabelText();
@@ -330,7 +330,7 @@ void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
     const Vector<HTMLElement*>& listItems = selectElement().listItems();
     for (int i = 0; i < size; ++i) {
         HTMLElement* element = listItems[i];
-        if (isHTMLOptionElement(element) && !element->isDisabledFormControl()) {
+        if (is<HTMLOptionElement>(element) && !element->isDisabledFormControl()) {
             selectElement().setActiveSelectionEndIndex(i);
             rects.append(snappedIntRect(itemBoundingBoxRect(additionalOffset, i)));
             return;
@@ -385,7 +385,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint&
         return;
 
     String itemText;
-    bool isOptionElement = isHTMLOptionElement(listItemElement);
+    bool isOptionElement = is<HTMLOptionElement>(listItemElement);
     if (isOptionElement)
         itemText = downcast<HTMLOptionElement>(*listItemElement).textIndentedToRespectGroupLabel();
     else if (isHTMLOptGroupElement(listItemElement))
@@ -426,7 +426,7 @@ void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const LayoutPoint&
     HTMLElement* listItemElement = listItems[listIndex];
 
     Color backColor;
-    if (isHTMLOptionElement(listItemElement) && downcast<HTMLOptionElement>(*listItemElement).selected()) {
+    if (is<HTMLOptionElement>(listItemElement) && downcast<HTMLOptionElement>(*listItemElement).selected()) {
         if (frame().selection().isFocusedAndActive() && document().focusedElement() == &selectElement())
             backColor = theme().activeListBoxSelectionBackgroundColor();
         else
index 37eea5e..6ee1b30 100644 (file)
@@ -64,7 +64,7 @@ static size_t selectedOptionCount(const RenderMenuList& renderMenuList)
 
     size_t count = 0;
     for (size_t i = 0; i < numberOfItems; ++i) {
-        if (isHTMLOptionElement(listItems[i]) && downcast<HTMLOptionElement>(*listItems[i]).selected())
+        if (is<HTMLOptionElement>(listItems[i]) && downcast<HTMLOptionElement>(*listItems[i]).selected())
             ++count;
     }
     return count;
@@ -214,7 +214,7 @@ void RenderMenuList::updateOptionsWidth()
 
     for (int i = 0; i < size; ++i) {
         HTMLElement* element = listItems[i];
-        if (!isHTMLOptionElement(element))
+        if (!is<HTMLOptionElement>(element))
             continue;
 
         String text = downcast<HTMLOptionElement>(*element).textIndentedToRespectGroupLabel();
@@ -270,7 +270,7 @@ void RenderMenuList::setTextFromOption(int optionIndex)
     String text = emptyString();
     if (i >= 0 && i < size) {
         Element* element = listItems[i];
-        if (isHTMLOptionElement(element)) {
+        if (is<HTMLOptionElement>(element)) {
             text = downcast<HTMLOptionElement>(*element).textIndentedToRespectGroupLabel();
             m_optionStyle = element->computedStyle();
         }
@@ -452,7 +452,7 @@ String RenderMenuList::itemText(unsigned listIndex) const
     Element* element = listItems[listIndex];
     if (isHTMLOptGroupElement(element))
         itemString = downcast<HTMLOptGroupElement>(*element).groupLabelText();
-    else if (isHTMLOptionElement(element))
+    else if (is<HTMLOptionElement>(element))
         itemString = downcast<HTMLOptionElement>(*element).textIndentedToRespectGroupLabel();
 
     applyTextTransform(style(), itemString, ' ');
@@ -492,7 +492,7 @@ bool RenderMenuList::itemIsEnabled(unsigned listIndex) const
     if (listIndex >= listItems.size())
         return false;
     HTMLElement* element = listItems[listIndex];
-    if (!isHTMLOptionElement(element))
+    if (!is<HTMLOptionElement>(element))
         return false;
 
     bool groupEnabled = true;
@@ -654,7 +654,7 @@ bool RenderMenuList::itemIsSelected(unsigned listIndex) const
     if (listIndex >= listItems.size())
         return false;
     HTMLElement* element = listItems[listIndex];
-    return isHTMLOptionElement(element) && downcast<HTMLOptionElement>(*element).selected();
+    return is<HTMLOptionElement>(element) && downcast<HTMLOptionElement>(*element).selected();
 }
 
 void RenderMenuList::setTextFromItem(unsigned listIndex)
index 63c103c..9604536 100644 (file)
@@ -1035,7 +1035,7 @@ void RenderTheme::paintSliderTicks(const RenderObject& o, const PaintInfo& paint
     GraphicsContextStateSaver stateSaver(*paintInfo.context);
     paintInfo.context->setFillColor(o.style().visitedDependentColor(CSSPropertyColor), ColorSpaceDeviceRGB);
     for (unsigned i = 0; Node* node = options->item(i); i++) {
-        ASSERT(isHTMLOptionElement(node));
+        ASSERT(is<HTMLOptionElement>(node));
         HTMLOptionElement& optionElement = downcast<HTMLOptionElement>(*node);
         String value = optionElement.value();
         if (!input->isValidValue(value))
index 08ef51f..a5dde03 100644 (file)
@@ -637,7 +637,7 @@ String Internals::visiblePlaceholder(Element* element)
 #if ENABLE(INPUT_TYPE_COLOR)
 void Internals::selectColorInColorChooser(Element* element, const String& colorValue)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
     HTMLInputElement* inputElement = element->toInputElement();
     if (!inputElement)
@@ -912,7 +912,7 @@ bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec)
     if (HTMLInputElement* inputElement = textField->toInputElement())
         return inputElement->lastChangeWasUserEdit();
 
-    if (isHTMLTextAreaElement(textField))
+    if (is<HTMLTextAreaElement>(textField))
         return downcast<HTMLTextAreaElement>(*textField).lastChangeWasUserEdit();
 
     ec = INVALID_NODE_TYPE_ERR;
@@ -2083,7 +2083,7 @@ void Internals::simulateAudioInterruption(Node* node)
 
 bool Internals::isSelectPopupVisible(Node* node)
 {
-    if (!isHTMLSelectElement(node))
+    if (!is<HTMLSelectElement>(node))
         return false;
 
     HTMLSelectElement& select = downcast<HTMLSelectElement>(*node);
index 9a1f8f5..c37cf80 100644 (file)
@@ -858,7 +858,7 @@ void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlCha
     pushCurrentNode(newElement.get());
 #endif
 
-    if (isHTMLHtmlElement(*newElement))
+    if (is<HTMLHtmlElement>(*newElement))
         downcast<HTMLHtmlElement>(*newElement).insertedByParser();
 
     if (!m_parsingFragment && isFirstElement && document()->frame())
index 38511ad..d223618 100644 (file)
@@ -1,3 +1,17 @@
+2014-09-24  Christophe Dumez  <cdumez@apple.com>
+
+        Use is<HTML*Element>() instead of isHTML*Element() - Part 1
+        https://bugs.webkit.org/show_bug.cgi?id=137068
+
+        Reviewed by Ryosuke Niwa.
+
+        Start using is<HTML*Element>() instead of isHTML*Element().
+        Remaining usages will be updated in a follow-up patch to
+        reduce the size of the change.
+
+        * WebCoreSupport/WebChromeClientIOS.mm:
+        (WebChromeClientIOS::focusedElementChanged):
+
 2014-09-21  Timothy Hatcher  <timothy@apple.com>
 
         Make the Web Inspector use a separate web process.
index 2b65bb0..185c663 100644 (file)
@@ -311,7 +311,7 @@ void WebChromeClientIOS::focusedElementChanged(Element* element)
 {
     if (!element)
         return;
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*element);
index 45aa8e7..62ebe80 100644 (file)
@@ -1,3 +1,26 @@
+2014-09-24  Christophe Dumez  <cdumez@apple.com>
+
+        Use is<HTML*Element>() instead of isHTML*Element() - Part 1
+        https://bugs.webkit.org/show_bug.cgi?id=137068
+
+        Reviewed by Ryosuke Niwa.
+
+        Start using is<HTML*Element>() instead of isHTML*Element().
+        Remaining usages will be updated in a follow-up patch to
+        reduce the size of the change.
+
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::focusedElementChanged):
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::textFieldDidBeginEditing):
+        (WebEditorClient::textFieldDidEndEditing):
+        (WebEditorClient::textDidChangeInTextField):
+        (WebEditorClient::doTextFieldCommandFromEvent):
+        (WebEditorClient::textWillBeDeletedInTextField):
+        (WebEditorClient::textDidChangeInTextArea):
+        * WebView/WebHTMLRepresentation.mm:
+        (inputElementFromDOMElement):
+
 2014-09-21  Timothy Hatcher  <timothy@apple.com>
 
         Make the Web Inspector use a separate web process.
index 24de67a..936f454 100644 (file)
@@ -220,7 +220,7 @@ void WebChromeClient::focusedElementChanged(Element* element)
 {
     if (!element)
         return;
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*element);
index a69492c..8840549 100644 (file)
@@ -705,7 +705,7 @@ void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
 
 void WebEditorClient::textFieldDidBeginEditing(Element* element)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     DOMHTMLInputElement* inputElement = kit(downcast<HTMLInputElement>(element));
@@ -715,7 +715,7 @@ void WebEditorClient::textFieldDidBeginEditing(Element* element)
 
 void WebEditorClient::textFieldDidEndEditing(Element* element)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     DOMHTMLInputElement* inputElement = kit(downcast<HTMLInputElement>(element));
@@ -725,7 +725,7 @@ void WebEditorClient::textFieldDidEndEditing(Element* element)
 
 void WebEditorClient::textDidChangeInTextField(Element* element)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
 #if !PLATFORM(IOS)
@@ -763,7 +763,7 @@ static SEL selectorForKeyEvent(KeyboardEvent* event)
 
 bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return NO;
 
     DOMHTMLInputElement* inputElement = kit(downcast<HTMLInputElement>(element));
@@ -775,7 +775,7 @@ bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEven
 
 void WebEditorClient::textWillBeDeletedInTextField(Element* element)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     DOMHTMLInputElement* inputElement = kit(downcast<HTMLInputElement>(element));
@@ -786,7 +786,7 @@ void WebEditorClient::textWillBeDeletedInTextField(Element* element)
 
 void WebEditorClient::textDidChangeInTextArea(Element* element)
 {
-    if (!isHTMLTextAreaElement(element))
+    if (!is<HTMLTextAreaElement>(element))
         return;
 
     DOMHTMLTextAreaElement* textAreaElement = kit(downcast<HTMLTextAreaElement>(element));
index 092e58d..9b9de7a 100644 (file)
@@ -305,7 +305,7 @@ static HTMLFormElement* formElementFromDOMElement(DOMElement *element)
 static HTMLInputElement* inputElementFromDOMElement(DOMElement* element)
 {
     Element* node = core(element);
-    return node && isHTMLInputElement(node) ? downcast<HTMLInputElement>(node) : nullptr;
+    return node && is<HTMLInputElement>(node) ? downcast<HTMLInputElement>(node) : nullptr;
 }
 
 - (BOOL)elementDoesAutoComplete:(DOMElement *)element
index 20ffc3b..122ced5 100644 (file)
@@ -1,3 +1,46 @@
+2014-09-24  Christophe Dumez  <cdumez@apple.com>
+
+        Use is<HTML*Element>() instead of isHTML*Element() - Part 1
+        https://bugs.webkit.org/show_bug.cgi?id=137068
+
+        Reviewed by Ryosuke Niwa.
+
+        Start using is<HTML*Element>() instead of isHTML*Element().
+        Remaining usages will be updated in a follow-up patch to
+        reduce the size of the change.
+
+        * DOMCoreClasses.cpp:
+        (DOMElement::createInstance):
+        * DOMHTMLClasses.cpp:
+        (DOMHTMLOptionElement::text):
+        (DOMHTMLOptionElement::label):
+        (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):
+        (DOMHTMLTextAreaElement::form):
+        (DOMHTMLTextAreaElement::value):
+        (DOMHTMLTextAreaElement::setValue):
+        (DOMHTMLTextAreaElement::select):
+        (DOMHTMLTextAreaElement::isUserEdited):
+        * WebFrame.cpp:
+        (inputElementFromDOMElement):
+
 2014-09-21  Timothy Hatcher  <timothy@apple.com>
 
         Make the Web Inspector use a separate web process.
index 8b9d52e..000f2a6 100644 (file)
@@ -1506,16 +1506,16 @@ IDOMElement* DOMElement::createInstance(WebCore::Element* e)
     } else if (e->hasTagName(iframeTag)) {
         DOMHTMLIFrameElement* newElement = new DOMHTMLIFrameElement(e);
         hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
-    } else if (isHTMLInputElement(e)) {
+    } else if (is<HTMLInputElement>(e)) {
         DOMHTMLInputElement* newElement = new DOMHTMLInputElement(e);
         hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
-    } else if (isHTMLOptionElement(e)) {
+    } else if (is<HTMLOptionElement>(e)) {
         DOMHTMLOptionElement* newElement = new DOMHTMLOptionElement(e);
         hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
     } else if (e->hasTagName(selectTag)) {
         DOMHTMLSelectElement* newElement = new DOMHTMLSelectElement(e);
         hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
-    } else if (isHTMLTextAreaElement(e)) {
+    } else if (is<HTMLTextAreaElement>(e)) {
         DOMHTMLTextAreaElement* newElement = new DOMHTMLTextAreaElement(e);
         hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
     } else if (e->isHTMLElement()) {
index cc6e34c..7ffaeac 100644 (file)
@@ -859,7 +859,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::text(
     *result = 0;
 
     ASSERT(m_element);
-    ASSERT(isHTMLOptionElement(m_element));
+    ASSERT(is<HTMLOptionElement>(m_element));
     HTMLOptionElement& optionElement = downcast<HTMLOptionElement>(*m_element);
 
     *result = BString(optionElement.text()).release();
@@ -896,7 +896,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLOptionElement::label(
     *result = 0;
 
     ASSERT(m_element);
-    ASSERT(isHTMLOptionElement(m_element));
+    ASSERT(is<HTMLOptionElement>(m_element));
     HTMLOptionElement& optionElement = downcast<HTMLOptionElement>(*m_element);
 
     *result = BString(optionElement.label()).release();
@@ -992,7 +992,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::form(
     if (!result)
         return E_POINTER;
     *result = nullptr;
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     COMPtr<IDOMElement> domElement;
     domElement.adoptRef(DOMHTMLElement::createInstance(inputElement.form()));
@@ -1074,7 +1074,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setChecked(
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::disabled( 
         /* [retval][out] */ BOOL* result)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     *result = inputElement.isDisabledFormControl() ? TRUE : FALSE;
     return S_OK;
@@ -1118,7 +1118,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setName(
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::readOnly( 
         /* [retval][out] */ BOOL* result)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     *result = inputElement.isReadOnly() ? TRUE : FALSE;
     return S_OK;
@@ -1183,7 +1183,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::type(
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setType( 
         /* [in] */ BSTR type)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     WTF::String typeString(type, SysStringLen(type));
     inputElement.setType(typeString);
@@ -1207,7 +1207,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setUseMap(
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::value( 
         /* [retval][out] */ BSTR* result)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     WTF::String valueString = inputElement.value();
     *result = BString(valueString).release();
@@ -1219,7 +1219,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::value(
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValue( 
         /* [in] */ BSTR value)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     inputElement.setValue(String((UChar*) value, SysStringLen(value)));
     return S_OK;
@@ -1229,7 +1229,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValueForUser(
         /* [in] */ BSTR value)
 {
     ASSERT(m_element);
-    ASSERT(isHTMLInputElement(m_element));
+    ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     inputElement.setValueForUser(String(static_cast<UChar*>(value), SysStringLen(value)));
     return S_OK;
@@ -1237,7 +1237,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setValueForUser(
 
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::select( void)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     inputElement.select();
     return S_OK;
@@ -1252,7 +1252,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::click( void)
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionStart( 
     /* [in] */ long start)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     inputElement.setSelectionStart(start);
     return S_OK;
@@ -1261,7 +1261,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionStart(
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionStart( 
     /* [retval][out] */ long *start)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     *start = inputElement.selectionStart();
     return S_OK;
@@ -1270,7 +1270,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionStart(
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionEnd( 
     /* [in] */ long end)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     inputElement.setSelectionEnd(end);
     return S_OK;
@@ -1279,7 +1279,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setSelectionEnd(
 HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectionEnd( 
     /* [retval][out] */ long *end)
 {
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     *end = inputElement.selectionEnd();
     return S_OK;
@@ -1291,7 +1291,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isTextField(
     /* [retval][out] */ BOOL* result)
 {
     ASSERT(m_element);
-    ASSERT(isHTMLInputElement(m_element));
+    ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     *result = inputElement.isTextField() ? TRUE : FALSE;
     return S_OK;
@@ -1301,7 +1301,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::rectOnScreen(
     /* [retval][out] */ LPRECT rect)
 {
     ASSERT(m_element);
-    ASSERT(isHTMLInputElement(m_element));
+    ASSERT(is<HTMLInputElement>(m_element));
     rect->left = rect->top = rect->right = rect->bottom = 0;
     RenderObject* renderer = m_element->renderer();
     FrameView* view = m_element->document().view();
@@ -1327,7 +1327,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::replaceCharactersInRange(
         return E_POINTER;
 
     ASSERT(m_element);
-    ASSERT(isHTMLInputElement(m_element));
+    ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
 
     String newValue = inputElement.value();
@@ -1344,7 +1344,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectedRange(
     /* [out] */ int* end)
 {
     ASSERT(m_element);
-    ASSERT(isHTMLInputElement(m_element));
+    ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     *start = inputElement.selectionStart();
     *end = inputElement.selectionEnd();
@@ -1355,7 +1355,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::setAutofilled(
     /* [in] */ BOOL filled)
 {
     ASSERT(m_element);
-    ASSERT(isHTMLInputElement(m_element));
+    ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     inputElement.setAutofilled(!!filled);
     return S_OK;
@@ -1365,7 +1365,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isAutofilled(
     /* [retval][out] */ BOOL* result)
 {
     ASSERT(m_element);
-    ASSERT(isHTMLInputElement(m_element));
+    ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
     *result = inputElement.isAutofilled() ? TRUE : FALSE;
     return S_OK;
@@ -1380,7 +1380,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isUserEdited(
         return E_POINTER;
 
     *result = FALSE;
-    ASSERT(m_element && isHTMLInputElement(m_element));
+    ASSERT(m_element && is<HTMLInputElement>(m_element));
     BOOL textField = FALSE;
     if (FAILED(isTextField(&textField)) || !textField)
         return S_OK;
@@ -1427,7 +1427,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::form(
     if (!result)
         return E_POINTER;
     *result = 0;
-    ASSERT(m_element && isHTMLTextAreaElement(m_element));
+    ASSERT(m_element && is<HTMLTextAreaElement>(m_element));
     HTMLTextAreaElement& textareaElement = downcast<HTMLTextAreaElement>(*m_element);
     COMPtr<IDOMElement> domElement;
     domElement.adoptRef(DOMHTMLElement::createInstance(textareaElement.form()));
@@ -1544,7 +1544,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::type(
 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::value( 
         /* [retval][out] */ BSTR* result)
 {
-    ASSERT(m_element && isHTMLTextAreaElement(m_element));
+    ASSERT(m_element && is<HTMLTextAreaElement>(m_element));
     HTMLTextAreaElement& textareaElement = downcast<HTMLTextAreaElement>(*m_element);
     WTF::String valueString = textareaElement.value();
     *result = BString(valueString).release();
@@ -1556,7 +1556,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::value(
 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setValue( 
         /* [in] */ BSTR value)
 {
-    ASSERT(m_element && isHTMLTextAreaElement(m_element));
+    ASSERT(m_element && is<HTMLTextAreaElement>(m_element));
     HTMLTextAreaElement& textareaElement = downcast<HTMLTextAreaElement>(*m_element);
     textareaElement.setValue(String((UChar*) value, SysStringLen(value)));
     return S_OK;
@@ -1564,7 +1564,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::setValue(
     
 HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::select( void)
 {
-    ASSERT(m_element && isHTMLTextAreaElement(m_element));
+    ASSERT(m_element && is<HTMLTextAreaElement>(m_element));
     HTMLTextAreaElement& textareaElement = downcast<HTMLTextAreaElement>(*m_element);
     textareaElement.select();
     return S_OK;
@@ -1579,7 +1579,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::isUserEdited(
         return E_POINTER;
 
     *result = FALSE;
-    ASSERT(m_element && isHTMLTextAreaElement(m_element));
+    ASSERT(m_element && is<HTMLTextAreaElement>(m_element));
     if (downcast<HTMLTextAreaElement>(*m_element).lastChangeWasUserEdit())
         *result = TRUE;
     return S_OK;
index 8c6c45c..d50bafd 100644 (file)
@@ -219,7 +219,7 @@ static HTMLInputElement* inputElementFromDOMElement(IDOMElement* element)
         Element* ele;
         hr = elePriv->coreElement((void**)&ele);
         elePriv->Release();
-        if (SUCCEEDED(hr) && ele && isHTMLInputElement(ele))
+        if (SUCCEEDED(hr) && ele && is<HTMLInputElement>(ele))
             return downcast<HTMLInputElement>(ele);
     }
     return nullptr;
index fbfb8dc..84ca254 100644 (file)
@@ -1,3 +1,37 @@
+2014-09-24  Christophe Dumez  <cdumez@apple.com>
+
+        Use is<HTML*Element>() instead of isHTML*Element() - Part 1
+        https://bugs.webkit.org/show_bug.cgi?id=137068
+
+        Reviewed by Ryosuke Niwa.
+
+        Start using is<HTML*Element>() instead of isHTML*Element().
+        Remaining usages will be updated in a follow-up patch to
+        reduce the size of the change.
+
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser):
+        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled):
+        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled):
+        (WebKit::InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit):
+        (WebKit::InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit):
+        (WebKit::InjectedBundleNodeHandle::isTextField):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::focusedElementChanged):
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::textFieldDidBeginEditing):
+        (WebKit::WebEditorClient::textFieldDidEndEditing):
+        (WebKit::WebEditorClient::textDidChangeInTextField):
+        (WebKit::WebEditorClient::textDidChangeInTextArea):
+        (WebKit::WebEditorClient::doTextFieldCommandFromEvent):
+        (WebKit::WebEditorClient::textWillBeDeletedInTextField):
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::containsAnyFormControls):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::setAssistedNodeValue):
+        (WebKit::WebPage::setAssistedNodeValueAsNumber):
+        (WebKit::WebPage::setAssistedNodeSelectedIndex):
+
 2014-09-23  Ada Chan  <adachan@apple.com>
 
         Add stub implementation of WKPageIsPlayingAudio().
index c612c2c..ced90ac 100644 (file)
@@ -199,7 +199,7 @@ PassRefPtr<InjectedBundleRangeHandle> InjectedBundleNodeHandle::visibleRange() c
 
 void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& value)
 {
-    if (!isHTMLInputElement(*m_node))
+    if (!is<HTMLInputElement>(*m_node))
         return;
 
     downcast<HTMLInputElement>(*m_node).setValueForUser(value);
@@ -207,7 +207,7 @@ void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& val
 
 bool InjectedBundleNodeHandle::isHTMLInputElementAutofilled() const
 {
-    if (!isHTMLInputElement(*m_node))
+    if (!is<HTMLInputElement>(*m_node))
         return false;
     
     return downcast<HTMLInputElement>(*m_node).isAutofilled();
@@ -215,7 +215,7 @@ bool InjectedBundleNodeHandle::isHTMLInputElementAutofilled() const
 
 void InjectedBundleNodeHandle::setHTMLInputElementAutofilled(bool filled)
 {
-    if (!isHTMLInputElement(*m_node))
+    if (!is<HTMLInputElement>(*m_node))
         return;
 
     downcast<HTMLInputElement>(*m_node).setAutofilled(filled);
@@ -223,7 +223,7 @@ void InjectedBundleNodeHandle::setHTMLInputElementAutofilled(bool filled)
 
 bool InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit()
 {
-    if (!isHTMLInputElement(*m_node))
+    if (!is<HTMLInputElement>(*m_node))
         return false;
 
     return downcast<HTMLInputElement>(*m_node).lastChangeWasUserEdit();
@@ -231,7 +231,7 @@ bool InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit()
 
 bool InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit()
 {
-    if (!isHTMLTextAreaElement(*m_node))
+    if (!is<HTMLTextAreaElement>(*m_node))
         return false;
 
     return downcast<HTMLTextAreaElement>(*m_node).lastChangeWasUserEdit();
@@ -239,7 +239,7 @@ bool InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit()
 
 bool InjectedBundleNodeHandle::isTextField() const
 {
-    return isHTMLInputElement(*m_node) && downcast<HTMLInputElement>(*m_node).isText();
+    return is<HTMLInputElement>(*m_node) && downcast<HTMLInputElement>(*m_node).isText();
 }
 
 PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::htmlTableCellElementCellAbove()
index b51763e..c2d5110 100644 (file)
@@ -178,7 +178,7 @@ void WebChromeClient::focusedElementChanged(Element* element)
 {
     if (!element)
         return;
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*element);
index 121417e..4b529a9 100644 (file)
@@ -295,7 +295,7 @@ void WebEditorClient::handleInputMethodKeydown(KeyboardEvent*)
 
 void WebEditorClient::textFieldDidBeginEditing(Element* element)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
@@ -306,7 +306,7 @@ void WebEditorClient::textFieldDidBeginEditing(Element* element)
 
 void WebEditorClient::textFieldDidEndEditing(Element* element)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
@@ -317,7 +317,7 @@ void WebEditorClient::textFieldDidEndEditing(Element* element)
 
 void WebEditorClient::textDidChangeInTextField(Element* element)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     bool initiatedByUserTyping = UserTypingGestureIndicator::processingUserTypingGesture() && UserTypingGestureIndicator::focusedElementAtGestureStart() == element;
@@ -330,7 +330,7 @@ void WebEditorClient::textDidChangeInTextField(Element* element)
 
 void WebEditorClient::textDidChangeInTextArea(Element* element)
 {
-    if (!isHTMLTextAreaElement(element))
+    if (!is<HTMLTextAreaElement>(element))
         return;
 
     WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
@@ -393,7 +393,7 @@ static API::InjectedBundle::FormClient::InputFieldAction toInputFieldAction(WKIn
 
 bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return false;
 
     WKInputFieldActionType actionType = static_cast<WKInputFieldActionType>(0);
@@ -408,7 +408,7 @@ bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEven
 
 void WebEditorClient::textWillBeDeletedInTextField(Element* element)
 {
-    if (!isHTMLInputElement(element))
+    if (!is<HTMLInputElement>(element))
         return;
 
     WebFrame* webFrame = WebFrame::fromCoreFrame(*element->document().frame());
index 20599d7..372de43 100644 (file)
@@ -633,7 +633,7 @@ bool WebFrame::containsAnyFormControls() const
     for (Node* node = document->documentElement(); node; node = NodeTraversal::next(node)) {
         if (!node->isElementNode())
             continue;
-        if (isHTMLInputElement(node) || isHTMLSelectElement(node) || isHTMLTextAreaElement(node))
+        if (is<HTMLInputElement>(node) || is<HTMLSelectElement>(node) || is<HTMLTextAreaElement>(node))
             return true;
     }
     return false;
index b4af020..e7af1ad 100644 (file)
@@ -612,7 +612,7 @@ void WebPage::setAssistedNodeValue(const String& value)
 {
     if (!m_assistedNode)
         return;
-    if (isHTMLInputElement(*m_assistedNode)) {
+    if (is<HTMLInputElement>(*m_assistedNode)) {
         HTMLInputElement& element = downcast<HTMLInputElement>(*m_assistedNode);
         element.setValue(value, DispatchInputAndChangeEvent);
     }
@@ -623,7 +623,7 @@ void WebPage::setAssistedNodeValueAsNumber(double value)
 {
     if (!m_assistedNode)
         return;
-    if (isHTMLInputElement(*m_assistedNode)) {
+    if (is<HTMLInputElement>(*m_assistedNode)) {
         HTMLInputElement& element = downcast<HTMLInputElement>(*m_assistedNode);
         element.setValueAsNumber(value, ASSERT_NO_EXCEPTION, DispatchInputAndChangeEvent);
     }
@@ -631,7 +631,7 @@ void WebPage::setAssistedNodeValueAsNumber(double value)
 
 void WebPage::setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection)
 {
-    if (!m_assistedNode || !isHTMLSelectElement(*m_assistedNode))
+    if (!m_assistedNode || !is<HTMLSelectElement>(*m_assistedNode))
         return;
     HTMLSelectElement& select = downcast<HTMLSelectElement>(*m_assistedNode);
     select.optionSelectedByUser(index, true, allowMultipleSelection);
@@ -1990,11 +1990,11 @@ void WebPage::performActionOnElement(uint32_t action)
 
 static inline bool isAssistableNode(Node* node)
 {
-    if (isHTMLSelectElement(node))
+    if (is<HTMLSelectElement>(node))
         return true;
-    if (isHTMLTextAreaElement(node))
+    if (is<HTMLTextAreaElement>(node))
         return !downcast<HTMLTextAreaElement>(*node).isReadOnlyNode();
-    if (isHTMLInputElement(node)) {
+    if (is<HTMLInputElement>(node)) {
         HTMLInputElement& element = downcast<HTMLInputElement>(*node);
         return !element.isReadOnlyNode() && (element.isTextField() || element.isDateField() || element.isDateTimeLocalField() || element.isMonthField() || element.isTimeField());
     }
@@ -2066,7 +2066,7 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
     information.hasNextNode = hasFocusableElement(m_assistedNode.get(), m_page.get(), true);
     information.hasPreviousNode = hasFocusableElement(m_assistedNode.get(), m_page.get(), false);
 
-    if (isHTMLSelectElement(*m_assistedNode)) {
+    if (is<HTMLSelectElement>(*m_assistedNode)) {
         HTMLSelectElement& element = downcast<HTMLSelectElement>(*m_assistedNode);
         information.elementType = InputType::Select;
         const Vector<HTMLElement*>& items = element.listItems();
@@ -2077,7 +2077,7 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
         // If a select does not have groups, all the option elements have group ID 0.
         for (size_t i = 0; i < count; ++i) {
             HTMLElement* item = items[i];
-            if (isHTMLOptionElement(item)) {
+            if (is<HTMLOptionElement>(item)) {
                 HTMLOptionElement& option = downcast<HTMLOptionElement>(*item);
                 information.selectOptions.append(OptionItem(option.text(), false, parentGroupID, option.selected(), option.fastHasAttribute(WebCore::HTMLNames::disabledAttr)));
             } else if (isHTMLOptGroupElement(item)) {
@@ -2088,14 +2088,14 @@ void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information)
         }
         information.selectedIndex = element.selectedIndex();
         information.isMultiSelect = element.multiple();
-    } else if (isHTMLTextAreaElement(*m_assistedNode)) {
+    } else if (is<HTMLTextAreaElement>(*m_assistedNode)) {
         HTMLTextAreaElement& element = downcast<HTMLTextAreaElement>(*m_assistedNode);
         information.autocapitalizeType = static_cast<WebAutocapitalizeType>(element.autocapitalizeType());
         information.isAutocorrect = element.autocorrect();
         information.elementType = InputType::TextArea;
         information.isReadOnly = element.isReadOnly();
         information.value = element.value();
-    } else if (isHTMLInputElement(*m_assistedNode)) {
+    } else if (is<HTMLInputElement>(*m_assistedNode)) {
         HTMLInputElement& element = downcast<HTMLInputElement>(*m_assistedNode);
         HTMLFormElement* form = element.form();
         if (form)