Title: [166615] trunk/Source/WebCore
- Revision
- 166615
- Author
- a...@apple.com
- Date
- 2014-04-01 14:57:15 -0700 (Tue, 01 Apr 2014)
Log Message
Eliminate HTMLFormElement::m_shouldSubmit
https://bugs.webkit.org/show_bug.cgi?id=131055
Reviewed by Tim Horton.
m_shouldSubmit was used for two purposes:
- as a return value in a function whose return value is ignored by all callers;
- to make a decision that's local to a function.
There is no need for it to be an instance variable.
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::HTMLFormElement):
(WebCore::HTMLFormElement::prepareForSubmission):
(WebCore::HTMLFormElement::submit):
* html/HTMLFormElement.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (166614 => 166615)
--- trunk/Source/WebCore/ChangeLog 2014-04-01 21:57:12 UTC (rev 166614)
+++ trunk/Source/WebCore/ChangeLog 2014-04-01 21:57:15 UTC (rev 166615)
@@ -1,3 +1,22 @@
+2014-04-01 Alexey Proskuryakov <a...@apple.com>
+
+ Eliminate HTMLFormElement::m_shouldSubmit
+ https://bugs.webkit.org/show_bug.cgi?id=131055
+
+ Reviewed by Tim Horton.
+
+ m_shouldSubmit was used for two purposes:
+ - as a return value in a function whose return value is ignored by all callers;
+ - to make a decision that's local to a function.
+
+ There is no need for it to be an instance variable.
+
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::HTMLFormElement):
+ (WebCore::HTMLFormElement::prepareForSubmission):
+ (WebCore::HTMLFormElement::submit):
+ * html/HTMLFormElement.h:
+
2014-04-01 Benjamin Poulain <bpoul...@apple.com>
Remove a couple of useless static strings
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (166614 => 166615)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2014-04-01 21:57:12 UTC (rev 166614)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2014-04-01 21:57:15 UTC (rev 166615)
@@ -57,7 +57,6 @@
, m_associatedElementsAfterIndex(0)
, m_wasUserSubmitted(false)
, m_isSubmittingOrPreparingForSubmission(false)
- , m_shouldSubmit(false)
, m_isInResetFunction(false)
, m_wasDemoted(false)
{
@@ -260,19 +259,19 @@
return false;
}
-bool HTMLFormElement::prepareForSubmission(Event* event)
+void HTMLFormElement::prepareForSubmission(Event* event)
{
Frame* frame = document().frame();
if (m_isSubmittingOrPreparingForSubmission || !frame)
- return m_isSubmittingOrPreparingForSubmission;
+ return;
m_isSubmittingOrPreparingForSubmission = true;
- m_shouldSubmit = false;
+ bool shouldSubmit = false;
// Interactive validation must be done before dispatching the submit event.
if (!validateInteractively(event)) {
m_isSubmittingOrPreparingForSubmission = false;
- return false;
+ return;
}
StringPairVector controlNamesAndValues;
@@ -281,14 +280,12 @@
frame->loader().client().dispatchWillSendSubmitEvent(formState.release());
if (dispatchEvent(Event::create(eventNames().submitEvent, true, true)))
- m_shouldSubmit = true;
+ shouldSubmit = true;
m_isSubmittingOrPreparingForSubmission = false;
- if (m_shouldSubmit)
+ if (shouldSubmit)
submit(event, true, true, NotSubmittedByJavaScript);
-
- return m_shouldSubmit;
}
void HTMLFormElement::submit()
@@ -325,10 +322,8 @@
if (!view || !frame)
return;
- if (m_isSubmittingOrPreparingForSubmission) {
- m_shouldSubmit = true;
+ if (m_isSubmittingOrPreparingForSubmission)
return;
- }
m_isSubmittingOrPreparingForSubmission = true;
m_wasUserSubmitted = processingUserGesture;
@@ -358,7 +353,6 @@
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(false);
- m_shouldSubmit = false;
m_isSubmittingOrPreparingForSubmission = false;
}
Modified: trunk/Source/WebCore/html/HTMLFormElement.h (166614 => 166615)
--- trunk/Source/WebCore/html/HTMLFormElement.h 2014-04-01 21:57:12 UTC (rev 166614)
+++ trunk/Source/WebCore/html/HTMLFormElement.h 2014-04-01 21:57:15 UTC (rev 166615)
@@ -81,7 +81,7 @@
void registerImgElement(HTMLImageElement*);
void removeImgElement(HTMLImageElement*);
- bool prepareForSubmission(Event*);
+ void prepareForSubmission(Event*); // FIXME: This function doesn't only prepare, it sometimes calls sumbit() itself.
void submit();
void submitFromJavaScript();
void reset();
@@ -172,7 +172,6 @@
bool m_wasUserSubmitted;
bool m_isSubmittingOrPreparingForSubmission;
- bool m_shouldSubmit;
bool m_isInResetFunction;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes