| 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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2534 bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio
n) | 2534 bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio
n) |
| 2535 { | 2535 { |
| 2536 if (!m_domWindow) | 2536 if (!m_domWindow) |
| 2537 return true; | 2537 return true; |
| 2538 | 2538 |
| 2539 if (!body()) | 2539 if (!body()) |
| 2540 return true; | 2540 return true; |
| 2541 | 2541 |
| 2542 RefPtr<Document> protect(this); | 2542 RefPtr<Document> protect(this); |
| 2543 | 2543 |
| 2544 RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create(); | 2544 RefPtrWillBeRawPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent:
:create(); |
| 2545 m_loadEventProgress = BeforeUnloadEventInProgress; | 2545 m_loadEventProgress = BeforeUnloadEventInProgress; |
| 2546 m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this); | 2546 m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this); |
| 2547 m_loadEventProgress = BeforeUnloadEventCompleted; | 2547 m_loadEventProgress = BeforeUnloadEventCompleted; |
| 2548 if (!beforeUnloadEvent->defaultPrevented()) | 2548 if (!beforeUnloadEvent->defaultPrevented()) |
| 2549 defaultEventHandler(beforeUnloadEvent.get()); | 2549 defaultEventHandler(beforeUnloadEvent.get()); |
| 2550 if (beforeUnloadEvent->returnValue().isNull()) | 2550 if (beforeUnloadEvent->returnValue().isNull()) |
| 2551 return true; | 2551 return true; |
| 2552 | 2552 |
| 2553 if (didAllowNavigation) { | 2553 if (didAllowNavigation) { |
| 2554 addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt t
o show multiple 'beforeunload' confirmation panels for a single navigation."); | 2554 addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt t
o show multiple 'beforeunload' confirmation panels for a single navigation."); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2578 if (DOMWindow* window = domWindow()) | 2578 if (DOMWindow* window = domWindow()) |
| 2579 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames
::pagehide, false), this); | 2579 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames
::pagehide, false), this); |
| 2580 if (!m_frame) | 2580 if (!m_frame) |
| 2581 return; | 2581 return; |
| 2582 | 2582 |
| 2583 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed | 2583 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed |
| 2584 // while dispatching the event, so protect it to prevent writing the
end | 2584 // while dispatching the event, so protect it to prevent writing the
end |
| 2585 // time into freed memory. | 2585 // time into freed memory. |
| 2586 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); | 2586 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); |
| 2587 m_loadEventProgress = UnloadEventInProgress; | 2587 m_loadEventProgress = UnloadEventInProgress; |
| 2588 RefPtr<Event> unloadEvent(Event::create(EventTypeNames::unload)); | 2588 RefPtrWillBeRawPtr<Event> unloadEvent(Event::create(EventTypeNames::
unload)); |
| 2589 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { | 2589 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { |
| 2590 DocumentLoadTiming* timing = documentLoader->timing(); | 2590 DocumentLoadTiming* timing = documentLoader->timing(); |
| 2591 ASSERT(timing->navigationStart()); | 2591 ASSERT(timing->navigationStart()); |
| 2592 timing->markUnloadEventStart(); | 2592 timing->markUnloadEventStart(); |
| 2593 m_frame->domWindow()->dispatchEvent(unloadEvent, this); | 2593 m_frame->domWindow()->dispatchEvent(unloadEvent, this); |
| 2594 timing->markUnloadEventEnd(); | 2594 timing->markUnloadEventEnd(); |
| 2595 } else { | 2595 } else { |
| 2596 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->docume
nt()); | 2596 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->docume
nt()); |
| 2597 } | 2597 } |
| 2598 } | 2598 } |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3749 return domWindow->getAttributeEventListener(eventType); | 3749 return domWindow->getAttributeEventListener(eventType); |
| 3750 } | 3750 } |
| 3751 | 3751 |
| 3752 EventQueue* Document::eventQueue() const | 3752 EventQueue* Document::eventQueue() const |
| 3753 { | 3753 { |
| 3754 if (!m_domWindow) | 3754 if (!m_domWindow) |
| 3755 return 0; | 3755 return 0; |
| 3756 return m_domWindow->eventQueue(); | 3756 return m_domWindow->eventQueue(); |
| 3757 } | 3757 } |
| 3758 | 3758 |
| 3759 void Document::enqueueAnimationFrameEvent(PassRefPtr<Event> event) | 3759 void Document::enqueueAnimationFrameEvent(PassRefPtrWillBeRawPtr<Event> event) |
| 3760 { | 3760 { |
| 3761 ensureScriptedAnimationController().enqueueEvent(event); | 3761 ensureScriptedAnimationController().enqueueEvent(event); |
| 3762 } | 3762 } |
| 3763 | 3763 |
| 3764 void Document::enqueueScrollEventForNode(Node* target) | 3764 void Document::enqueueScrollEventForNode(Node* target) |
| 3765 { | 3765 { |
| 3766 // Per the W3C CSSOM View Module only scroll events fired at the document sh
ould bubble. | 3766 // Per the W3C CSSOM View Module only scroll events fired at the document sh
ould bubble. |
| 3767 RefPtr<Event> scrollEvent = target->isDocumentNode() ? Event::createBubble(E
ventTypeNames::scroll) : Event::create(EventTypeNames::scroll); | 3767 RefPtrWillBeRawPtr<Event> scrollEvent = target->isDocumentNode() ? Event::cr
eateBubble(EventTypeNames::scroll) : Event::create(EventTypeNames::scroll); |
| 3768 scrollEvent->setTarget(target); | 3768 scrollEvent->setTarget(target); |
| 3769 ensureScriptedAnimationController().enqueuePerFrameEvent(scrollEvent.release
()); | 3769 ensureScriptedAnimationController().enqueuePerFrameEvent(scrollEvent.release
()); |
| 3770 } | 3770 } |
| 3771 | 3771 |
| 3772 void Document::enqueueResizeEvent() | 3772 void Document::enqueueResizeEvent() |
| 3773 { | 3773 { |
| 3774 RefPtr<Event> event = Event::create(EventTypeNames::resize); | 3774 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::resize); |
| 3775 event->setTarget(domWindow()); | 3775 event->setTarget(domWindow()); |
| 3776 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); | 3776 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); |
| 3777 } | 3777 } |
| 3778 | 3778 |
| 3779 PassRefPtrWillBeRawPtr<Event> Document::createEvent(const String& eventType, Exc
eptionState& exceptionState) | 3779 PassRefPtrWillBeRawPtr<Event> Document::createEvent(const String& eventType, Exc
eptionState& exceptionState) |
| 3780 { | 3780 { |
| 3781 RefPtrWillBeRawPtr<Event> event = EventFactory::create(eventType); | 3781 RefPtrWillBeRawPtr<Event> event = EventFactory::create(eventType); |
| 3782 if (event) | 3782 if (event) |
| 3783 return event.release(); | 3783 return event.release(); |
| 3784 | 3784 |
| (...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5522 } | 5522 } |
| 5523 | 5523 |
| 5524 void Document::invalidateNodeListCaches(const QualifiedName* attrName) | 5524 void Document::invalidateNodeListCaches(const QualifiedName* attrName) |
| 5525 { | 5525 { |
| 5526 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); | 5526 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); |
| 5527 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) | 5527 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) |
| 5528 (*it)->invalidateCache(attrName); | 5528 (*it)->invalidateCache(attrName); |
| 5529 } | 5529 } |
| 5530 | 5530 |
| 5531 } // namespace WebCore | 5531 } // namespace WebCore |
| OLD | NEW |