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

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

Issue 2261393002: Fixed the behaviour of form submit to Firefox: form does not submit once it has been removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review change Created 4 years, 3 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 } 344 }
345 } 345 }
346 346
347 void HTMLFormElement::submit(Event* event, bool activateSubmitButton) 347 void HTMLFormElement::submit(Event* event, bool activateSubmitButton)
348 { 348 {
349 FrameView* view = document().view(); 349 FrameView* view = document().view();
350 LocalFrame* frame = document().frame(); 350 LocalFrame* frame = document().frame();
351 if (!view || !frame || !frame->page()) 351 if (!view || !frame || !frame->page())
352 return; 352 return;
353
354 // Do not submit if the form is not attached to the document.
tkent 2016/08/25 00:52:54 I don't think this comment and the CL description
iclelland 2016/08/25 13:17:30 Agreed -- that's better. (I looked for that kind o
lunalu1 2016/08/25 15:05:35 Done.
355 // This matches the behaviour in Firefox.
353 // See crbug.com/586749. 356 // See crbug.com/586749.
tkent 2016/08/25 00:52:54 Remove this line. The bug won't be so helpful aft
lunalu1 2016/08/25 15:05:35 Done.
354 if (!isConnected()) 357 if (!isConnected())
355 UseCounter::count(document(), UseCounter::FormSubmissionNotInDocumentTre e); 358 return;
tkent 2016/08/25 00:52:54 Need to remove FormSubmissionNotInDocumentTree fro
356 359
357 if (m_isSubmitting) 360 if (m_isSubmitting)
358 return; 361 return;
359 362
360 // Delay dispatching 'close' to dialog until done submitting. 363 // Delay dispatching 'close' to dialog until done submitting.
361 EventQueueScope scopeForDialogClose; 364 EventQueueScope scopeForDialogClose;
362 AutoReset<bool> submitScope(&m_isSubmitting, true); 365 AutoReset<bool> submitScope(&m_isSubmitting, true);
363 366
364 HTMLFormControlElement* firstSuccessfulSubmitButton = nullptr; 367 HTMLFormControlElement* firstSuccessfulSubmitButton = nullptr;
365 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button? 368 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 { 798 {
796 for (const auto& control : associatedElements()) { 799 for (const auto& control : associatedElements()) {
797 if (!control->isFormControlElement()) 800 if (!control->isFormControlElement())
798 continue; 801 continue;
799 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) 802 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton())
800 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P seudoDefault); 803 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P seudoDefault);
801 } 804 }
802 } 805 }
803 806
804 } // namespace blink 807 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698