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

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

Issue 2189513004: Blink: prevent didAssociateFormControls notification while parsing the document. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 4 years, 4 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
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 5720 matching lines...) Expand 10 before | Expand all | Expand 10 after
5731 m_templateDocument = Document::create(DocumentInit(blankURL())); 5731 m_templateDocument = Document::create(DocumentInit(blankURL()));
5732 } 5732 }
5733 5733
5734 m_templateDocument->m_templateDocumentHost = this; // balanced in dtor. 5734 m_templateDocument->m_templateDocumentHost = this; // balanced in dtor.
5735 5735
5736 return *m_templateDocument.get(); 5736 return *m_templateDocument.get();
5737 } 5737 }
5738 5738
5739 void Document::didAssociateFormControl(Element* element) 5739 void Document::didAssociateFormControl(Element* element)
5740 { 5740 {
5741 if (!frame() || !frame()->page()) 5741 if (!frame() || !frame()->page() || !loadEventFinished())
5742 return; 5742 return;
5743 m_associatedFormControls.add(element); 5743
5744 // We add a slight delay because this could be called rapidly. 5744 // We add a slight delay because this could be called rapidly.
5745 if (!m_didAssociateFormControlsTimer.isActive()) 5745 if (!m_didAssociateFormControlsTimer.isActive())
5746 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE); 5746 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE);
5747 } 5747 }
5748 5748
5749 void Document::removeFormAssociation(Element* element) 5749 void Document::removeFormAssociation(Element* element)
5750 { 5750 {
5751 auto it = m_associatedFormControls.find(element);
5752 if (it == m_associatedFormControls.end())
5753 return;
5754 m_associatedFormControls.remove(it);
5755 if (m_associatedFormControls.isEmpty())
5756 m_didAssociateFormControlsTimer.stop();
5757 } 5751 }
5758 5752
5759 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) 5753 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer)
5760 { 5754 {
5761 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); 5755 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer);
5762 if (!frame() || !frame()->page()) 5756 if (!frame() || !frame()->page())
5763 return; 5757 return;
5764 5758
5765 HeapVector<Member<Element>> associatedFormControls; 5759 frame()->page()->chromeClient().didAssociateFormControlsAfterLoad(frame());
5766 copyToVector(m_associatedFormControls, associatedFormControls);
5767
5768 frame()->page()->chromeClient().didAssociateFormControls(associatedFormContr ols, frame());
5769 m_associatedFormControls.clear();
5770 } 5760 }
5771 5761
5772 float Document::devicePixelRatio() const 5762 float Document::devicePixelRatio() const
5773 { 5763 {
5774 return m_frame ? m_frame->devicePixelRatio() : 1.0; 5764 return m_frame ? m_frame->devicePixelRatio() : 1.0;
5775 } 5765 }
5776 5766
5777 TextAutosizer* Document::textAutosizer() 5767 TextAutosizer* Document::textAutosizer()
5778 { 5768 {
5779 if (!m_textAutosizer) 5769 if (!m_textAutosizer)
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
5987 visitor->trace(m_contextFeatures); 5977 visitor->trace(m_contextFeatures);
5988 visitor->trace(m_styleSheetList); 5978 visitor->trace(m_styleSheetList);
5989 visitor->trace(m_documentTiming); 5979 visitor->trace(m_documentTiming);
5990 visitor->trace(m_mediaQueryMatcher); 5980 visitor->trace(m_mediaQueryMatcher);
5991 visitor->trace(m_scriptedAnimationController); 5981 visitor->trace(m_scriptedAnimationController);
5992 visitor->trace(m_scriptedIdleTaskController); 5982 visitor->trace(m_scriptedIdleTaskController);
5993 visitor->trace(m_textAutosizer); 5983 visitor->trace(m_textAutosizer);
5994 visitor->trace(m_registrationContext); 5984 visitor->trace(m_registrationContext);
5995 visitor->trace(m_customElementMicrotaskRunQueue); 5985 visitor->trace(m_customElementMicrotaskRunQueue);
5996 visitor->trace(m_elementDataCache); 5986 visitor->trace(m_elementDataCache);
5997 visitor->trace(m_associatedFormControls);
5998 visitor->trace(m_useElementsNeedingUpdate); 5987 visitor->trace(m_useElementsNeedingUpdate);
5999 visitor->trace(m_layerUpdateSVGFilterElements); 5988 visitor->trace(m_layerUpdateSVGFilterElements);
6000 visitor->trace(m_timers); 5989 visitor->trace(m_timers);
6001 visitor->trace(m_templateDocument); 5990 visitor->trace(m_templateDocument);
6002 visitor->trace(m_templateDocumentHost); 5991 visitor->trace(m_templateDocumentHost);
6003 visitor->trace(m_userActionElements); 5992 visitor->trace(m_userActionElements);
6004 visitor->trace(m_svgExtensions); 5993 visitor->trace(m_svgExtensions);
6005 visitor->trace(m_timeline); 5994 visitor->trace(m_timeline);
6006 visitor->trace(m_compositorPendingAnimations); 5995 visitor->trace(m_compositorPendingAnimations);
6007 visitor->trace(m_contextDocument); 5996 visitor->trace(m_contextDocument);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
6048 } 6037 }
6049 6038
6050 void showLiveDocumentInstances() 6039 void showLiveDocumentInstances()
6051 { 6040 {
6052 WeakDocumentSet& set = liveDocumentSet(); 6041 WeakDocumentSet& set = liveDocumentSet();
6053 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6042 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6054 for (Document* document : set) 6043 for (Document* document : set)
6055 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6044 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6056 } 6045 }
6057 #endif 6046 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698