| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 | 196 |
| 197 static inline void registerPendingResource(SVGDocumentExtensions& extensions, co
nst AtomicString& id, SVGElement* element) | 197 static inline void registerPendingResource(SVGDocumentExtensions& extensions, co
nst AtomicString& id, SVGElement* element) |
| 198 { | 198 { |
| 199 ASSERT(element); | 199 ASSERT(element); |
| 200 extensions.addPendingResource(id, element); | 200 extensions.addPendingResource(id, element); |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool SVGResources::hasResourceData() const | 203 bool SVGResources::hasResourceData() const |
| 204 { | 204 { |
| 205 return !m_clipperFilterMaskerData | 205 return m_clipperFilterMaskerData |
| 206 && !m_markerData | 206 || m_markerData |
| 207 && !m_fillStrokeData | 207 || m_fillStrokeData |
| 208 && !m_linkedResource; | 208 || m_linkedResource; |
| 209 } | 209 } |
| 210 | 210 |
| 211 static inline SVGResources* ensureResources(OwnPtr<SVGResources>& resources) | 211 static inline SVGResources* ensureResources(OwnPtr<SVGResources>& resources) |
| 212 { | 212 { |
| 213 if (!resources) | 213 if (!resources) |
| 214 resources = adoptPtr(new SVGResources); | 214 resources = adoptPtr(new SVGResources); |
| 215 | 215 |
| 216 return resources.get(); | 216 return resources.get(); |
| 217 } | 217 } |
| 218 | 218 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 if (chainableResourceTags().contains(tagName)) { | 294 if (chainableResourceTags().contains(tagName)) { |
| 295 AtomicString id = targetReferenceFromResource(*element); | 295 AtomicString id = targetReferenceFromResource(*element); |
| 296 if (!ensureResources(resources)->setLinkedResource(getRenderSVGResourceC
ontainerById(treeScope, id))) | 296 if (!ensureResources(resources)->setLinkedResource(getRenderSVGResourceC
ontainerById(treeScope, id))) |
| 297 registerPendingResource(extensions, id, element); | 297 registerPendingResource(extensions, id, element); |
| 298 } | 298 } |
| 299 | 299 |
| 300 return (!resources || resources->hasResourceData()) ? nullptr : resources.re
lease(); | 300 return (!resources || !resources->hasResourceData()) ? nullptr : resources.r
elease(); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void SVGResources::layoutIfNeeded() | 303 void SVGResources::layoutIfNeeded() |
| 304 { | 304 { |
| 305 if (m_clipperFilterMaskerData) { | 305 if (m_clipperFilterMaskerData) { |
| 306 if (RenderSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipp
er) | 306 if (RenderSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipp
er) |
| 307 clipper->layoutIfNeeded(); | 307 clipper->layoutIfNeeded(); |
| 308 if (RenderSVGResourceMasker* masker = m_clipperFilterMaskerData->masker) | 308 if (RenderSVGResourceMasker* masker = m_clipperFilterMaskerData->masker) |
| 309 masker->layoutIfNeeded(); | 309 masker->layoutIfNeeded(); |
| 310 if (RenderSVGResourceFilter* filter = m_clipperFilterMaskerData->filter) | 310 if (RenderSVGResourceFilter* filter = m_clipperFilterMaskerData->filter) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 326 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) | 326 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) |
| 327 stroke->layoutIfNeeded(); | 327 stroke->layoutIfNeeded(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 if (m_linkedResource) | 330 if (m_linkedResource) |
| 331 m_linkedResource->layoutIfNeeded(); | 331 m_linkedResource->layoutIfNeeded(); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void SVGResources::removeClientFromCache(RenderObject* object, bool markForInval
idation) const | 334 void SVGResources::removeClientFromCache(RenderObject* object, bool markForInval
idation) const |
| 335 { | 335 { |
| 336 if (hasResourceData()) | 336 if (!hasResourceData()) |
| 337 return; | 337 return; |
| 338 | 338 |
| 339 if (m_linkedResource) { | 339 if (m_linkedResource) { |
| 340 ASSERT(!m_clipperFilterMaskerData); | 340 ASSERT(!m_clipperFilterMaskerData); |
| 341 ASSERT(!m_markerData); | 341 ASSERT(!m_markerData); |
| 342 ASSERT(!m_fillStrokeData); | 342 ASSERT(!m_fillStrokeData); |
| 343 m_linkedResource->removeClientFromCache(object, markForInvalidation); | 343 m_linkedResource->removeClientFromCache(object, markForInvalidation); |
| 344 return; | 344 return; |
| 345 } | 345 } |
| 346 | 346 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 366 if (m_fillStrokeData->fill) | 366 if (m_fillStrokeData->fill) |
| 367 m_fillStrokeData->fill->removeClientFromCache(object, markForInvalid
ation); | 367 m_fillStrokeData->fill->removeClientFromCache(object, markForInvalid
ation); |
| 368 if (m_fillStrokeData->stroke) | 368 if (m_fillStrokeData->stroke) |
| 369 m_fillStrokeData->stroke->removeClientFromCache(object, markForInval
idation); | 369 m_fillStrokeData->stroke->removeClientFromCache(object, markForInval
idation); |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 | 372 |
| 373 void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) | 373 void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) |
| 374 { | 374 { |
| 375 ASSERT(resource); | 375 ASSERT(resource); |
| 376 if (hasResourceData()) | 376 if (!hasResourceData()) |
| 377 return; | 377 return; |
| 378 | 378 |
| 379 if (m_linkedResource == resource) { | 379 if (m_linkedResource == resource) { |
| 380 ASSERT(!m_clipperFilterMaskerData); | 380 ASSERT(!m_clipperFilterMaskerData); |
| 381 ASSERT(!m_markerData); | 381 ASSERT(!m_markerData); |
| 382 ASSERT(!m_fillStrokeData); | 382 ASSERT(!m_fillStrokeData); |
| 383 m_linkedResource->removeAllClientsFromCache(); | 383 m_linkedResource->removeAllClientsFromCache(); |
| 384 m_linkedResource = 0; | 384 m_linkedResource = 0; |
| 385 return; | 385 return; |
| 386 } | 386 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 m_clipperFilterMaskerData->clipper = 0; | 440 m_clipperFilterMaskerData->clipper = 0; |
| 441 } | 441 } |
| 442 break; | 442 break; |
| 443 case SolidColorResourceType: | 443 case SolidColorResourceType: |
| 444 ASSERT_NOT_REACHED(); | 444 ASSERT_NOT_REACHED(); |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 | 447 |
| 448 void SVGResources::buildSetOfResources(HashSet<RenderSVGResourceContainer*>& set
) | 448 void SVGResources::buildSetOfResources(HashSet<RenderSVGResourceContainer*>& set
) |
| 449 { | 449 { |
| 450 if (hasResourceData()) | 450 if (!hasResourceData()) |
| 451 return; | 451 return; |
| 452 | 452 |
| 453 if (m_linkedResource) { | 453 if (m_linkedResource) { |
| 454 ASSERT(!m_clipperFilterMaskerData); | 454 ASSERT(!m_clipperFilterMaskerData); |
| 455 ASSERT(!m_markerData); | 455 ASSERT(!m_markerData); |
| 456 ASSERT(!m_fillStrokeData); | 456 ASSERT(!m_fillStrokeData); |
| 457 set.add(m_linkedResource); | 457 set.add(m_linkedResource); |
| 458 return; | 458 return; |
| 459 } | 459 } |
| 460 | 460 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) | 706 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) |
| 707 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
element()); | 707 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
element()); |
| 708 } | 708 } |
| 709 | 709 |
| 710 if (m_linkedResource) | 710 if (m_linkedResource) |
| 711 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->element()); | 711 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->element()); |
| 712 } | 712 } |
| 713 #endif | 713 #endif |
| 714 | 714 |
| 715 } | 715 } |
| OLD | NEW |