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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 | 240 |
241 static TextStream& operator<<(TextStream& ts, const SVGSpreadMethodType& type) { | 241 static TextStream& operator<<(TextStream& ts, const SVGSpreadMethodType& type) { |
242 ts << SVGEnumerationToString<SVGSpreadMethodType>(type).upper(); | 242 ts << SVGEnumerationToString<SVGSpreadMethodType>(type).upper(); |
243 return ts; | 243 return ts; |
244 } | 244 } |
245 | 245 |
246 static void writeSVGPaintingResource( | 246 static void writeSVGPaintingResource( |
247 TextStream& ts, | 247 TextStream& ts, |
248 const SVGPaintDescription& paintDescription) { | 248 const SVGPaintDescription& paintDescription) { |
249 ASSERT(paintDescription.isValid); | 249 DCHECK(paintDescription.isValid); |
250 if (!paintDescription.resource) { | 250 if (!paintDescription.resource) { |
251 ts << "[type=SOLID] [color=" << paintDescription.color << "]"; | 251 ts << "[type=SOLID] [color=" << paintDescription.color << "]"; |
252 return; | 252 return; |
253 } | 253 } |
254 | 254 |
255 LayoutSVGResourcePaintServer* paintServerContainer = | 255 LayoutSVGResourcePaintServer* paintServerContainer = |
256 paintDescription.resource; | 256 paintDescription.resource; |
257 SVGElement* element = paintServerContainer->element(); | 257 SVGElement* element = paintServerContainer->element(); |
258 ASSERT(element); | 258 DCHECK(element); |
259 | 259 |
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 LayoutObject& object) { | 270 static void writeStyle(TextStream& ts, const LayoutObject& object) { |
271 const ComputedStyle& style = object.styleRef(); | 271 const ComputedStyle& style = object.styleRef(); |
272 const SVGComputedStyle& svgStyle = style.svgStyle(); | 272 const SVGComputedStyle& svgStyle = style.svgStyle(); |
273 | 273 |
274 if (!object.localSVGTransform().isIdentity()) | 274 if (!object.localSVGTransform().isIdentity()) |
275 writeNameValuePair(ts, "transform", object.localSVGTransform()); | 275 writeNameValuePair(ts, "transform", object.localSVGTransform()); |
276 writeIfNotDefault(ts, "image rendering", style.imageRendering(), | 276 writeIfNotDefault(ts, "image rendering", style.imageRendering(), |
277 ComputedStyle::initialImageRendering()); | 277 ComputedStyle::initialImageRendering()); |
278 writeIfNotDefault(ts, "opacity", style.opacity(), | 278 writeIfNotDefault(ts, "opacity", style.opacity(), |
279 ComputedStyle::initialOpacity()); | 279 ComputedStyle::initialOpacity()); |
280 if (object.isSVGShape()) { | 280 if (object.isSVGShape()) { |
281 const LayoutSVGShape& shape = static_cast<const LayoutSVGShape&>(object); | 281 const LayoutSVGShape& shape = static_cast<const LayoutSVGShape&>(object); |
282 ASSERT(shape.element()); | 282 DCHECK(shape.element()); |
283 | 283 |
284 SVGPaintDescription strokePaintDescription = | 284 SVGPaintDescription strokePaintDescription = |
285 LayoutSVGResourcePaintServer::requestPaintDescription( | 285 LayoutSVGResourcePaintServer::requestPaintDescription( |
286 shape, shape.styleRef(), ApplyToStrokeMode); | 286 shape, shape.styleRef(), ApplyToStrokeMode); |
287 if (strokePaintDescription.isValid) { | 287 if (strokePaintDescription.isValid) { |
288 TextStreamSeparator s(" "); | 288 TextStreamSeparator s(" "); |
289 ts << " [stroke={" << s; | 289 ts << " [stroke={" << s; |
290 writeSVGPaintingResource(ts, strokePaintDescription); | 290 writeSVGPaintingResource(ts, strokePaintDescription); |
291 | 291 |
292 SVGLengthContext lengthContext(shape.element()); | 292 SVGLengthContext lengthContext(shape.element()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 const LayoutObject& object) { | 332 const LayoutObject& object) { |
333 ts << " " << object.objectBoundingBox(); | 333 ts << " " << object.objectBoundingBox(); |
334 writeStyle(ts, object); | 334 writeStyle(ts, object); |
335 return ts; | 335 return ts; |
336 } | 336 } |
337 | 337 |
338 static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) { | 338 static TextStream& operator<<(TextStream& ts, const LayoutSVGShape& shape) { |
339 writePositionAndStyle(ts, shape); | 339 writePositionAndStyle(ts, shape); |
340 | 340 |
341 SVGElement* svgElement = shape.element(); | 341 SVGElement* svgElement = shape.element(); |
342 ASSERT(svgElement); | 342 DCHECK(svgElement); |
343 SVGLengthContext lengthContext(svgElement); | 343 SVGLengthContext lengthContext(svgElement); |
344 | 344 |
345 if (isSVGRectElement(*svgElement)) { | 345 if (isSVGRectElement(*svgElement)) { |
346 SVGRectElement& element = toSVGRectElement(*svgElement); | 346 SVGRectElement& element = toSVGRectElement(*svgElement); |
347 writeNameValuePair(ts, "x", | 347 writeNameValuePair(ts, "x", |
348 element.x()->currentValue()->value(lengthContext)); | 348 element.x()->currentValue()->value(lengthContext)); |
349 writeNameValuePair(ts, "y", | 349 writeNameValuePair(ts, "y", |
350 element.y()->currentValue()->value(lengthContext)); | 350 element.y()->currentValue()->value(lengthContext)); |
351 writeNameValuePair(ts, "width", | 351 writeNameValuePair(ts, "width", |
352 element.width()->currentValue()->value(lengthContext)); | 352 element.width()->currentValue()->value(lengthContext)); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 const LayoutObject& object, | 529 const LayoutObject& object, |
530 int indent) { | 530 int indent) { |
531 writeStandardPrefix(ts, object, indent); | 531 writeStandardPrefix(ts, object, indent); |
532 | 532 |
533 Element* element = toElement(object.node()); | 533 Element* element = toElement(object.node()); |
534 const AtomicString& id = element->getIdAttribute(); | 534 const AtomicString& id = element->getIdAttribute(); |
535 writeNameAndQuotedValue(ts, "id", id); | 535 writeNameAndQuotedValue(ts, "id", id); |
536 | 536 |
537 LayoutSVGResourceContainer* resource = | 537 LayoutSVGResourceContainer* resource = |
538 toLayoutSVGResourceContainer(const_cast<LayoutObject*>(&object)); | 538 toLayoutSVGResourceContainer(const_cast<LayoutObject*>(&object)); |
539 ASSERT(resource); | 539 DCHECK(resource); |
540 | 540 |
541 if (resource->resourceType() == MaskerResourceType) { | 541 if (resource->resourceType() == MaskerResourceType) { |
542 LayoutSVGResourceMasker* masker = toLayoutSVGResourceMasker(resource); | 542 LayoutSVGResourceMasker* masker = toLayoutSVGResourceMasker(resource); |
543 writeNameValuePair(ts, "maskUnits", masker->maskUnits()); | 543 writeNameValuePair(ts, "maskUnits", masker->maskUnits()); |
544 writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits()); | 544 writeNameValuePair(ts, "maskContentUnits", masker->maskContentUnits()); |
545 ts << "\n"; | 545 ts << "\n"; |
546 } else if (resource->resourceType() == FilterResourceType) { | 546 } else if (resource->resourceType() == FilterResourceType) { |
547 LayoutSVGResourceFilter* filter = toLayoutSVGResourceFilter(resource); | 547 LayoutSVGResourceFilter* filter = toLayoutSVGResourceFilter(resource); |
548 writeNameValuePair(ts, "filterUnits", filter->filterUnits()); | 548 writeNameValuePair(ts, "filterUnits", filter->filterUnits()); |
549 writeNameValuePair(ts, "primitiveUnits", filter->primitiveUnits()); | 549 writeNameValuePair(ts, "primitiveUnits", filter->primitiveUnits()); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 ts << shape << "\n"; | 693 ts << shape << "\n"; |
694 writeResources(ts, shape, indent); | 694 writeResources(ts, shape, indent); |
695 } | 695 } |
696 | 696 |
697 void writeSVGGradientStop(TextStream& ts, | 697 void writeSVGGradientStop(TextStream& ts, |
698 const LayoutSVGGradientStop& stop, | 698 const LayoutSVGGradientStop& stop, |
699 int indent) { | 699 int indent) { |
700 writeStandardPrefix(ts, stop, indent); | 700 writeStandardPrefix(ts, stop, indent); |
701 | 701 |
702 SVGStopElement* stopElement = toSVGStopElement(stop.node()); | 702 SVGStopElement* stopElement = toSVGStopElement(stop.node()); |
703 ASSERT(stopElement); | 703 DCHECK(stopElement); |
704 ASSERT(stop.style()); | 704 DCHECK(stop.style()); |
705 | 705 |
706 ts << " [offset=" << stopElement->offset()->currentValue()->value() | 706 ts << " [offset=" << stopElement->offset()->currentValue()->value() |
707 << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n"; | 707 << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n"; |
708 } | 708 } |
709 | 709 |
710 void writeResources(TextStream& ts, const LayoutObject& object, int indent) { | 710 void writeResources(TextStream& ts, const LayoutObject& object, int indent) { |
711 SVGResources* resources = | 711 SVGResources* resources = |
712 SVGResourcesCache::cachedResourcesForLayoutObject(&object); | 712 SVGResourcesCache::cachedResourcesForLayoutObject(&object); |
713 if (!resources) | 713 if (!resources) |
714 return; | 714 return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 writeIndent(ts, indent); | 749 writeIndent(ts, indent); |
750 ts << " "; | 750 ts << " "; |
751 writeNameAndQuotedValue(ts, "filter", id); | 751 writeNameAndQuotedValue(ts, "filter", id); |
752 ts << " "; | 752 ts << " "; |
753 writeStandardPrefix(ts, *filter, 0); | 753 writeStandardPrefix(ts, *filter, 0); |
754 ts << " " << filter->resourceBoundingBox(&object) << "\n"; | 754 ts << " " << filter->resourceBoundingBox(&object) << "\n"; |
755 } | 755 } |
756 } | 756 } |
757 | 757 |
758 } // namespace blink | 758 } // namespace blink |
OLD | NEW |