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, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
6 * Copyright (C) 2012 University of Szeged | 6 * Copyright (C) 2012 University of Szeged |
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 { | 160 { |
161 // This functions exists to assure assumptions made in the code regarding SV
GElementInstance creation/destruction are satisfied. | 161 // This functions exists to assure assumptions made in the code regarding SV
GElementInstance creation/destruction are satisfied. |
162 SVGGraphicsElement::insertedInto(rootParent); | 162 SVGGraphicsElement::insertedInto(rootParent); |
163 if (!rootParent->inDocument()) | 163 if (!rootParent->inDocument()) |
164 return InsertionDone; | 164 return InsertionDone; |
165 ASSERT(!m_targetElementInstance || !isWellFormedDocument(&document())); | 165 ASSERT(!m_targetElementInstance || !isWellFormedDocument(&document())); |
166 ASSERT(!hasPendingResources() || !isWellFormedDocument(&document())); | 166 ASSERT(!hasPendingResources() || !isWellFormedDocument(&document())); |
167 if (!m_wasInsertedByParser) { | 167 if (!m_wasInsertedByParser) { |
168 buildPendingResource(); | 168 buildPendingResource(); |
169 | 169 |
170 m_haveFiredLoadEvent = true; | 170 if (!isStructurallyExternal()) { |
171 sendSVGLoadEventIfPossibleAsynchronously(); | 171 sendSVGLoadEventIfPossibleAsynchronously(); |
| 172 } |
172 } | 173 } |
173 | |
174 return InsertionDone; | 174 return InsertionDone; |
175 } | 175 } |
176 | 176 |
177 void SVGUseElement::removedFrom(ContainerNode* rootParent) | 177 void SVGUseElement::removedFrom(ContainerNode* rootParent) |
178 { | 178 { |
179 SVGGraphicsElement::removedFrom(rootParent); | 179 SVGGraphicsElement::removedFrom(rootParent); |
180 if (rootParent->inDocument()) | 180 if (rootParent->inDocument()) |
181 clearResourceReferences(); | 181 clearResourceReferences(); |
182 } | 182 } |
183 | 183 |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 | 927 |
928 void SVGUseElement::notifyFinished(Resource* resource) | 928 void SVGUseElement::notifyFinished(Resource* resource) |
929 { | 929 { |
930 if (!inDocument()) | 930 if (!inDocument()) |
931 return; | 931 return; |
932 | 932 |
933 invalidateShadowTree(); | 933 invalidateShadowTree(); |
934 if (resource->errorOccurred()) | 934 if (resource->errorOccurred()) |
935 dispatchEvent(Event::create(EventTypeNames::error)); | 935 dispatchEvent(Event::create(EventTypeNames::error)); |
936 else if (!resource->wasCanceled()) { | 936 else if (!resource->wasCanceled()) { |
937 if (!m_wasInsertedByParser) | 937 if (m_wasInsertedByParser && m_haveFiredLoadEvent) |
938 ASSERT(m_haveFiredLoadEvent); | |
939 else if (m_haveFiredLoadEvent) | |
940 return; | 938 return; |
| 939 if (!isStructurallyExternal()) |
| 940 return; |
| 941 |
| 942 ASSERT(!m_haveFiredLoadEvent); |
| 943 m_haveFiredLoadEvent = true; |
| 944 sendSVGLoadEventIfPossible(); |
941 } | 945 } |
942 } | 946 } |
943 | 947 |
944 bool SVGUseElement::resourceIsStillLoading() | 948 bool SVGUseElement::resourceIsStillLoading() |
945 { | 949 { |
946 if (m_resource && m_resource->isLoading()) | 950 if (m_resource && m_resource->isLoading()) |
947 return true; | 951 return true; |
948 return false; | 952 return false; |
949 } | 953 } |
950 | 954 |
951 bool SVGUseElement::instanceTreeIsLoading(SVGElementInstance* targetElementInsta
nce) | 955 bool SVGUseElement::instanceTreeIsLoading(SVGElementInstance* targetElementInsta
nce) |
952 { | 956 { |
953 for (SVGElementInstance* instance = targetElementInstance->firstChild(); ins
tance; instance = instance->nextSibling()) { | 957 for (SVGElementInstance* instance = targetElementInstance->firstChild(); ins
tance; instance = instance->nextSibling()) { |
954 if (SVGUseElement* use = instance->correspondingUseElement()) { | 958 if (SVGUseElement* use = instance->correspondingUseElement()) { |
955 if (use->resourceIsStillLoading()) | 959 if (use->resourceIsStillLoading()) |
956 return true; | 960 return true; |
957 } | 961 } |
958 if (instance->hasChildNodes()) | 962 if (instance->hasChildNodes()) |
959 instanceTreeIsLoading(instance); | 963 instanceTreeIsLoading(instance); |
960 } | 964 } |
961 return false; | 965 return false; |
962 } | 966 } |
963 | 967 |
964 void SVGUseElement::finishParsingChildren() | 968 void SVGUseElement::finishParsingChildren() |
965 { | 969 { |
966 SVGGraphicsElement::finishParsingChildren(); | 970 SVGGraphicsElement::finishParsingChildren(); |
967 m_haveFiredLoadEvent = true; | |
968 if (m_wasInsertedByParser) { | 971 if (m_wasInsertedByParser) { |
969 buildPendingResource(); | 972 buildPendingResource(); |
970 m_wasInsertedByParser = false; | 973 m_wasInsertedByParser = false; |
971 } | 974 } |
972 } | 975 } |
973 | 976 |
974 void SVGUseElement::setDocumentResource(ResourcePtr<DocumentResource> resource) | 977 void SVGUseElement::setDocumentResource(ResourcePtr<DocumentResource> resource) |
975 { | 978 { |
976 if (m_resource == resource) | 979 if (m_resource == resource) |
977 return; | 980 return; |
978 | 981 |
979 if (m_resource) | 982 if (m_resource) |
980 m_resource->removeClient(this); | 983 m_resource->removeClient(this); |
981 | 984 |
982 m_resource = resource; | 985 m_resource = resource; |
983 if (m_resource) | 986 if (m_resource) |
984 m_resource->addClient(this); | 987 m_resource->addClient(this); |
985 } | 988 } |
986 | 989 |
987 } | 990 } |
OLD | NEW |