Chromium Code Reviews| 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 5719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5730 m_templateDocument = Document::create(DocumentInit(blankURL())); | 5730 m_templateDocument = Document::create(DocumentInit(blankURL())); |
| 5731 } | 5731 } |
| 5732 | 5732 |
| 5733 m_templateDocument->m_templateDocumentHost = this; // balanced in dtor. | 5733 m_templateDocument->m_templateDocumentHost = this; // balanced in dtor. |
| 5734 | 5734 |
| 5735 return *m_templateDocument.get(); | 5735 return *m_templateDocument.get(); |
| 5736 } | 5736 } |
| 5737 | 5737 |
| 5738 void Document::didAssociateFormControl(Element* element) | 5738 void Document::didAssociateFormControl(Element* element) |
| 5739 { | 5739 { |
| 5740 if (!frame() || !frame()->page()) | 5740 if (!frame() || !frame()->page() || !hasFinishedParsing()) |
|
tkent
2016/07/28 00:21:24
We should use !loadEventFinished() if this should
vasilii
2016/07/28 12:38:50
Done.
| |
| 5741 return; | 5741 return; |
| 5742 m_associatedFormControls.add(element); | 5742 |
| 5743 // We add a slight delay because this could be called rapidly. | 5743 // We add a slight delay because this could be called rapidly. |
| 5744 if (!m_didAssociateFormControlsTimer.isActive()) | 5744 if (!m_didAssociateFormControlsTimer.isActive()) |
| 5745 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE); | 5745 m_didAssociateFormControlsTimer.startOneShot(0.3, BLINK_FROM_HERE); |
| 5746 } | 5746 } |
| 5747 | 5747 |
| 5748 void Document::removeFormAssociation(Element* element) | 5748 void Document::removeFormAssociation(Element* element) |
| 5749 { | 5749 { |
| 5750 auto it = m_associatedFormControls.find(element); | |
| 5751 if (it == m_associatedFormControls.end()) | |
| 5752 return; | |
| 5753 m_associatedFormControls.remove(it); | |
| 5754 if (m_associatedFormControls.isEmpty()) | |
| 5755 m_didAssociateFormControlsTimer.stop(); | |
| 5756 } | 5750 } |
| 5757 | 5751 |
| 5758 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) | 5752 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) |
| 5759 { | 5753 { |
| 5760 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); | 5754 ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); |
| 5761 if (!frame() || !frame()->page()) | 5755 if (!frame() || !frame()->page()) |
| 5762 return; | 5756 return; |
| 5763 | 5757 |
| 5764 HeapVector<Member<Element>> associatedFormControls; | 5758 frame()->page()->chromeClient().didAssociateFormControls(frame()); |
| 5765 copyToVector(m_associatedFormControls, associatedFormControls); | |
| 5766 | |
| 5767 frame()->page()->chromeClient().didAssociateFormControls(associatedFormContr ols, frame()); | |
| 5768 m_associatedFormControls.clear(); | |
| 5769 } | 5759 } |
| 5770 | 5760 |
| 5771 float Document::devicePixelRatio() const | 5761 float Document::devicePixelRatio() const |
| 5772 { | 5762 { |
| 5773 return m_frame ? m_frame->devicePixelRatio() : 1.0; | 5763 return m_frame ? m_frame->devicePixelRatio() : 1.0; |
| 5774 } | 5764 } |
| 5775 | 5765 |
| 5776 TextAutosizer* Document::textAutosizer() | 5766 TextAutosizer* Document::textAutosizer() |
| 5777 { | 5767 { |
| 5778 if (!m_textAutosizer) | 5768 if (!m_textAutosizer) |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5986 visitor->trace(m_contextFeatures); | 5976 visitor->trace(m_contextFeatures); |
| 5987 visitor->trace(m_styleSheetList); | 5977 visitor->trace(m_styleSheetList); |
| 5988 visitor->trace(m_documentTiming); | 5978 visitor->trace(m_documentTiming); |
| 5989 visitor->trace(m_mediaQueryMatcher); | 5979 visitor->trace(m_mediaQueryMatcher); |
| 5990 visitor->trace(m_scriptedAnimationController); | 5980 visitor->trace(m_scriptedAnimationController); |
| 5991 visitor->trace(m_scriptedIdleTaskController); | 5981 visitor->trace(m_scriptedIdleTaskController); |
| 5992 visitor->trace(m_textAutosizer); | 5982 visitor->trace(m_textAutosizer); |
| 5993 visitor->trace(m_registrationContext); | 5983 visitor->trace(m_registrationContext); |
| 5994 visitor->trace(m_customElementMicrotaskRunQueue); | 5984 visitor->trace(m_customElementMicrotaskRunQueue); |
| 5995 visitor->trace(m_elementDataCache); | 5985 visitor->trace(m_elementDataCache); |
| 5996 visitor->trace(m_associatedFormControls); | |
| 5997 visitor->trace(m_useElementsNeedingUpdate); | 5986 visitor->trace(m_useElementsNeedingUpdate); |
| 5998 visitor->trace(m_layerUpdateSVGFilterElements); | 5987 visitor->trace(m_layerUpdateSVGFilterElements); |
| 5999 visitor->trace(m_timers); | 5988 visitor->trace(m_timers); |
| 6000 visitor->trace(m_templateDocument); | 5989 visitor->trace(m_templateDocument); |
| 6001 visitor->trace(m_templateDocumentHost); | 5990 visitor->trace(m_templateDocumentHost); |
| 6002 visitor->trace(m_userActionElements); | 5991 visitor->trace(m_userActionElements); |
| 6003 visitor->trace(m_svgExtensions); | 5992 visitor->trace(m_svgExtensions); |
| 6004 visitor->trace(m_timeline); | 5993 visitor->trace(m_timeline); |
| 6005 visitor->trace(m_compositorPendingAnimations); | 5994 visitor->trace(m_compositorPendingAnimations); |
| 6006 visitor->trace(m_contextDocument); | 5995 visitor->trace(m_contextDocument); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6047 } | 6036 } |
| 6048 | 6037 |
| 6049 void showLiveDocumentInstances() | 6038 void showLiveDocumentInstances() |
| 6050 { | 6039 { |
| 6051 WeakDocumentSet& set = liveDocumentSet(); | 6040 WeakDocumentSet& set = liveDocumentSet(); |
| 6052 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6041 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6053 for (Document* document : set) | 6042 for (Document* document : set) |
| 6054 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); | 6043 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); |
| 6055 } | 6044 } |
| 6056 #endif | 6045 #endif |
| OLD | NEW |