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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
(...skipping 4575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4586 "The provided event type ('" + event_type + "') is invalid."); | 4586 "The provided event type ('" + event_type + "') is invalid."); |
4587 return nullptr; | 4587 return nullptr; |
4588 } | 4588 } |
4589 | 4589 |
4590 void Document::AddMutationEventListenerTypeIfEnabled( | 4590 void Document::AddMutationEventListenerTypeIfEnabled( |
4591 ListenerType listener_type) { | 4591 ListenerType listener_type) { |
4592 if (ContextFeatures::MutationEventsEnabled(this)) | 4592 if (ContextFeatures::MutationEventsEnabled(this)) |
4593 AddListenerType(listener_type); | 4593 AddListenerType(listener_type); |
4594 } | 4594 } |
4595 | 4595 |
4596 void Document::AddListenerTypeIfNeeded(const AtomicString& event_type) { | 4596 void Document::AddListenerTypeIfNeeded(const AtomicString& event_type, |
| 4597 EventTarget& event_target) { |
4597 if (event_type == EventTypeNames::DOMSubtreeModified) { | 4598 if (event_type == EventTypeNames::DOMSubtreeModified) { |
4598 UseCounter::Count(*this, UseCounter::kDOMSubtreeModifiedEvent); | 4599 UseCounter::Count(*this, UseCounter::kDOMSubtreeModifiedEvent); |
4599 AddMutationEventListenerTypeIfEnabled(DOMSUBTREEMODIFIED_LISTENER); | 4600 AddMutationEventListenerTypeIfEnabled(DOMSUBTREEMODIFIED_LISTENER); |
4600 } else if (event_type == EventTypeNames::DOMNodeInserted) { | 4601 } else if (event_type == EventTypeNames::DOMNodeInserted) { |
4601 UseCounter::Count(*this, UseCounter::kDOMNodeInsertedEvent); | 4602 UseCounter::Count(*this, UseCounter::kDOMNodeInsertedEvent); |
4602 AddMutationEventListenerTypeIfEnabled(DOMNODEINSERTED_LISTENER); | 4603 AddMutationEventListenerTypeIfEnabled(DOMNODEINSERTED_LISTENER); |
4603 } else if (event_type == EventTypeNames::DOMNodeRemoved) { | 4604 } else if (event_type == EventTypeNames::DOMNodeRemoved) { |
4604 UseCounter::Count(*this, UseCounter::kDOMNodeRemovedEvent); | 4605 UseCounter::Count(*this, UseCounter::kDOMNodeRemovedEvent); |
4605 AddMutationEventListenerTypeIfEnabled(DOMNODEREMOVED_LISTENER); | 4606 AddMutationEventListenerTypeIfEnabled(DOMNODEREMOVED_LISTENER); |
4606 } else if (event_type == EventTypeNames::DOMNodeRemovedFromDocument) { | 4607 } else if (event_type == EventTypeNames::DOMNodeRemovedFromDocument) { |
(...skipping 16 matching lines...) Expand all Loading... |
4623 AddListenerType(ANIMATIONITERATION_LISTENER); | 4624 AddListenerType(ANIMATIONITERATION_LISTENER); |
4624 if (View()) { | 4625 if (View()) { |
4625 // Need to re-evaluate time-to-effect-change for any running animations. | 4626 // Need to re-evaluate time-to-effect-change for any running animations. |
4626 View()->ScheduleAnimation(); | 4627 View()->ScheduleAnimation(); |
4627 } | 4628 } |
4628 } else if (event_type == EventTypeNames::webkitTransitionEnd || | 4629 } else if (event_type == EventTypeNames::webkitTransitionEnd || |
4629 event_type == EventTypeNames::transitionend) { | 4630 event_type == EventTypeNames::transitionend) { |
4630 AddListenerType(TRANSITIONEND_LISTENER); | 4631 AddListenerType(TRANSITIONEND_LISTENER); |
4631 } else if (event_type == EventTypeNames::scroll) { | 4632 } else if (event_type == EventTypeNames::scroll) { |
4632 AddListenerType(SCROLL_LISTENER); | 4633 AddListenerType(SCROLL_LISTENER); |
| 4634 } else if (event_type == EventTypeNames::load) { |
| 4635 if (Node* node = event_target.ToNode()) { |
| 4636 if (isHTMLStyleElement(*node)) { |
| 4637 AddListenerType(LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT); |
| 4638 return; |
| 4639 } |
| 4640 } |
| 4641 if (event_target.HasCapturingEventListeners(event_type)) |
| 4642 AddListenerType(LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT); |
4633 } | 4643 } |
4634 } | 4644 } |
4635 | 4645 |
4636 HTMLFrameOwnerElement* Document::LocalOwner() const { | 4646 HTMLFrameOwnerElement* Document::LocalOwner() const { |
4637 if (!GetFrame()) | 4647 if (!GetFrame()) |
4638 return 0; | 4648 return 0; |
4639 // FIXME: This probably breaks the attempts to layout after a load is finished | 4649 // FIXME: This probably breaks the attempts to layout after a load is finished |
4640 // in implicitClose(), and probably tons of other things... | 4650 // in implicitClose(), and probably tons of other things... |
4641 return GetFrame()->DeprecatedLocalOwner(); | 4651 return GetFrame()->DeprecatedLocalOwner(); |
4642 } | 4652 } |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6721 } | 6731 } |
6722 | 6732 |
6723 void showLiveDocumentInstances() { | 6733 void showLiveDocumentInstances() { |
6724 WeakDocumentSet& set = liveDocumentSet(); | 6734 WeakDocumentSet& set = liveDocumentSet(); |
6725 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6735 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6726 for (blink::Document* document : set) | 6736 for (blink::Document* document : set) |
6727 fprintf(stderr, "- Document %p URL: %s\n", document, | 6737 fprintf(stderr, "- Document %p URL: %s\n", document, |
6728 document->Url().GetString().Utf8().data()); | 6738 document->Url().GetString().Utf8().data()); |
6729 } | 6739 } |
6730 #endif | 6740 #endif |
OLD | NEW |