| OLD | NEW |
| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 void HTMLFormElement::requestAutocomplete() | 428 void HTMLFormElement::requestAutocomplete() |
| 429 { | 429 { |
| 430 if (!document().frame() || !shouldAutocomplete() || !UserGestureIndicator::p
rocessingUserGesture()) | 430 if (!document().frame() || !shouldAutocomplete() || !UserGestureIndicator::p
rocessingUserGesture()) |
| 431 finishRequestAutocomplete(AutocompleteResultErrorDisabled); | 431 finishRequestAutocomplete(AutocompleteResultErrorDisabled); |
| 432 else | 432 else |
| 433 document().frame()->loader().client()->didRequestAutocomplete(this); | 433 document().frame()->loader().client()->didRequestAutocomplete(this); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) | 436 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) |
| 437 { | 437 { |
| 438 RefPtr<Event> event; | 438 RefPtrWillBeRawPtr<Event> event = nullptr; |
| 439 if (result == AutocompleteResultSuccess) | 439 if (result == AutocompleteResultSuccess) |
| 440 event = Event::create(EventTypeNames::autocomplete); | 440 event = Event::create(EventTypeNames::autocomplete); |
| 441 else if (result == AutocompleteResultErrorDisabled) | 441 else if (result == AutocompleteResultErrorDisabled) |
| 442 event = AutocompleteErrorEvent::create("disabled"); | 442 event = AutocompleteErrorEvent::create("disabled"); |
| 443 else if (result == AutocompleteResultErrorCancel) | 443 else if (result == AutocompleteResultErrorCancel) |
| 444 event = AutocompleteErrorEvent::create("cancel"); | 444 event = AutocompleteErrorEvent::create("cancel"); |
| 445 else if (result == AutocompleteResultErrorInvalid) | 445 else if (result == AutocompleteResultErrorInvalid) |
| 446 event = AutocompleteErrorEvent::create("invalid"); | 446 event = AutocompleteErrorEvent::create("invalid"); |
| 447 else |
| 448 ASSERT_NOT_REACHED(); |
| 447 | 449 |
| 448 event->setTarget(this); | 450 event->setTarget(this); |
| 449 m_pendingAutocompleteEvents.append(event.release()); | 451 m_pendingAutocompleteEvents.append(event.release()); |
| 450 | 452 |
| 451 // Dispatch events later as this API is meant to work asynchronously in all
situations and implementations. | 453 // Dispatch events later as this API is meant to work asynchronously in all
situations and implementations. |
| 452 if (!m_requestAutocompleteTimer.isActive()) | 454 if (!m_requestAutocompleteTimer.isActive()) |
| 453 m_requestAutocompleteTimer.startOneShot(0, FROM_HERE); | 455 m_requestAutocompleteTimer.startOneShot(0, FROM_HERE); |
| 454 } | 456 } |
| 455 | 457 |
| 456 void HTMLFormElement::requestAutocompleteTimerFired(Timer<HTMLFormElement>*) | 458 void HTMLFormElement::requestAutocompleteTimerFired(Timer<HTMLFormElement>*) |
| 457 { | 459 { |
| 458 Vector<RefPtr<Event> > pendingEvents; | 460 WillBeHeapVector<RefPtrWillBeMember<Event> > pendingEvents; |
| 459 m_pendingAutocompleteEvents.swap(pendingEvents); | 461 m_pendingAutocompleteEvents.swap(pendingEvents); |
| 460 for (size_t i = 0; i < pendingEvents.size(); ++i) | 462 for (size_t i = 0; i < pendingEvents.size(); ++i) |
| 461 dispatchEvent(pendingEvents[i].release()); | 463 dispatchEvent(pendingEvents[i].release()); |
| 462 } | 464 } |
| 463 | 465 |
| 464 void HTMLFormElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) | 466 void HTMLFormElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) |
| 465 { | 467 { |
| 466 if (name == actionAttr) | 468 if (name == actionAttr) |
| 467 m_attributes.parseAction(value); | 469 m_attributes.parseAction(value); |
| 468 else if (name == targetAttr) | 470 else if (name == targetAttr) |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 } | 777 } |
| 776 | 778 |
| 777 void HTMLFormElement::setDemoted(bool demoted) | 779 void HTMLFormElement::setDemoted(bool demoted) |
| 778 { | 780 { |
| 779 if (demoted) | 781 if (demoted) |
| 780 UseCounter::count(document(), UseCounter::DemotedFormElement); | 782 UseCounter::count(document(), UseCounter::DemotedFormElement); |
| 781 m_wasDemoted = demoted; | 783 m_wasDemoted = demoted; |
| 782 } | 784 } |
| 783 | 785 |
| 784 } // namespace | 786 } // namespace |
| OLD | NEW |