Changeset 117971 in webkit
- Timestamp:
- May 22, 2012 7:42:10 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117967 r117971 1 2012-05-22 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Crash in WebCore::RenderSVGContainer::paint 4 https://bugs.webkit.org/show_bug.cgi?id=86392 5 6 Reviewed by Rob Buis. 7 8 * svg/custom/bug86392-expected.txt: Added. 9 * svg/custom/bug86392.html: Added. 10 * svg/custom/marker-zero-length-linecaps-expected.svg: Added. 11 * svg/custom/marker-zero-length-linecaps.svg: Added. 12 1 13 2012-05-22 Thiago Marcos P. Santos <thiago.santos@intel.com> 2 14 -
trunk/Source/WebCore/CMakeLists.txt
r117898 r117971 1800 1800 rendering/svg/SVGInlineFlowBox.cpp 1801 1801 rendering/svg/SVGInlineTextBox.cpp 1802 rendering/svg/SVGMarkerLayoutInfo.cpp1803 1802 rendering/svg/SVGPathData.cpp 1804 1803 rendering/svg/SVGRenderSupport.cpp -
trunk/Source/WebCore/ChangeLog
r117970 r117971 1 2012-05-22 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Crash in WebCore::RenderSVGContainer::paint 4 https://bugs.webkit.org/show_bug.cgi?id=86392 5 6 Reviewed by Rob Buis. 7 8 Modernize the <marker> code, switch to the same design pattern used for handling zero-length subpaths. 9 Decouple the generation of the marker start/mid/end positions from the actual usage of these information. 10 Only generate those marker positions if the underlying Path changes, and never else. 11 12 When figuring out the bounds for a shape, access to current set of RenderSVGResourceMarker start/mid/end resources 13 and ask the marker resources for their bounds using the previously figured out marker positions on the Path. 14 Drawing markers is handled in the same way. 15 16 Remove SVGMarkerLayoutInfo alltogether which stored raw pointers to the RenderSVGResourceMarkers. 17 We assumed that those objects would stay alive from layout() to paint(), but that assumption is wrong. 18 19 Tests: svg/custom/bug86392.html 20 svg/custom/marker-zero-length-linecaps-expected.svg 21 svg/custom/marker-zero-length-linecaps.svg 22 23 * CMakeLists.txt: Remove SVGMarkerLayoutInfo.*. 24 * GNUmakefile.list.am: Ditto. 25 * Target.pri: Ditto. 26 * WebCore.gypi: Ditto. 27 * WebCore.order: Ditto. 28 * WebCore.vcproj/WebCore.vcproj: Ditto. 29 * WebCore.xcodeproj/project.pbxproj: Ditto. 30 * rendering/svg/RenderSVGAllInOne.cpp: Ditto. 31 * rendering/svg/RenderSVGShape.cpp: Handle markers just like the existing zero leng subpath code, which is superior. 32 (WebCore::RenderSVGShape::createShape): 33 (WebCore::RenderSVGShape::layout): 34 (WebCore::RenderSVGShape::shouldGenerateMarkerPositions): 35 (WebCore::RenderSVGShape::paint): 36 (WebCore::markerForType): 37 (WebCore::RenderSVGShape::markerRect): 38 (WebCore::RenderSVGShape::inflateWithStrokeAndMarkerBounds): 39 (WebCore::RenderSVGShape::drawMarkers): 40 (WebCore::RenderSVGShape::processMarkerPositions): 41 * rendering/svg/RenderSVGShape.h: 42 (RenderSVGShape): 43 * rendering/svg/SVGMarkerData.h: 44 (WebCore::MarkerPosition::MarkerPosition): 45 (MarkerPosition): 46 (WebCore::SVGMarkerData::SVGMarkerData): 47 (WebCore::SVGMarkerData::updateFromPathElement): 48 (WebCore::SVGMarkerData::pathIsDone): 49 (SVGMarkerData): 50 (WebCore::SVGMarkerData::currentAngle): 51 * rendering/svg/SVGMarkerLayoutInfo.cpp: Removed. 52 * rendering/svg/SVGMarkerLayoutInfo.h: Removed. 53 * rendering/svg/SVGResourcesCache.cpp: 54 (WebCore::resourcesCacheFromRenderObject): 55 (WebCore::SVGResourcesCache::cachedResourcesForRenderObject): 56 * rendering/svg/SVGResourcesCache.h: 57 (SVGResourcesCache): 58 1 59 2012-05-22 Alexander Pavlov <apavlov@chromium.org> 2 60 -
trunk/Source/WebCore/GNUmakefile.list.am
r117898 r117971 4088 4088 Source/WebCore/rendering/svg/SVGInlineTextBox.h \ 4089 4089 Source/WebCore/rendering/svg/SVGMarkerData.h \ 4090 Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.cpp \4091 Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h \4092 4090 Source/WebCore/rendering/svg/SVGPathData.cpp \ 4093 4091 Source/WebCore/rendering/svg/SVGPathData.h \ -
trunk/Source/WebCore/Target.pri
r117899 r117971 2576 2576 rendering/svg/SVGInlineTextBox.h \ 2577 2577 rendering/svg/SVGMarkerData.h \ 2578 rendering/svg/SVGMarkerLayoutInfo.h \2579 2578 rendering/svg/SVGPathData.h \ 2580 2579 rendering/svg/SVGRenderSupport.h \ … … 3539 3538 rendering/svg/SVGInlineFlowBox.cpp \ 3540 3539 rendering/svg/SVGInlineTextBox.cpp \ 3541 rendering/svg/SVGMarkerLayoutInfo.cpp \3542 3540 rendering/svg/SVGPathData.cpp \ 3543 3541 rendering/svg/SVGRenderSupport.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r117898 r117971 4995 4995 'rendering/svg/SVGInlineTextBox.h', 4996 4996 'rendering/svg/SVGMarkerData.h', 4997 'rendering/svg/SVGMarkerLayoutInfo.cpp',4998 'rendering/svg/SVGMarkerLayoutInfo.h',4999 4997 'rendering/svg/SVGPathData.cpp', 5000 4998 'rendering/svg/SVGPathData.h', … … 5924 5922 'rendering/svg/SVGInlineTextBox.h', 5925 5923 'rendering/svg/SVGMarkerData.h', 5926 'rendering/svg/SVGMarkerLayoutInfo.cpp',5927 'rendering/svg/SVGMarkerLayoutInfo.h',5928 5924 'rendering/svg/SVGPathData.cpp', 5929 5925 'rendering/svg/SVGPathData.h', -
trunk/Source/WebCore/WebCore.order
r117210 r117971 28903 28903 __ZN7WebCore13RenderSVGPath29calculateMarkerBoundsIfNeededEv 28904 28904 __ZNK7WebCore14SVGPathElement15supportsMarkersEv 28905 __ZN7WebCore19SVGMarkerLayoutInfo19calculateBoundariesEPNS_23RenderSVGResourceMarkerES2_S2_fRKNS_4PathE28906 28905 __ZN7WebCoreL25processStartAndMidMarkersEPvPKNS_11PathElementE 28907 28906 __ZN7WebCore13SVGMarkerData30updateMarkerDataForPathElementEPKNS_11PathElementE 28908 __ZN7WebCore19SVGMarkerLayoutInfo17addLayoutedMarkerEPNS_23RenderSVGResourceMarkerERKNS_10FloatPointEf28909 28907 __ZNK7WebCore23RenderSVGResourceMarker20markerTransformationERKNS_10FloatPointEff 28910 28908 __ZNK7WebCore8SVGAngle5valueEv -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r117898 r117971 43589 43589 </File> 43590 43590 <File 43591 RelativePath="..\rendering\svg\SVGMarkerLayoutInfo.cpp"43592 >43593 <FileConfiguration43594 Name="Debug|Win32"43595 ExcludedFromBuild="true"43596 >43597 <Tool43598 Name="VCCLCompilerTool"43599 />43600 </FileConfiguration>43601 <FileConfiguration43602 Name="Release|Win32"43603 ExcludedFromBuild="true"43604 >43605 <Tool43606 Name="VCCLCompilerTool"43607 />43608 </FileConfiguration>43609 <FileConfiguration43610 Name="Debug_Cairo_CFLite|Win32"43611 ExcludedFromBuild="true"43612 >43613 <Tool43614 Name="VCCLCompilerTool"43615 />43616 </FileConfiguration>43617 <FileConfiguration43618 Name="Release_Cairo_CFLite|Win32"43619 ExcludedFromBuild="true"43620 >43621 <Tool43622 Name="VCCLCompilerTool"43623 />43624 </FileConfiguration>43625 <FileConfiguration43626 Name="Debug_All|Win32"43627 ExcludedFromBuild="true"43628 >43629 <Tool43630 Name="VCCLCompilerTool"43631 />43632 </FileConfiguration>43633 <FileConfiguration43634 Name="Production|Win32"43635 ExcludedFromBuild="true"43636 >43637 <Tool43638 Name="VCCLCompilerTool"43639 />43640 </FileConfiguration>43641 </File>43642 <File43643 RelativePath="..\rendering\svg\SVGMarkerLayoutInfo.h"43644 >43645 </File>43646 <File43647 43591 RelativePath="..\rendering\svg\SVGPathData.cpp" 43648 43592 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r117898 r117971 1129 1129 436708EB12D9CA4B00044234 /* RenderSVGViewportContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */; }; 1130 1130 436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AF12D9CA4B00044234 /* SVGMarkerData.h */; }; 1131 436708F012D9CA4B00044234 /* SVGMarkerLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B112D9CA4B00044234 /* SVGMarkerLayoutInfo.h */; };1132 1131 436708F212D9CA4B00044234 /* SVGRenderSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B312D9CA4B00044234 /* SVGRenderSupport.h */; }; 1133 1132 436708F412D9CA4B00044234 /* SVGRenderTreeAsText.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B512D9CA4B00044234 /* SVGRenderTreeAsText.h */; }; … … 8113 8112 436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGViewportContainer.h; sourceTree = "<group>"; }; 8114 8113 436708AF12D9CA4B00044234 /* SVGMarkerData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerData.h; sourceTree = "<group>"; }; 8115 436708B012D9CA4B00044234 /* SVGMarkerLayoutInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGMarkerLayoutInfo.cpp; sourceTree = "<group>"; };8116 436708B112D9CA4B00044234 /* SVGMarkerLayoutInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerLayoutInfo.h; sourceTree = "<group>"; };8117 8114 436708B212D9CA4B00044234 /* SVGRenderSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGRenderSupport.cpp; sourceTree = "<group>"; }; 8118 8115 436708B312D9CA4B00044234 /* SVGRenderSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRenderSupport.h; sourceTree = "<group>"; }; … … 13928 13925 0854B00F1255E4E600B9CDD0 /* SVGInlineTextBox.h */, 13929 13926 436708AF12D9CA4B00044234 /* SVGMarkerData.h */, 13930 436708B012D9CA4B00044234 /* SVGMarkerLayoutInfo.cpp */,13931 436708B112D9CA4B00044234 /* SVGMarkerLayoutInfo.h */,13932 13927 715379FE146BD9D6008BD615 /* SVGPathData.cpp */, 13933 13928 715379FF146BD9D6008BD615 /* SVGPathData.h */, … … 24533 24528 436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */, 24534 24529 B2227A440D00BF220071B782 /* SVGMarkerElement.h in Headers */, 24535 436708F012D9CA4B00044234 /* SVGMarkerLayoutInfo.h in Headers */,24536 24530 B2227A470D00BF220071B782 /* SVGMaskElement.h in Headers */, 24537 24531 0806E57A12893045007CED32 /* SVGMatrix.h in Headers */, -
trunk/Source/WebCore/rendering/svg/RenderSVGAllInOne.cpp
r112667 r117971 59 59 #include "SVGInlineFlowBox.cpp" 60 60 #include "SVGInlineTextBox.cpp" 61 #include "SVGMarkerLayoutInfo.cpp"62 61 #include "SVGPathData.cpp" 63 62 #include "SVGRenderSupport.cpp" -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp
r117709 r117971 41 41 #include "RenderSVGResourceSolidColor.h" 42 42 #include "SVGPathData.h" 43 #include "SVGPathElement.h"44 43 #include "SVGRenderingContext.h" 45 44 #include "SVGResources.h" … … 73 72 ASSERT(isEmpty()); 74 73 75 SVG PathElement* element = static_cast<SVGPathElement*>(node());74 SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node()); 76 75 updatePathFromGraphicsElement(element, path()); 77 76 processZeroLengthSubpaths(); 77 processMarkerPositions(); 78 78 } 79 79 … … 188 188 189 189 // Invalidate all resources of this client if our layout changed. 190 if (everHadLayout() && selfNeedsLayout()) {190 if (everHadLayout() && selfNeedsLayout()) 191 191 SVGResourcesCache::clientLayoutChanged(this); 192 m_markerLayoutInfo.clear();193 }194 192 195 193 // At this point LayoutRepainter already grabbed the old bounds, … … 239 237 // but shall be stroked if the "stroke-linecap" property has a value of round or square 240 238 return style()->svgStyle()->hasStroke() && style()->svgStyle()->capStyle() != ButtCap; 239 } 240 241 bool RenderSVGShape::shouldGenerateMarkerPositions() const 242 { 243 if (!style()->svgStyle()->hasMarkers()) 244 return false; 245 246 SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node()); 247 if (!element->supportsMarkers()) 248 return false; 249 250 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); 251 if (!resources) 252 return false; 253 254 return resources->markerStart() || resources->markerMid() || resources->markerEnd(); 241 255 } 242 256 … … 354 368 355 369 fillAndStrokePath(childPaintInfo.context); 356 357 if (svgStyle->hasMarkers()) 358 m_markerLayoutInfo.drawMarkers(childPaintInfo); 370 if (!m_markerPositions.isEmpty()) 371 drawMarkers(childPaintInfo); 359 372 } 360 373 } … … 401 414 } 402 415 403 FloatRect RenderSVGShape::calculateMarkerBoundsIfNeeded() 404 { 405 SVGElement* svgElement = static_cast<SVGElement*>(node()); 406 ASSERT(svgElement && svgElement->document()); 407 if (!svgElement->isStyled()) 408 return FloatRect(); 409 410 SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement); 411 if (!styledElement->supportsMarkers()) 412 return FloatRect(); 413 414 ASSERT(style()->svgStyle()->hasMarkers()); 416 static inline RenderSVGResourceMarker* markerForType(SVGMarkerType type, RenderSVGResourceMarker* markerStart, RenderSVGResourceMarker* markerMid, RenderSVGResourceMarker* markerEnd) 417 { 418 switch (type) { 419 case StartMarker: 420 return markerStart; 421 case MidMarker: 422 return markerMid; 423 case EndMarker: 424 return markerEnd; 425 } 426 427 ASSERT_NOT_REACHED(); 428 return 0; 429 } 430 431 FloatRect RenderSVGShape::markerRect(float strokeWidth) const 432 { 433 ASSERT(!m_markerPositions.isEmpty()); 415 434 416 435 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); 417 if (!resources) 418 return FloatRect(); 436 ASSERT(resources); 419 437 420 438 RenderSVGResourceMarker* markerStart = resources->markerStart(); 421 439 RenderSVGResourceMarker* markerMid = resources->markerMid(); 422 440 RenderSVGResourceMarker* markerEnd = resources->markerEnd(); 423 if (!markerStart && !markerMid && !markerEnd) 424 return FloatRect(); 425 426 return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, strokeWidth(), path()); 441 ASSERT(markerStart || markerMid || markerEnd); 442 443 FloatRect boundaries; 444 unsigned size = m_markerPositions.size(); 445 for (unsigned i = 0; i < size; ++i) { 446 if (RenderSVGResourceMarker* marker = markerForType(m_markerPositions[i].type, markerStart, markerMid, markerEnd)) 447 boundaries.unite(marker->markerBoundaries(marker->markerTransformation(m_markerPositions[i].origin, m_markerPositions[i].angle, strokeWidth))); 448 } 449 return boundaries; 427 450 } 428 451 … … 464 487 { 465 488 const SVGRenderStyle* svgStyle = style()->svgStyle(); 466 FloatRect strokeRect;467 489 if (svgStyle->hasStroke()) { 468 490 BoundingRectStrokeStyleApplier strokeStyle(this, style()); … … 480 502 m_strokeAndMarkerBoundingBox.unite(path().strokeBoundingRect(&strokeStyle)); 481 503 } 482 if (svgStyle->hasMarkers()) { 483 FloatRect markerBounds = calculateMarkerBoundsIfNeeded(); 484 if (!markerBounds.isEmpty()) 485 m_strokeAndMarkerBoundingBox.unite(markerBounds); 504 if (!m_markerPositions.isEmpty()) 505 m_strokeAndMarkerBoundingBox.unite(markerRect(strokeWidth())); 506 } 507 508 void RenderSVGShape::drawMarkers(PaintInfo& paintInfo) 509 { 510 ASSERT(!m_markerPositions.isEmpty()); 511 512 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); 513 if (!resources) 514 return; 515 516 RenderSVGResourceMarker* markerStart = resources->markerStart(); 517 RenderSVGResourceMarker* markerMid = resources->markerMid(); 518 RenderSVGResourceMarker* markerEnd = resources->markerEnd(); 519 if (!markerStart && !markerMid && !markerEnd) 520 return; 521 522 float strokeWidth = this->strokeWidth(); 523 unsigned size = m_markerPositions.size(); 524 for (unsigned i = 0; i < size; ++i) { 525 if (RenderSVGResourceMarker* marker = markerForType(m_markerPositions[i].type, markerStart, markerMid, markerEnd)) 526 marker->draw(paintInfo, marker->markerTransformation(m_markerPositions[i].origin, m_markerPositions[i].angle, strokeWidth)); 486 527 } 487 528 } … … 502 543 } 503 544 545 void RenderSVGShape::processMarkerPositions() 546 { 547 m_markerPositions.clear(); 548 549 if (!shouldGenerateMarkerPositions()) 550 return; 551 552 ASSERT(m_path); 553 554 SVGMarkerData markerData(m_markerPositions); 555 m_path->apply(&markerData, SVGMarkerData::updateFromPathElement); 556 markerData.pathIsDone(); 557 } 558 504 559 } 505 560 -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.h
r117709 r117971 31 31 #include "FloatRect.h" 32 32 #include "RenderSVGModelObject.h" 33 #include "SVGMarker LayoutInfo.h"33 #include "SVGMarkerData.h" 34 34 #include "StrokeStyleApplier.h" 35 35 #include <wtf/OwnPtr.h> … … 94 94 float strokeWidth() const; 95 95 void setIsPaintingFallback(bool isFallback) { m_fillFallback = isFallback; } 96 FloatRect calculateMarkerBoundsIfNeeded();97 void processZeroLengthSubpaths();98 99 96 bool hasPath() const { return m_path.get(); } 100 97 bool hasNonScalingStroke() const { return style()->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE; } … … 127 124 bool shouldStrokeZeroLengthSubpath() const; 128 125 FloatRect zeroLengthSubpathRect(const FloatPoint&, float) const; 126 void processZeroLengthSubpaths(); 127 128 bool shouldGenerateMarkerPositions() const; 129 FloatRect markerRect(float strokeWidth) const; 130 void processMarkerPositions(); 129 131 130 132 void fillShape(RenderStyle*, GraphicsContext*, Path*, RenderSVGShape*); … … 133 135 void fillAndStrokePath(GraphicsContext*); 134 136 void inflateWithStrokeAndMarkerBounds(); 137 void drawMarkers(PaintInfo&); 135 138 136 139 private: … … 138 141 FloatRect m_strokeAndMarkerBoundingBox; 139 142 FloatRect m_repaintBoundingBox; 140 SVGMarkerLayoutInfo m_markerLayoutInfo;141 143 AffineTransform m_localTransform; 142 144 OwnPtr<Path> m_path; 143 145 Vector<FloatPoint> m_zeroLengthLinecapLocations; 146 Vector<MarkerPosition> m_markerPositions; 144 147 145 148 bool m_needsBoundariesUpdate : 1; -
trunk/Source/WebCore/rendering/svg/SVGMarkerData.h
r95901 r117971 30 30 class RenderSVGResourceMarker; 31 31 32 class SVGMarkerData { 33 public: 34 enum Type { 35 Unknown = 0, 36 Start, 37 Mid, 38 End 39 }; 32 enum SVGMarkerType { 33 StartMarker, 34 MidMarker, 35 EndMarker 36 }; 40 37 41 SVGMarkerData(const Type& type = Unknown, RenderSVGResourceMarker* marker = 0) 42 : m_type(type) 43 , m_marker(marker) 38 struct MarkerPosition { 39 MarkerPosition(SVGMarkerType useType, const FloatPoint& useOrigin, float useAngle) 40 : type(useType) 41 , origin(useOrigin) 42 , angle(useAngle) 44 43 { 45 44 } 46 45 47 FloatPoint origin() const { return m_origin; } 48 RenderSVGResourceMarker* marker() const { return m_marker; } 46 SVGMarkerType type; 47 FloatPoint origin; 48 float angle; 49 }; 49 50 50 float currentAngle() const 51 class SVGMarkerData { 52 public: 53 SVGMarkerData(Vector<MarkerPosition>& positions) 54 : m_positions(positions) 55 , m_elementIndex(0) 56 { 57 } 58 59 static void updateFromPathElement(void* info, const PathElement* element) 60 { 61 SVGMarkerData* markerData = static_cast<SVGMarkerData*>(info); 62 63 // First update the outslope for the previous element. 64 markerData->updateOutslope(element->points[0]); 65 66 // Record the marker for the previous element. 67 if (markerData->m_elementIndex > 0) { 68 SVGMarkerType markerType = markerData->m_elementIndex == 1 ? StartMarker : MidMarker; 69 markerData->m_positions.append(MarkerPosition(markerType, markerData->m_origin, markerData->currentAngle(markerType))); 70 } 71 72 // Update our marker data for this element. 73 markerData->updateMarkerDataForPathElement(element); 74 ++markerData->m_elementIndex; 75 } 76 77 void pathIsDone() 78 { 79 m_positions.append(MarkerPosition(EndMarker, m_origin, currentAngle(EndMarker))); 80 } 81 82 private: 83 float currentAngle(SVGMarkerType type) const 51 84 { 52 85 FloatSize inslopeChange = m_inslopePoints[1] - m_inslopePoints[0]; … … 56 89 double outslope = rad2deg(atan2(outslopeChange.height(), outslopeChange.width())); 57 90 58 double angle = 0; 59 switch (m_type) { 60 case Start: 61 angle = outslope; 62 break; 63 case Mid: 64 angle = (inslope + outslope) / 2; 65 break; 66 case End: 67 angle = inslope; 68 break; 69 default: 70 ASSERT_NOT_REACHED(); 71 break; 91 switch (type) { 92 case StartMarker: 93 return narrowPrecisionToFloat(outslope); 94 case MidMarker: 95 return narrowPrecisionToFloat((inslope + outslope) / 2); 96 case EndMarker: 97 return narrowPrecisionToFloat(inslope); 72 98 } 73 99 74 return narrowPrecisionToFloat(angle); 75 } 76 77 void updateTypeAndMarker(const Type& type, RenderSVGResourceMarker* marker) 78 { 79 m_type = type; 80 m_marker = marker; 100 ASSERT_NOT_REACHED(); 101 return 0; 81 102 } 82 103 … … 114 135 } 115 136 116 private:117 137 void updateInslope(const FloatPoint& point) 118 138 { … … 121 141 } 122 142 123 Type m_type;124 RenderSVGResourceMarker* m_marker;143 Vector<MarkerPosition>& m_positions; 144 unsigned m_elementIndex; 125 145 FloatPoint m_origin; 126 146 FloatPoint m_subpathStart; -
trunk/Source/WebCore/rendering/svg/SVGResourcesCache.cpp
r103539 r117971 90 90 } 91 91 92 static inline SVGResourcesCache* resourcesCacheFromRenderObject( RenderObject* renderer)92 static inline SVGResourcesCache* resourcesCacheFromRenderObject(const RenderObject* renderer) 93 93 { 94 94 Document* document = renderer->document(); … … 104 104 } 105 105 106 SVGResources* SVGResourcesCache::cachedResourcesForRenderObject( RenderObject* renderer)106 SVGResources* SVGResourcesCache::cachedResourcesForRenderObject(const RenderObject* renderer) 107 107 { 108 108 ASSERT(renderer); … … 171 171 cache->removeResourcesFromRenderObject(resource); 172 172 173 HashMap< RenderObject*, SVGResources*>::iterator end = cache->m_cache.end();174 for (HashMap< RenderObject*, SVGResources*>::iterator it = cache->m_cache.begin(); it != end; ++it) {173 HashMap<const RenderObject*, SVGResources*>::iterator end = cache->m_cache.end(); 174 for (HashMap<const RenderObject*, SVGResources*>::iterator it = cache->m_cache.begin(); it != end; ++it) { 175 175 it->second->resourceDestroyed(resource); 176 176 -
trunk/Source/WebCore/rendering/svg/SVGResourcesCache.h
r95901 r117971 40 40 void addResourcesFromRenderObject(RenderObject*, const RenderStyle*); 41 41 void removeResourcesFromRenderObject(RenderObject*); 42 static SVGResources* cachedResourcesForRenderObject( RenderObject*);42 static SVGResources* cachedResourcesForRenderObject(const RenderObject*); 43 43 44 44 // Called from all SVG renderers destroy() methods - except for RenderSVGResourceContainer. … … 58 58 59 59 private: 60 HashMap< RenderObject*, SVGResources*> m_cache;60 HashMap<const RenderObject*, SVGResources*> m_cache; 61 61 }; 62 62
Note: See TracChangeset
for help on using the changeset viewer.