| 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 14 matching lines...) Expand all Loading... |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 | 30 |
| 31 #include "core/layout/svg/SVGLayoutTreeAsText.h" | 31 #include "core/layout/svg/SVGLayoutTreeAsText.h" |
| 32 | 32 |
| 33 #include "core/layout/LayoutTreeAsText.h" | 33 #include "core/layout/LayoutTreeAsText.h" |
| 34 #include "core/layout/line/InlineTextBox.h" | 34 #include "core/layout/line/InlineTextBox.h" |
| 35 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 36 #include "core/layout/svg/LayoutSVGResourceFilter.h" |
| 37 #include "core/layout/svg/LayoutSVGResourceLinearGradient.h" |
| 38 #include "core/layout/svg/LayoutSVGResourceMarker.h" |
| 39 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
| 40 #include "core/layout/svg/LayoutSVGResourcePattern.h" |
| 41 #include "core/layout/svg/LayoutSVGResourceRadialGradient.h" |
| 35 #include "core/layout/svg/line/SVGInlineTextBox.h" | 42 #include "core/layout/svg/line/SVGInlineTextBox.h" |
| 36 #include "core/layout/svg/line/SVGRootInlineBox.h" | 43 #include "core/layout/svg/line/SVGRootInlineBox.h" |
| 37 #include "core/rendering/svg/RenderSVGGradientStop.h" | 44 #include "core/rendering/svg/RenderSVGGradientStop.h" |
| 38 #include "core/rendering/svg/RenderSVGImage.h" | 45 #include "core/rendering/svg/RenderSVGImage.h" |
| 39 #include "core/rendering/svg/RenderSVGInlineText.h" | 46 #include "core/rendering/svg/RenderSVGInlineText.h" |
| 40 #include "core/rendering/svg/RenderSVGResourceClipper.h" | |
| 41 #include "core/rendering/svg/RenderSVGResourceFilter.h" | |
| 42 #include "core/rendering/svg/RenderSVGResourceLinearGradient.h" | |
| 43 #include "core/rendering/svg/RenderSVGResourceMarker.h" | |
| 44 #include "core/rendering/svg/RenderSVGResourceMasker.h" | |
| 45 #include "core/rendering/svg/RenderSVGResourcePattern.h" | |
| 46 #include "core/rendering/svg/RenderSVGResourceRadialGradient.h" | |
| 47 #include "core/rendering/svg/RenderSVGRoot.h" | 47 #include "core/rendering/svg/RenderSVGRoot.h" |
| 48 #include "core/rendering/svg/RenderSVGShape.h" | 48 #include "core/rendering/svg/RenderSVGShape.h" |
| 49 #include "core/rendering/svg/RenderSVGText.h" | 49 #include "core/rendering/svg/RenderSVGText.h" |
| 50 #include "core/svg/LinearGradientAttributes.h" | 50 #include "core/svg/LinearGradientAttributes.h" |
| 51 #include "core/svg/PatternAttributes.h" | 51 #include "core/svg/PatternAttributes.h" |
| 52 #include "core/svg/RadialGradientAttributes.h" | 52 #include "core/svg/RadialGradientAttributes.h" |
| 53 #include "core/svg/SVGCircleElement.h" | 53 #include "core/svg/SVGCircleElement.h" |
| 54 #include "core/svg/SVGEllipseElement.h" | 54 #include "core/svg/SVGEllipseElement.h" |
| 55 #include "core/svg/SVGLineElement.h" | 55 #include "core/svg/SVGLineElement.h" |
| 56 #include "core/svg/SVGLinearGradientElement.h" | 56 #include "core/svg/SVGLinearGradientElement.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 247 } |
| 248 | 248 |
| 249 static void writeSVGPaintingResource(TextStream& ts, const SVGPaintDescription&
paintDescription) | 249 static void writeSVGPaintingResource(TextStream& ts, const SVGPaintDescription&
paintDescription) |
| 250 { | 250 { |
| 251 ASSERT(paintDescription.isValid); | 251 ASSERT(paintDescription.isValid); |
| 252 if (!paintDescription.resource) { | 252 if (!paintDescription.resource) { |
| 253 ts << "[type=SOLID] [color=" << paintDescription.color << "]"; | 253 ts << "[type=SOLID] [color=" << paintDescription.color << "]"; |
| 254 return; | 254 return; |
| 255 } | 255 } |
| 256 | 256 |
| 257 RenderSVGResourcePaintServer* paintServerContainer = paintDescription.resour
ce; | 257 LayoutSVGResourcePaintServer* paintServerContainer = paintDescription.resour
ce; |
| 258 SVGElement* element = paintServerContainer->element(); | 258 SVGElement* element = paintServerContainer->element(); |
| 259 ASSERT(element); | 259 ASSERT(element); |
| 260 | 260 |
| 261 if (paintServerContainer->resourceType() == PatternResourceType) | 261 if (paintServerContainer->resourceType() == PatternResourceType) |
| 262 ts << "[type=PATTERN]"; | 262 ts << "[type=PATTERN]"; |
| 263 else if (paintServerContainer->resourceType() == LinearGradientResourceType) | 263 else if (paintServerContainer->resourceType() == LinearGradientResourceType) |
| 264 ts << "[type=LINEAR-GRADIENT]"; | 264 ts << "[type=LINEAR-GRADIENT]"; |
| 265 else if (paintServerContainer->resourceType() == RadialGradientResourceType) | 265 else if (paintServerContainer->resourceType() == RadialGradientResourceType) |
| 266 ts << "[type=RADIAL-GRADIENT]"; | 266 ts << "[type=RADIAL-GRADIENT]"; |
| 267 | 267 |
| 268 ts << " [id=\"" << element->getIdAttribute() << "\"]"; | 268 ts << " [id=\"" << element->getIdAttribute() << "\"]"; |
| 269 } | 269 } |
| 270 | 270 |
| 271 static void writeStyle(TextStream& ts, const LayoutObject& object) | 271 static void writeStyle(TextStream& ts, const LayoutObject& object) |
| 272 { | 272 { |
| 273 const LayoutStyle& style = object.styleRef(); | 273 const LayoutStyle& style = object.styleRef(); |
| 274 const SVGLayoutStyle& svgStyle = style.svgStyle(); | 274 const SVGLayoutStyle& svgStyle = style.svgStyle(); |
| 275 | 275 |
| 276 if (!object.localTransform().isIdentity()) | 276 if (!object.localTransform().isIdentity()) |
| 277 writeNameValuePair(ts, "transform", object.localTransform()); | 277 writeNameValuePair(ts, "transform", object.localTransform()); |
| 278 writeIfNotDefault(ts, "image rendering", style.imageRendering(), LayoutStyle
::initialImageRendering()); | 278 writeIfNotDefault(ts, "image rendering", style.imageRendering(), LayoutStyle
::initialImageRendering()); |
| 279 writeIfNotDefault(ts, "opacity", style.opacity(), LayoutStyle::initialOpacit
y()); | 279 writeIfNotDefault(ts, "opacity", style.opacity(), LayoutStyle::initialOpacit
y()); |
| 280 if (object.isSVGShape()) { | 280 if (object.isSVGShape()) { |
| 281 const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object)
; | 281 const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object)
; |
| 282 ASSERT(shape.element()); | 282 ASSERT(shape.element()); |
| 283 | 283 |
| 284 SVGPaintDescription strokePaintDescription = RenderSVGResourcePaintServe
r::requestPaintDescription(shape, shape.styleRef(), ApplyToStrokeMode); | 284 SVGPaintDescription strokePaintDescription = LayoutSVGResourcePaintServe
r::requestPaintDescription(shape, shape.styleRef(), ApplyToStrokeMode); |
| 285 if (strokePaintDescription.isValid) { | 285 if (strokePaintDescription.isValid) { |
| 286 TextStreamSeparator s(" "); | 286 TextStreamSeparator s(" "); |
| 287 ts << " [stroke={" << s; | 287 ts << " [stroke={" << s; |
| 288 writeSVGPaintingResource(ts, strokePaintDescription); | 288 writeSVGPaintingResource(ts, strokePaintDescription); |
| 289 | 289 |
| 290 SVGLengthContext lengthContext(shape.element()); | 290 SVGLengthContext lengthContext(shape.element()); |
| 291 double dashOffset = svgStyle.strokeDashOffset()->value(lengthContext
); | 291 double dashOffset = svgStyle.strokeDashOffset()->value(lengthContext
); |
| 292 double strokeWidth = svgStyle.strokeWidth()->value(lengthContext); | 292 double strokeWidth = svgStyle.strokeWidth()->value(lengthContext); |
| 293 RefPtrWillBeRawPtr<SVGLengthList> dashes = svgStyle.strokeDashArray(
); | 293 RefPtrWillBeRawPtr<SVGLengthList> dashes = svgStyle.strokeDashArray(
); |
| 294 | 294 |
| 295 DashArray dashArray; | 295 DashArray dashArray; |
| 296 SVGLengthList::ConstIterator it = dashes->begin(); | 296 SVGLengthList::ConstIterator it = dashes->begin(); |
| 297 SVGLengthList::ConstIterator itEnd = dashes->end(); | 297 SVGLengthList::ConstIterator itEnd = dashes->end(); |
| 298 for (; it != itEnd; ++it) | 298 for (; it != itEnd; ++it) |
| 299 dashArray.append(it->value(lengthContext)); | 299 dashArray.append(it->value(lengthContext)); |
| 300 | 300 |
| 301 writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f); | 301 writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f); |
| 302 writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0); | 302 writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0); |
| 303 writeIfNotDefault(ts, "miter limit", svgStyle.strokeMiterLimit(), 4.
0f); | 303 writeIfNotDefault(ts, "miter limit", svgStyle.strokeMiterLimit(), 4.
0f); |
| 304 writeIfNotDefault(ts, "line cap", svgStyle.capStyle(), ButtCap); | 304 writeIfNotDefault(ts, "line cap", svgStyle.capStyle(), ButtCap); |
| 305 writeIfNotDefault(ts, "line join", svgStyle.joinStyle(), MiterJoin); | 305 writeIfNotDefault(ts, "line join", svgStyle.joinStyle(), MiterJoin); |
| 306 writeIfNotDefault(ts, "dash offset", dashOffset, 0.0); | 306 writeIfNotDefault(ts, "dash offset", dashOffset, 0.0); |
| 307 if (!dashArray.isEmpty()) | 307 if (!dashArray.isEmpty()) |
| 308 writeNameValuePair(ts, "dash array", dashArray); | 308 writeNameValuePair(ts, "dash array", dashArray); |
| 309 | 309 |
| 310 ts << "}]"; | 310 ts << "}]"; |
| 311 } | 311 } |
| 312 | 312 |
| 313 SVGPaintDescription fillPaintDescription = RenderSVGResourcePaintServer:
:requestPaintDescription(shape, shape.styleRef(), ApplyToFillMode); | 313 SVGPaintDescription fillPaintDescription = LayoutSVGResourcePaintServer:
:requestPaintDescription(shape, shape.styleRef(), ApplyToFillMode); |
| 314 if (fillPaintDescription.isValid) { | 314 if (fillPaintDescription.isValid) { |
| 315 TextStreamSeparator s(" "); | 315 TextStreamSeparator s(" "); |
| 316 ts << " [fill={" << s; | 316 ts << " [fill={" << s; |
| 317 writeSVGPaintingResource(ts, fillPaintDescription); | 317 writeSVGPaintingResource(ts, fillPaintDescription); |
| 318 | 318 |
| 319 writeIfNotDefault(ts, "opacity", svgStyle.fillOpacity(), 1.0f); | 319 writeIfNotDefault(ts, "opacity", svgStyle.fillOpacity(), 1.0f); |
| 320 writeIfNotDefault(ts, "fill rule", svgStyle.fillRule(), RULE_NONZERO
); | 320 writeIfNotDefault(ts, "fill rule", svgStyle.fillRule(), RULE_NONZERO
); |
| 321 ts << "}]"; | 321 ts << "}]"; |
| 322 } | 322 } |
| 323 writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), RULE_NONZERO); | 323 writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), RULE_NONZERO); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 493 } |
| 494 | 494 |
| 495 void writeSVGResourceContainer(TextStream& ts, const LayoutObject& object, int i
ndent) | 495 void writeSVGResourceContainer(TextStream& ts, const LayoutObject& object, int i
ndent) |
| 496 { | 496 { |
| 497 writeStandardPrefix(ts, object, indent); | 497 writeStandardPrefix(ts, object, indent); |
| 498 | 498 |
| 499 Element* element = toElement(object.node()); | 499 Element* element = toElement(object.node()); |
| 500 const AtomicString& id = element->getIdAttribute(); | 500 const AtomicString& id = element->getIdAttribute(); |
| 501 writeNameAndQuotedValue(ts, "id", id); | 501 writeNameAndQuotedValue(ts, "id", id); |
| 502 | 502 |
| 503 RenderSVGResourceContainer* resource = toRenderSVGResourceContainer(const_ca
st<LayoutObject*>(&object)); | 503 LayoutSVGResourceContainer* resource = toLayoutSVGResourceContainer(const_ca
st<LayoutObject*>(&object)); |
| 504 ASSERT(resource); | 504 ASSERT(resource); |
| 505 | 505 |
| 506 if (resource->resourceType() == MaskerResourceType) { | 506 if (resource->resourceType() == MaskerResourceType) { |
| 507 RenderSVGResourceMasker* masker = toRenderSVGResourceMasker(resource); | 507 LayoutSVGResourceMasker* masker = toLayoutSVGResourceMasker(resource); |
| 508 writeNameValuePair(ts, "maskUnits", masker->maskUnits()); | 508 writeNameValuePair(ts, "maskUnits", masker->maskUnits()); |
| 509 writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits()); | 509 writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits()); |
| 510 ts << "\n"; | 510 ts << "\n"; |
| 511 } else if (resource->resourceType() == FilterResourceType) { | 511 } else if (resource->resourceType() == FilterResourceType) { |
| 512 RenderSVGResourceFilter* filter = toRenderSVGResourceFilter(resource); | 512 LayoutSVGResourceFilter* filter = toLayoutSVGResourceFilter(resource); |
| 513 writeNameValuePair(ts, "filterUnits", filter->filterUnits()); | 513 writeNameValuePair(ts, "filterUnits", filter->filterUnits()); |
| 514 writeNameValuePair(ts, "primitiveUnits", filter->primitiveUnits()); | 514 writeNameValuePair(ts, "primitiveUnits", filter->primitiveUnits()); |
| 515 ts << "\n"; | 515 ts << "\n"; |
| 516 // Creating a placeholder filter which is passed to the builder. | 516 // Creating a placeholder filter which is passed to the builder. |
| 517 FloatRect dummyRect; | 517 FloatRect dummyRect; |
| 518 IntRect dummyIntRect; | 518 IntRect dummyIntRect; |
| 519 RefPtrWillBeRawPtr<SVGFilter> dummyFilter = SVGFilter::create(dummyIntRe
ct, dummyRect, dummyRect, true); | 519 RefPtrWillBeRawPtr<SVGFilter> dummyFilter = SVGFilter::create(dummyIntRe
ct, dummyRect, dummyRect, true); |
| 520 if (RefPtrWillBeRawPtr<SVGFilterBuilder> builder = filter->buildPrimitiv
es(dummyFilter.get())) { | 520 if (RefPtrWillBeRawPtr<SVGFilterBuilder> builder = filter->buildPrimitiv
es(dummyFilter.get())) { |
| 521 if (FilterEffect* lastEffect = builder->lastEffect()) | 521 if (FilterEffect* lastEffect = builder->lastEffect()) |
| 522 lastEffect->externalRepresentation(ts, indent + 1); | 522 lastEffect->externalRepresentation(ts, indent + 1); |
| 523 } | 523 } |
| 524 } else if (resource->resourceType() == ClipperResourceType) { | 524 } else if (resource->resourceType() == ClipperResourceType) { |
| 525 writeNameValuePair(ts, "clipPathUnits", toRenderSVGResourceClipper(resou
rce)->clipPathUnits()); | 525 writeNameValuePair(ts, "clipPathUnits", toLayoutSVGResourceClipper(resou
rce)->clipPathUnits()); |
| 526 ts << "\n"; | 526 ts << "\n"; |
| 527 } else if (resource->resourceType() == MarkerResourceType) { | 527 } else if (resource->resourceType() == MarkerResourceType) { |
| 528 RenderSVGResourceMarker* marker = toRenderSVGResourceMarker(resource); | 528 LayoutSVGResourceMarker* marker = toLayoutSVGResourceMarker(resource); |
| 529 writeNameValuePair(ts, "markerUnits", marker->markerUnits()); | 529 writeNameValuePair(ts, "markerUnits", marker->markerUnits()); |
| 530 ts << " [ref at " << marker->referencePoint() << "]"; | 530 ts << " [ref at " << marker->referencePoint() << "]"; |
| 531 ts << " [angle="; | 531 ts << " [angle="; |
| 532 if (marker->angle() == -1) | 532 if (marker->angle() == -1) |
| 533 ts << marker->orientType() << "]\n"; | 533 ts << marker->orientType() << "]\n"; |
| 534 else | 534 else |
| 535 ts << marker->angle() << "]\n"; | 535 ts << marker->angle() << "]\n"; |
| 536 } else if (resource->resourceType() == PatternResourceType) { | 536 } else if (resource->resourceType() == PatternResourceType) { |
| 537 RenderSVGResourcePattern* pattern = static_cast<RenderSVGResourcePattern
*>(resource); | 537 LayoutSVGResourcePattern* pattern = static_cast<LayoutSVGResourcePattern
*>(resource); |
| 538 | 538 |
| 539 // Dump final results that are used for rendering. No use in asking SVGP
atternElement for its patternUnits(), as it may | 539 // Dump final results that are used for rendering. No use in asking SVGP
atternElement for its patternUnits(), as it may |
| 540 // link to other patterns using xlink:href, we need to build the full in
heritance chain, aka. collectPatternProperties() | 540 // link to other patterns using xlink:href, we need to build the full in
heritance chain, aka. collectPatternProperties() |
| 541 PatternAttributes attributes; | 541 PatternAttributes attributes; |
| 542 toSVGPatternElement(pattern->element())->collectPatternAttributes(attrib
utes); | 542 toSVGPatternElement(pattern->element())->collectPatternAttributes(attrib
utes); |
| 543 | 543 |
| 544 writeNameValuePair(ts, "patternUnits", attributes.patternUnits()); | 544 writeNameValuePair(ts, "patternUnits", attributes.patternUnits()); |
| 545 writeNameValuePair(ts, "patternContentUnits", attributes.patternContentU
nits()); | 545 writeNameValuePair(ts, "patternContentUnits", attributes.patternContentU
nits()); |
| 546 | 546 |
| 547 AffineTransform transform = attributes.patternTransform(); | 547 AffineTransform transform = attributes.patternTransform(); |
| 548 if (!transform.isIdentity()) | 548 if (!transform.isIdentity()) |
| 549 ts << " [patternTransform=" << transform << "]"; | 549 ts << " [patternTransform=" << transform << "]"; |
| 550 ts << "\n"; | 550 ts << "\n"; |
| 551 } else if (resource->resourceType() == LinearGradientResourceType) { | 551 } else if (resource->resourceType() == LinearGradientResourceType) { |
| 552 RenderSVGResourceLinearGradient* gradient = static_cast<RenderSVGResourc
eLinearGradient*>(resource); | 552 LayoutSVGResourceLinearGradient* gradient = static_cast<LayoutSVGResourc
eLinearGradient*>(resource); |
| 553 | 553 |
| 554 // Dump final results that are used for rendering. No use in asking SVGG
radientElement for its gradientUnits(), as it may | 554 // Dump final results that are used for rendering. No use in asking SVGG
radientElement for its gradientUnits(), as it may |
| 555 // link to other gradients using xlink:href, we need to build the full i
nheritance chain, aka. collectGradientProperties() | 555 // link to other gradients using xlink:href, we need to build the full i
nheritance chain, aka. collectGradientProperties() |
| 556 LinearGradientAttributes attributes; | 556 LinearGradientAttributes attributes; |
| 557 toSVGLinearGradientElement(gradient->element())->collectGradientAttribut
es(attributes); | 557 toSVGLinearGradientElement(gradient->element())->collectGradientAttribut
es(attributes); |
| 558 writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.
gradientTransform(), attributes.gradientUnits()); | 558 writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.
gradientTransform(), attributes.gradientUnits()); |
| 559 | 559 |
| 560 ts << " [start=" << gradient->startPoint(attributes) << "] [end=" << gra
dient->endPoint(attributes) << "]\n"; | 560 ts << " [start=" << gradient->startPoint(attributes) << "] [end=" << gra
dient->endPoint(attributes) << "]\n"; |
| 561 } else if (resource->resourceType() == RadialGradientResourceType) { | 561 } else if (resource->resourceType() == RadialGradientResourceType) { |
| 562 RenderSVGResourceRadialGradient* gradient = toRenderSVGResourceRadialGra
dient(resource); | 562 LayoutSVGResourceRadialGradient* gradient = toLayoutSVGResourceRadialGra
dient(resource); |
| 563 | 563 |
| 564 // Dump final results that are used for rendering. No use in asking SVGG
radientElement for its gradientUnits(), as it may | 564 // Dump final results that are used for rendering. No use in asking SVGG
radientElement for its gradientUnits(), as it may |
| 565 // link to other gradients using xlink:href, we need to build the full i
nheritance chain, aka. collectGradientProperties() | 565 // link to other gradients using xlink:href, we need to build the full i
nheritance chain, aka. collectGradientProperties() |
| 566 RadialGradientAttributes attributes; | 566 RadialGradientAttributes attributes; |
| 567 toSVGRadialGradientElement(gradient->element())->collectGradientAttribut
es(attributes); | 567 toSVGRadialGradientElement(gradient->element())->collectGradientAttribut
es(attributes); |
| 568 writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.
gradientTransform(), attributes.gradientUnits()); | 568 writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.
gradientTransform(), attributes.gradientUnits()); |
| 569 | 569 |
| 570 FloatPoint focalPoint = gradient->focalPoint(attributes); | 570 FloatPoint focalPoint = gradient->focalPoint(attributes); |
| 571 FloatPoint centerPoint = gradient->centerPoint(attributes); | 571 FloatPoint centerPoint = gradient->centerPoint(attributes); |
| 572 float radius = gradient->radius(attributes); | 572 float radius = gradient->radius(attributes); |
| 573 float focalRadius = gradient->focalRadius(attributes); | 573 float focalRadius = gradient->focalRadius(attributes); |
| 574 | 574 |
| 575 ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [rad
ius=" << radius << "] [focalRadius=" << focalRadius << "]\n"; | 575 ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [rad
ius=" << radius << "] [focalRadius=" << focalRadius << "]\n"; |
| 576 } else { | 576 } else { |
| 577 ts << "\n"; | 577 ts << "\n"; |
| 578 } | 578 } |
| 579 writeChildren(ts, object, indent); | 579 writeChildren(ts, object, indent); |
| 580 } | 580 } |
| 581 | 581 |
| 582 void writeSVGContainer(TextStream& ts, const LayoutObject& container, int indent
) | 582 void writeSVGContainer(TextStream& ts, const LayoutObject& container, int indent
) |
| 583 { | 583 { |
| 584 // Currently RenderSVGResourceFilterPrimitive has no meaningful output. | 584 // Currently LayoutSVGResourceFilterPrimitive has no meaningful output. |
| 585 if (container.isSVGResourceFilterPrimitive()) | 585 if (container.isSVGResourceFilterPrimitive()) |
| 586 return; | 586 return; |
| 587 writeStandardPrefix(ts, container, indent); | 587 writeStandardPrefix(ts, container, indent); |
| 588 writePositionAndStyle(ts, container); | 588 writePositionAndStyle(ts, container); |
| 589 ts << "\n"; | 589 ts << "\n"; |
| 590 writeResources(ts, container, indent); | 590 writeResources(ts, container, indent); |
| 591 writeChildren(ts, container, indent); | 591 writeChildren(ts, container, indent); |
| 592 } | 592 } |
| 593 | 593 |
| 594 void write(TextStream& ts, const RenderSVGRoot& root, int indent) | 594 void write(TextStream& ts, const RenderSVGRoot& root, int indent) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 643 |
| 644 void writeResources(TextStream& ts, const LayoutObject& object, int indent) | 644 void writeResources(TextStream& ts, const LayoutObject& object, int indent) |
| 645 { | 645 { |
| 646 const LayoutStyle& style = object.styleRef(); | 646 const LayoutStyle& style = object.styleRef(); |
| 647 const SVGLayoutStyle& svgStyle = style.svgStyle(); | 647 const SVGLayoutStyle& svgStyle = style.svgStyle(); |
| 648 | 648 |
| 649 // FIXME: We want to use SVGResourcesCache to determine which resources are
present, instead of quering the resource <-> id cache. | 649 // FIXME: We want to use SVGResourcesCache to determine which resources are
present, instead of quering the resource <-> id cache. |
| 650 // 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 // For now leave the DRT output as is, but later on we should change this so
cycles are properly ignored in the DRT output. |
| 651 LayoutObject& renderer = const_cast<LayoutObject&>(object); | 651 LayoutObject& renderer = const_cast<LayoutObject&>(object); |
| 652 if (!svgStyle.maskerResource().isEmpty()) { | 652 if (!svgStyle.maskerResource().isEmpty()) { |
| 653 if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVG
ResourceMasker>(object.document(), svgStyle.maskerResource())) { | 653 if (LayoutSVGResourceMasker* masker = getLayoutSVGResourceById<LayoutSVG
ResourceMasker>(object.document(), svgStyle.maskerResource())) { |
| 654 writeIndent(ts, indent); | 654 writeIndent(ts, indent); |
| 655 ts << " "; | 655 ts << " "; |
| 656 writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource()); | 656 writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource()); |
| 657 ts << " "; | 657 ts << " "; |
| 658 writeStandardPrefix(ts, *masker, 0); | 658 writeStandardPrefix(ts, *masker, 0); |
| 659 ts << " " << masker->resourceBoundingBox(&renderer) << "\n"; | 659 ts << " " << masker->resourceBoundingBox(&renderer) << "\n"; |
| 660 } | 660 } |
| 661 } | 661 } |
| 662 if (!svgStyle.clipperResource().isEmpty()) { | 662 if (!svgStyle.clipperResource().isEmpty()) { |
| 663 if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderS
VGResourceClipper>(object.document(), svgStyle.clipperResource())) { | 663 if (LayoutSVGResourceClipper* clipper = getLayoutSVGResourceById<LayoutS
VGResourceClipper>(object.document(), svgStyle.clipperResource())) { |
| 664 writeIndent(ts, indent); | 664 writeIndent(ts, indent); |
| 665 ts << " "; | 665 ts << " "; |
| 666 writeNameAndQuotedValue(ts, "clipPath", svgStyle.clipperResource()); | 666 writeNameAndQuotedValue(ts, "clipPath", svgStyle.clipperResource()); |
| 667 ts << " "; | 667 ts << " "; |
| 668 writeStandardPrefix(ts, *clipper, 0); | 668 writeStandardPrefix(ts, *clipper, 0); |
| 669 ts << " " << clipper->resourceBoundingBox(&renderer) << "\n"; | 669 ts << " " << clipper->resourceBoundingBox(&renderer) << "\n"; |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 if (!svgStyle.filterResource().isEmpty()) { | 672 if (!svgStyle.filterResource().isEmpty()) { |
| 673 if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVG
ResourceFilter>(object.document(), svgStyle.filterResource())) { | 673 if (LayoutSVGResourceFilter* filter = getLayoutSVGResourceById<LayoutSVG
ResourceFilter>(object.document(), svgStyle.filterResource())) { |
| 674 writeIndent(ts, indent); | 674 writeIndent(ts, indent); |
| 675 ts << " "; | 675 ts << " "; |
| 676 writeNameAndQuotedValue(ts, "filter", svgStyle.filterResource()); | 676 writeNameAndQuotedValue(ts, "filter", svgStyle.filterResource()); |
| 677 ts << " "; | 677 ts << " "; |
| 678 writeStandardPrefix(ts, *filter, 0); | 678 writeStandardPrefix(ts, *filter, 0); |
| 679 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; | 679 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 | 683 |
| 684 } // namespace blink | 684 } // namespace blink |
| OLD | NEW |