Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFormElement.cpp

Issue 1768953002: Remove WebFormElement::wasUserSubmitted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 HTMLFormElement::HTMLFormElement(Document& document) 65 HTMLFormElement::HTMLFormElement(Document& document)
66 : HTMLElement(formTag, document) 66 : HTMLElement(formTag, document)
67 #if !ENABLE(OILPAN) 67 #if !ENABLE(OILPAN)
68 , m_weakPtrFactory(this) 68 , m_weakPtrFactory(this)
69 #endif 69 #endif
70 , m_associatedElementsAreDirty(false) 70 , m_associatedElementsAreDirty(false)
71 , m_imageElementsAreDirty(false) 71 , m_imageElementsAreDirty(false)
72 , m_hasElementsAssociatedByParser(false) 72 , m_hasElementsAssociatedByParser(false)
73 , m_hasElementsAssociatedByFormAttribute(false) 73 , m_hasElementsAssociatedByFormAttribute(false)
74 , m_didFinishParsingChildren(false) 74 , m_didFinishParsingChildren(false)
75 , m_wasUserSubmitted(false)
76 , m_isSubmittingOrInUserJSSubmitEvent(false) 75 , m_isSubmittingOrInUserJSSubmitEvent(false)
77 , m_shouldSubmit(false) 76 , m_shouldSubmit(false)
78 , m_isInResetFunction(false) 77 , m_isInResetFunction(false)
79 , m_wasDemoted(false) 78 , m_wasDemoted(false)
80 , m_pendingAutocompleteEventsQueue(GenericEventQueue::create(this)) 79 , m_pendingAutocompleteEventsQueue(GenericEventQueue::create(this))
81 { 80 {
82 } 81 }
83 82
84 PassRefPtrWillBeRawPtr<HTMLFormElement> HTMLFormElement::create(Document& docume nt) 83 PassRefPtrWillBeRawPtr<HTMLFormElement> HTMLFormElement::create(Document& docume nt)
85 { 84 {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 m_shouldSubmit = false; 324 m_shouldSubmit = false;
326 325
327 frame->loader().client()->dispatchWillSendSubmitEvent(this); 326 frame->loader().client()->dispatchWillSendSubmitEvent(this);
328 327
329 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit)) == DispatchEventResult::NotCanceled) 328 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit)) == DispatchEventResult::NotCanceled)
330 m_shouldSubmit = true; 329 m_shouldSubmit = true;
331 330
332 m_isSubmittingOrInUserJSSubmitEvent = false; 331 m_isSubmittingOrInUserJSSubmitEvent = false;
333 332
334 if (m_shouldSubmit) 333 if (m_shouldSubmit)
335 submit(event, true, true); 334 submit(event, true);
336 } 335 }
337 336
338 void HTMLFormElement::submitFromJavaScript() 337 void HTMLFormElement::submitFromJavaScript()
339 { 338 {
340 submit(0, false, UserGestureIndicator::processingUserGesture()); 339 submit(0, false);
341 } 340 }
342 341
343 void HTMLFormElement::submitDialog(PassRefPtrWillBeRawPtr<FormSubmission> formSu bmission) 342 void HTMLFormElement::submitDialog(PassRefPtrWillBeRawPtr<FormSubmission> formSu bmission)
344 { 343 {
345 for (Node* node = this; node; node = node->parentOrShadowHostNode()) { 344 for (Node* node = this; node; node = node->parentOrShadowHostNode()) {
346 if (isHTMLDialogElement(*node)) { 345 if (isHTMLDialogElement(*node)) {
347 toHTMLDialogElement(*node).closeDialog(formSubmission->result()); 346 toHTMLDialogElement(*node).closeDialog(formSubmission->result());
348 return; 347 return;
349 } 348 }
350 } 349 }
351 } 350 }
352 351
353 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce ssingUserGesture) 352 void HTMLFormElement::submit(Event* event, bool activateSubmitButton)
354 { 353 {
355 FrameView* view = document().view(); 354 FrameView* view = document().view();
356 LocalFrame* frame = document().frame(); 355 LocalFrame* frame = document().frame();
357 if (!view || !frame || !frame->page()) 356 if (!view || !frame || !frame->page())
358 return; 357 return;
359 358
360 if (m_isSubmittingOrInUserJSSubmitEvent) { 359 if (m_isSubmittingOrInUserJSSubmitEvent) {
361 m_shouldSubmit = true; 360 m_shouldSubmit = true;
362 return; 361 return;
363 } 362 }
364 363
365 m_isSubmittingOrInUserJSSubmitEvent = true; 364 m_isSubmittingOrInUserJSSubmitEvent = true;
366 m_wasUserSubmitted = processingUserGesture;
367 365
368 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul lptr; 366 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul lptr;
369 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button? 367 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
370 368
371 const FormAssociatedElement::List& elements = associatedElements(); 369 const FormAssociatedElement::List& elements = associatedElements();
372 for (unsigned i = 0; i < elements.size(); ++i) { 370 for (unsigned i = 0; i < elements.size(); ++i) {
373 FormAssociatedElement* associatedElement = elements[i]; 371 FormAssociatedElement* associatedElement = elements[i];
374 if (!associatedElement->isFormControlElement()) 372 if (!associatedElement->isFormControlElement())
375 continue; 373 continue;
376 if (needButtonActivation) { 374 if (needButtonActivation) {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 String HTMLFormElement::method() const 659 String HTMLFormElement::method() const
662 { 660 {
663 return FormSubmission::Attributes::methodString(m_attributes.method()); 661 return FormSubmission::Attributes::methodString(m_attributes.method());
664 } 662 }
665 663
666 void HTMLFormElement::setMethod(const AtomicString& value) 664 void HTMLFormElement::setMethod(const AtomicString& value)
667 { 665 {
668 setAttribute(methodAttr, value); 666 setAttribute(methodAttr, value);
669 } 667 }
670 668
671 bool HTMLFormElement::wasUserSubmitted() const
672 {
673 return m_wasUserSubmitted;
674 }
675
676 HTMLFormControlElement* HTMLFormElement::findDefaultButton() const 669 HTMLFormControlElement* HTMLFormElement::findDefaultButton() const
677 { 670 {
678 for (const auto& element : associatedElements()) { 671 for (const auto& element : associatedElements()) {
679 if (!element->isFormControlElement()) 672 if (!element->isFormControlElement())
680 continue; 673 continue;
681 HTMLFormControlElement* control = toHTMLFormControlElement(element); 674 HTMLFormControlElement* control = toHTMLFormControlElement(element);
682 if (control->canBeSuccessfulSubmitButton()) 675 if (control->canBeSuccessfulSubmitButton())
683 return control; 676 return control;
684 } 677 }
685 return nullptr; 678 return nullptr;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 { 834 {
842 for (const auto& control : associatedElements()) { 835 for (const auto& control : associatedElements()) {
843 if (!control->isFormControlElement()) 836 if (!control->isFormControlElement())
844 continue; 837 continue;
845 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) 838 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton())
846 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P seudoDefault); 839 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P seudoDefault);
847 } 840 }
848 } 841 }
849 842
850 } // namespace blink 843 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFormElement.h ('k') | third_party/WebKit/Source/web/WebFormElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698