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

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: 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
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 ad88264a539403bfbcd9c8ec5e1ef51b405d080b..064a9a884132a9e8b6f5b2fc8bfc59b1ea24600b 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -5737,9 +5737,9 @@ Document& Document::ensureTemplateDocument()
void Document::didAssociateFormControl(Element* element)
{
- if (!frame() || !frame()->page())
+ if (!frame() || !frame()->page() || !hasFinishedParsing())
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);
@@ -5747,12 +5747,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)
@@ -5761,11 +5755,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().didAssociateFormControls(frame());
}
float Document::devicePixelRatio() const
@@ -5993,7 +5983,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);

Powered by Google App Engine
This is Rietveld 408576698