 Chromium Code Reviews
 Chromium Code Reviews Issue 134263003:
  Followup fixes for bug 332066.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 134263003:
  Followup fixes for bug 332066.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 936 return; | 936 return; | 
| 937 | 937 | 
| 938 invalidateShadowTree(); | 938 invalidateShadowTree(); | 
| 939 if (resource->errorOccurred()) | 939 if (resource->errorOccurred()) | 
| 940 dispatchEvent(Event::create(EventTypeNames::error)); | 940 dispatchEvent(Event::create(EventTypeNames::error)); | 
| 941 else if (!resource->wasCanceled()) { | 941 else if (!resource->wasCanceled()) { | 
| 942 if (!m_wasInsertedByParser) | 942 if (!m_wasInsertedByParser) | 
| 943 ASSERT(m_haveFiredLoadEvent); | 943 ASSERT(m_haveFiredLoadEvent); | 
| 944 else if (m_haveFiredLoadEvent) | 944 else if (m_haveFiredLoadEvent) | 
| 945 return; | 945 return; | 
| 946 if (!isStructurallyExternal()) | |
| 947 return; | |
| 948 | |
| 949 ASSERT(!m_haveFiredLoadEvent); | |
| 950 m_haveFiredLoadEvent = true; | |
| 951 sendSVGLoadEventIfPossible(); | |
| 946 } | 952 } | 
| 947 } | 953 } | 
| 948 | 954 | 
| 949 bool SVGUseElement::resourceIsStillLoading() | 955 bool SVGUseElement::resourceIsStillLoading() | 
| 950 { | 956 { | 
| 951 if (m_resource && m_resource->isLoading()) | 957 if (m_resource && m_resource->isLoading()) | 
| 952 return true; | 958 return true; | 
| 953 return false; | 959 return false; | 
| 954 } | 960 } | 
| 955 | 961 | 
| 956 bool SVGUseElement::instanceTreeIsLoading(SVGElementInstance* targetElementInsta nce) | 962 bool SVGUseElement::instanceTreeIsLoading(SVGElementInstance* targetElementInsta nce) | 
| 957 { | 963 { | 
| 958 for (SVGElementInstance* instance = targetElementInstance->firstChild(); ins tance; instance = instance->nextSibling()) { | 964 for (SVGElementInstance* instance = targetElementInstance->firstChild(); ins tance; instance = instance->nextSibling()) { | 
| 959 if (SVGUseElement* use = instance->correspondingUseElement()) { | 965 if (SVGUseElement* use = instance->correspondingUseElement()) { | 
| 960 if (use->resourceIsStillLoading()) | 966 if (use->resourceIsStillLoading()) | 
| 961 return true; | 967 return true; | 
| 962 } | 968 } | 
| 963 if (instance->hasChildNodes()) | 969 if (instance->hasChildNodes()) | 
| 964 instanceTreeIsLoading(instance); | 970 instanceTreeIsLoading(instance); | 
| 
pdr.
2014/01/13 19:56:37
Wow. Spot the bug :)
(I'll fix this in a separate
 | |
| 965 } | 971 } | 
| 966 return false; | 972 return false; | 
| 967 } | 973 } | 
| 968 | 974 | 
| 969 void SVGUseElement::finishParsingChildren() | 975 void SVGUseElement::finishParsingChildren() | 
| 970 { | 976 { | 
| 971 SVGGraphicsElement::finishParsingChildren(); | 977 SVGGraphicsElement::finishParsingChildren(); | 
| 972 m_haveFiredLoadEvent = true; | |
| 973 if (m_wasInsertedByParser) { | 978 if (m_wasInsertedByParser) { | 
| 974 buildPendingResource(); | 979 buildPendingResource(); | 
| 975 m_wasInsertedByParser = false; | 980 m_wasInsertedByParser = false; | 
| 976 } | 981 } | 
| 977 } | 982 } | 
| 978 | 983 | 
| 979 void SVGUseElement::setDocumentResource(ResourcePtr<DocumentResource> resource) | 984 void SVGUseElement::setDocumentResource(ResourcePtr<DocumentResource> resource) | 
| 980 { | 985 { | 
| 981 if (m_resource == resource) | 986 if (m_resource == resource) | 
| 982 return; | 987 return; | 
| 983 | 988 | 
| 984 if (m_resource) | 989 if (m_resource) | 
| 985 m_resource->removeClient(this); | 990 m_resource->removeClient(this); | 
| 986 | 991 | 
| 987 m_resource = resource; | 992 m_resource = resource; | 
| 988 if (m_resource) | 993 if (m_resource) | 
| 989 m_resource->addClient(this); | 994 m_resource->addClient(this); | 
| 990 } | 995 } | 
| 991 | 996 | 
| 992 } | 997 } | 
| OLD | NEW |