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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 */ | 18 */ |
19 | 19 |
20 #include "config.h" | 20 #include "config.h" |
21 #include "core/layout/svg/SVGResources.h" | 21 #include "core/layout/svg/SVGResources.h" |
22 | 22 |
23 #include "core/SVGNames.h" | 23 #include "core/SVGNames.h" |
24 #include "core/layout/style/SVGLayoutStyle.h" | 24 #include "core/layout/style/SVGLayoutStyle.h" |
25 #include "core/rendering/svg/RenderSVGResourceClipper.h" | 25 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
26 #include "core/rendering/svg/RenderSVGResourceFilter.h" | 26 #include "core/layout/svg/LayoutSVGResourceFilter.h" |
27 #include "core/rendering/svg/RenderSVGResourceMarker.h" | 27 #include "core/layout/svg/LayoutSVGResourceMarker.h" |
28 #include "core/rendering/svg/RenderSVGResourceMasker.h" | 28 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
29 #include "core/rendering/svg/RenderSVGResourcePaintServer.h" | 29 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" |
30 #include "core/svg/SVGFilterElement.h" | 30 #include "core/svg/SVGFilterElement.h" |
31 #include "core/svg/SVGGradientElement.h" | 31 #include "core/svg/SVGGradientElement.h" |
32 #include "core/svg/SVGPatternElement.h" | 32 #include "core/svg/SVGPatternElement.h" |
33 #include "core/svg/SVGURIReference.h" | 33 #include "core/svg/SVGURIReference.h" |
34 | 34 |
35 #ifndef NDEBUG | 35 #ifndef NDEBUG |
36 #include <stdio.h> | 36 #include <stdio.h> |
37 #endif | 37 #endif |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 case SVG_PAINTTYPE_URI_CURRENTCOLOR: | 157 case SVG_PAINTTYPE_URI_CURRENTCOLOR: |
158 case SVG_PAINTTYPE_URI_RGBCOLOR: | 158 case SVG_PAINTTYPE_URI_RGBCOLOR: |
159 case SVG_PAINTTYPE_URI: | 159 case SVG_PAINTTYPE_URI: |
160 return true; | 160 return true; |
161 default: | 161 default: |
162 break; | 162 break; |
163 } | 163 } |
164 return false; | 164 return false; |
165 } | 165 } |
166 | 166 |
167 static inline RenderSVGResourcePaintServer* paintingResourceFromSVGPaint(TreeSco
pe& treeScope, const SVGPaintType& paintType, const String& paintUri, AtomicStri
ng& id, bool& hasPendingResource) | 167 static inline LayoutSVGResourcePaintServer* paintingResourceFromSVGPaint(TreeSco
pe& treeScope, const SVGPaintType& paintType, const String& paintUri, AtomicStri
ng& id, bool& hasPendingResource) |
168 { | 168 { |
169 if (!svgPaintTypeHasURL(paintType)) | 169 if (!svgPaintTypeHasURL(paintType)) |
170 return nullptr; | 170 return nullptr; |
171 | 171 |
172 id = SVGURIReference::fragmentIdentifierFromIRIString(paintUri, treeScope); | 172 id = SVGURIReference::fragmentIdentifierFromIRIString(paintUri, treeScope); |
173 RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(tr
eeScope, id); | 173 LayoutSVGResourceContainer* container = getLayoutSVGResourceContainerById(tr
eeScope, id); |
174 if (!container) { | 174 if (!container) { |
175 hasPendingResource = true; | 175 hasPendingResource = true; |
176 return nullptr; | 176 return nullptr; |
177 } | 177 } |
178 | 178 |
179 if (!container->isSVGPaintServer()) | 179 if (!container->isSVGPaintServer()) |
180 return nullptr; | 180 return nullptr; |
181 | 181 |
182 return toRenderSVGResourcePaintServer(container); | 182 return toLayoutSVGResourcePaintServer(container); |
183 } | 183 } |
184 | 184 |
185 static inline void registerPendingResource(SVGDocumentExtensions& extensions, co
nst AtomicString& id, SVGElement* element) | 185 static inline void registerPendingResource(SVGDocumentExtensions& extensions, co
nst AtomicString& id, SVGElement* element) |
186 { | 186 { |
187 ASSERT(element); | 187 ASSERT(element); |
188 extensions.addPendingResource(id, element); | 188 extensions.addPendingResource(id, element); |
189 } | 189 } |
190 | 190 |
191 bool SVGResources::hasResourceData() const | 191 bool SVGResources::hasResourceData() const |
192 { | 192 { |
(...skipping 25 matching lines...) Expand all Loading... |
218 const AtomicString& tagName = element->localName(); | 218 const AtomicString& tagName = element->localName(); |
219 ASSERT(!tagName.isNull()); | 219 ASSERT(!tagName.isNull()); |
220 | 220 |
221 TreeScope& treeScope = element->treeScope(); | 221 TreeScope& treeScope = element->treeScope(); |
222 SVGDocumentExtensions& extensions = element->document().accessSVGExtensions(
); | 222 SVGDocumentExtensions& extensions = element->document().accessSVGExtensions(
); |
223 | 223 |
224 OwnPtr<SVGResources> resources; | 224 OwnPtr<SVGResources> resources; |
225 if (clipperFilterMaskerTags().contains(tagName)) { | 225 if (clipperFilterMaskerTags().contains(tagName)) { |
226 if (style.hasClipper()) { | 226 if (style.hasClipper()) { |
227 AtomicString id = style.clipperResource(); | 227 AtomicString id = style.clipperResource(); |
228 if (!ensureResources(resources).setClipper(getRenderSVGResourceById<
RenderSVGResourceClipper>(treeScope, id))) | 228 if (!ensureResources(resources).setClipper(getLayoutSVGResourceById<
LayoutSVGResourceClipper>(treeScope, id))) |
229 registerPendingResource(extensions, id, element); | 229 registerPendingResource(extensions, id, element); |
230 } | 230 } |
231 | 231 |
232 if (style.hasFilter()) { | 232 if (style.hasFilter()) { |
233 AtomicString id = style.filterResource(); | 233 AtomicString id = style.filterResource(); |
234 if (!ensureResources(resources).setFilter(getRenderSVGResourceById<R
enderSVGResourceFilter>(treeScope, id))) | 234 if (!ensureResources(resources).setFilter(getLayoutSVGResourceById<L
ayoutSVGResourceFilter>(treeScope, id))) |
235 registerPendingResource(extensions, id, element); | 235 registerPendingResource(extensions, id, element); |
236 } | 236 } |
237 | 237 |
238 if (style.hasMasker()) { | 238 if (style.hasMasker()) { |
239 AtomicString id = style.maskerResource(); | 239 AtomicString id = style.maskerResource(); |
240 if (!ensureResources(resources).setMasker(getRenderSVGResourceById<R
enderSVGResourceMasker>(treeScope, id))) | 240 if (!ensureResources(resources).setMasker(getLayoutSVGResourceById<L
ayoutSVGResourceMasker>(treeScope, id))) |
241 registerPendingResource(extensions, id, element); | 241 registerPendingResource(extensions, id, element); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 if (style.hasMarkers() && supportsMarkers(*element)) { | 245 if (style.hasMarkers() && supportsMarkers(*element)) { |
246 const AtomicString& markerStartId = style.markerStartResource(); | 246 const AtomicString& markerStartId = style.markerStartResource(); |
247 if (!ensureResources(resources).setMarkerStart(getRenderSVGResourceById<
RenderSVGResourceMarker>(treeScope, markerStartId))) | 247 if (!ensureResources(resources).setMarkerStart(getLayoutSVGResourceById<
LayoutSVGResourceMarker>(treeScope, markerStartId))) |
248 registerPendingResource(extensions, markerStartId, element); | 248 registerPendingResource(extensions, markerStartId, element); |
249 | 249 |
250 const AtomicString& markerMidId = style.markerMidResource(); | 250 const AtomicString& markerMidId = style.markerMidResource(); |
251 if (!ensureResources(resources).setMarkerMid(getRenderSVGResourceById<Re
nderSVGResourceMarker>(treeScope, markerMidId))) | 251 if (!ensureResources(resources).setMarkerMid(getLayoutSVGResourceById<La
youtSVGResourceMarker>(treeScope, markerMidId))) |
252 registerPendingResource(extensions, markerMidId, element); | 252 registerPendingResource(extensions, markerMidId, element); |
253 | 253 |
254 const AtomicString& markerEndId = style.markerEndResource(); | 254 const AtomicString& markerEndId = style.markerEndResource(); |
255 if (!ensureResources(resources).setMarkerEnd(getRenderSVGResourceById<Re
nderSVGResourceMarker>(treeScope, style.markerEndResource()))) | 255 if (!ensureResources(resources).setMarkerEnd(getLayoutSVGResourceById<La
youtSVGResourceMarker>(treeScope, style.markerEndResource()))) |
256 registerPendingResource(extensions, markerEndId, element); | 256 registerPendingResource(extensions, markerEndId, element); |
257 } | 257 } |
258 | 258 |
259 if (fillAndStrokeTags().contains(tagName)) { | 259 if (fillAndStrokeTags().contains(tagName)) { |
260 if (style.hasFill()) { | 260 if (style.hasFill()) { |
261 bool hasPendingResource = false; | 261 bool hasPendingResource = false; |
262 AtomicString id; | 262 AtomicString id; |
263 RenderSVGResourcePaintServer* resource = paintingResourceFromSVGPain
t(treeScope, style.fillPaintType(), style.fillPaintUri(), id, hasPendingResource
); | 263 LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPain
t(treeScope, style.fillPaintType(), style.fillPaintUri(), id, hasPendingResource
); |
264 if (!ensureResources(resources).setFill(resource) && hasPendingResou
rce) { | 264 if (!ensureResources(resources).setFill(resource) && hasPendingResou
rce) { |
265 registerPendingResource(extensions, id, element); | 265 registerPendingResource(extensions, id, element); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 if (style.hasStroke()) { | 269 if (style.hasStroke()) { |
270 bool hasPendingResource = false; | 270 bool hasPendingResource = false; |
271 AtomicString id; | 271 AtomicString id; |
272 RenderSVGResourcePaintServer* resource = paintingResourceFromSVGPain
t(treeScope, style.strokePaintType(), style.strokePaintUri(), id, hasPendingReso
urce); | 272 LayoutSVGResourcePaintServer* resource = paintingResourceFromSVGPain
t(treeScope, style.strokePaintType(), style.strokePaintUri(), id, hasPendingReso
urce); |
273 if (!ensureResources(resources).setStroke(resource) && hasPendingRes
ource) { | 273 if (!ensureResources(resources).setStroke(resource) && hasPendingRes
ource) { |
274 registerPendingResource(extensions, id, element); | 274 registerPendingResource(extensions, id, element); |
275 } | 275 } |
276 } | 276 } |
277 } | 277 } |
278 | 278 |
279 if (chainableResourceTags().contains(tagName)) { | 279 if (chainableResourceTags().contains(tagName)) { |
280 AtomicString id = targetReferenceFromResource(*element); | 280 AtomicString id = targetReferenceFromResource(*element); |
281 if (!ensureResources(resources).setLinkedResource(getRenderSVGResourceCo
ntainerById(treeScope, id))) | 281 if (!ensureResources(resources).setLinkedResource(getLayoutSVGResourceCo
ntainerById(treeScope, id))) |
282 registerPendingResource(extensions, id, element); | 282 registerPendingResource(extensions, id, element); |
283 } | 283 } |
284 | 284 |
285 return (!resources || !resources->hasResourceData()) ? nullptr : resources.r
elease(); | 285 return (!resources || !resources->hasResourceData()) ? nullptr : resources.r
elease(); |
286 } | 286 } |
287 | 287 |
288 void SVGResources::layoutIfNeeded() | 288 void SVGResources::layoutIfNeeded() |
289 { | 289 { |
290 if (m_clipperFilterMaskerData) { | 290 if (m_clipperFilterMaskerData) { |
291 if (RenderSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipp
er) | 291 if (LayoutSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipp
er) |
292 clipper->layoutIfNeeded(); | 292 clipper->layoutIfNeeded(); |
293 if (RenderSVGResourceMasker* masker = m_clipperFilterMaskerData->masker) | 293 if (LayoutSVGResourceMasker* masker = m_clipperFilterMaskerData->masker) |
294 masker->layoutIfNeeded(); | 294 masker->layoutIfNeeded(); |
295 if (RenderSVGResourceFilter* filter = m_clipperFilterMaskerData->filter) | 295 if (LayoutSVGResourceFilter* filter = m_clipperFilterMaskerData->filter) |
296 filter->layoutIfNeeded(); | 296 filter->layoutIfNeeded(); |
297 } | 297 } |
298 | 298 |
299 if (m_markerData) { | 299 if (m_markerData) { |
300 if (RenderSVGResourceMarker* marker = m_markerData->markerStart) | 300 if (LayoutSVGResourceMarker* marker = m_markerData->markerStart) |
301 marker->layoutIfNeeded(); | 301 marker->layoutIfNeeded(); |
302 if (RenderSVGResourceMarker* marker = m_markerData->markerMid) | 302 if (LayoutSVGResourceMarker* marker = m_markerData->markerMid) |
303 marker->layoutIfNeeded(); | 303 marker->layoutIfNeeded(); |
304 if (RenderSVGResourceMarker* marker = m_markerData->markerEnd) | 304 if (LayoutSVGResourceMarker* marker = m_markerData->markerEnd) |
305 marker->layoutIfNeeded(); | 305 marker->layoutIfNeeded(); |
306 } | 306 } |
307 | 307 |
308 if (m_fillStrokeData) { | 308 if (m_fillStrokeData) { |
309 if (RenderSVGResourcePaintServer* fill = m_fillStrokeData->fill) | 309 if (LayoutSVGResourcePaintServer* fill = m_fillStrokeData->fill) |
310 fill->layoutIfNeeded(); | 310 fill->layoutIfNeeded(); |
311 if (RenderSVGResourcePaintServer* stroke = m_fillStrokeData->stroke) | 311 if (LayoutSVGResourcePaintServer* stroke = m_fillStrokeData->stroke) |
312 stroke->layoutIfNeeded(); | 312 stroke->layoutIfNeeded(); |
313 } | 313 } |
314 | 314 |
315 if (m_linkedResource) | 315 if (m_linkedResource) |
316 m_linkedResource->layoutIfNeeded(); | 316 m_linkedResource->layoutIfNeeded(); |
317 } | 317 } |
318 | 318 |
319 void SVGResources::removeClientFromCache(LayoutObject* object, bool markForInval
idation) const | 319 void SVGResources::removeClientFromCache(LayoutObject* object, bool markForInval
idation) const |
320 { | 320 { |
321 if (!hasResourceData()) | 321 if (!hasResourceData()) |
(...skipping 26 matching lines...) Expand all Loading... |
348 } | 348 } |
349 | 349 |
350 if (m_fillStrokeData) { | 350 if (m_fillStrokeData) { |
351 if (m_fillStrokeData->fill) | 351 if (m_fillStrokeData->fill) |
352 m_fillStrokeData->fill->removeClientFromCache(object, markForInvalid
ation); | 352 m_fillStrokeData->fill->removeClientFromCache(object, markForInvalid
ation); |
353 if (m_fillStrokeData->stroke) | 353 if (m_fillStrokeData->stroke) |
354 m_fillStrokeData->stroke->removeClientFromCache(object, markForInval
idation); | 354 m_fillStrokeData->stroke->removeClientFromCache(object, markForInval
idation); |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) | 358 void SVGResources::resourceDestroyed(LayoutSVGResourceContainer* resource) |
359 { | 359 { |
360 ASSERT(resource); | 360 ASSERT(resource); |
361 if (!hasResourceData()) | 361 if (!hasResourceData()) |
362 return; | 362 return; |
363 | 363 |
364 if (m_linkedResource == resource) { | 364 if (m_linkedResource == resource) { |
365 ASSERT(!m_clipperFilterMaskerData); | 365 ASSERT(!m_clipperFilterMaskerData); |
366 ASSERT(!m_markerData); | 366 ASSERT(!m_markerData); |
367 ASSERT(!m_fillStrokeData); | 367 ASSERT(!m_fillStrokeData); |
368 m_linkedResource->removeAllClientsFromCache(); | 368 m_linkedResource->removeAllClientsFromCache(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 if (m_clipperFilterMaskerData->clipper == resource) { | 423 if (m_clipperFilterMaskerData->clipper == resource) { |
424 m_clipperFilterMaskerData->clipper->removeAllClientsFromCache(); | 424 m_clipperFilterMaskerData->clipper->removeAllClientsFromCache(); |
425 m_clipperFilterMaskerData->clipper = nullptr; | 425 m_clipperFilterMaskerData->clipper = nullptr; |
426 } | 426 } |
427 break; | 427 break; |
428 default: | 428 default: |
429 ASSERT_NOT_REACHED(); | 429 ASSERT_NOT_REACHED(); |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
433 void SVGResources::buildSetOfResources(HashSet<RenderSVGResourceContainer*>& set
) | 433 void SVGResources::buildSetOfResources(HashSet<LayoutSVGResourceContainer*>& set
) |
434 { | 434 { |
435 if (!hasResourceData()) | 435 if (!hasResourceData()) |
436 return; | 436 return; |
437 | 437 |
438 if (m_linkedResource) { | 438 if (m_linkedResource) { |
439 ASSERT(!m_clipperFilterMaskerData); | 439 ASSERT(!m_clipperFilterMaskerData); |
440 ASSERT(!m_markerData); | 440 ASSERT(!m_markerData); |
441 ASSERT(!m_fillStrokeData); | 441 ASSERT(!m_fillStrokeData); |
442 set.add(m_linkedResource); | 442 set.add(m_linkedResource); |
443 return; | 443 return; |
(...skipping 18 matching lines...) Expand all Loading... |
462 } | 462 } |
463 | 463 |
464 if (m_fillStrokeData) { | 464 if (m_fillStrokeData) { |
465 if (m_fillStrokeData->fill) | 465 if (m_fillStrokeData->fill) |
466 set.add(m_fillStrokeData->fill); | 466 set.add(m_fillStrokeData->fill); |
467 if (m_fillStrokeData->stroke) | 467 if (m_fillStrokeData->stroke) |
468 set.add(m_fillStrokeData->stroke); | 468 set.add(m_fillStrokeData->stroke); |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 bool SVGResources::setClipper(RenderSVGResourceClipper* clipper) | 472 bool SVGResources::setClipper(LayoutSVGResourceClipper* clipper) |
473 { | 473 { |
474 if (!clipper) | 474 if (!clipper) |
475 return false; | 475 return false; |
476 | 476 |
477 ASSERT(clipper->resourceType() == ClipperResourceType); | 477 ASSERT(clipper->resourceType() == ClipperResourceType); |
478 | 478 |
479 if (!m_clipperFilterMaskerData) | 479 if (!m_clipperFilterMaskerData) |
480 m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); | 480 m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); |
481 | 481 |
482 m_clipperFilterMaskerData->clipper = clipper; | 482 m_clipperFilterMaskerData->clipper = clipper; |
483 return true; | 483 return true; |
484 } | 484 } |
485 | 485 |
486 void SVGResources::resetClipper() | 486 void SVGResources::resetClipper() |
487 { | 487 { |
488 ASSERT(m_clipperFilterMaskerData); | 488 ASSERT(m_clipperFilterMaskerData); |
489 ASSERT(m_clipperFilterMaskerData->clipper); | 489 ASSERT(m_clipperFilterMaskerData->clipper); |
490 m_clipperFilterMaskerData->clipper = nullptr; | 490 m_clipperFilterMaskerData->clipper = nullptr; |
491 } | 491 } |
492 | 492 |
493 bool SVGResources::setFilter(RenderSVGResourceFilter* filter) | 493 bool SVGResources::setFilter(LayoutSVGResourceFilter* filter) |
494 { | 494 { |
495 if (!filter) | 495 if (!filter) |
496 return false; | 496 return false; |
497 | 497 |
498 ASSERT(filter->resourceType() == FilterResourceType); | 498 ASSERT(filter->resourceType() == FilterResourceType); |
499 | 499 |
500 if (!m_clipperFilterMaskerData) | 500 if (!m_clipperFilterMaskerData) |
501 m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); | 501 m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); |
502 | 502 |
503 m_clipperFilterMaskerData->filter = filter; | 503 m_clipperFilterMaskerData->filter = filter; |
504 return true; | 504 return true; |
505 } | 505 } |
506 | 506 |
507 void SVGResources::resetFilter() | 507 void SVGResources::resetFilter() |
508 { | 508 { |
509 ASSERT(m_clipperFilterMaskerData); | 509 ASSERT(m_clipperFilterMaskerData); |
510 ASSERT(m_clipperFilterMaskerData->filter); | 510 ASSERT(m_clipperFilterMaskerData->filter); |
511 m_clipperFilterMaskerData->filter = nullptr; | 511 m_clipperFilterMaskerData->filter = nullptr; |
512 } | 512 } |
513 | 513 |
514 bool SVGResources::setMarkerStart(RenderSVGResourceMarker* markerStart) | 514 bool SVGResources::setMarkerStart(LayoutSVGResourceMarker* markerStart) |
515 { | 515 { |
516 if (!markerStart) | 516 if (!markerStart) |
517 return false; | 517 return false; |
518 | 518 |
519 ASSERT(markerStart->resourceType() == MarkerResourceType); | 519 ASSERT(markerStart->resourceType() == MarkerResourceType); |
520 | 520 |
521 if (!m_markerData) | 521 if (!m_markerData) |
522 m_markerData = MarkerData::create(); | 522 m_markerData = MarkerData::create(); |
523 | 523 |
524 m_markerData->markerStart = markerStart; | 524 m_markerData->markerStart = markerStart; |
525 return true; | 525 return true; |
526 } | 526 } |
527 | 527 |
528 void SVGResources::resetMarkerStart() | 528 void SVGResources::resetMarkerStart() |
529 { | 529 { |
530 ASSERT(m_markerData); | 530 ASSERT(m_markerData); |
531 ASSERT(m_markerData->markerStart); | 531 ASSERT(m_markerData->markerStart); |
532 m_markerData->markerStart = nullptr; | 532 m_markerData->markerStart = nullptr; |
533 } | 533 } |
534 | 534 |
535 bool SVGResources::setMarkerMid(RenderSVGResourceMarker* markerMid) | 535 bool SVGResources::setMarkerMid(LayoutSVGResourceMarker* markerMid) |
536 { | 536 { |
537 if (!markerMid) | 537 if (!markerMid) |
538 return false; | 538 return false; |
539 | 539 |
540 ASSERT(markerMid->resourceType() == MarkerResourceType); | 540 ASSERT(markerMid->resourceType() == MarkerResourceType); |
541 | 541 |
542 if (!m_markerData) | 542 if (!m_markerData) |
543 m_markerData = MarkerData::create(); | 543 m_markerData = MarkerData::create(); |
544 | 544 |
545 m_markerData->markerMid = markerMid; | 545 m_markerData->markerMid = markerMid; |
546 return true; | 546 return true; |
547 } | 547 } |
548 | 548 |
549 void SVGResources::resetMarkerMid() | 549 void SVGResources::resetMarkerMid() |
550 { | 550 { |
551 ASSERT(m_markerData); | 551 ASSERT(m_markerData); |
552 ASSERT(m_markerData->markerMid); | 552 ASSERT(m_markerData->markerMid); |
553 m_markerData->markerMid = nullptr; | 553 m_markerData->markerMid = nullptr; |
554 } | 554 } |
555 | 555 |
556 bool SVGResources::setMarkerEnd(RenderSVGResourceMarker* markerEnd) | 556 bool SVGResources::setMarkerEnd(LayoutSVGResourceMarker* markerEnd) |
557 { | 557 { |
558 if (!markerEnd) | 558 if (!markerEnd) |
559 return false; | 559 return false; |
560 | 560 |
561 ASSERT(markerEnd->resourceType() == MarkerResourceType); | 561 ASSERT(markerEnd->resourceType() == MarkerResourceType); |
562 | 562 |
563 if (!m_markerData) | 563 if (!m_markerData) |
564 m_markerData = MarkerData::create(); | 564 m_markerData = MarkerData::create(); |
565 | 565 |
566 m_markerData->markerEnd = markerEnd; | 566 m_markerData->markerEnd = markerEnd; |
567 return true; | 567 return true; |
568 } | 568 } |
569 | 569 |
570 void SVGResources::resetMarkerEnd() | 570 void SVGResources::resetMarkerEnd() |
571 { | 571 { |
572 ASSERT(m_markerData); | 572 ASSERT(m_markerData); |
573 ASSERT(m_markerData->markerEnd); | 573 ASSERT(m_markerData->markerEnd); |
574 m_markerData->markerEnd = nullptr; | 574 m_markerData->markerEnd = nullptr; |
575 } | 575 } |
576 | 576 |
577 bool SVGResources::setMasker(RenderSVGResourceMasker* masker) | 577 bool SVGResources::setMasker(LayoutSVGResourceMasker* masker) |
578 { | 578 { |
579 if (!masker) | 579 if (!masker) |
580 return false; | 580 return false; |
581 | 581 |
582 ASSERT(masker->resourceType() == MaskerResourceType); | 582 ASSERT(masker->resourceType() == MaskerResourceType); |
583 | 583 |
584 if (!m_clipperFilterMaskerData) | 584 if (!m_clipperFilterMaskerData) |
585 m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); | 585 m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); |
586 | 586 |
587 m_clipperFilterMaskerData->masker = masker; | 587 m_clipperFilterMaskerData->masker = masker; |
588 return true; | 588 return true; |
589 } | 589 } |
590 | 590 |
591 void SVGResources::resetMasker() | 591 void SVGResources::resetMasker() |
592 { | 592 { |
593 ASSERT(m_clipperFilterMaskerData); | 593 ASSERT(m_clipperFilterMaskerData); |
594 ASSERT(m_clipperFilterMaskerData->masker); | 594 ASSERT(m_clipperFilterMaskerData->masker); |
595 m_clipperFilterMaskerData->masker = nullptr; | 595 m_clipperFilterMaskerData->masker = nullptr; |
596 } | 596 } |
597 | 597 |
598 bool SVGResources::setFill(RenderSVGResourcePaintServer* fill) | 598 bool SVGResources::setFill(LayoutSVGResourcePaintServer* fill) |
599 { | 599 { |
600 if (!fill) | 600 if (!fill) |
601 return false; | 601 return false; |
602 | 602 |
603 if (!m_fillStrokeData) | 603 if (!m_fillStrokeData) |
604 m_fillStrokeData = FillStrokeData::create(); | 604 m_fillStrokeData = FillStrokeData::create(); |
605 | 605 |
606 m_fillStrokeData->fill = fill; | 606 m_fillStrokeData->fill = fill; |
607 return true; | 607 return true; |
608 } | 608 } |
609 | 609 |
610 void SVGResources::resetFill() | 610 void SVGResources::resetFill() |
611 { | 611 { |
612 ASSERT(m_fillStrokeData); | 612 ASSERT(m_fillStrokeData); |
613 ASSERT(m_fillStrokeData->fill); | 613 ASSERT(m_fillStrokeData->fill); |
614 m_fillStrokeData->fill = nullptr; | 614 m_fillStrokeData->fill = nullptr; |
615 } | 615 } |
616 | 616 |
617 bool SVGResources::setStroke(RenderSVGResourcePaintServer* stroke) | 617 bool SVGResources::setStroke(LayoutSVGResourcePaintServer* stroke) |
618 { | 618 { |
619 if (!stroke) | 619 if (!stroke) |
620 return false; | 620 return false; |
621 | 621 |
622 if (!m_fillStrokeData) | 622 if (!m_fillStrokeData) |
623 m_fillStrokeData = FillStrokeData::create(); | 623 m_fillStrokeData = FillStrokeData::create(); |
624 | 624 |
625 m_fillStrokeData->stroke = stroke; | 625 m_fillStrokeData->stroke = stroke; |
626 return true; | 626 return true; |
627 } | 627 } |
628 | 628 |
629 void SVGResources::resetStroke() | 629 void SVGResources::resetStroke() |
630 { | 630 { |
631 ASSERT(m_fillStrokeData); | 631 ASSERT(m_fillStrokeData); |
632 ASSERT(m_fillStrokeData->stroke); | 632 ASSERT(m_fillStrokeData->stroke); |
633 m_fillStrokeData->stroke = nullptr; | 633 m_fillStrokeData->stroke = nullptr; |
634 } | 634 } |
635 | 635 |
636 bool SVGResources::setLinkedResource(RenderSVGResourceContainer* linkedResource) | 636 bool SVGResources::setLinkedResource(LayoutSVGResourceContainer* linkedResource) |
637 { | 637 { |
638 if (!linkedResource) | 638 if (!linkedResource) |
639 return false; | 639 return false; |
640 | 640 |
641 m_linkedResource = linkedResource; | 641 m_linkedResource = linkedResource; |
642 return true; | 642 return true; |
643 } | 643 } |
644 | 644 |
645 void SVGResources::resetLinkedResource() | 645 void SVGResources::resetLinkedResource() |
646 { | 646 { |
647 ASSERT(m_linkedResource); | 647 ASSERT(m_linkedResource); |
648 m_linkedResource = nullptr; | 648 m_linkedResource = nullptr; |
649 } | 649 } |
650 | 650 |
651 #ifndef NDEBUG | 651 #ifndef NDEBUG |
652 void SVGResources::dump(const LayoutObject* object) | 652 void SVGResources::dump(const LayoutObject* object) |
653 { | 653 { |
654 ASSERT(object); | 654 ASSERT(object); |
655 ASSERT(object->node()); | 655 ASSERT(object->node()); |
656 | 656 |
657 fprintf(stderr, "-> this=%p, SVGResources(renderer=%p, node=%p)\n", this, ob
ject, object->node()); | 657 fprintf(stderr, "-> this=%p, SVGResources(renderer=%p, node=%p)\n", this, ob
ject, object->node()); |
658 fprintf(stderr, " | DOM Tree:\n"); | 658 fprintf(stderr, " | DOM Tree:\n"); |
659 object->node()->showTreeForThis(); | 659 object->node()->showTreeForThis(); |
660 | 660 |
661 fprintf(stderr, "\n | List of resources:\n"); | 661 fprintf(stderr, "\n | List of resources:\n"); |
662 if (m_clipperFilterMaskerData) { | 662 if (m_clipperFilterMaskerData) { |
663 if (RenderSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipp
er) | 663 if (LayoutSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipp
er) |
664 fprintf(stderr, " |-> Clipper : %p (node=%p)\n", clipper, clipper
->element()); | 664 fprintf(stderr, " |-> Clipper : %p (node=%p)\n", clipper, clipper
->element()); |
665 if (RenderSVGResourceFilter* filter = m_clipperFilterMaskerData->filter) | 665 if (LayoutSVGResourceFilter* filter = m_clipperFilterMaskerData->filter) |
666 fprintf(stderr, " |-> Filter : %p (node=%p)\n", filter, filter->
element()); | 666 fprintf(stderr, " |-> Filter : %p (node=%p)\n", filter, filter->
element()); |
667 if (RenderSVGResourceMasker* masker = m_clipperFilterMaskerData->masker) | 667 if (LayoutSVGResourceMasker* masker = m_clipperFilterMaskerData->masker) |
668 fprintf(stderr, " |-> Masker : %p (node=%p)\n", masker, masker->
element()); | 668 fprintf(stderr, " |-> Masker : %p (node=%p)\n", masker, masker->
element()); |
669 } | 669 } |
670 | 670 |
671 if (m_markerData) { | 671 if (m_markerData) { |
672 if (RenderSVGResourceMarker* markerStart = m_markerData->markerStart) | 672 if (LayoutSVGResourceMarker* markerStart = m_markerData->markerStart) |
673 fprintf(stderr, " |-> MarkerStart: %p (node=%p)\n", markerStart, mar
kerStart->element()); | 673 fprintf(stderr, " |-> MarkerStart: %p (node=%p)\n", markerStart, mar
kerStart->element()); |
674 if (RenderSVGResourceMarker* markerMid = m_markerData->markerMid) | 674 if (LayoutSVGResourceMarker* markerMid = m_markerData->markerMid) |
675 fprintf(stderr, " |-> MarkerMid : %p (node=%p)\n", markerMid, marke
rMid->element()); | 675 fprintf(stderr, " |-> MarkerMid : %p (node=%p)\n", markerMid, marke
rMid->element()); |
676 if (RenderSVGResourceMarker* markerEnd = m_markerData->markerEnd) | 676 if (LayoutSVGResourceMarker* markerEnd = m_markerData->markerEnd) |
677 fprintf(stderr, " |-> MarkerEnd : %p (node=%p)\n", markerEnd, marke
rEnd->element()); | 677 fprintf(stderr, " |-> MarkerEnd : %p (node=%p)\n", markerEnd, marke
rEnd->element()); |
678 } | 678 } |
679 | 679 |
680 if (m_fillStrokeData) { | 680 if (m_fillStrokeData) { |
681 if (RenderSVGResourcePaintServer* fill = m_fillStrokeData->fill) | 681 if (LayoutSVGResourcePaintServer* fill = m_fillStrokeData->fill) |
682 fprintf(stderr, " |-> Fill : %p (node=%p)\n", fill, fill->elem
ent()); | 682 fprintf(stderr, " |-> Fill : %p (node=%p)\n", fill, fill->elem
ent()); |
683 if (RenderSVGResourcePaintServer* stroke = m_fillStrokeData->stroke) | 683 if (LayoutSVGResourcePaintServer* stroke = m_fillStrokeData->stroke) |
684 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
element()); | 684 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
element()); |
685 } | 685 } |
686 | 686 |
687 if (m_linkedResource) | 687 if (m_linkedResource) |
688 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->element()); | 688 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->element()); |
689 } | 689 } |
690 #endif | 690 #endif |
691 | 691 |
692 } | 692 } |
OLD | NEW |