Changeset 23509 in webkit
- Timestamp:
- Jun 13, 2007 4:14:48 PM (17 years ago)
- Location:
- branches/feature-branch/WebCore
- Files:
-
- 2 added
- 2 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-branch/WebCore/ChangeLog
r22098 r23509 1 2007-06-14 Rob Buis <buis@kde.org> 2 3 Reviewed by Eric. 4 5 http://bugs.webkit.org/show_bug.cgi?id=12207 6 RenderSVGContainer should be split into multiple classes 7 http://bugs.webkit.org/show_bug.cgi?id=14125 8 KCanvasRenderingStyle should be removed 9 10 Introduce the RenderSVGRoot class and kill the KCanvas enums. 11 12 * WebCore.xcodeproj/project.pbxproj: 13 * ksvg2/css/SVGRenderStyle.cpp: 14 (WebCore::SVGRenderStyle::cssPrimitiveToLength): 15 * ksvg2/css/SVGRenderStyle.h: 16 * ksvg2/misc/KCanvasRenderingStyle.cpp: Removed. 17 * ksvg2/misc/KCanvasRenderingStyle.h: Removed. 18 * ksvg2/svg/SVGMarkerElement.cpp: 19 (WebCore::SVGMarkerElement::createRenderer): 20 (WebCore::SVGMarkerElement::notifyAttributeChange): 21 * ksvg2/svg/SVGSVGElement.cpp: 22 (WebCore::SVGSVGElement::createRenderer): 23 * ksvg2/svg/SVGSVGElement.h: 24 * platform/graphics/svg/SVGPaintServer.cpp: 25 (WebCore::sharedSolidPaintServer): 26 (WebCore::SVGPaintServer::fillPaintServer): 27 (WebCore::SVGPaintServer::strokePaintServer): 28 (WebCore::dashArrayFromRenderingStyle): 29 * platform/graphics/svg/SVGPaintServer.h: 30 * platform/graphics/svg/cg/CgSupport.cpp: 31 (WebCore::applyStrokeStyleToContext): 32 * platform/graphics/svg/cg/RenderPathCg.cpp: 33 (WebCore::RenderPath::strokeContains): 34 * rendering/RenderPath.cpp: 35 (WebCore::RenderPath::fillContains): 36 (WebCore::fillAndStrokePath): 37 (WebCore::RenderPath::drawMarkersIfNeeded): 38 * rendering/RenderSVGContainer.cpp: 39 (WebCore::RenderSVGContainer::requiresLayer): 40 (WebCore::RenderSVGContainer::layout): 41 (WebCore::RenderSVGContainer::applyContentTransforms): 42 (WebCore::RenderSVGContainer::paint): 43 (WebCore::RenderSVGContainer::setAlign): 44 (WebCore::RenderSVGContainer::align): 45 (WebCore::RenderSVGContainer::viewportTransform): 46 (WebCore::RenderSVGContainer::absoluteTransform): 47 (WebCore::RenderSVGContainer::getAspectRatio): 48 * rendering/RenderSVGContainer.h: 49 * rendering/RenderSVGInlineText.cpp: 50 * rendering/RenderSVGRoot.cpp: Added. 51 (WebCore::RenderSVGRoot::RenderSVGRoot): 52 (WebCore::RenderSVGRoot::~RenderSVGRoot): 53 (WebCore::RenderSVGRoot::localTransform): 54 (WebCore::RenderSVGRoot::setLocalTransform): 55 (WebCore::RenderSVGRoot::requiresLayer): 56 (WebCore::RenderSVGRoot::lineHeight): 57 (WebCore::RenderSVGRoot::baselinePosition): 58 (WebCore::RenderSVGRoot::layout): 59 (WebCore::RenderSVGRoot::applyContentTransforms): 60 (WebCore::RenderSVGRoot::paint): 61 (WebCore::RenderSVGRoot::viewport): 62 (WebCore::RenderSVGRoot::calcViewport): 63 (WebCore::RenderSVGRoot::setViewBox): 64 (WebCore::RenderSVGRoot::viewBox): 65 (WebCore::RenderSVGRoot::setAlign): 66 (WebCore::RenderSVGRoot::align): 67 (WebCore::RenderSVGRoot::viewportTransform): 68 (WebCore::RenderSVGRoot::absoluteClippedOverflowRect): 69 (WebCore::RenderSVGRoot::addFocusRingRects): 70 (WebCore::RenderSVGRoot::absoluteRects): 71 (WebCore::RenderSVGRoot::absoluteTransform): 72 (WebCore::RenderSVGRoot::fillContains): 73 (WebCore::RenderSVGRoot::strokeContains): 74 (WebCore::RenderSVGRoot::relativeBBox): 75 (WebCore::RenderSVGRoot::setSlice): 76 (WebCore::RenderSVGRoot::slice): 77 (WebCore::RenderSVGRoot::getAspectRatio): 78 (WebCore::RenderSVGRoot::nodeAtPoint): 79 * rendering/RenderSVGRoot.h: Added. 80 (WebCore::RenderSVGRoot::isSVGContainer): 81 (WebCore::RenderSVGRoot::renderName): 82 * rendering/RenderSVGTSpan.cpp: 83 * rendering/RenderSVGText.cpp: 84 (WebCore::RenderSVGText::relativeBBox): 85 * rendering/SVGRenderTreeAsText.cpp: 86 (WebCore::operator<<): 87 (WebCore::writeStyle): 88 * rendering/SVGRootInlineBox.cpp: 89 (WebCore::SVGRootInlineBox::paint): 90 (WebCore::SVGRootInlineBox::paintInlineBoxes): 91 1 92 2007-06-12 Nikolas Zimmermann <zimmermann@kde.org> 2 93 -
branches/feature-branch/WebCore/WebCore.xcodeproj/project.pbxproj
r22028 r23509 1900 1900 A88AD40A095248F0001DD196 /* SVGZoomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F7F5089701F300BA5114 /* SVGZoomEvent.cpp */; }; 1901 1901 A88AD40B095248F0001DD196 /* SVGZoomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F7F6089701F300BA5114 /* SVGZoomEvent.h */; }; 1902 A88AD40C095248F0001DD196 /* KCanvasRenderingStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F6EB089701F100BA5114 /* KCanvasRenderingStyle.cpp */; };1903 A88AD40D095248F0001DD196 /* KCanvasRenderingStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F6EC089701F100BA5114 /* KCanvasRenderingStyle.h */; };1904 1902 A88AD40E095248F0001DD196 /* TimeScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F6EF089701F100BA5114 /* TimeScheduler.cpp */; }; 1905 1903 A88AD40F095248F0001DD196 /* TimeScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0F6F0089701F100BA5114 /* TimeScheduler.h */; }; … … 2259 2257 AA21ECCA0ABF0FBA002B834C /* CSSCursorImageValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA0978ED0ABAA6E100874480 /* CSSCursorImageValue.cpp */; }; 2260 2258 AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2259 AA31B5B40C1DFD1000AE7083 /* RenderSVGRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */; }; 2260 AA31B5B50C1DFD1000AE7083 /* RenderSVGRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */; }; 2261 2261 AA4C3A760B2B1679002334A2 /* StyleElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA4C3A740B2B1679002334A2 /* StyleElement.cpp */; }; 2262 2262 AA4C3A770B2B1679002334A2 /* StyleElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* StyleElement.h */; }; … … 4988 4988 A89943260B42338700D7C802 /* BitmapImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitmapImage.h; sourceTree = "<group>"; }; 4989 4989 A89943270B42338700D7C802 /* BitmapImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BitmapImage.cpp; sourceTree = "<group>"; }; 4990 A8C0F6EB089701F100BA5114 /* KCanvasRenderingStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KCanvasRenderingStyle.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };4991 A8C0F6EC089701F100BA5114 /* KCanvasRenderingStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KCanvasRenderingStyle.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };4992 4990 A8C0F6EF089701F100BA5114 /* TimeScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeScheduler.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 4993 4991 A8C0F6F0089701F100BA5114 /* TimeScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = TimeScheduler.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 5353 5351 AA0978ED0ABAA6E100874480 /* CSSCursorImageValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCursorImageValue.cpp; sourceTree = "<group>"; }; 5354 5352 AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSCursorImageValue.h; sourceTree = "<group>"; }; 5353 AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGRoot.cpp; sourceTree = "<group>"; }; 5354 AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderSVGRoot.h; sourceTree = "<group>"; }; 5355 5355 AA4C3A740B2B1679002334A2 /* StyleElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyleElement.cpp; sourceTree = "<group>"; }; 5356 5356 AA4C3A750B2B1679002334A2 /* StyleElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyleElement.h; sourceTree = "<group>"; }; … … 8306 8306 AA882B2D0B4EF5EB006D26D1 /* PointerEventsHitRules.cpp */, 8307 8307 AA882B2E0B4EF5EB006D26D1 /* PointerEventsHitRules.h */, 8308 A8C0F6EB089701F100BA5114 /* KCanvasRenderingStyle.cpp */,8309 A8C0F6EC089701F100BA5114 /* KCanvasRenderingStyle.h */,8310 8308 A8C0F6EF089701F100BA5114 /* TimeScheduler.cpp */, 8311 8309 A8C0F6F0089701F100BA5114 /* TimeScheduler.h */, … … 9486 9484 isa = PBXGroup; 9487 9485 children = ( 9486 AA31B5B20C1DFD1000AE7083 /* RenderSVGRoot.cpp */, 9487 AA31B5B30C1DFD1000AE7083 /* RenderSVGRoot.h */, 9488 9488 A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */, 9489 9489 A8CFF0490A154F09000A4234 /* AutoTableLayout.h */, … … 9865 9865 A88AD404095248F0001DD196 /* SVGRenderStyleDefs.h in Headers */, 9866 9866 A88AD40B095248F0001DD196 /* SVGZoomEvent.h in Headers */, 9867 A88AD40D095248F0001DD196 /* KCanvasRenderingStyle.h in Headers */,9868 9867 A88AD40F095248F0001DD196 /* TimeScheduler.h in Headers */, 9869 9868 A88AD412095248F0001DD196 /* SVGAElement.h in Headers */, … … 11301 11300 14C9A29A0BF04DB600D734A8 /* WebScriptObjectPendingPublic.h in Headers */, 11302 11301 A8F4FB940C169E7B002AFED5 /* SVGRenderSupport.h in Headers */, 11302 AA31B5B50C1DFD1000AE7083 /* RenderSVGRoot.h in Headers */, 11303 11303 ); 11304 11304 runOnlyForDeploymentPostprocessing = 0; … … 11506 11506 A88AD403095248F0001DD196 /* SVGRenderStyleDefs.cpp in Sources */, 11507 11507 A88AD40A095248F0001DD196 /* SVGZoomEvent.cpp in Sources */, 11508 A88AD40C095248F0001DD196 /* KCanvasRenderingStyle.cpp in Sources */,11509 11508 A88AD40E095248F0001DD196 /* TimeScheduler.cpp in Sources */, 11510 11509 A88AD411095248F0001DD196 /* SVGAElement.cpp in Sources */, … … 12678 12677 AACF144D0BEC1EF000827982 /* TextBreakIteratorInternalICUMac.mm in Sources */, 12679 12678 A8F4FB960C169E85002AFED5 /* SVGRenderSupport.cpp in Sources */, 12679 AA31B5B40C1DFD1000AE7083 /* RenderSVGRoot.cpp in Sources */, 12680 12680 ); 12681 12681 runOnlyForDeploymentPostprocessing = 0; -
branches/feature-branch/WebCore/ksvg2/css/SVGRenderStyle.cpp
r19992 r23509 30 30 #if ENABLE(SVG) 31 31 #include "SVGRenderStyle.h" 32 33 #include "CSSPrimitiveValue.h" 34 #include "CSSValueList.h" 35 #include "RenderObject.h" 36 #include "RenderStyle.h" 37 #include "SVGStyledElement.h" 32 38 33 39 namespace WebCore { … … 116 122 } 117 123 124 double SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* value, double defaultValue) 125 { 126 CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(value); 127 128 unsigned short cssType = (primitive ? primitive->primitiveType() : (unsigned short) CSSPrimitiveValue::CSS_UNKNOWN); 129 if (!(cssType > CSSPrimitiveValue::CSS_UNKNOWN && cssType <= CSSPrimitiveValue::CSS_PC)) 130 return defaultValue; 131 132 if (cssType == CSSPrimitiveValue::CSS_PERCENTAGE) { 133 SVGStyledElement* element = static_cast<SVGStyledElement*>(item->element()); 134 SVGElement* viewportElement = (element ? element->viewportElement() : 0); 135 if (viewportElement) { 136 double result = primitive->getFloatValue() / 100.0; 137 return SVGLength::PercentageOfViewport(result, element, LengthModeOther); 138 } 139 } 140 141 return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style())); 142 } 143 118 144 } 119 145 -
branches/feature-branch/WebCore/ksvg2/css/SVGRenderStyle.h
r19992 r23509 39 39 40 40 namespace WebCore { 41 42 class RenderObject; 43 class RenderStyle; 41 44 42 45 class SVGRenderStyle : public Shared<SVGRenderStyle> { … … 103 106 bool hasStroke() const { return (strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); } 104 107 bool hasFill() const { return (fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE); } 108 109 static double cssPrimitiveToLength(const RenderObject*, CSSValue*, double defaultValue = 0.0); 105 110 106 111 protected: -
branches/feature-branch/WebCore/ksvg2/svg/SVGMarkerElement.cpp
r21272 r23509 138 138 RenderSVGContainer* markerContainer = new (arena) RenderSVGContainer(this); 139 139 markerContainer->setViewBox(viewBox()); 140 markerContainer->setAlign( KCAlign(preserveAspectRatio()->align() - 1));140 markerContainer->setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType(preserveAspectRatio()->align())); 141 141 markerContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); 142 142 markerContainer->setDrawsContents(false); // Marker contents will be explicitly drawn. … … 154 154 if (markerContainer) { 155 155 markerContainer->setViewBox(viewBox()); 156 markerContainer->setAlign( KCAlign(preserveAspectRatio()->align() - 1));156 markerContainer->setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType(preserveAspectRatio()->align())); 157 157 markerContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); 158 158 } -
branches/feature-branch/WebCore/ksvg2/svg/SVGSVGElement.cpp
r21895 r23509 34 34 #include "HTMLNames.h" 35 35 #include "RenderSVGContainer.h" 36 #include "RenderSVGRoot.h" 36 37 #include "SVGAngle.h" 37 38 #include "SVGLength.h" … … 357 358 RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*) 358 359 { 359 RenderSVGContainer* rootContainer = new (arena) RenderSVGContainer(this); 360 361 // FIXME: All this setup should be done after attributesChanged, not here. 362 rootContainer->setViewBox(viewBox()); 363 rootContainer->setAlign(KCAlign(preserveAspectRatio()->align() - 1)); 364 rootContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); 365 366 return rootContainer; 360 if (!parentNode()->isSVGElement()) { 361 RenderSVGRoot* rootContainer = new (arena) RenderSVGRoot(this); 362 // FIXME: All this setup should be done after attributesChanged, not here. 363 rootContainer->setViewBox(viewBox()); 364 rootContainer->setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType(preserveAspectRatio()->align())); 365 rootContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); 366 return rootContainer; 367 } else { 368 RenderSVGContainer* rootContainer = new (arena) RenderSVGContainer(this); 369 370 // FIXME: All this setup should be done after attributesChanged, not here. 371 rootContainer->setViewBox(viewBox()); 372 rootContainer->setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType(preserveAspectRatio()->align())); 373 rootContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); 374 return rootContainer; 375 } 367 376 } 368 377 -
branches/feature-branch/WebCore/ksvg2/svg/SVGSVGElement.h
r21895 r23509 127 127 128 128 friend class RenderSVGContainer; 129 friend class RenderSVGRoot; 129 130 virtual bool hasRelativeValues() const; 130 131 -
branches/feature-branch/WebCore/platform/graphics/svg/SVGPaintServer.cpp
r19855 r23509 29 29 #include "SVGPaintServer.h" 30 30 31 #include "RenderObject.h" 32 #include "RenderStyle.h" 33 #include "SVGPaintServerSolid.h" 34 #include "SVGStyledElement.h" 35 #include "SVGURIReference.h" 36 31 37 namespace WebCore { 32 38 … … 53 59 } 54 60 61 static SVGPaintServerSolid* sharedSolidPaintServer() 62 { 63 static SVGPaintServerSolid* _sharedSolidPaintServer = 0; 64 if (!_sharedSolidPaintServer) 65 _sharedSolidPaintServer = new SVGPaintServerSolid(); 66 return _sharedSolidPaintServer; 67 } 68 69 SVGPaintServer* SVGPaintServer::fillPaintServer(const RenderStyle* style, const RenderObject* item) 70 { 71 if (!style->svgStyle()->hasFill()) 72 return 0; 73 74 SVGPaint* fill = style->svgStyle()->fillPaint(); 75 76 SVGPaintServer* fillPaintServer = 0; 77 if (fill->paintType() == SVGPaint::SVG_PAINTTYPE_URI) { 78 AtomicString id(SVGURIReference::getTarget(fill->uri())); 79 fillPaintServer = getPaintServerById(item->document(), id); 80 81 SVGElement* svgElement = static_cast<SVGElement*>(item->element()); 82 ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); 83 84 if (item->isRenderPath() && fillPaintServer) 85 fillPaintServer->addClient(static_cast<SVGStyledElement*>(svgElement)); 86 else if (!fillPaintServer) 87 svgElement->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); 88 } else { 89 fillPaintServer = sharedSolidPaintServer(); 90 SVGPaintServerSolid* fillPaintServerSolid = static_cast<SVGPaintServerSolid*>(fillPaintServer); 91 if (fill->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) 92 fillPaintServerSolid->setColor(style->color()); 93 else 94 fillPaintServerSolid->setColor(fill->color()); 95 // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT 96 if (!fillPaintServerSolid->color().isValid()) 97 fillPaintServer = 0; 98 } 99 if (!fillPaintServer) { 100 // default value (black), see bug 11017 101 fillPaintServer = sharedSolidPaintServer(); 102 static_cast<SVGPaintServerSolid*>(fillPaintServer)->setColor(Color::black); 103 } 104 return fillPaintServer; 105 } 106 107 SVGPaintServer* SVGPaintServer::strokePaintServer(const RenderStyle* style, const RenderObject* item) 108 { 109 if (!style->svgStyle()->hasStroke()) 110 return 0; 111 112 SVGPaint* stroke = style->svgStyle()->strokePaint(); 113 114 SVGPaintServer* strokePaintServer = 0; 115 if (stroke->paintType() == SVGPaint::SVG_PAINTTYPE_URI) { 116 AtomicString id(SVGURIReference::getTarget(stroke->uri())); 117 strokePaintServer = getPaintServerById(item->document(), id); 118 119 SVGElement* svgElement = static_cast<SVGElement*>(item->element()); 120 ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); 121 122 if (item->isRenderPath() && strokePaintServer) 123 strokePaintServer->addClient(static_cast<SVGStyledElement*>(svgElement)); 124 else if (!strokePaintServer) 125 svgElement->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); 126 } else { 127 strokePaintServer = sharedSolidPaintServer(); 128 SVGPaintServerSolid* strokePaintServerSolid = static_cast<SVGPaintServerSolid*>(strokePaintServer); 129 if (stroke->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) 130 strokePaintServerSolid->setColor(style->color()); 131 else 132 strokePaintServerSolid->setColor(stroke->color()); 133 // FIXME: Ideally invalid colors would never get set on the RenderStyle and this could turn into an ASSERT 134 if (!strokePaintServerSolid->color().isValid()) 135 strokePaintServer = 0; 136 } 137 138 return strokePaintServer; 139 } 140 141 DashArray dashArrayFromRenderingStyle(const RenderStyle* style) 142 { 143 DashArray array; 144 145 CSSValueList* dashes = style->svgStyle()->strokeDashArray(); 146 if (dashes) { 147 CSSPrimitiveValue* dash = 0; 148 unsigned long len = dashes->length(); 149 for (unsigned long i = 0; i < len; i++) { 150 dash = static_cast<CSSPrimitiveValue*>(dashes->item(i)); 151 if (!dash) 152 continue; 153 154 array.append((float) dash->computeLengthFloat(const_cast<RenderStyle*>(style))); 155 } 156 } 157 158 return array; 159 } 160 55 161 } // namespace WebCore 56 162 -
branches/feature-branch/WebCore/platform/graphics/svg/SVGPaintServer.h
r19855 r23509 38 38 class QPen; 39 39 #endif 40 40 41 #if PLATFORM(CG) 42 typedef Vector<CGFloat> DashArray; 43 #else 44 typedef Vector<float> DashArray; 45 #endif 46 41 47 namespace WebCore { 42 48 43 49 enum SVGPaintServerType { 44 50 // Painting mode … … 77 83 virtual bool setup(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const = 0; 78 84 85 static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*); 86 static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*); 87 79 88 protected: 80 89 #if PLATFORM(CG) … … 94 103 SVGPaintServer* getPaintServerById(Document*, const AtomicString&); 95 104 105 DashArray dashArrayFromRenderingStyle(const RenderStyle* style); 96 106 } // namespace WebCore 97 107 -
branches/feature-branch/WebCore/platform/graphics/svg/cg/CgSupport.cpp
r19855 r23509 32 32 33 33 #include "GraphicsContext.h" 34 #include "KCanvasRenderingStyle.h"35 34 #include "RenderStyle.h" 35 #include "SVGPaintServer.h" 36 36 #include <wtf/Assertions.h> 37 37 #include "SVGRenderStyle.h" … … 54 54 { 55 55 /* Shouldn't all these be in the stroke painter? */ 56 CGContextSetLineWidth(context, KSVGPainterFactory::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0));56 CGContextSetLineWidth(context, SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0)); 57 57 58 58 CGContextSetLineCap(context, CGLineCapFromKC(style->svgStyle()->capStyle())); … … 61 61 CGContextSetMiterLimit(context, style->svgStyle()->strokeMiterLimit()); 62 62 63 const KCDashArray& dashes = KSVGPainterFactory::dashArrayFromRenderingStyle(style);64 double dashOffset = KSVGPainterFactory::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0);63 const DashArray& dashes = dashArrayFromRenderingStyle(style); 64 double dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0); 65 65 66 66 CGContextSetLineDash(context, dashOffset, dashes.data(), dashes.size()); -
branches/feature-branch/WebCore/platform/graphics/svg/cg/RenderPathCg.cpp
r19855 r23509 32 32 33 33 #include <ApplicationServices/ApplicationServices.h> 34 #include "KCanvasRenderingStyle.h"35 34 #include "CgSupport.h" 36 35 #include "RenderPath.h" 36 #include "SVGPaintServer.h" 37 37 #include "SVGRenderStyle.h" 38 38 #include "SVGStyledElement.h" … … 54 54 return false; 55 55 56 if (requiresStroke && ! KSVGPainterFactory::strokePaintServer(style(), this))56 if (requiresStroke && !SVGPaintServer::strokePaintServer(style(), this)) 57 57 return false; 58 58 -
branches/feature-branch/WebCore/rendering/RenderPath.cpp
r22032 r23509 30 30 31 31 #include "GraphicsContext.h" 32 #include "KCanvasRenderingStyle.h"33 32 #include "RenderSVGContainer.h" 34 33 #include "PointerEventsHitRules.h" … … 80 79 return false; 81 80 82 if (requiresFill && ! KSVGPainterFactory::fillPaintServer(style(), this))81 if (requiresFill && !SVGPaintServer::fillPaintServer(style(), this)) 83 82 return false; 84 83 … … 178 177 context->beginPath(); 179 178 180 SVGPaintServer* fillPaintServer = KSVGPainterFactory::fillPaintServer(style, object);179 SVGPaintServer* fillPaintServer = SVGPaintServer::fillPaintServer(style, object); 181 180 if (fillPaintServer) { 182 181 context->addPath(path); … … 184 183 } 185 184 186 SVGPaintServer* strokePaintServer = KSVGPainterFactory::strokePaintServer(style, object);185 SVGPaintServer* strokePaintServer = SVGPaintServer::strokePaintServer(style, object); 187 186 if (strokePaintServer) { 188 187 context->addPath(path); // path is cleared when filled. … … 416 415 return FloatRect(); 417 416 418 double strokeWidth = KSVGPainterFactory::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0);417 double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0); 419 418 DrawMarkersData data(context, startMarker, midMarker, strokeWidth); 420 419 -
branches/feature-branch/WebCore/rendering/RenderSVGContainer.cpp
r22032 r23509 76 76 { 77 77 // Only allow an <svg> element to generate a layer when it's positioned in a non-SVG context 78 return (isPositioned() || isRelPositioned()) && isOutermostSVG();78 return false; 79 79 } 80 80 … … 87 87 { 88 88 return height() + marginTop() + marginBottom(); 89 }90 91 // This method should be temporary until a RenderSVGRoot class can be made92 // http://bugs.webkit.org/show_bug.cgi?id=1220793 bool RenderSVGContainer::isOutermostSVG() const94 {95 return parent() && !parent()->isSVGContainer();96 89 } 97 90 … … 128 121 129 122 m_absoluteBounds = absoluteClippedOverflowRect(); 130 if (isOutermostSVG()) {131 SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());132 m_width = m_width * svg->currentScale();133 m_height = m_height * svg->currentScale();134 }135 123 136 124 if (selfNeedsLayout() && checkForRepaint) … … 143 131 void RenderSVGContainer::applyContentTransforms(PaintInfo& paintInfo, int& parentX, int& parentY) 144 132 { 145 if (isOutermostSVG()) { 146 // Translate from parent offsets (html renderers) to a relative transform (svg renderers) 147 IntPoint origin; 148 origin.move(parentX, parentY); 149 origin.move(m_x, m_y); 150 origin.move(borderLeft(), borderTop()); 151 origin.move(paddingLeft(), paddingTop()); 152 if (origin.x() || origin.y()) { 153 paintInfo.context->concatCTM(AffineTransform().translate(origin.x(), origin.y())); 154 paintInfo.rect.move(-origin.x(), -origin.y()); 155 } 156 parentX = parentY = 0; 157 SVGSVGElement* svg = static_cast<SVGSVGElement*>(element()); 158 paintInfo.context->concatCTM(AffineTransform().scale(svg->currentScale())); 159 } else { 160 // Only the root <svg> element should need any translations using the HTML/CSS system 161 // parentX, parentY are also non-zero for first-level kids of these 162 // CSS-transformed <svg> root-elements (due to RenderBox::paint) for any other element 163 // they should be 0. m_x, m_y should always be 0 for non-root svg containers 164 ASSERT(m_x == 0); 165 ASSERT(m_y == 0); 166 } 133 // Only the root <svg> element should need any translations using the HTML/CSS system 134 // parentX, parentY are also non-zero for first-level kids of these 135 // CSS-transformed <svg> root-elements (due to RenderBox::paint) for any other element 136 // they should be 0. m_x, m_y should always be 0 for non-root svg containers 137 ASSERT(m_x == 0); 138 ASSERT(m_y == 0); 167 139 168 140 if (!viewport().isEmpty()) { … … 174 146 if (!localTransform().isIdentity()) 175 147 paintInfo.context->concatCTM(localTransform()); 176 if (isOutermostSVG()) {177 SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());178 paintInfo.context->concatCTM(AffineTransform().translate(svg->currentTranslate().x(), svg->currentTranslate().y()));179 }180 148 } 181 149 … … 184 152 if (paintInfo.context->paintingDisabled() || !drawsContents()) 185 153 return; 186 187 // This should only exist for <svg> renderers188 if (isOutermostSVG() && hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))189 paintBoxDecorations(paintInfo, m_x + parentX, m_y + parentY);190 154 191 155 if (!firstChild()) { … … 284 248 } 285 249 286 void RenderSVGContainer::setAlign( KCAlignalign)250 void RenderSVGContainer::setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType align) 287 251 { 288 252 m_align = align; … … 291 255 } 292 256 293 KCAlignRenderSVGContainer::align() const257 SVGPreserveAspectRatio::SVGPreserveAspectRatioType RenderSVGContainer::align() const 294 258 { 295 259 return m_align; … … 301 265 // do viewport translating anymore. Look into this while 302 266 // fixing bug 12207. 303 if (!viewBox().isEmpty()) { 304 FloatRect viewportRect = viewport(); 305 if (isOutermostSVG()) 306 viewportRect = FloatRect(viewport().x(), viewport().y(), width(), height()); 307 308 return getAspectRatio(viewBox(), viewportRect); 309 } 267 if (!viewBox().isEmpty()) 268 return getAspectRatio(viewBox(), viewport()); 310 269 311 270 return AffineTransform(); … … 342 301 { 343 302 AffineTransform ctm = RenderContainer::absoluteTransform(); 344 if (isOutermostSVG()) {345 SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());346 ctm.scale(svg->currentScale());347 ctm.translate(svg->currentTranslate().x(), svg->currentTranslate().y());348 }349 303 ctm.translate(viewport().x(), viewport().y()); 350 304 return viewportTransform() * ctm; … … 418 372 float svgar = physWidth / physHeight; 419 373 420 if (align() == ALIGN_NONE) {374 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) { 421 375 temp.scale(physWidth / logicWidth, physHeight / logicHeight); 422 376 temp.translate(-logicX, -logicY); … … 424 378 temp.scale(physHeight / logicHeight, physHeight / logicHeight); 425 379 426 if (align() == ALIGN_XMINYMIN || align() == ALIGN_XMINYMID || align() == ALIGN_XMINYMAX)380 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMAX) 427 381 temp.translate(-logicX, -logicY); 428 else if (align() == ALIGN_XMIDYMIN || align() == ALIGN_XMIDYMID || align() == ALIGN_XMIDYMAX)382 else if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMAX) 429 383 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight) / 2, -logicY); 430 384 else … … 433 387 temp.scale(physWidth / logicWidth, physWidth / logicWidth); 434 388 435 if (align() == ALIGN_XMINYMIN || align() == ALIGN_XMIDYMIN || align() == ALIGN_XMAXYMIN)389 if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMIN) 436 390 temp.translate(-logicX, -logicY); 437 else if (align() == ALIGN_XMINYMID || align() == ALIGN_XMIDYMID || align() == ALIGN_XMAXYMID)391 else if (align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMAXYMID) 438 392 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth) / 2); 439 393 else -
branches/feature-branch/WebCore/rendering/RenderSVGContainer.h
r22032 r23509 28 28 #include "RenderContainer.h" 29 29 #include "RenderPath.h" 30 #include "SVGPreserveAspectRatio.h" 30 31 31 32 namespace WebCore { 32 33 enum KCAlign {34 ALIGN_NONE = 0,35 ALIGN_XMINYMIN = 1,36 ALIGN_XMIDYMIN = 2,37 ALIGN_XMAXYMIN = 3,38 ALIGN_XMINYMID = 4,39 ALIGN_XMIDYMID = 5,40 ALIGN_XMAXYMID = 6,41 ALIGN_XMINYMAX = 7,42 ALIGN_XMIDYMAX = 8,43 ALIGN_XMAXYMAX = 944 };45 33 46 34 class SVGElement; … … 85 73 FloatRect viewBox() const; 86 74 87 void setAlign( KCAlign);88 KCAlignalign() const;75 void setAlign(SVGPreserveAspectRatio::SVGPreserveAspectRatioType); 76 SVGPreserveAspectRatio::SVGPreserveAspectRatioType align() const; 89 77 90 78 void setSlice(bool); … … 95 83 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); 96 84 97 bool isOutermostSVG() const;98 99 85 private: 100 86 void calcViewport(); … … 108 94 FloatRect m_viewport; 109 95 FloatRect m_viewBox; 110 KCAlignm_align;96 SVGPreserveAspectRatio::SVGPreserveAspectRatioType m_align; 111 97 IntRect m_absoluteBounds; 112 98 }; -
branches/feature-branch/WebCore/rendering/RenderSVGInlineText.cpp
r21863 r23509 33 33 #include "SVGInlineTextBox.h" 34 34 #include "SVGRootInlineBox.h" 35 #include "KCanvasRenderingStyle.h"36 35 37 36 namespace WebCore { -
branches/feature-branch/WebCore/rendering/RenderSVGTSpan.cpp
r19855 r23509 27 27 #include "RenderSVGTSpan.h" 28 28 #include "GraphicsContext.h" 29 #include "KCanvasRenderingStyle.h"30 29 #include "SVGRootInlineBox.h" 31 30 #include "SVGInlineFlowBox.h" -
branches/feature-branch/WebCore/rendering/RenderSVGText.cpp
r21607 r23509 30 30 31 31 #include "GraphicsContext.h" 32 #include "KCanvasRenderingStyle.h"33 32 #include "PointerEventsHitRules.h" 34 33 #include "SVGLength.h" … … 145 144 // SVG needs to include the strokeWidth(), not the textStrokeWidth(). 146 145 if (includeStroke && style()->svgStyle()->hasStroke()) 147 repaintRect.inflate( KSVGPainterFactory::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 0.0));146 repaintRect.inflate(SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 0.0)); 148 147 149 148 repaintRect.move(xPos(), yPos()); -
branches/feature-branch/WebCore/rendering/SVGRenderTreeAsText.cpp
r21705 r23509 34 34 #include "InlineTextBox.h" 35 35 #include "HTMLNames.h" 36 #include "KCanvasRenderingStyle.h"37 36 #include "RenderSVGContainer.h" 38 37 #include "RenderSVGInlineText.h" … … 180 179 181 180 // FIXME: Maybe this should be in KCanvasRenderingStyle.cpp 182 static TextStream& operator<<(TextStream& ts, const KCDashArray& a)181 static TextStream& operator<<(TextStream& ts, const DashArray& a) 183 182 { 184 183 ts << "{"; 185 KCDashArray::const_iterator end = a.end();186 for ( KCDashArray::const_iterator it = a.begin(); it != end; ++it) {184 DashArray::const_iterator end = a.end(); 185 for (DashArray::const_iterator it = a.begin(); it != end; ++it) { 187 186 if (it != a.begin()) 188 187 ts << ", "; … … 240 239 if (object.isRenderPath()) { 241 240 const RenderPath& path = static_cast<const RenderPath&>(object); 242 SVGPaintServer* strokePaintServer = KSVGPainterFactory::strokePaintServer(style, &path);241 SVGPaintServer* strokePaintServer = SVGPaintServer::strokePaintServer(style, &path); 243 242 if (strokePaintServer) { 244 243 TextStreamSeparator s(" "); … … 247 246 ts << s << *strokePaintServer; 248 247 249 double dashOffset = KSVGPainterFactory::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0);250 const KCDashArray& dashArray = KSVGPainterFactory::dashArrayFromRenderingStyle(style);251 double strokeWidth = KSVGPainterFactory::cssPrimitiveToLength(&path, svgStyle->strokeWidth(), 1.0);248 double dashOffset = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0); 249 const DashArray& dashArray = dashArrayFromRenderingStyle(style); 250 double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeWidth(), 1.0); 252 251 253 252 if (svgStyle->strokeOpacity() != 1.0f) … … 267 266 ts << "}]"; 268 267 } 269 SVGPaintServer* fillPaintServer = KSVGPainterFactory::fillPaintServer(style, &path);268 SVGPaintServer* fillPaintServer = SVGPaintServer::fillPaintServer(style, &path); 270 269 if (fillPaintServer) { 271 270 TextStreamSeparator s(" "); -
branches/feature-branch/WebCore/rendering/SVGRootInlineBox.cpp
r22028 r23509 31 31 #include "GraphicsContext.h" 32 32 #include "InlineTextBox.h" 33 #include "KCanvasRenderingStyle.h"34 33 #include "Range.h" 35 34 #include "SVGInlineFlowBox.h" … … 134 133 } 135 134 136 SVGPaintServer* fillPaintServer = KSVGPainterFactory::fillPaintServer(object()->style(), object());135 SVGPaintServer* fillPaintServer = SVGPaintServer::fillPaintServer(object()->style(), object()); 137 136 if (fillPaintServer) { 138 137 if (fillPaintServer->setup(pi.context, object(), ApplyToFillTargetType, true)) { … … 145 144 } 146 145 147 SVGPaintServer* strokePaintServer = KSVGPainterFactory::strokePaintServer(object()->style(), object());146 SVGPaintServer* strokePaintServer = SVGPaintServer::strokePaintServer(object()->style(), object()); 148 147 if (strokePaintServer) { 149 148 if (strokePaintServer->setup(pi.context, object(), ApplyToStrokeTargetType, true)) { … … 1034 1033 Vector<SVGChar>::iterator savedIt = it; 1035 1034 1036 SVGPaintServer* fillPaintServer = KSVGPainterFactory::fillPaintServer(object->style(), object);1035 SVGPaintServer* fillPaintServer = SVGPaintServer::fillPaintServer(object->style(), object); 1037 1036 if (fillPaintServer) { 1038 1037 if (fillPaintServer->setup(pi.context, object, ApplyToFillTargetType, true)) { … … 1044 1043 } 1045 1044 1046 SVGPaintServer* strokePaintServer = KSVGPainterFactory::strokePaintServer(object->style(), object);1045 SVGPaintServer* strokePaintServer = SVGPaintServer::strokePaintServer(object->style(), object); 1047 1046 if (strokePaintServer) { 1048 1047 if (strokePaintServer->setup(pi.context, object, ApplyToStrokeTargetType, true)) {
Note: See TracChangeset
for help on using the changeset viewer.