Title: [152709] trunk/Source
Revision
152709
Author
[email protected]
Date
2013-07-16 02:20:04 -0700 (Tue, 16 Jul 2013)

Log Message

Use toHTMLSelectElement and dismiss isHTMLSelectElement
https://bugs.webkit.org/show_bug.cgi?id=118714

Reviewed by Ryosuke Niwa.

To avoid direct use of static_cast, this patch introduces toHTMLIFrameElement for code cleanup.
Additionally, this patch removes isHTMLSelectElement because not all element subclasses can be checked by a combination of tag names.

Source/WebCore:

* html/HTMLSelectElement.h:
(WebCore::toHTMLSelectElement):
* testing/Internals.cpp:
(WebCore::Internals::isSelectPopupVisible):

Source/WebKit/blackberry:

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::didNodeOpenPopup):
(BlackBerry::WebKit::InputHandler::setPopupListIndex):
(BlackBerry::WebKit::InputHandler::setPopupListIndexes):

Source/WebKit/win:

* DOMHTMLClasses.cpp:
(DOMHTMLSelectElement::options):
(DOMHTMLSelectElement::activateItemAtIndex):

Source/WebKit2:

* WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
(WebKit::PDFPluginChoiceAnnotation::commit):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152708 => 152709)


--- trunk/Source/WebCore/ChangeLog	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebCore/ChangeLog	2013-07-16 09:20:04 UTC (rev 152709)
@@ -1,3 +1,18 @@
+2013-07-16  Kangil Han  <[email protected]>
+
+        Use toHTMLSelectElement and dismiss isHTMLSelectElement
+        https://bugs.webkit.org/show_bug.cgi?id=118714
+
+        Reviewed by Ryosuke Niwa.
+
+        To avoid direct use of static_cast, this patch introduces toHTMLIFrameElement for code cleanup.
+        Additionally, this patch removes isHTMLSelectElement because not all element subclasses can be checked by a combination of tag names.
+
+        * html/HTMLSelectElement.h:
+        (WebCore::toHTMLSelectElement):
+        * testing/Internals.cpp:
+        (WebCore::Internals::isSelectPopupVisible):
+
 2013-07-15  Yuta Kitamura  <[email protected]>
 
         Fix a crash in Range::processContents().

Modified: trunk/Source/WebCore/html/HTMLSelectElement.h (152708 => 152709)


--- trunk/Source/WebCore/html/HTMLSelectElement.h	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebCore/html/HTMLSelectElement.h	2013-07-16 09:20:04 UTC (rev 152709)
@@ -202,25 +202,12 @@
     mutable bool m_shouldRecalcListItems;
 };
 
-inline bool isHTMLSelectElement(const Node* node)
-{
-    return node->hasTagName(HTMLNames::selectTag);
-}
-
 inline HTMLSelectElement* toHTMLSelectElement(Node* node)
 {
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLSelectElement(node));
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::selectTag));
     return static_cast<HTMLSelectElement*>(node);
 }
 
-inline const HTMLSelectElement* toHTMLSelectElement(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLSelectElement(node));
-    return static_cast<const HTMLSelectElement*>(node);
-}
-
-void toHTMLSelectElement(const HTMLSelectElement*); // This overload will catch anyone doing an unnecessary cast.
-
 } // namespace
 
 #endif

Modified: trunk/Source/WebCore/testing/Internals.cpp (152708 => 152709)


--- trunk/Source/WebCore/testing/Internals.cpp	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebCore/testing/Internals.cpp	2013-07-16 09:20:04 UTC (rev 152709)
@@ -2055,7 +2055,7 @@
 
 bool Internals::isSelectPopupVisible(Node* node)
 {
-    if (!isHTMLSelectElement(node))
+    if (!node->hasTagName(HTMLNames::selectTag))
         return false;
 
     HTMLSelectElement* select = toHTMLSelectElement(node);

Modified: trunk/Source/WebKit/blackberry/ChangeLog (152708 => 152709)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-07-16 09:20:04 UTC (rev 152709)
@@ -1,3 +1,18 @@
+2013-07-16  Kangil Han  <[email protected]>
+
+        Use toHTMLSelectElement and dismiss isHTMLSelectElement
+        https://bugs.webkit.org/show_bug.cgi?id=118714
+
+        Reviewed by Ryosuke Niwa.
+
+        To avoid direct use of static_cast, this patch introduces toHTMLIFrameElement for code cleanup.
+        Additionally, this patch removes isHTMLSelectElement because not all element subclasses can be checked by a combination of tag names.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::didNodeOpenPopup):
+        (BlackBerry::WebKit::InputHandler::setPopupListIndex):
+        (BlackBerry::WebKit::InputHandler::setPopupListIndexes):
+
 2013-07-08  Jacky Jiang  <[email protected]>
 
         [BlackBerry] Block Zoom does not zoom in on narrow paragraphs properly

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (152708 => 152709)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-07-16 09:20:04 UTC (rev 152709)
@@ -2008,7 +2008,7 @@
     ASSERT(!node->isInShadowTree());
 
     if (node->hasTagName(HTMLNames::selectTag))
-        return openSelectPopup(static_cast<HTMLSelectElement*>(node));
+        return openSelectPopup(toHTMLSelectElement(node));
 
     if (isHTMLOptionElement(node)) {
         HTMLOptionElement* optionElement = toHTMLOptionElement(node);
@@ -2101,7 +2101,7 @@
         renderMenu->hidePopup();
     }
 
-    HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_currentFocusElement.get());
+    HTMLSelectElement* selectElement = toHTMLSelectElement(m_currentFocusElement.get());
     int optionIndex = selectElement->listToOptionIndex(index);
     selectElement->optionSelectedByUser(optionIndex, true /* deselect = true */, true /* fireOnChangeNow = false */);
     clearCurrentFocusElement();
@@ -2115,7 +2115,7 @@
     if (size < 0)
         return;
 
-    HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_currentFocusElement.get());
+    HTMLSelectElement* selectElement = toHTMLSelectElement(m_currentFocusElement.get());
     const WTF::Vector<HTMLElement*>& items = selectElement->listItems();
     if (items.size() != static_cast<unsigned>(size))
         return;

Modified: trunk/Source/WebKit/win/ChangeLog (152708 => 152709)


--- trunk/Source/WebKit/win/ChangeLog	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebKit/win/ChangeLog	2013-07-16 09:20:04 UTC (rev 152709)
@@ -1,3 +1,17 @@
+2013-07-16  Kangil Han  <[email protected]>
+
+        Use toHTMLSelectElement and dismiss isHTMLSelectElement
+        https://bugs.webkit.org/show_bug.cgi?id=118714
+
+        Reviewed by Ryosuke Niwa.
+
+        To avoid direct use of static_cast, this patch introduces toHTMLIFrameElement for code cleanup.
+        Additionally, this patch removes isHTMLSelectElement because not all element subclasses can be checked by a combination of tag names.
+
+        * DOMHTMLClasses.cpp:
+        (DOMHTMLSelectElement::options):
+        (DOMHTMLSelectElement::activateItemAtIndex):
+
 2013-07-15  Kangil Han  <[email protected]>
 
         Introduce toHTMLIFrameElement

Modified: trunk/Source/WebKit/win/DOMHTMLClasses.cpp (152708 => 152709)


--- trunk/Source/WebKit/win/DOMHTMLClasses.cpp	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebKit/win/DOMHTMLClasses.cpp	2013-07-16 09:20:04 UTC (rev 152709)
@@ -701,15 +701,13 @@
     if (!result)
         return E_POINTER;
 
-    *result = 0;
-
     ASSERT(m_element);
-    ASSERT(m_element->hasTagName(selectTag));
-    HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element);
+    HTMLSelectElement* selectElement = toHTMLSelectElement(m_element);
 
     if (!selectElement->options())
         return E_FAIL;
 
+    *result = 0;
     RefPtr<HTMLOptionsCollection> options = selectElement->options();
     *result = DOMHTMLOptionsCollection::createInstance(options.get());
     return S_OK;
@@ -806,8 +804,7 @@
     /* [in] */ int index)
 {
     ASSERT(m_element);
-    ASSERT(m_element->hasTagName(selectTag));
-    HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_element);
+    HTMLSelectElement* selectElement = toHTMLSelectElement(m_element);
 
     if (index >= selectElement->length())
         return E_FAIL;

Modified: trunk/Source/WebKit2/ChangeLog (152708 => 152709)


--- trunk/Source/WebKit2/ChangeLog	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebKit2/ChangeLog	2013-07-16 09:20:04 UTC (rev 152709)
@@ -1,3 +1,16 @@
+2013-07-16  Kangil Han  <[email protected]>
+
+        Use toHTMLSelectElement and dismiss isHTMLSelectElement
+        https://bugs.webkit.org/show_bug.cgi?id=118714
+
+        Reviewed by Ryosuke Niwa.
+
+        To avoid direct use of static_cast, this patch introduces toHTMLIFrameElement for code cleanup.
+        Additionally, this patch removes isHTMLSelectElement because not all element subclasses can be checked by a combination of tag names.
+
+        * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
+        (WebKit::PDFPluginChoiceAnnotation::commit):
+
 2013-07-16  Dong-Gwan Kim  <[email protected]>
 
         Replace mouseClick with more meaningful method in test_ewk2_text_checker.cpp

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm (152708 => 152709)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm	2013-07-16 07:35:49 UTC (rev 152708)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm	2013-07-16 09:20:04 UTC (rev 152709)
@@ -61,7 +61,7 @@
 
 void PDFPluginChoiceAnnotation::commit()
 {
-    choiceAnnotation().stringValue = static_cast<HTMLSelectElement*>(element())->value();
+    choiceAnnotation().stringValue = toHTMLSelectElement(element())->value();
 
     PDFPluginAnnotation::commit();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to