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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 7b4c2c697197fc129609eff73f3bfc2b1f235172..ee181075077d95efd92d345867b7ad939ebc11fa 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -5738,9 +5738,9 @@ Document& Document::ensureTemplateDocument()
void Document::didAssociateFormControl(Element* element)
{
- if (!frame() || !frame()->page())
+ if (!frame() || !frame()->page() || !loadEventFinished())
return;
- m_associatedFormControls.add(element);
+
// We add a slight delay because this could be called rapidly.
if (!m_didAssociateFormControlsTimer.isActive())
m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE);
@@ -5748,12 +5748,6 @@ void Document::didAssociateFormControl(Element* element)
void Document::removeFormAssociation(Element* element)
{
- auto it = m_associatedFormControls.find(element);
- if (it == m_associatedFormControls.end())
- return;
- m_associatedFormControls.remove(it);
- if (m_associatedFormControls.isEmpty())
- m_didAssociateFormControlsTimer.stop();
}
void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer)
@@ -5762,11 +5756,7 @@ void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer)
if (!frame() || !frame()->page())
return;
- HeapVector<Member<Element>> associatedFormControls;
- copyToVector(m_associatedFormControls, associatedFormControls);
-
- frame()->page()->chromeClient().didAssociateFormControls(associatedFormControls, frame());
- m_associatedFormControls.clear();
+ frame()->page()->chromeClient().didAssociateFormControlsAfterLoad(frame());
}
float Document::devicePixelRatio() const
@@ -5994,7 +5984,6 @@ DEFINE_TRACE(Document)
visitor->trace(m_registrationContext);
visitor->trace(m_customElementMicrotaskRunQueue);
visitor->trace(m_elementDataCache);
- visitor->trace(m_associatedFormControls);
visitor->trace(m_useElementsNeedingUpdate);
visitor->trace(m_layerUpdateSVGFilterElements);
visitor->trace(m_timers);
« 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