| 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 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2509 bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio
n) | 2509 bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio
n) |
| 2510 { | 2510 { |
| 2511 if (!m_domWindow) | 2511 if (!m_domWindow) |
| 2512 return true; | 2512 return true; |
| 2513 | 2513 |
| 2514 if (!body()) | 2514 if (!body()) |
| 2515 return true; | 2515 return true; |
| 2516 | 2516 |
| 2517 RefPtr<Document> protect(this); | 2517 RefPtr<Document> protect(this); |
| 2518 | 2518 |
| 2519 RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create(); | 2519 RefPtrWillBeRawPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent:
:create(); |
| 2520 m_loadEventProgress = BeforeUnloadEventInProgress; | 2520 m_loadEventProgress = BeforeUnloadEventInProgress; |
| 2521 m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this); | 2521 m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this); |
| 2522 m_loadEventProgress = BeforeUnloadEventCompleted; | 2522 m_loadEventProgress = BeforeUnloadEventCompleted; |
| 2523 if (!beforeUnloadEvent->defaultPrevented()) | 2523 if (!beforeUnloadEvent->defaultPrevented()) |
| 2524 defaultEventHandler(beforeUnloadEvent.get()); | 2524 defaultEventHandler(beforeUnloadEvent.get()); |
| 2525 if (beforeUnloadEvent->returnValue().isNull()) | 2525 if (beforeUnloadEvent->returnValue().isNull()) |
| 2526 return true; | 2526 return true; |
| 2527 | 2527 |
| 2528 if (didAllowNavigation) { | 2528 if (didAllowNavigation) { |
| 2529 addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt t
o show multiple 'beforeunload' confirmation panels for a single navigation."); | 2529 addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt t
o show multiple 'beforeunload' confirmation panels for a single navigation."); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2553 if (DOMWindow* window = domWindow()) | 2553 if (DOMWindow* window = domWindow()) |
| 2554 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames
::pagehide, false), this); | 2554 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames
::pagehide, false), this); |
| 2555 if (!m_frame) | 2555 if (!m_frame) |
| 2556 return; | 2556 return; |
| 2557 | 2557 |
| 2558 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed | 2558 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed |
| 2559 // while dispatching the event, so protect it to prevent writing the
end | 2559 // while dispatching the event, so protect it to prevent writing the
end |
| 2560 // time into freed memory. | 2560 // time into freed memory. |
| 2561 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); | 2561 RefPtr<DocumentLoader> documentLoader = m_frame->loader().provision
alDocumentLoader(); |
| 2562 m_loadEventProgress = UnloadEventInProgress; | 2562 m_loadEventProgress = UnloadEventInProgress; |
| 2563 RefPtr<Event> unloadEvent(Event::create(EventTypeNames::unload)); | 2563 RefPtrWillBeRawPtr<Event> unloadEvent(Event::create(EventTypeNames::
unload)); |
| 2564 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { | 2564 if (documentLoader && !documentLoader->timing()->unloadEventStart()
&& !documentLoader->timing()->unloadEventEnd()) { |
| 2565 DocumentLoadTiming* timing = documentLoader->timing(); | 2565 DocumentLoadTiming* timing = documentLoader->timing(); |
| 2566 ASSERT(timing->navigationStart()); | 2566 ASSERT(timing->navigationStart()); |
| 2567 timing->markUnloadEventStart(); | 2567 timing->markUnloadEventStart(); |
| 2568 m_frame->domWindow()->dispatchEvent(unloadEvent, this); | 2568 m_frame->domWindow()->dispatchEvent(unloadEvent, this); |
| 2569 timing->markUnloadEventEnd(); | 2569 timing->markUnloadEventEnd(); |
| 2570 } else { | 2570 } else { |
| 2571 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->docume
nt()); | 2571 m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->docume
nt()); |
| 2572 } | 2572 } |
| 2573 } | 2573 } |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3719 return domWindow->getAttributeEventListener(eventType); | 3719 return domWindow->getAttributeEventListener(eventType); |
| 3720 } | 3720 } |
| 3721 | 3721 |
| 3722 EventQueue* Document::eventQueue() const | 3722 EventQueue* Document::eventQueue() const |
| 3723 { | 3723 { |
| 3724 if (!m_domWindow) | 3724 if (!m_domWindow) |
| 3725 return 0; | 3725 return 0; |
| 3726 return m_domWindow->eventQueue(); | 3726 return m_domWindow->eventQueue(); |
| 3727 } | 3727 } |
| 3728 | 3728 |
| 3729 void Document::enqueueAnimationFrameEvent(PassRefPtr<Event> event) | 3729 void Document::enqueueAnimationFrameEvent(PassRefPtrWillBeRawPtr<Event> event) |
| 3730 { | 3730 { |
| 3731 ensureScriptedAnimationController().enqueueEvent(event); | 3731 ensureScriptedAnimationController().enqueueEvent(event); |
| 3732 } | 3732 } |
| 3733 | 3733 |
| 3734 void Document::enqueueScrollEventForNode(Node* target) | 3734 void Document::enqueueScrollEventForNode(Node* target) |
| 3735 { | 3735 { |
| 3736 // Per the W3C CSSOM View Module only scroll events fired at the document sh
ould bubble. | 3736 // Per the W3C CSSOM View Module only scroll events fired at the document sh
ould bubble. |
| 3737 RefPtr<Event> scrollEvent = target->isDocumentNode() ? Event::createBubble(E
ventTypeNames::scroll) : Event::create(EventTypeNames::scroll); | 3737 RefPtrWillBeRawPtr<Event> scrollEvent = target->isDocumentNode() ? Event::cr
eateBubble(EventTypeNames::scroll) : Event::create(EventTypeNames::scroll); |
| 3738 scrollEvent->setTarget(target); | 3738 scrollEvent->setTarget(target); |
| 3739 ensureScriptedAnimationController().enqueuePerFrameEvent(scrollEvent.release
()); | 3739 ensureScriptedAnimationController().enqueuePerFrameEvent(scrollEvent.release
()); |
| 3740 } | 3740 } |
| 3741 | 3741 |
| 3742 void Document::enqueueResizeEvent() | 3742 void Document::enqueueResizeEvent() |
| 3743 { | 3743 { |
| 3744 RefPtr<Event> event = Event::create(EventTypeNames::resize); | 3744 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::resize); |
| 3745 event->setTarget(domWindow()); | 3745 event->setTarget(domWindow()); |
| 3746 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); | 3746 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); |
| 3747 } | 3747 } |
| 3748 | 3748 |
| 3749 PassRefPtrWillBeRawPtr<Event> Document::createEvent(const String& eventType, Exc
eptionState& exceptionState) | 3749 PassRefPtrWillBeRawPtr<Event> Document::createEvent(const String& eventType, Exc
eptionState& exceptionState) |
| 3750 { | 3750 { |
| 3751 RefPtrWillBeRawPtr<Event> event = EventFactory::create(eventType); | 3751 RefPtrWillBeRawPtr<Event> event = EventFactory::create(eventType); |
| 3752 if (event) | 3752 if (event) |
| 3753 return event.release(); | 3753 return event.release(); |
| 3754 | 3754 |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5491 } | 5491 } |
| 5492 | 5492 |
| 5493 void Document::invalidateNodeListCaches(const QualifiedName* attrName) | 5493 void Document::invalidateNodeListCaches(const QualifiedName* attrName) |
| 5494 { | 5494 { |
| 5495 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); | 5495 HashSet<LiveNodeListBase*>::iterator end = m_listsInvalidatedAtDocument.end(
); |
| 5496 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) | 5496 for (HashSet<LiveNodeListBase*>::iterator it = m_listsInvalidatedAtDocument.
begin(); it != end; ++it) |
| 5497 (*it)->invalidateCache(attrName); | 5497 (*it)->invalidateCache(attrName); |
| 5498 } | 5498 } |
| 5499 | 5499 |
| 5500 } // namespace WebCore | 5500 } // namespace WebCore |
| OLD | NEW |