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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 460043002: Remove Document::LoadEventTried, it's not necessary (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | 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 * (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 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 implicitClose(); 2510 implicitClose();
2511 return; 2511 return;
2512 } 2512 }
2513 2513
2514 m_frame->loader().checkCompleted(); 2514 m_frame->loader().checkCompleted();
2515 } 2515 }
2516 2516
2517 void Document::implicitClose() 2517 void Document::implicitClose()
2518 { 2518 {
2519 ASSERT(!inStyleRecalc()); 2519 ASSERT(!inStyleRecalc());
2520 2520 if (processingLoadEvent() || !m_parser)
2521 bool wasLocationChangePending = frame() && frame()->navigationScheduler().lo cationChangePending(); 2521 return;
2522 bool doload = !parsing() && m_parser && !processingLoadEvent() && !wasLocati onChangePending; 2522 if (frame() && frame()->navigationScheduler().locationChangePending())
2523
2524 // If the load was blocked because of a pending location change and the loca tion change triggers a same document
2525 // navigation, don't fire load events after the same document navigation com pletes (unless there's an explicit open).
2526 m_loadEventProgress = LoadEventTried;
2527
2528 if (!doload)
2529 return; 2523 return;
2530 2524
2531 // The call to dispatchWindowLoadEvent can detach the LocalDOMWindow and cau se it (and its 2525 // The call to dispatchWindowLoadEvent can detach the LocalDOMWindow and cau se it (and its
2532 // attached Document) to be destroyed. 2526 // attached Document) to be destroyed.
2533 RefPtrWillBeRawPtr<LocalDOMWindow> protectedWindow(this->domWindow()); 2527 RefPtrWillBeRawPtr<LocalDOMWindow> protectedWindow(this->domWindow());
2534 2528
2535 m_loadEventProgress = LoadEventInProgress; 2529 m_loadEventProgress = LoadEventInProgress;
2536 2530
2537 ScriptableDocumentParser* parser = scriptableDocumentParser(); 2531 ScriptableDocumentParser* parser = scriptableDocumentParser();
2538 m_wellFormed = parser && parser->wellFormed(); 2532 m_wellFormed = parser && parser->wellFormed();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 } 2640 }
2647 return false; 2641 return false;
2648 } 2642 }
2649 2643
2650 void Document::dispatchUnloadEvents() 2644 void Document::dispatchUnloadEvents()
2651 { 2645 {
2652 RefPtrWillBeRawPtr<Document> protect(this); 2646 RefPtrWillBeRawPtr<Document> protect(this);
2653 if (m_parser) 2647 if (m_parser)
2654 m_parser->stopParsing(); 2648 m_parser->stopParsing();
2655 2649
2656 if (m_loadEventProgress >= LoadEventTried && m_loadEventProgress <= UnloadEv entInProgress) { 2650 if (m_loadEventProgress == LoadEventNotRun)
2651 return;
2652
2653 if (m_loadEventProgress <= UnloadEventInProgress) {
2657 Element* currentFocusedElement = focusedElement(); 2654 Element* currentFocusedElement = focusedElement();
2658 if (isHTMLInputElement(currentFocusedElement)) 2655 if (isHTMLInputElement(currentFocusedElement))
2659 toHTMLInputElement(*currentFocusedElement).endEditing(); 2656 toHTMLInputElement(*currentFocusedElement).endEditing();
2660 if (m_loadEventProgress < PageHideInProgress) { 2657 if (m_loadEventProgress < PageHideInProgress) {
2661 m_loadEventProgress = PageHideInProgress; 2658 m_loadEventProgress = PageHideInProgress;
2662 if (LocalDOMWindow* window = domWindow()) 2659 if (LocalDOMWindow* window = domWindow())
2663 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames ::pagehide, false), this); 2660 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames ::pagehide, false), this);
2664 if (!m_frame) 2661 if (!m_frame)
2665 return; 2662 return;
2666 2663
(...skipping 3183 matching lines...) Expand 10 before | Expand all | Expand 10 after
5850 using namespace blink; 5847 using namespace blink;
5851 void showLiveDocumentInstances() 5848 void showLiveDocumentInstances()
5852 { 5849 {
5853 WeakDocumentSet& set = liveDocumentSet(); 5850 WeakDocumentSet& set = liveDocumentSet();
5854 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5851 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5855 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 5852 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
5856 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 5853 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
5857 } 5854 }
5858 } 5855 }
5859 #endif 5856 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698