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

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

Issue 31063004: Have Frame::loader() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLElement.cpp ('k') | Source/core/html/HTMLFrameOwnerElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 // Interactive validation must be done before dispatching the submit event. 273 // Interactive validation must be done before dispatching the submit event.
274 if (!validateInteractively(event)) { 274 if (!validateInteractively(event)) {
275 m_isSubmittingOrPreparingForSubmission = false; 275 m_isSubmittingOrPreparingForSubmission = false;
276 return false; 276 return false;
277 } 277 }
278 278
279 StringPairVector controlNamesAndValues; 279 StringPairVector controlNamesAndValues;
280 getTextFieldValues(controlNamesAndValues); 280 getTextFieldValues(controlNamesAndValues);
281 RefPtr<FormState> formState = FormState::create(this, controlNamesAndValues, &document(), NotSubmittedByJavaScript); 281 RefPtr<FormState> formState = FormState::create(this, controlNamesAndValues, &document(), NotSubmittedByJavaScript);
282 frame->loader()->client()->dispatchWillSendSubmitEvent(formState.release()); 282 frame->loader().client()->dispatchWillSendSubmitEvent(formState.release());
283 283
284 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit))) 284 if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit)))
285 m_shouldSubmit = true; 285 m_shouldSubmit = true;
286 286
287 m_isSubmittingOrPreparingForSubmission = false; 287 m_isSubmittingOrPreparingForSubmission = false;
288 288
289 if (m_shouldSubmit) 289 if (m_shouldSubmit)
290 submit(event, true, true, NotSubmittedByJavaScript); 290 submit(event, true, true, NotSubmittedByJavaScript);
291 291
292 return m_shouldSubmit; 292 return m_shouldSubmit;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, " Blocked form submission to '" + submission->action().elidedString() + "' because the form's frame is sandboxed and the 'allow-forms' permission is not set."); 391 document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, " Blocked form submission to '" + submission->action().elidedString() + "' because the form's frame is sandboxed and the 'allow-forms' permission is not set.");
392 return; 392 return;
393 } 393 }
394 394
395 if (protocolIsJavaScript(submission->action())) { 395 if (protocolIsJavaScript(submission->action())) {
396 if (!document().contentSecurityPolicy()->allowFormAction(KURL(submission ->action()))) 396 if (!document().contentSecurityPolicy()->allowFormAction(KURL(submission ->action())))
397 return; 397 return;
398 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac tion()); 398 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac tion());
399 return; 399 return;
400 } 400 }
401 submission->setReferrer(document().frame()->loader()->outgoingReferrer()); 401 submission->setReferrer(document().frame()->loader().outgoingReferrer());
402 submission->setOrigin(document().frame()->loader()->outgoingOrigin()); 402 submission->setOrigin(document().frame()->loader().outgoingOrigin());
403 403
404 document().frame()->navigationScheduler().scheduleFormSubmission(submission) ; 404 document().frame()->navigationScheduler().scheduleFormSubmission(submission) ;
405 } 405 }
406 406
407 void HTMLFormElement::reset() 407 void HTMLFormElement::reset()
408 { 408 {
409 Frame* frame = document().frame(); 409 Frame* frame = document().frame();
410 if (m_isInResetFunction || !frame) 410 if (m_isInResetFunction || !frame)
411 return; 411 return;
412 412
(...skipping 19 matching lines...) Expand all
432 return; 432 return;
433 433
434 if (!shouldAutocomplete() || !UserGestureIndicator::processingUserGesture()) { 434 if (!shouldAutocomplete() || !UserGestureIndicator::processingUserGesture()) {
435 finishRequestAutocomplete(AutocompleteResultErrorDisabled); 435 finishRequestAutocomplete(AutocompleteResultErrorDisabled);
436 return; 436 return;
437 } 437 }
438 438
439 StringPairVector controlNamesAndValues; 439 StringPairVector controlNamesAndValues;
440 getTextFieldValues(controlNamesAndValues); 440 getTextFieldValues(controlNamesAndValues);
441 RefPtr<FormState> formState = FormState::create(this, controlNamesAndValues, &document(), SubmittedByJavaScript); 441 RefPtr<FormState> formState = FormState::create(this, controlNamesAndValues, &document(), SubmittedByJavaScript);
442 frame->loader()->client()->didRequestAutocomplete(formState.release()); 442 frame->loader().client()->didRequestAutocomplete(formState.release());
443 } 443 }
444 444
445 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) 445 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result)
446 { 446 {
447 RefPtr<Event> event; 447 RefPtr<Event> event;
448 if (result == AutocompleteResultSuccess) 448 if (result == AutocompleteResultSuccess)
449 event = Event::create(EventTypeNames::autocomplete); 449 event = Event::create(EventTypeNames::autocomplete);
450 else if (result == AutocompleteResultErrorDisabled) 450 else if (result == AutocompleteResultErrorDisabled)
451 event = AutocompleteErrorEvent::create("disabled"); 451 event = AutocompleteErrorEvent::create("disabled");
452 else if (result == AutocompleteResultErrorCancel) 452 else if (result == AutocompleteResultErrorCancel)
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 } 806 }
807 807
808 void HTMLFormElement::setDemoted(bool demoted) 808 void HTMLFormElement::setDemoted(bool demoted)
809 { 809 {
810 if (demoted) 810 if (demoted)
811 UseCounter::count(document(), UseCounter::DemotedFormElement); 811 UseCounter::count(document(), UseCounter::DemotedFormElement);
812 m_wasDemoted = demoted; 812 m_wasDemoted = demoted;
813 } 813 }
814 814
815 } // namespace 815 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLElement.cpp ('k') | Source/core/html/HTMLFrameOwnerElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698