Generate more HTML type checks and casting
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Sep 2013 08:02:57 +0000 (08:02 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Sep 2013 08:02:57 +0000 (08:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121080

Reviewed by Andreas Kling.

Clean-up remained functions of HTML elements using auto-generated isFooElement(),
and replace toFooElement() with ELEMENT_TYPE_CASTS() macro.

Besides this patch clean-up unnecessary checks which are being supported by
auto-generated isFooElement().

Source/WebCore:

No new tests, no behavior change.

* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::notifyChildrenSelectionChange):
* html/HTMLFrameElementBase.h:
(WebCore::toHTMLFrameElementBase):
* html/HTMLIFrameElement.h:
* html/HTMLImageLoader.cpp:
(WebCore::HTMLImageLoader::dispatchLoadEvent):
(WebCore::HTMLImageLoader::notifyFinished):
* html/HTMLObjectElemenaeh:
* html/HTMLOptionsCollection.cpp:
(WebCore::HTMLOptionsCollection::HTMLOptionsCollection):
* html/HTMLSelectElement.h:
* html/HTMLTagNames.in:
* html/HTMLVideoElement.h:
* html/shadow/HTMLContentElement.h:
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::dispatchPendingBeforeLoadEvent):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* page/PageSerializer.cpp:
(WebCore::frameOwnerURLAttributeName):
* page/SpatialNavigation.cpp:
(WebCore::canScrollInDirection):
* platform/gtk/PasteboardGtk.cpp:
(WebCore::getURLForImageNode):
* plugins/IFrameShimSupport.cpp:
(WebCore::getPluginOcclusions):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::mediaSupportsFullscreen):
(WebCore::HitTestResult::mediaElement):
(WebCore::HitTestResult::enterFullscreenForVideo):
(WebCore::HitTestResult::mediaIsVideo):

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForVideo):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::RenderListBox):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::RenderMenuList):
* testing/Internals.cpp:
(WebCore::Internals::isSelectPopupVisible):

Source/WebKit/blackberry:

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::adjustRectOffsetForFrameOffset):
(BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited):
(BlackBerry::WebKit::WebPagePrivate::enterFullscreenForNode):
(BlackBerry::WebKit::WebPagePrivate::exitFullscreenForNode):
(BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
(BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::supportsFullscreenForNode):
* WebCoreSupport/EditorClientBlackBerry.cpp:
(WebCore::EditorClientBlackBerry::shouldChangeSelectedRange):
* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::isElementTypePlugin):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::willOpenPopupForNode):
(BlackBerry::WebKit::InputHandler::didNodeOpenPopup):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):

Source/WebKit/gtk:

No new tests, no behavior change.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::supportsFullscreenForNode):

Source/WebKit/mac:

No new tests, no behavior change.

* Plugins/WebPluginController.mm:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::supportsFullscreenForNode):
* WebView/WebView.mm:
(-[WebView _enterFullscreenForNode:WebCore::]):

Source/WebKit/qt:

* WebCoreSupport/ChromeClientQt.cpp:

Source/WebKit/win:

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::supportsFullscreenForNode):
* WebView.cpp:
(WebView::enterFullscreenForNode):

Source/WebKit2:

* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::containsAnyFormControls):

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

42 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
Source/WebCore/html/HTMLFrameElementBase.h
Source/WebCore/html/HTMLIFrameElement.h
Source/WebCore/html/HTMLImageLoader.cpp
Source/WebCore/html/HTMLObjectElement.h
Source/WebCore/html/HTMLOptionsCollection.cpp
Source/WebCore/html/HTMLSelectElement.h
Source/WebCore/html/HTMLTagNames.in
Source/WebCore/html/HTMLVideoElement.h
Source/WebCore/html/shadow/HTMLContentElement.h
Source/WebCore/loader/ImageLoader.cpp
Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/page/SpatialNavigation.cpp
Source/WebCore/platform/gtk/PasteboardGtk.cpp
Source/WebCore/plugins/IFrameShimSupport.cpp
Source/WebCore/rendering/HitTestResult.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp
Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp
Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp
Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Plugins/WebPluginController.mm
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

index b4f8898..dd0cf6d 100644 (file)
@@ -1,3 +1,60 @@
+2013-09-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Generate more HTML type checks and casting
+        https://bugs.webkit.org/show_bug.cgi?id=121080
+
+        Reviewed by Andreas Kling.
+
+        Clean-up remained functions of HTML elements using auto-generated isFooElement(),
+        and replace toFooElement() with ELEMENT_TYPE_CASTS() macro.
+
+        Besides this patch clean-up unnecessary checks which are being supported by
+        auto-generated isFooElement().
+
+        No new tests, no behavior change.
+
+        * accessibility/atk/AXObjectCacheAtk.cpp:
+        (WebCore::notifyChildrenSelectionChange):
+        * html/HTMLFrameElementBase.h:
+        (WebCore::toHTMLFrameElementBase):
+        * html/HTMLIFrameElement.h:
+        * html/HTMLImageLoader.cpp:
+        (WebCore::HTMLImageLoader::dispatchLoadEvent):
+        (WebCore::HTMLImageLoader::notifyFinished):
+        * html/HTMLObjectElemenaeh:
+        * html/HTMLOptionsCollection.cpp:
+        (WebCore::HTMLOptionsCollection::HTMLOptionsCollection):
+        * html/HTMLSelectElement.h:
+        * html/HTMLTagNames.in:
+        * html/HTMLVideoElement.h:
+        * html/shadow/HTMLContentElement.h:
+        * loader/ImageLoader.cpp:
+        (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        * page/PageSerializer.cpp:
+        (WebCore::frameOwnerURLAttributeName):
+        * page/SpatialNavigation.cpp:
+        (WebCore::canScrollInDirection):
+        * platform/gtk/PasteboardGtk.cpp:
+        (WebCore::getURLForImageNode):
+        * plugins/IFrameShimSupport.cpp:
+        (WebCore::getPluginOcclusions):
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::mediaSupportsFullscreen):
+        (WebCore::HitTestResult::mediaElement):
+        (WebCore::HitTestResult::enterFullscreenForVideo):
+        (WebCore::HitTestResult::mediaIsVideo):
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForVideo):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::RenderListBox):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::RenderMenuList):
+        * testing/Internals.cpp:
+        (WebCore::Internals::isSelectPopupVisible):
+
 2013-09-11  Chris Fleizach  <cfleizach@apple.com>
 
         AX: Mac platform is not using accessibilityTitle from the Base implementation
index 2cc09bd..253b12a 100644 (file)
@@ -86,7 +86,7 @@ static void notifyChildrenSelectionChange(AccessibilityObject* object)
 
     // Only support HTML select elements so far (ARIA selectors not supported).
     Node* node = object->node();
-    if (!node || !node->hasTagName(HTMLNames::selectTag))
+    if (!node || !isHTMLSelectElement(node))
         return;
 
     // Emit signal from the listbox's point of view first.
index 499f2bd..388060a 100644 (file)
@@ -83,7 +83,7 @@ private:
 
 inline HTMLFrameElementBase* toHTMLFrameElementBase(Node* node)
 {
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::frameTag) || node->hasTagName(HTMLNames::iframeTag));
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLFrameElement(node) || isHTMLIFrameElement(node));
     return static_cast<HTMLFrameElementBase*>(node);
 }
 
index c893462..67a5887 100644 (file)
@@ -47,11 +47,7 @@ private:
     virtual void didRecalcStyle(Style::Change) OVERRIDE;
 };
 
-inline HTMLIFrameElement* toHTMLIFrameElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::iframeTag));
-    return static_cast<HTMLIFrameElement*>(node);
-}
+ELEMENT_TYPE_CASTS(HTMLIFrameElement)
 
 } // namespace WebCore
 
index d345f82..7c0e6cb 100644 (file)
@@ -49,12 +49,12 @@ HTMLImageLoader::~HTMLImageLoader()
 void HTMLImageLoader::dispatchLoadEvent()
 {
     // HTMLVideoElement uses this class to load the poster image, but it should not fire events for loading or failure.
-    if (element()->hasTagName(HTMLNames::videoTag))
+    if (isHTMLVideoElement(element()))
         return;
 
     bool errorOccurred = image()->errorOccurred();
     if (!errorOccurred && image()->response().httpStatusCode() >= 400)
-        errorOccurred = element()->hasTagName(HTMLNames::objectTag); // An <object> considers a 404 to be an error and should fire onerror.
+        errorOccurred = isHTMLObjectElement(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 && element->hasTagName(HTMLNames::objectTag))
+    if (loadError && isHTMLObjectElement(element.get()))
         static_cast<HTMLObjectElement*>(element.get())->renderFallbackContent();
 }
 
index 31d2fd0..042b329 100644 (file)
@@ -109,11 +109,7 @@ private:
     bool m_useFallbackContent : 1;
 };
 
-inline HTMLObjectElement* toHTMLObjectElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::objectTag));
-    return static_cast<HTMLObjectElement*>(node);
-}
+ELEMENT_TYPE_CASTS(HTMLObjectElement)
 
 }
 
index ddcfcb4..653fccd 100644 (file)
@@ -30,7 +30,7 @@ namespace WebCore {
 HTMLOptionsCollection::HTMLOptionsCollection(Node* select)
     : HTMLCollection(select, SelectOptions, DoesNotOverrideItemAfter)
 {
-    ASSERT(select->hasTagName(HTMLNames::selectTag));
+    ASSERT(isHTMLSelectElement(select));
 }
 
 PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(Node* select, CollectionType)
index 3153a06..5140a66 100644 (file)
@@ -202,11 +202,7 @@ private:
     mutable bool m_shouldRecalcListItems;
 };
 
-inline HTMLSelectElement* toHTMLSelectElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::selectTag));
-    return static_cast<HTMLSelectElement*>(node);
-}
+ELEMENT_TYPE_CASTS(HTMLSelectElement)
 
 } // namespace
 
index a53031e..6d6f026 100644 (file)
@@ -31,7 +31,7 @@ code interfaceName=HTMLElement
 col interfaceName=HTMLTableColElement
 colgroup interfaceName=HTMLTableColElement
 command interfaceName=HTMLElement
-content interfaceName=HTMLContentElement, conditional=SHADOW_DOM, runtimeConditional=shadowDOM
+content interfaceName=HTMLContentElement, conditional=SHADOW_DOM, runtimeConditional=shadowDOM, generateTypeHelpers
 webkitShadowContent interfaceName=HTMLElement, noConstructor
 datalist interfaceName=HTMLDataListElement, conditional=DATALIST_ELEMENT
 dd interfaceName=HTMLElement
@@ -50,7 +50,7 @@ figure interfaceName=HTMLElement
 font
 footer interfaceName=HTMLElement
 form generateTypeHelpers
-frame
+frame generateTypeHelpers
 frameset interfaceName=HTMLFrameSetElement, generateTypeHelpers
 h1 interfaceName=HTMLHeadingElement
 h2 interfaceName=HTMLHeadingElement
@@ -64,7 +64,7 @@ hgroup interfaceName=HTMLElement
 hr interfaceName=HTMLHRElement
 html
 i interfaceName=HTMLElement
-iframe interfaceName=HTMLIFrameElement
+iframe interfaceName=HTMLIFrameElement, generateTypeHelpers
 image interfaceName=HTMLElement
 img interfaceName=HTMLImageElement, constructorNeedsFormElement, generateTypeHelpers
 input constructorNeedsFormElement, constructorNeedsCreatedByParser, generateTypeHelpers
@@ -90,7 +90,7 @@ nobr interfaceName=HTMLElement
 noembed interfaceName=HTMLElement
 noframes interfaceName=HTMLElement
 nolayer interfaceName=HTMLElement
-object constructorNeedsFormElement, constructorNeedsCreatedByParser
+object constructorNeedsFormElement, constructorNeedsCreatedByParser, generateTypeHelpers
 ol interfaceName=HTMLOListElement
 optgroup interfaceName=HTMLOptGroupElement, generateTypeHelpers
 option generateTypeHelpers
@@ -108,7 +108,7 @@ s interfaceName=HTMLElement
 samp interfaceName=HTMLElement
 script constructorNeedsCreatedByParser, generateTypeHelpers
 section interfaceName=HTMLElement
-select constructorNeedsFormElement
+select constructorNeedsFormElement, generateTypeHelpers
 small interfaceName=HTMLElement
 source wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, generateTypeHelpers
 span
@@ -133,7 +133,7 @@ tt interfaceName=HTMLElement
 u interfaceName=HTMLElement
 ul interfaceName=HTMLUListElement
 var interfaceName=HTMLElement
-video wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser
+video wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, generateTypeHelpers
 wbr interfaceName=HTMLElement
 xmp interfaceName=HTMLPreElement
 noscript interfaceName=HTMLElement
index 86cd1de..cdd69bf 100644 (file)
@@ -98,11 +98,7 @@ private:
     AtomicString m_defaultPosterURL;
 };
 
-inline HTMLVideoElement* toHTMLVideoElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::videoTag));
-    return static_cast<HTMLVideoElement*>(node);
-}
+ELEMENT_TYPE_CASTS(HTMLVideoElement)
 
 } //namespace
 
index 5380888..41dc6b3 100644 (file)
@@ -80,18 +80,6 @@ inline const CSSSelectorList& HTMLContentElement::selectorList()
     return m_selectorList;
 }
 
-inline bool isHTMLContentElement(const Node* node)
-{
-    ASSERT(node);
-    return node->isInsertionPoint() && toInsertionPoint(node)->insertionPointType() == InsertionPoint::HTMLContentElementType;
-}
-
-inline HTMLContentElement* toHTMLContentElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLContentElement(node));
-    return static_cast<HTMLContentElement*>(node);
-}
-
 #endif // if ENABLE(SHADOW_DOM)
 
 }
index 59338df..d35d5c9 100644 (file)
@@ -416,7 +416,7 @@ void ImageLoader::dispatchPendingBeforeLoadEvent()
     loadEventSender().cancelEvent(this);
     m_hasPendingLoadEvent = false;
     
-    if (m_element->hasTagName(HTMLNames::objectTag))
+    if (isHTMLObjectElement(m_element))
         static_cast<HTMLObjectElement*>(m_element)->renderFallbackContent();
 
     // Only consider updating the protection ref-count of the Element immediately before returning
index 9a58864..ffebe3d 100644 (file)
@@ -518,8 +518,8 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString
     for (size_t i = 0; i < nodesSize; ++i) {
         Node* node = nodes[i];
         Frame* childFrame;
-        if ((node->hasTagName(HTMLNames::frameTag) || node->hasTagName(HTMLNames::iframeTag) || node->hasTagName(HTMLNames::objectTag)) &&
-            (childFrame = toFrameOwnerElement(node)->contentFrame())) {
+        if ((isHTMLFrameElement(node) || isHTMLIFrameElement(node) || isHTMLObjectElement(node))
+            && (childFrame = toFrameOwnerElement(node)->contentFrame())) {
             if (frameFilter && !frameFilter->shouldIncludeSubframe(childFrame))
                 continue;
                 
index 93deb94..024fbf3 100644 (file)
@@ -91,7 +91,7 @@ static bool shouldIgnoreElement(Element* element)
 static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerElement& frameOwner)
 {
     // FIXME: We should support all frame owners including applets.
-    return frameOwner.hasTagName(HTMLNames::objectTag) ? HTMLNames::dataAttr : HTMLNames::srcAttr;
+    return isHTMLObjectElement(frameOwner) ? HTMLNames::dataAttr : HTMLNames::srcAttr;
 }
 
 class SerializerMarkupAccumulator : public WebCore::MarkupAccumulator {
index 5f007d6..0f32efc 100644 (file)
@@ -449,7 +449,7 @@ bool canScrollInDirection(const Node* container, FocusDirection direction)
 {
     ASSERT(container);
 
-    if (container->hasTagName(HTMLNames::selectTag))
+    if (isHTMLSelectElement(container))
         return false;
 
     if (container->isDocumentNode())
index 0428db2..caee302 100644 (file)
@@ -194,7 +194,7 @@ static KURL getURLForImageNode(Node* node)
     else if (node->hasTagName(SVGNames::imageTag))
         urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr);
 #endif
-    else if (node->hasTagName(HTMLNames::embedTag) || node->hasTagName(HTMLNames::objectTag)) {
+    else if (node->hasTagName(HTMLNames::embedTag) || isHTMLObjectElement(node)) {
         Element* element = toElement(node);
         urlString = element->imageSourceURL();
     }
index d987329..4f78401 100644 (file)
@@ -150,7 +150,7 @@ void getPluginOcclusions(Element* element, Widget* parentWidget, const IntRect&
         HTMLElement* element = frameView->frame().ownerElement();
         RenderObject* iframeRenderer = element->renderer();
 
-        if (element->hasTagName(HTMLNames::iframeTag)
+        if (isHTMLIFrameElement(element)
             && iframeRenderer->absoluteBoundingBoxRectIgnoringTransforms().intersects(frameRect)
             && (!iframeRenderer->style() || iframeRenderer->style()->visibility() == VISIBLE)) {
             getObjectStack(iframeRenderer, &iframeZstack);
index 269940c..b39a380 100644 (file)
@@ -368,7 +368,7 @@ bool HitTestResult::mediaSupportsFullscreen() const
 {
 #if ENABLE(VIDEO)
     HTMLMediaElement* mediaElt(mediaElement());
-    return (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag) && mediaElt->supportsFullscreen());
+    return (mediaElt && isHTMLVideoElement(mediaElt) && mediaElt->supportsFullscreen());
 #else
     return false;
 #endif
@@ -383,7 +383,7 @@ HTMLMediaElement* HitTestResult::mediaElement() const
     if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()->isMedia()))
         return 0;
 
-    if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || isHTMLAudioElement(m_innerNonSharedNode.get()))
+    if (isHTMLVideoElement(m_innerNonSharedNode.get()) || isHTMLAudioElement(m_innerNonSharedNode.get()))
         return toHTMLMediaElement(m_innerNonSharedNode.get());
     return 0;
 }
@@ -430,7 +430,7 @@ void HitTestResult::enterFullscreenForVideo() const
 {
 #if ENABLE(VIDEO)
     HTMLMediaElement* mediaElt(mediaElement());
-    if (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag)) {
+    if (mediaElt && isHTMLVideoElement(mediaElt)) {
         HTMLVideoElement* videoElt = toHTMLVideoElement(mediaElt);
         if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen()) {
             UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
@@ -488,7 +488,7 @@ bool HitTestResult::mediaIsVideo() const
 {
 #if ENABLE(VIDEO)
     if (HTMLMediaElement* mediaElt = mediaElement())
-        return mediaElt->hasTagName(HTMLNames::videoTag);
+        return isHTMLVideoElement(mediaElt);
 #endif
     return false;
 }
index d38d211..628b1f9 100644 (file)
@@ -2086,7 +2086,7 @@ bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer)
             return false;
 
         Node* node = renderer->node();
-        if (!node || (!node->hasTagName(HTMLNames::videoTag) && !isHTMLAudioElement(node)))
+        if (!node || (!isHTMLVideoElement(node) && !isHTMLAudioElement(node)))
             return false;
 
         HTMLMediaElement* mediaElement = toHTMLMediaElement(node);
index 7cb0020..6532c20 100644 (file)
@@ -92,7 +92,7 @@ RenderListBox::RenderListBox(Element* element)
 {
     ASSERT(element);
     ASSERT(element->isHTMLElement());
-    ASSERT(element->hasTagName(HTMLNames::selectTag));
+    ASSERT(isHTMLSelectElement(element));
 
     view().frameView().addScrollableArea(this);
 }
index e00a395..737af9b 100644 (file)
@@ -65,7 +65,7 @@ RenderMenuList::RenderMenuList(Element* element)
 {
     ASSERT(element);
     ASSERT(element->isHTMLElement());
-    ASSERT(element->hasTagName(HTMLNames::selectTag));
+    ASSERT(isHTMLSelectElement(element));
 }
 
 RenderMenuList::~RenderMenuList()
index 9b4b1da..6834cb6 100644 (file)
@@ -1987,7 +1987,7 @@ void Internals::simulateAudioInterruption(Node* node)
 
 bool Internals::isSelectPopupVisible(Node* node)
 {
-    if (!node->hasTagName(HTMLNames::selectTag))
+    if (!isHTMLSelectElement(node))
         return false;
 
     HTMLSelectElement* select = toHTMLSelectElement(node);
index 556eeee..00e6840 100644 (file)
@@ -2819,7 +2819,7 @@ IntRect WebPagePrivate::adjustRectOffsetForFrameOffset(const IntRect& rect, cons
 
         Node* ownerNode = static_cast<Node*>(frame->ownerElement());
         tnode = ownerNode;
-        if (ownerNode && (ownerNode->hasTagName(HTMLNames::iframeTag) || ownerNode->hasTagName(HTMLNames::frameTag))) {
+        if (ownerNode && (isHTMLIFrameElement(ownerNode) || isHTMLFrameNode(ownerNode))) {
             IntRect iFrameRect;
             do {
                 iFrameRect = rectForNode(ownerNode);
@@ -5015,7 +5015,7 @@ void WebPage::notifyFullScreenVideoExited(bool done)
     Element* element = toElement(d->m_fullscreenNode.get());
     if (!element)
         return;
-    if (d->m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag))
+    if (d->m_webSettings->fullScreenVideoCapable() && isHTMLVideoElement(element))
         toHTMLMediaElement(element)->exitFullscreen();
 #if ENABLE(FULLSCREEN_API)
     else
@@ -5664,7 +5664,7 @@ void WebPagePrivate::notifyFlushRequired(const GraphicsLayer*)
 void WebPagePrivate::enterFullscreenForNode(Node* node)
 {
 #if ENABLE(VIDEO)
-    if (!node || !node->hasTagName(HTMLNames::videoTag))
+    if (!node || !isHTMLVideoElement(node))
         return;
 
     MediaPlayer* player = toHTMLMediaElement(node)->player();
@@ -5697,7 +5697,7 @@ void WebPagePrivate::exitFullscreenForNode(Node* node)
         m_fullscreenNode = 0;
     }
 
-    if (!node || !node->hasTagName(HTMLNames::videoTag))
+    if (!node || !isHTMLVideoElement(node))
         return;
 
     MediaPlayer* player = toHTMLMediaElement(node)->player();
@@ -5719,7 +5719,7 @@ void WebPagePrivate::enterFullScreenForElement(Element* element)
 #if ENABLE(VIDEO)
     if (!element)
         return;
-    if (m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag)) {
+    if (m_webSettings->fullScreenVideoCapable() && isHTMLVideoElement(element)) {
         // The Browser chrome has its own fullscreen video widget it wants to
         // use, and this is a video element. The only reason that
         // webkitWillEnterFullScreenForElement() and
@@ -5764,7 +5764,7 @@ void WebPagePrivate::exitFullScreenForElement(Element* element)
 #if ENABLE(VIDEO)
     if (!element)
         return;
-    if (m_webSettings->fullScreenVideoCapable() && element->hasTagName(HTMLNames::videoTag)) {
+    if (m_webSettings->fullScreenVideoCapable() && isHTMLVideoElement(element)) {
         // The Browser chrome has its own fullscreen video widget.
         exitFullscreenForNode(element);
     } else {
index 517097c..9e2e522 100644 (file)
@@ -1,3 +1,35 @@
+2013-09-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Generate more HTML type checks and casting
+        https://bugs.webkit.org/show_bug.cgi?id=121080
+
+        Reviewed by Andreas Kling.
+
+        Clean-up remained functions of HTML elements using auto-generated isFooElement(),
+        and replace toFooElement() with ELEMENT_TYPE_CASTS() macro.
+
+        Besides this patch clean-up unnecessary checks which are being supported by
+        auto-generated isFooElement().
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::adjustRectOffsetForFrameOffset):
+        (BlackBerry::WebKit::WebPage::notifyFullScreenVideoExited):
+        (BlackBerry::WebKit::WebPagePrivate::enterFullscreenForNode):
+        (BlackBerry::WebKit::WebPagePrivate::exitFullscreenForNode):
+        (BlackBerry::WebKit::WebPagePrivate::enterFullScreenForElement):
+        (BlackBerry::WebKit::WebPagePrivate::exitFullScreenForElement):
+        * WebCoreSupport/ChromeClientBlackBerry.cpp:
+        (WebCore::ChromeClientBlackBerry::supportsFullscreenForNode):
+        * WebCoreSupport/EditorClientBlackBerry.cpp:
+        (WebCore::EditorClientBlackBerry::shouldChangeSelectedRange):
+        * WebKitSupport/DOMSupport.cpp:
+        (BlackBerry::WebKit::DOMSupport::isElementTypePlugin):
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::willOpenPopupForNode):
+        (BlackBerry::WebKit::InputHandler::didNodeOpenPopup):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
+
 2013-09-08  Anders Carlsson  <andersca@apple.com>
 
         Move WTF::notFound to Vector.h and delete NotFound.h
index 844768c..32393a7 100644 (file)
@@ -697,7 +697,7 @@ void ChromeClientBlackBerry::chooseIconForFiles(const Vector<String>&, FileChoos
 
 bool ChromeClientBlackBerry::supportsFullscreenForNode(const Node* node)
 {
-    return node->hasTagName(HTMLNames::videoTag);
+    return isHTMLVideoElement(node);
 }
 
 void ChromeClientBlackBerry::enterFullscreenForNode(Node* node)
index 3bb71df..1a39af5 100644 (file)
@@ -191,7 +191,7 @@ bool EditorClientBlackBerry::shouldChangeSelectedRange(Range* fromRange, Range*
     Frame* frame = m_webPagePrivate->focusedOrMainFrame();
     if (frame && frame->document()) {
         if (Element* focusedElement = frame->document()->focusedElement()) {
-            if (focusedElement->hasTagName(HTMLNames::selectTag))
+            if (isHTMLSelectElement(focusedElement))
                 return false;
             if (DOMSupport::isPopupInputField(focusedElement))
                 return false;
index a58055c..f28368b 100644 (file)
@@ -149,7 +149,7 @@ bool isElementTypePlugin(const Element* element)
     if (!element)
         return false;
 
-    if (element->hasTagName(HTMLNames::objectTag)
+    if (isHTMLObjectElement(element)
         || element->hasTagName(HTMLNames::embedTag)
         || element->hasTagName(HTMLNames::appletTag))
         return true;
index c9716ba..c858902 100644 (file)
@@ -1983,7 +1983,7 @@ bool InputHandler::willOpenPopupForNode(Node* node)
 
     ASSERT(!node->isInShadowTree());
 
-    if (node->hasTagName(HTMLNames::selectTag) || isHTMLOptionElement(node)) {
+    if (isHTMLSelectElement(node) || isHTMLOptionElement(node)) {
         // We open list popups for options and selects.
         return true;
     }
@@ -2005,7 +2005,7 @@ bool InputHandler::didNodeOpenPopup(Node* node)
 
     ASSERT(!node->isInShadowTree());
 
-    if (node->hasTagName(HTMLNames::selectTag))
+    if (isHTMLSelectElement(node))
         return openSelectPopup(toHTMLSelectElement(node));
 
     if (isHTMLOptionElement(node)) {
index 6b3e7e8..2b92fce 100644 (file)
@@ -1168,7 +1168,7 @@ void SelectionHandler::selectionPositionChanged(bool forceUpdateWithoutChange)
         return;
 
     if (Node* focusedNode = frame->document()->focusedElement()) {
-        if (focusedNode->hasTagName(HTMLNames::selectTag) || (focusedNode->isElementNode() && DOMSupport::isPopupInputField(toElement(focusedNode)))) {
+        if (isHTMLSelectElement(focusedNode) || (focusedNode->isElementNode() && DOMSupport::isPopupInputField(toElement(focusedNode)))) {
             SelectionLog(Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged selection is on a popup control, skipping rendering.");
             return;
         }
index b767fcb..66dd351 100644 (file)
@@ -1,3 +1,21 @@
+2013-09-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Generate more HTML type checks and casting
+        https://bugs.webkit.org/show_bug.cgi?id=121080
+
+        Reviewed by Andreas Kling.
+
+        Clean-up remained functions of HTML elements using auto-generated isFooElement(),
+        and replace toFooElement() with ELEMENT_TYPE_CASTS() macro.
+
+        Besides this patch clean-up unnecessary checks which are being supported by
+        auto-generated isFooElement().
+
+        No new tests, no behavior change.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::supportsFullscreenForNode):
+
 2013-09-04  Zan Dobersek  <zdobersek@igalia.com>
 
         [GTK] Add support for the Wayland build target
index 6215450..1c0985a 100644 (file)
@@ -927,7 +927,7 @@ PassRefPtr<WebCore::SearchPopupMenu> ChromeClient::createSearchPopupMenu(WebCore
 #if ENABLE(VIDEO) && USE(NATIVE_FULLSCREEN_VIDEO)
 bool ChromeClient::supportsFullscreenForNode(const Node* node)
 {
-    return node->hasTagName(HTMLNames::videoTag);
+    return isHTMLVideoElement(node);
 }
 
 void ChromeClient::enterFullscreenForNode(Node* node)
index 4324281..6fd16db 100644 (file)
@@ -1,3 +1,24 @@
+2013-09-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Generate more HTML type checks and casting
+        https://bugs.webkit.org/show_bug.cgi?id=121080
+
+        Reviewed by Andreas Kling.
+
+        Clean-up remained functions of HTML elements using auto-generated isFooElement(),
+        and replace toFooElement() with ELEMENT_TYPE_CASTS() macro.
+
+        Besides this patch clean-up unnecessary checks which are being supported by
+        auto-generated isFooElement().
+
+        No new tests, no behavior change.
+
+        * Plugins/WebPluginController.mm:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::supportsFullscreenForNode):
+        * WebView/WebView.mm:
+        (-[WebView _enterFullscreenForNode:WebCore::]):
+
 2013-09-10  Daniel Bates  <dabates@apple.com>
 
         [iOS] Upstream text autosizing
index f0e4e7f..ea9ba4d 100644 (file)
@@ -499,7 +499,7 @@ static WebCore::HTMLMediaElement* mediaProxyClient(DOMElement* element)
     }
 
     Element* node = core(element);
-    if (!node || (!node->hasTagName(HTMLNames::videoTag) && !isHTMLAudioElement(node))) {
+    if (!node || (!isHTMLVideoElement(node) && !isHTMLAudioElement(node))) {
         LOG_ERROR("invalid media element passed");
         return nil;
     }
index 9c88219..91bf38f 100644 (file)
@@ -900,7 +900,7 @@ void WebChromeClient::scheduleCompositingLayerFlush()
 
 bool WebChromeClient::supportsFullscreenForNode(const Node* node)
 {
-    return node->hasTagName(WebCore::HTMLNames::videoTag);
+    return isHTMLVideoElement(node);
 }
 
 void WebChromeClient::enterFullscreenForNode(Node* node)
index 5430066..d6e5da5 100644 (file)
@@ -6497,7 +6497,7 @@ bool LayerFlushController::flushLayers()
 
 - (void)_enterFullscreenForNode:(WebCore::Node*)node
 {
-    ASSERT(node->hasTagName(WebCore::HTMLNames::videoTag));
+    ASSERT(isHTMLVideoElement(node));
     HTMLMediaElement* videoElement = toHTMLMediaElement(node);
 
     if (_private->fullscreenController) {
index abc8933..379222e 100644 (file)
@@ -1,3 +1,18 @@
+2013-09-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Generate more HTML type checks and casting
+        https://bugs.webkit.org/show_bug.cgi?id=121080
+
+        Reviewed by Andreas Kling.
+
+        Clean-up remained functions of HTML elements using auto-generated isFooElement(),
+        and replace toFooElement() with ELEMENT_TYPE_CASTS() macro.
+
+        Besides this patch clean-up unnecessary checks which are being supported by
+        auto-generated isFooElement().
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+
 2013-09-03  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         [Qt] Images scaled poorly on composited canvas
index 546281a..9bcbcab 100644 (file)
@@ -690,7 +690,7 @@ FullScreenVideoQt* ChromeClientQt::fullScreenVideo()
 bool ChromeClientQt::supportsFullscreenForNode(const Node* node)
 {
     ASSERT(node);
-    return node->hasTagName(HTMLNames::videoTag) && fullScreenVideo()->isValid();
+    return isHTMLVideoElement(node) && fullScreenVideo()->isValid();
 }
 
 bool ChromeClientQt::requiresFullscreenForVideoPlayback()
@@ -700,14 +700,14 @@ bool ChromeClientQt::requiresFullscreenForVideoPlayback()
 
 void ChromeClientQt::enterFullscreenForNode(Node* node)
 {
-    ASSERT(node && node->hasTagName(HTMLNames::videoTag));
+    ASSERT(node && isHTMLVideoElement(node));
 
     fullScreenVideo()->enterFullScreenForNode(node);
 }
 
 void ChromeClientQt::exitFullscreenForNode(Node* node)
 {
-    ASSERT(node && node->hasTagName(HTMLNames::videoTag));
+    ASSERT(node && isHTMLVideoElement(node));
 
     fullScreenVideo()->exitFullScreenForNode(node);
 } 
index 91186bf..234a498 100644 (file)
@@ -1,3 +1,21 @@
+2013-09-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Generate more HTML type checks and casting
+        https://bugs.webkit.org/show_bug.cgi?id=121080
+
+        Reviewed by Andreas Kling.
+
+        Clean-up remained functions of HTML elements using auto-generated isFooElement(),
+        and replace toFooElement() with ELEMENT_TYPE_CASTS() macro.
+
+        Besides this patch clean-up unnecessary checks which are being supported by
+        auto-generated isFooElement().
+
+        * WebCoreSupport/WebChromeClient.cpp:
+        (WebChromeClient::supportsFullscreenForNode):
+        * WebView.cpp:
+        (WebView::enterFullscreenForNode):
+
 2013-09-10  Brent Fulgham  <bfulgham@apple.com>
 
         [Windows] Create SharedGDIObject Class Template
index 9f37266..dc5b3d6 100644 (file)
@@ -776,7 +776,7 @@ COMPtr<IWebUIDelegate> WebChromeClient::uiDelegate()
 
 bool WebChromeClient::supportsFullscreenForNode(const Node* node)
 {
-    return node->hasTagName(HTMLNames::videoTag);
+    return isHTMLVideoElement(node);
 }
 
 void WebChromeClient::enterFullscreenForNode(Node* node)
index 4addbfa..72ae63d 100644 (file)
@@ -6257,7 +6257,7 @@ HRESULT WebView::setCanStartPlugins(BOOL canStartPlugins)
 
 void WebView::enterFullscreenForNode(Node* node)
 {
-    if (!node->hasTagName(HTMLNames::videoTag) || !node->isElementNode())
+    if (!isHTMLVideoElement(node) || !node->isElementNode())
         return;
 
 #if ENABLE(VIDEO)
index 444ea89..23ceb16 100644 (file)
@@ -1,3 +1,19 @@
+2013-09-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Generate more HTML type checks and casting
+        https://bugs.webkit.org/show_bug.cgi?id=121080
+
+        Reviewed by Andreas Kling.
+
+        Clean-up remained functions of HTML elements using auto-generated isFooElement(),
+        and replace toFooElement() with ELEMENT_TYPE_CASTS() macro.
+
+        Besides this patch clean-up unnecessary checks which are being supported by
+        auto-generated isFooElement().
+
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::containsAnyFormControls):
+
 2013-09-10  Marcelo Morais  <m.morais@samsung.com>
 
         [EFL] WebInspector: Move to new webinspector
index 2229c0c..7857f8a 100644 (file)
@@ -608,7 +608,7 @@ bool WebFrame::containsAnyFormControls() const
     for (Node* node = document->documentElement(); node; node = NodeTraversal::next(node)) {
         if (!node->isElementNode())
             continue;
-        if (isHTMLInputElement(node) || toElement(node)->hasTagName(HTMLNames::selectTag) || isHTMLTextAreaElement(node))
+        if (isHTMLInputElement(node) || isHTMLSelectElement(node) || isHTMLTextAreaElement(node))
             return true;
     }
     return false;