Skip to content
Permalink
Browse files
2010-07-16 James Hawkins <jhawkins@chromium.org>
        Reviewed by Darin Fisher.

        [Chromium] Implement WebFormElement::wasUserSubmitted(). This is used to
        verify that the user submitted the form instead of JS when saving form
        data in AutoFill.
        https://bugs.webkit.org/show_bug.cgi?id=42479

        * public/WebFormElement.h:
        * src/WebFormElement.cpp:
        (WebKit::WebFormElement::wasUserSubmitted):
2010-07-16  James Hawkins  <jhawkins@chromium.org>

        Reviewed by Darin Fisher.

        Expose the form submission trigger on the HTMLFormElement object. This
        is used to verify that the user submitted the form instead of JS when
        saving form data in Chrome AutoFill.
        https://bugs.webkit.org/show_bug.cgi?id=42479

        No new tests as this is only used by the Chromium WebKit API.

        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::HTMLFormElement):
        (WebCore::HTMLFormElement::submit):
        (WebCore::HTMLFormElement::reset):
        (WebCore::HTMLFormElement::submissionTrigger):
        * html/HTMLFormElement.h:


Canonical link: https://commits.webkit.org/54623@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63786 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
James Hawkins committed Jul 20, 2010
1 parent 54f54f4 commit ce086aafd2956883b3e0bd1e0b1746f1f4cda984
Showing with 53 additions and 4 deletions.
  1. +18 −0 WebCore/ChangeLog
  2. +7 −0 WebCore/html/HTMLFormElement.cpp
  3. +4 −0 WebCore/html/HTMLFormElement.h
  4. +13 −0 WebKit/chromium/ChangeLog
  5. +1 −0 WebKit/chromium/public/WebFormElement.h
  6. +10 −4 WebKit/chromium/src/WebFormElement.cpp
@@ -1,3 +1,21 @@
2010-07-16 James Hawkins <jhawkins@chromium.org>

Reviewed by Darin Fisher.

Expose the form submission trigger on the HTMLFormElement object. This
is used to verify that the user submitted the form instead of JS when
saving form data in Chrome AutoFill.
https://bugs.webkit.org/show_bug.cgi?id=42479

No new tests as this is only used by the Chromium WebKit API.

* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::HTMLFormElement):
(WebCore::HTMLFormElement::submit):
(WebCore::HTMLFormElement::reset):
(WebCore::HTMLFormElement::submissionTrigger):
* html/HTMLFormElement.h:

2010-07-20 Adam Barth <abarth@webkit.org>

Unreviewed.
@@ -74,6 +74,7 @@ static int64_t generateFormDataIdentifier()

HTMLFormElement::HTMLFormElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
, m_submissionTrigger(NotSubmittedByJavaScript)
, m_autocomplete(true)
, m_insubmit(false)
, m_doingsubmit(false)
@@ -370,6 +371,7 @@ void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockH
}

m_insubmit = true;
m_submissionTrigger = formSubmissionTrigger;

HTMLFormControlElement* firstSuccessfulSubmitButton = 0;
bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
@@ -559,6 +561,11 @@ String HTMLFormElement::target() const
return getAttribute(targetAttr);
}

FormSubmissionTrigger HTMLFormElement::submissionTrigger() const
{
return m_submissionTrigger;
}

HTMLFormControlElement* HTMLFormElement::defaultButton() const
{
for (unsigned i = 0; i < m_associatedElements.size(); ++i) {
@@ -98,6 +98,8 @@ class HTMLFormElement : public HTMLElement {

virtual String target() const;

FormSubmissionTrigger submissionTrigger() const;

HTMLFormControlElement* defaultButton() const;

bool checkValidity();
@@ -153,6 +155,8 @@ class HTMLFormElement : public HTMLElement {
Vector<HTMLFormControlElement*> m_associatedElements;
Vector<HTMLImageElement*> m_imageElements;

FormSubmissionTrigger m_submissionTrigger;

bool m_autocomplete : 1;
bool m_insubmit : 1;
bool m_doingsubmit : 1;
@@ -1,3 +1,16 @@
2010-07-16 James Hawkins <jhawkins@chromium.org>

Reviewed by Darin Fisher.

[Chromium] Implement WebFormElement::wasUserSubmitted(). This is used to
verify that the user submitted the form instead of JS when saving form
data in AutoFill.
https://bugs.webkit.org/show_bug.cgi?id=42479

* public/WebFormElement.h:
* src/WebFormElement.cpp:
(WebKit::WebFormElement::wasUserSubmitted):

2010-07-20 Daniel Erat <derat@chromium.org>

Reviewed by Ojan Vafai.
@@ -63,6 +63,7 @@ namespace WebKit {
WEBKIT_API WebString action() const;
WEBKIT_API WebString name() const;
WEBKIT_API WebString method() const;
WEBKIT_API bool wasUserSubmitted() const;
WEBKIT_API void submit();
// FIXME: Deprecate and replace with WebVector<WebElement>.
WEBKIT_API void getNamedElements(const WebString&, WebVector<WebNode>&);
@@ -31,6 +31,7 @@
#include "config.h"
#include "WebFormElement.h"

#include "FormState.h"
#include "HTMLFormControlElement.h"
#include "HTMLFormElement.h"
#include "HTMLInputElement.h"
@@ -55,16 +56,21 @@ WebString WebFormElement::action() const
return constUnwrap<HTMLFormElement>()->action();
}

WebString WebFormElement::name() const
WebString WebFormElement::name() const
{
return constUnwrap<HTMLFormElement>()->name();
}

WebString WebFormElement::method() const
WebString WebFormElement::method() const
{
return constUnwrap<HTMLFormElement>()->method();
}


bool WebFormElement::wasUserSubmitted() const
{
return constUnwrap<HTMLFormElement>()->submissionTrigger() == NotSubmittedByJavaScript;
}

void WebFormElement::submit()
{
unwrap<HTMLFormElement>()->submit();
@@ -77,7 +83,7 @@ void WebFormElement::getNamedElements(const WebString& name,
unwrap<HTMLFormElement>()->getNamedElements(name, tempVector);
result.assign(tempVector);
}

void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& result) const
{
const HTMLFormElement* form = constUnwrap<HTMLFormElement>();

0 comments on commit ce086aa

Please sign in to comment.