| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. |
| 3 * (C) 2005 Rob Buis <buis@kde.org> | 3 * (C) 2005 Rob Buis <buis@kde.org> |
| 4 * (C) 2006 Alexander Kellett <lypanov@kde.org> | 4 * (C) 2006 Alexander Kellett <lypanov@kde.org> |
| 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 if (paintServerContainer->resourceType() == PatternResourceType) | 260 if (paintServerContainer->resourceType() == PatternResourceType) |
| 261 ts << "[type=PATTERN]"; | 261 ts << "[type=PATTERN]"; |
| 262 else if (paintServerContainer->resourceType() == LinearGradientResourceType) | 262 else if (paintServerContainer->resourceType() == LinearGradientResourceType) |
| 263 ts << "[type=LINEAR-GRADIENT]"; | 263 ts << "[type=LINEAR-GRADIENT]"; |
| 264 else if (paintServerContainer->resourceType() == RadialGradientResourceType) | 264 else if (paintServerContainer->resourceType() == RadialGradientResourceType) |
| 265 ts << "[type=RADIAL-GRADIENT]"; | 265 ts << "[type=RADIAL-GRADIENT]"; |
| 266 | 266 |
| 267 ts << " [id=\"" << element->getIdAttribute() << "\"]"; | 267 ts << " [id=\"" << element->getIdAttribute() << "\"]"; |
| 268 } | 268 } |
| 269 | 269 |
| 270 static void writeStyle(TextStream& ts, const RenderObject& object) | 270 static void writeStyle(TextStream& ts, const LayoutObject& object) |
| 271 { | 271 { |
| 272 const RenderStyle* style = object.style(); | 272 const RenderStyle* style = object.style(); |
| 273 const SVGRenderStyle& svgStyle = style->svgStyle(); | 273 const SVGRenderStyle& svgStyle = style->svgStyle(); |
| 274 | 274 |
| 275 if (!object.localTransform().isIdentity()) | 275 if (!object.localTransform().isIdentity()) |
| 276 writeNameValuePair(ts, "transform", object.localTransform()); | 276 writeNameValuePair(ts, "transform", object.localTransform()); |
| 277 writeIfNotDefault(ts, "image rendering", style->imageRendering(), RenderStyl
e::initialImageRendering()); | 277 writeIfNotDefault(ts, "image rendering", style->imageRendering(), RenderStyl
e::initialImageRendering()); |
| 278 writeIfNotDefault(ts, "opacity", style->opacity(), RenderStyle::initialOpaci
ty()); | 278 writeIfNotDefault(ts, "opacity", style->opacity(), RenderStyle::initialOpaci
ty()); |
| 279 if (object.isSVGShape()) { | 279 if (object.isSVGShape()) { |
| 280 const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object)
; | 280 const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object)
; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 ts << "}]"; | 320 ts << "}]"; |
| 321 } | 321 } |
| 322 writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), RULE_NONZERO); | 322 writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), RULE_NONZERO); |
| 323 } | 323 } |
| 324 | 324 |
| 325 writeIfNotEmpty(ts, "start marker", svgStyle.markerStartResource()); | 325 writeIfNotEmpty(ts, "start marker", svgStyle.markerStartResource()); |
| 326 writeIfNotEmpty(ts, "middle marker", svgStyle.markerMidResource()); | 326 writeIfNotEmpty(ts, "middle marker", svgStyle.markerMidResource()); |
| 327 writeIfNotEmpty(ts, "end marker", svgStyle.markerEndResource()); | 327 writeIfNotEmpty(ts, "end marker", svgStyle.markerEndResource()); |
| 328 } | 328 } |
| 329 | 329 |
| 330 static TextStream& writePositionAndStyle(TextStream& ts, const RenderObject& obj
ect) | 330 static TextStream& writePositionAndStyle(TextStream& ts, const LayoutObject& obj
ect) |
| 331 { | 331 { |
| 332 ts << " " << enclosingIntRect(const_cast<RenderObject&>(object).absoluteClip
pedOverflowRect()); | 332 ts << " " << enclosingIntRect(const_cast<LayoutObject&>(object).absoluteClip
pedOverflowRect()); |
| 333 writeStyle(ts, object); | 333 writeStyle(ts, object); |
| 334 return ts; | 334 return ts; |
| 335 } | 335 } |
| 336 | 336 |
| 337 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) | 337 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) |
| 338 { | 338 { |
| 339 writePositionAndStyle(ts, shape); | 339 writePositionAndStyle(ts, shape); |
| 340 | 340 |
| 341 SVGElement* svgElement = shape.element(); | 341 SVGElement* svgElement = shape.element(); |
| 342 ASSERT(svgElement); | 342 ASSERT(svgElement); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 static inline void writeSVGInlineTextBoxes(TextStream& ts, const RenderText& tex
t, int indent) | 456 static inline void writeSVGInlineTextBoxes(TextStream& ts, const RenderText& tex
t, int indent) |
| 457 { | 457 { |
| 458 for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()
) { | 458 for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()
) { |
| 459 if (!box->isSVGInlineTextBox()) | 459 if (!box->isSVGInlineTextBox()) |
| 460 continue; | 460 continue; |
| 461 | 461 |
| 462 writeSVGInlineTextBox(ts, toSVGInlineTextBox(box), indent); | 462 writeSVGInlineTextBox(ts, toSVGInlineTextBox(box), indent); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 static void writeStandardPrefix(TextStream& ts, const RenderObject& object, int
indent) | 466 static void writeStandardPrefix(TextStream& ts, const LayoutObject& object, int
indent) |
| 467 { | 467 { |
| 468 writeIndent(ts, indent); | 468 writeIndent(ts, indent); |
| 469 ts << object.renderName(); | 469 ts << object.renderName(); |
| 470 | 470 |
| 471 if (object.node()) | 471 if (object.node()) |
| 472 ts << " {" << object.node()->nodeName() << "}"; | 472 ts << " {" << object.node()->nodeName() << "}"; |
| 473 } | 473 } |
| 474 | 474 |
| 475 static void writeChildren(TextStream& ts, const RenderObject& object, int indent
) | 475 static void writeChildren(TextStream& ts, const LayoutObject& object, int indent
) |
| 476 { | 476 { |
| 477 for (RenderObject* child = object.slowFirstChild(); child; child = child->ne
xtSibling()) | 477 for (LayoutObject* child = object.slowFirstChild(); child; child = child->ne
xtSibling()) |
| 478 write(ts, *child, indent + 1); | 478 write(ts, *child, indent + 1); |
| 479 } | 479 } |
| 480 | 480 |
| 481 static inline void writeCommonGradientProperties(TextStream& ts, SVGSpreadMethod
Type spreadMethod, const AffineTransform& gradientTransform, SVGUnitTypes::SVGUn
itType gradientUnits) | 481 static inline void writeCommonGradientProperties(TextStream& ts, SVGSpreadMethod
Type spreadMethod, const AffineTransform& gradientTransform, SVGUnitTypes::SVGUn
itType gradientUnits) |
| 482 { | 482 { |
| 483 writeNameValuePair(ts, "gradientUnits", gradientUnits); | 483 writeNameValuePair(ts, "gradientUnits", gradientUnits); |
| 484 | 484 |
| 485 if (spreadMethod != SVGSpreadMethodPad) | 485 if (spreadMethod != SVGSpreadMethodPad) |
| 486 ts << " [spreadMethod=" << spreadMethod << "]"; | 486 ts << " [spreadMethod=" << spreadMethod << "]"; |
| 487 | 487 |
| 488 if (!gradientTransform.isIdentity()) | 488 if (!gradientTransform.isIdentity()) |
| 489 ts << " [gradientTransform=" << gradientTransform << "]"; | 489 ts << " [gradientTransform=" << gradientTransform << "]"; |
| 490 } | 490 } |
| 491 | 491 |
| 492 void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i
ndent) | 492 void writeSVGResourceContainer(TextStream& ts, const LayoutObject& object, int i
ndent) |
| 493 { | 493 { |
| 494 writeStandardPrefix(ts, object, indent); | 494 writeStandardPrefix(ts, object, indent); |
| 495 | 495 |
| 496 Element* element = toElement(object.node()); | 496 Element* element = toElement(object.node()); |
| 497 const AtomicString& id = element->getIdAttribute(); | 497 const AtomicString& id = element->getIdAttribute(); |
| 498 writeNameAndQuotedValue(ts, "id", id); | 498 writeNameAndQuotedValue(ts, "id", id); |
| 499 | 499 |
| 500 RenderSVGResourceContainer* resource = toRenderSVGResourceContainer(const_ca
st<RenderObject*>(&object)); | 500 RenderSVGResourceContainer* resource = toRenderSVGResourceContainer(const_ca
st<LayoutObject*>(&object)); |
| 501 ASSERT(resource); | 501 ASSERT(resource); |
| 502 | 502 |
| 503 if (resource->resourceType() == MaskerResourceType) { | 503 if (resource->resourceType() == MaskerResourceType) { |
| 504 RenderSVGResourceMasker* masker = toRenderSVGResourceMasker(resource); | 504 RenderSVGResourceMasker* masker = toRenderSVGResourceMasker(resource); |
| 505 writeNameValuePair(ts, "maskUnits", masker->maskUnits()); | 505 writeNameValuePair(ts, "maskUnits", masker->maskUnits()); |
| 506 writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits()); | 506 writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits()); |
| 507 ts << "\n"; | 507 ts << "\n"; |
| 508 } else if (resource->resourceType() == FilterResourceType) { | 508 } else if (resource->resourceType() == FilterResourceType) { |
| 509 RenderSVGResourceFilter* filter = toRenderSVGResourceFilter(resource); | 509 RenderSVGResourceFilter* filter = toRenderSVGResourceFilter(resource); |
| 510 writeNameValuePair(ts, "filterUnits", filter->filterUnits()); | 510 writeNameValuePair(ts, "filterUnits", filter->filterUnits()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 FloatPoint centerPoint = gradient->centerPoint(attributes); | 568 FloatPoint centerPoint = gradient->centerPoint(attributes); |
| 569 float radius = gradient->radius(attributes); | 569 float radius = gradient->radius(attributes); |
| 570 float focalRadius = gradient->focalRadius(attributes); | 570 float focalRadius = gradient->focalRadius(attributes); |
| 571 | 571 |
| 572 ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [rad
ius=" << radius << "] [focalRadius=" << focalRadius << "]\n"; | 572 ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [rad
ius=" << radius << "] [focalRadius=" << focalRadius << "]\n"; |
| 573 } else | 573 } else |
| 574 ts << "\n"; | 574 ts << "\n"; |
| 575 writeChildren(ts, object, indent); | 575 writeChildren(ts, object, indent); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void writeSVGContainer(TextStream& ts, const RenderObject& container, int indent
) | 578 void writeSVGContainer(TextStream& ts, const LayoutObject& container, int indent
) |
| 579 { | 579 { |
| 580 // Currently RenderSVGResourceFilterPrimitive has no meaningful output. | 580 // Currently RenderSVGResourceFilterPrimitive has no meaningful output. |
| 581 if (container.isSVGResourceFilterPrimitive()) | 581 if (container.isSVGResourceFilterPrimitive()) |
| 582 return; | 582 return; |
| 583 writeStandardPrefix(ts, container, indent); | 583 writeStandardPrefix(ts, container, indent); |
| 584 writePositionAndStyle(ts, container); | 584 writePositionAndStyle(ts, container); |
| 585 ts << "\n"; | 585 ts << "\n"; |
| 586 writeResources(ts, container, indent); | 586 writeResources(ts, container, indent); |
| 587 writeChildren(ts, container, indent); | 587 writeChildren(ts, container, indent); |
| 588 } | 588 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 SVGStopElement* stopElement = toSVGStopElement(stop.node()); | 633 SVGStopElement* stopElement = toSVGStopElement(stop.node()); |
| 634 ASSERT(stopElement); | 634 ASSERT(stopElement); |
| 635 | 635 |
| 636 RenderStyle* style = stop.style(); | 636 RenderStyle* style = stop.style(); |
| 637 if (!style) | 637 if (!style) |
| 638 return; | 638 return; |
| 639 | 639 |
| 640 ts << " [offset=" << stopElement->offset()->currentValue()->value() << "] [c
olor=" << stopElement->stopColorIncludingOpacity() << "]\n"; | 640 ts << " [offset=" << stopElement->offset()->currentValue()->value() << "] [c
olor=" << stopElement->stopColorIncludingOpacity() << "]\n"; |
| 641 } | 641 } |
| 642 | 642 |
| 643 void writeResources(TextStream& ts, const RenderObject& object, int indent) | 643 void writeResources(TextStream& ts, const LayoutObject& object, int indent) |
| 644 { | 644 { |
| 645 const RenderStyle* style = object.style(); | 645 const RenderStyle* style = object.style(); |
| 646 const SVGRenderStyle& svgStyle = style->svgStyle(); | 646 const SVGRenderStyle& svgStyle = style->svgStyle(); |
| 647 | 647 |
| 648 // FIXME: We want to use SVGResourcesCache to determine which resources are
present, instead of quering the resource <-> id cache. | 648 // FIXME: We want to use SVGResourcesCache to determine which resources are
present, instead of quering the resource <-> id cache. |
| 649 // For now leave the DRT output as is, but later on we should change this so
cycles are properly ignored in the DRT output. | 649 // For now leave the DRT output as is, but later on we should change this so
cycles are properly ignored in the DRT output. |
| 650 RenderObject& renderer = const_cast<RenderObject&>(object); | 650 LayoutObject& renderer = const_cast<LayoutObject&>(object); |
| 651 if (!svgStyle.maskerResource().isEmpty()) { | 651 if (!svgStyle.maskerResource().isEmpty()) { |
| 652 if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVG
ResourceMasker>(object.document(), svgStyle.maskerResource())) { | 652 if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVG
ResourceMasker>(object.document(), svgStyle.maskerResource())) { |
| 653 writeIndent(ts, indent); | 653 writeIndent(ts, indent); |
| 654 ts << " "; | 654 ts << " "; |
| 655 writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource()); | 655 writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource()); |
| 656 ts << " "; | 656 ts << " "; |
| 657 writeStandardPrefix(ts, *masker, 0); | 657 writeStandardPrefix(ts, *masker, 0); |
| 658 ts << " " << masker->resourceBoundingBox(&renderer) << "\n"; | 658 ts << " " << masker->resourceBoundingBox(&renderer) << "\n"; |
| 659 } | 659 } |
| 660 } | 660 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 674 ts << " "; | 674 ts << " "; |
| 675 writeNameAndQuotedValue(ts, "filter", svgStyle.filterResource()); | 675 writeNameAndQuotedValue(ts, "filter", svgStyle.filterResource()); |
| 676 ts << " "; | 676 ts << " "; |
| 677 writeStandardPrefix(ts, *filter, 0); | 677 writeStandardPrefix(ts, *filter, 0); |
| 678 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; | 678 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; |
| 679 } | 679 } |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 | 682 |
| 683 } // namespace blink | 683 } // namespace blink |
| OLD | NEW |