| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 std::unique_ptr<SVGResources> SVGResources::buildResources( | 175 std::unique_ptr<SVGResources> SVGResources::buildResources( |
| 176 const LayoutObject* object, | 176 const LayoutObject* object, |
| 177 const ComputedStyle& computedStyle) { | 177 const ComputedStyle& computedStyle) { |
| 178 ASSERT(object); | 178 ASSERT(object); |
| 179 | 179 |
| 180 Node* node = object->node(); | 180 Node* node = object->node(); |
| 181 ASSERT(node); | 181 ASSERT(node); |
| 182 SECURITY_DCHECK(node->isSVGElement()); | 182 SECURITY_DCHECK(node->isSVGElement()); |
| 183 | 183 |
| 184 SVGElement* element = toSVGElement(node); | 184 SVGElement& element = toSVGElement(*node); |
| 185 ASSERT(element); | |
| 186 | 185 |
| 187 const AtomicString& tagName = element->localName(); | 186 const AtomicString& tagName = element.localName(); |
| 188 ASSERT(!tagName.isNull()); | 187 ASSERT(!tagName.isNull()); |
| 189 | 188 |
| 190 TreeScope& treeScope = element->treeScopeForIdResolution(); | 189 TreeScope& treeScope = element.treeScopeForIdResolution(); |
| 191 SVGTreeScopeResources& treeScopeResources = | 190 SVGTreeScopeResources& treeScopeResources = |
| 192 treeScope.ensureSVGTreeScopedResources(); | 191 treeScope.ensureSVGTreeScopedResources(); |
| 193 | 192 |
| 194 const SVGComputedStyle& style = computedStyle.svgStyle(); | 193 const SVGComputedStyle& style = computedStyle.svgStyle(); |
| 195 | 194 |
| 196 std::unique_ptr<SVGResources> resources; | 195 std::unique_ptr<SVGResources> resources; |
| 197 if (clipperFilterMaskerTags().contains(tagName)) { | 196 if (clipperFilterMaskerTags().contains(tagName)) { |
| 198 if (computedStyle.clipPath() && !object->isSVGRoot()) { | 197 if (computedStyle.clipPath() && !object->isSVGRoot()) { |
| 199 ClipPathOperation* clipPathOperation = computedStyle.clipPath(); | 198 ClipPathOperation* clipPathOperation = computedStyle.clipPath(); |
| 200 if (clipPathOperation->type() == ClipPathOperation::REFERENCE) { | 199 if (clipPathOperation->type() == ClipPathOperation::REFERENCE) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 228 | 227 |
| 229 if (style.hasMasker()) { | 228 if (style.hasMasker()) { |
| 230 AtomicString id = style.maskerResource(); | 229 AtomicString id = style.maskerResource(); |
| 231 if (!ensureResources(resources).setMasker( | 230 if (!ensureResources(resources).setMasker( |
| 232 getLayoutSVGResourceById<LayoutSVGResourceMasker>( | 231 getLayoutSVGResourceById<LayoutSVGResourceMasker>( |
| 233 treeScopeResources, id))) | 232 treeScopeResources, id))) |
| 234 treeScopeResources.addPendingResource(id, element); | 233 treeScopeResources.addPendingResource(id, element); |
| 235 } | 234 } |
| 236 } | 235 } |
| 237 | 236 |
| 238 if (style.hasMarkers() && supportsMarkers(*element)) { | 237 if (style.hasMarkers() && supportsMarkers(element)) { |
| 239 const AtomicString& markerStartId = style.markerStartResource(); | 238 const AtomicString& markerStartId = style.markerStartResource(); |
| 240 if (!ensureResources(resources).setMarkerStart( | 239 if (!ensureResources(resources).setMarkerStart( |
| 241 getLayoutSVGResourceById<LayoutSVGResourceMarker>( | 240 getLayoutSVGResourceById<LayoutSVGResourceMarker>( |
| 242 treeScopeResources, markerStartId))) | 241 treeScopeResources, markerStartId))) |
| 243 treeScopeResources.addPendingResource(markerStartId, element); | 242 treeScopeResources.addPendingResource(markerStartId, element); |
| 244 | 243 |
| 245 const AtomicString& markerMidId = style.markerMidResource(); | 244 const AtomicString& markerMidId = style.markerMidResource(); |
| 246 if (!ensureResources(resources).setMarkerMid( | 245 if (!ensureResources(resources).setMarkerMid( |
| 247 getLayoutSVGResourceById<LayoutSVGResourceMarker>( | 246 getLayoutSVGResourceById<LayoutSVGResourceMarker>( |
| 248 treeScopeResources, markerMidId))) | 247 treeScopeResources, markerMidId))) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 271 AtomicString id; | 270 AtomicString id; |
| 272 LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPaint( | 271 LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPaint( |
| 273 treeScope, style.strokePaintType(), style.strokePaintUri(), id, | 272 treeScope, style.strokePaintType(), style.strokePaintUri(), id, |
| 274 hasPendingResource); | 273 hasPendingResource); |
| 275 if (!ensureResources(resources).setStroke(resource) && hasPendingResource) | 274 if (!ensureResources(resources).setStroke(resource) && hasPendingResource) |
| 276 treeScopeResources.addPendingResource(id, element); | 275 treeScopeResources.addPendingResource(id, element); |
| 277 } | 276 } |
| 278 } | 277 } |
| 279 | 278 |
| 280 if (chainableResourceTags().contains(tagName)) { | 279 if (chainableResourceTags().contains(tagName)) { |
| 281 AtomicString id = targetReferenceFromResource(*element); | 280 AtomicString id = targetReferenceFromResource(element); |
| 282 if (!ensureResources(resources).setLinkedResource( | 281 if (!ensureResources(resources).setLinkedResource( |
| 283 treeScopeResources.resourceById(id))) | 282 treeScopeResources.resourceById(id))) |
| 284 treeScopeResources.addPendingResource(id, element); | 283 treeScopeResources.addPendingResource(id, element); |
| 285 } | 284 } |
| 286 | 285 |
| 287 return (!resources || !resources->hasResourceData()) ? nullptr | 286 return (!resources || !resources->hasResourceData()) ? nullptr |
| 288 : std::move(resources); | 287 : std::move(resources); |
| 289 } | 288 } |
| 290 | 289 |
| 291 void SVGResources::layoutIfNeeded() { | 290 void SVGResources::layoutIfNeeded() { |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 stroke->element()); | 670 stroke->element()); |
| 672 } | 671 } |
| 673 | 672 |
| 674 if (m_linkedResource) | 673 if (m_linkedResource) |
| 675 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, | 674 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, |
| 676 m_linkedResource->element()); | 675 m_linkedResource->element()); |
| 677 } | 676 } |
| 678 #endif | 677 #endif |
| 679 | 678 |
| 680 } // namespace blink | 679 } // namespace blink |
| OLD | NEW |