OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 collectInstancesForSVGElement(this, instances); | 776 collectInstancesForSVGElement(this, instances); |
777 for (SVGElement* shadowTreeElement : instances) { | 777 for (SVGElement* shadowTreeElement : instances) { |
778 ASSERT(shadowTreeElement); | 778 ASSERT(shadowTreeElement); |
779 | 779 |
780 shadowTreeElement->Node::removeEventListener(eventType, listener, useCap
ture); | 780 shadowTreeElement->Node::removeEventListener(eventType, listener, useCap
ture); |
781 } | 781 } |
782 | 782 |
783 return true; | 783 return true; |
784 } | 784 } |
785 | 785 |
786 static bool hasLoadListener(Element* element) | 786 static bool hasEventListener(Element* element, const AtomicString& eventType) |
787 { | 787 { |
788 if (element->hasEventListeners(EventTypeNames::load)) | 788 ASSERT(eventType == EventTypeNames::load || eventType == EventTypeNames::err
or); |
| 789 if (element->hasEventListeners(eventType)) |
789 return true; | 790 return true; |
790 | 791 |
791 for (element = element->parentOrShadowHostElement(); element; element = elem
ent->parentOrShadowHostElement()) { | 792 for (element = element->parentOrShadowHostElement(); element; element = elem
ent->parentOrShadowHostElement()) { |
792 const EventListenerVector& entry = element->getEventListeners(EventTypeN
ames::load); | 793 const EventListenerVector& entry = element->getEventListeners(eventType)
; |
793 for (size_t i = 0; i < entry.size(); ++i) { | 794 for (size_t i = 0; i < entry.size(); ++i) { |
794 if (entry[i].useCapture) | 795 if (entry[i].useCapture) |
795 return true; | 796 return true; |
796 } | 797 } |
797 } | 798 } |
798 | 799 |
799 return false; | 800 return false; |
800 } | 801 } |
801 | 802 |
802 bool SVGElement::sendSVGLoadEventIfPossible() | 803 bool SVGElement::sendSVGLoadEventIfPossible() |
803 { | 804 { |
804 if (!haveLoadedRequiredResources()) | 805 if (!haveLoadedRequiredResources()) |
805 return false; | 806 return false; |
806 if ((isStructurallyExternal() || isSVGSVGElement(*this)) && hasLoadListener(
this)) | 807 if ((isStructurallyExternal() || isSVGSVGElement(*this)) && hasEventListener
(this, EventTypeNames::load)) |
807 dispatchEvent(Event::create(EventTypeNames::load)); | 808 dispatchEvent(Event::create(EventTypeNames::load)); |
808 return true; | 809 return true; |
809 } | 810 } |
810 | 811 |
811 void SVGElement::sendSVGLoadEventToSelfAndAncestorChainIfPossible() | 812 void SVGElement::sendSVGLoadEventToSelfAndAncestorChainIfPossible() |
812 { | 813 { |
813 // Let Document::implicitClose() dispatch the 'load' to the outermost SVG ro
ot. | 814 // Let Document::implicitClose() dispatch the 'load' to the outermost SVG ro
ot. |
814 if (isOutermostSVGSVGElement()) | 815 if (isOutermostSVGSVGElement()) |
815 return; | 816 return; |
816 | 817 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 Element::trace(visitor); | 1187 Element::trace(visitor); |
1187 } | 1188 } |
1188 | 1189 |
1189 const AtomicString& SVGElement::eventParameterName() | 1190 const AtomicString& SVGElement::eventParameterName() |
1190 { | 1191 { |
1191 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con
structFromLiteral)); | 1192 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con
structFromLiteral)); |
1192 return evtString; | 1193 return evtString; |
1193 } | 1194 } |
1194 | 1195 |
1195 } // namespace blink | 1196 } // namespace blink |
OLD | NEW |