Refactoring: Simplify FormController interface
https://bugs.webkit.org/show_bug.cgi?id=89951
Reviewed by Kentaro Hara.
- Remove FormController::hasStateForNewFormElements()
takeStateForFormElement() can check the emptiness, and return an empty
FormControlState.
- Change the argument of takeStateForFormElement()
Passing just one HTMLFormControlElementWithState object instead of two
AtomicStringImpl. This is a preparation to use
HTMLFormControlElementWithState::form() in FormController.
No new tests. Just a refactoring.
* html/FormController.cpp:
(WebCore::FormController::takeStateForFormElement):
* html/FormController.h:
(FormController):
* html/HTMLFormControlElementWithState.cpp:
(WebCore::HTMLFormControlElementWithState::finishParsingChildren):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121235 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp
index 31c7763..8719443 100644
--- a/Source/WebCore/html/FormController.cpp
+++ b/Source/WebCore/html/FormController.cpp
@@ -138,15 +138,12 @@
m_stateForNewFormElements.clear();
}
-bool FormController::hasStateForNewFormElements() const
+FormControlState FormController::takeStateForFormElement(const HTMLFormControlElementWithState& control)
{
- return !m_stateForNewFormElements.isEmpty();
-}
-
-FormControlState FormController::takeStateForFormElement(AtomicStringImpl* name, AtomicStringImpl* type)
-{
+ if (m_stateForNewFormElements.isEmpty())
+ return FormControlState();
typedef FormElementStateMap::iterator Iterator;
- Iterator it = m_stateForNewFormElements.find(FormElementKey(name, type));
+ Iterator it = m_stateForNewFormElements.find(FormElementKey(control.name().impl(), control.type().impl()));
if (it == m_stateForNewFormElements.end())
return FormControlState();
ASSERT(it->second.size());