Changeset 187492 in webkit
- Timestamp:
- Jul 28, 2015 11:22:00 AM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r187491 r187492 1 2015-07-27 Simon Fraser <simon.fraser@apple.com> 2 3 PathApplierFunction should take a reference to a PathElement 4 https://bugs.webkit.org/show_bug.cgi?id=147337 5 6 Reviewed by Dan Bates. 7 8 Convert PathApplierFunction to take a const PathElement&, since it can never be null. 9 10 * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: 11 (ConvertPathToScreenSpaceFunction): 12 * inspector/InspectorOverlay.cpp: 13 (WebCore::appendPathSegment): 14 * platform/graphics/Path.cpp: 15 (WebCore::pathLengthApplierFunction): 16 * platform/graphics/Path.h: 17 * platform/graphics/PathTraversalState.h: 18 (WebCore::PathTraversalState::processPathElement): 19 * platform/graphics/cg/PathCG.cpp: 20 (WebCore::CGPathApplierToPathApplier): 21 * rendering/svg/SVGMarkerData.h: 22 (WebCore::SVGMarkerData::updateFromPathElement): 23 (WebCore::SVGMarkerData::updateMarkerDataForPathElement): 24 * rendering/svg/SVGSubpathData.h: 25 (WebCore::SVGSubpathData::updateFromPathElement): 26 * svg/SVGPathUtilities.cpp: 27 (WebCore::pathIteratorForBuildingString): 28 1 29 2015-07-28 Jer Noble <jer.noble@apple.com> 2 30 -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
r185924 r187492 248 248 }; 249 249 250 static void ConvertPathToScreenSpaceFunction(void* info, const PathElement *element)250 static void ConvertPathToScreenSpaceFunction(void* info, const PathElement& element) 251 251 { 252 252 PathConversionInfo* conversion = (PathConversionInfo*)info; 253 253 WebAccessibilityObjectWrapperBase *wrapper = conversion->wrapper; 254 254 CGMutablePathRef newPath = conversion->path; 255 switch (element ->type) {255 switch (element.type) { 256 256 case PathElementMoveToPoint: 257 257 { 258 CGPoint newPoint = [wrapper convertPointToScreenSpace:element ->points[0]];258 CGPoint newPoint = [wrapper convertPointToScreenSpace:element.points[0]]; 259 259 CGPathMoveToPoint(newPath, nil, newPoint.x, newPoint.y); 260 260 break; … … 262 262 case PathElementAddLineToPoint: 263 263 { 264 CGPoint newPoint = [wrapper convertPointToScreenSpace:element ->points[0]];264 CGPoint newPoint = [wrapper convertPointToScreenSpace:element.points[0]]; 265 265 CGPathAddLineToPoint(newPath, nil, newPoint.x, newPoint.y); 266 266 break; … … 268 268 case PathElementAddQuadCurveToPoint: 269 269 { 270 CGPoint newPoint1 = [wrapper convertPointToScreenSpace:element ->points[0]];271 CGPoint newPoint2 = [wrapper convertPointToScreenSpace:element ->points[1]];270 CGPoint newPoint1 = [wrapper convertPointToScreenSpace:element.points[0]]; 271 CGPoint newPoint2 = [wrapper convertPointToScreenSpace:element.points[1]]; 272 272 CGPathAddQuadCurveToPoint(newPath, nil, newPoint1.x, newPoint1.y, newPoint2.x, newPoint2.y); 273 273 break; … … 275 275 case PathElementAddCurveToPoint: 276 276 { 277 CGPoint newPoint1 = [wrapper convertPointToScreenSpace:element ->points[0]];278 CGPoint newPoint2 = [wrapper convertPointToScreenSpace:element ->points[1]];279 CGPoint newPoint3 = [wrapper convertPointToScreenSpace:element ->points[2]];277 CGPoint newPoint1 = [wrapper convertPointToScreenSpace:element.points[0]]; 278 CGPoint newPoint2 = [wrapper convertPointToScreenSpace:element.points[1]]; 279 CGPoint newPoint3 = [wrapper convertPointToScreenSpace:element.points[2]]; 280 280 CGPathAddCurveToPoint(newPath, nil, newPoint1.x, newPoint1.y, newPoint2.x, newPoint2.y, newPoint3.x, newPoint3.y); 281 281 break; -
trunk/Source/WebCore/inspector/InspectorOverlay.cpp
r187145 r187492 610 610 611 611 // Used as a functor for Shape::apply, which has not been cleaned up to use modern C++. 612 static void appendPathSegment(void* info, const PathElement *pathElement)612 static void appendPathSegment(void* info, const PathElement& pathElement) 613 613 { 614 614 PathApplyInfo& pathApplyInfo = *static_cast<PathApplyInfo*>(info); 615 615 FloatPoint point; 616 switch (pathElement ->type) {616 switch (pathElement.type) { 617 617 // The points member will contain 1 value. 618 618 case PathElementMoveToPoint: 619 appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("M"), pathElement ->points, 1);619 appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("M"), pathElement.points, 1); 620 620 break; 621 621 // The points member will contain 1 value. 622 622 case PathElementAddLineToPoint: 623 appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("L"), pathElement ->points, 1);623 appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("L"), pathElement.points, 1); 624 624 break; 625 625 // The points member will contain 3 values. 626 626 case PathElementAddCurveToPoint: 627 appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("C"), pathElement ->points, 3);627 appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("C"), pathElement.points, 3); 628 628 break; 629 629 // The points member will contain 2 values. 630 630 case PathElementAddQuadCurveToPoint: 631 appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("Q"), pathElement ->points, 2);631 appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("Q"), pathElement.points, 2); 632 632 break; 633 633 // The points member will contain no values. -
trunk/Source/WebCore/platform/graphics/Path.cpp
r182828 r187492 40 40 namespace WebCore { 41 41 42 static void pathLengthApplierFunction(void* info, const PathElement *element)42 static void pathLengthApplierFunction(void* info, const PathElement& element) 43 43 { 44 44 PathTraversalState& traversalState = *static_cast<PathTraversalState*>(info); -
trunk/Source/WebCore/platform/graphics/Path.h
r186858 r187492 81 81 }; 82 82 83 typedef void (*PathApplierFunction)(void* info, const PathElement *);83 typedef void (*PathApplierFunction)(void* info, const PathElement&); 84 84 85 85 class Path { -
trunk/Source/WebCore/platform/graphics/PathTraversalState.h
r182828 r187492 45 45 public: 46 46 bool processPathElement(PathElementType, const FloatPoint*); 47 bool processPathElement(const PathElement * element) { return processPathElement(element->type, element->points); }47 bool processPathElement(const PathElement& element) { return processPathElement(element.type, element.points); } 48 48 49 49 Action action() const { return m_action; } -
trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp
r179398 r187492 175 175 // It keeps track of the leftmost and rightmost intersection in GlyphIterationState::minX and 176 176 // GlyphIterationState::maxX. 177 static void findPathIntersections(void* stateAsVoidPointer, const PathElement *element)177 static void findPathIntersections(void* stateAsVoidPointer, const PathElement& element) 178 178 { 179 179 auto& state = *static_cast<GlyphIterationState*>(stateAsVoidPointer); 180 180 bool doIntersection = false; 181 181 FloatPoint point = FloatPoint(); 182 switch (element ->type) {182 switch (element.type) { 183 183 case PathElementMoveToPoint: 184 state.startingPoint = element ->points[0];185 state.currentPoint = element ->points[0];184 state.startingPoint = element.points[0]; 185 state.currentPoint = element.points[0]; 186 186 break; 187 187 case PathElementAddLineToPoint: 188 188 doIntersection = true; 189 point = element ->points[0];189 point = element.points[0]; 190 190 break; 191 191 case PathElementAddQuadCurveToPoint: 192 192 doIntersection = true; 193 point = element ->points[1];193 point = element.points[1]; 194 194 break; 195 195 case PathElementAddCurveToPoint: 196 196 doIntersection = true; 197 point = element ->points[2];197 point = element.points[2]; 198 198 break; 199 199 case PathElementCloseSubpath: -
trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp
r187009 r187492 381 381 }; 382 382 383 static void CGPathApplierToPathApplier(void *info, const CGPathElement *element)383 static void CGPathApplierToPathApplier(void *info, const CGPathElement* element) 384 384 { 385 385 PathApplierInfo* pinfo = (PathApplierInfo*)info; … … 406 406 break; 407 407 } 408 pinfo->function(pinfo->info, &pelement);408 pinfo->function(pinfo->info, pelement); 409 409 } 410 410 -
trunk/Source/WebCore/rendering/svg/SVGMarkerData.h
r167473 r187492 55 55 } 56 56 57 static void updateFromPathElement(void* info, const PathElement *element)57 static void updateFromPathElement(void* info, const PathElement& element) 58 58 { 59 59 SVGMarkerData* markerData = static_cast<SVGMarkerData*>(info); 60 60 61 61 // First update the outslope for the previous element. 62 markerData->updateOutslope(element ->points[0]);62 markerData->updateOutslope(element.points[0]); 63 63 64 64 // Record the marker for the previous element. … … 110 110 } 111 111 112 void updateMarkerDataForPathElement(const PathElement *element)112 void updateMarkerDataForPathElement(const PathElement& element) 113 113 { 114 FloatPoint* points = element ->points;114 FloatPoint* points = element.points; 115 115 116 switch (element ->type) {116 switch (element.type) { 117 117 case PathElementAddQuadCurveToPoint: 118 118 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=33115 (PathElementAddQuadCurveToPoint not handled for <marker>) -
trunk/Source/WebCore/rendering/svg/SVGSubpathData.h
r163440 r187492 37 37 } 38 38 39 static void updateFromPathElement(void* info, const PathElement *element)39 static void updateFromPathElement(void* info, const PathElement& element) 40 40 { 41 41 SVGSubpathData* subpathFinder = static_cast<SVGSubpathData*>(info); 42 switch (element ->type) {42 switch (element.type) { 43 43 case PathElementMoveToPoint: 44 44 if (subpathFinder->m_pathIsZeroLength && !subpathFinder->m_haveSeenMoveOnly) 45 45 subpathFinder->m_zeroLengthSubpathLocations.append(subpathFinder->m_lastPoint); 46 subpathFinder->m_lastPoint = subpathFinder->m_movePoint = element ->points[0];46 subpathFinder->m_lastPoint = subpathFinder->m_movePoint = element.points[0]; 47 47 subpathFinder->m_haveSeenMoveOnly = true; 48 48 subpathFinder->m_pathIsZeroLength = true; 49 49 break; 50 50 case PathElementAddLineToPoint: 51 if (subpathFinder->m_lastPoint != element ->points[0]) {51 if (subpathFinder->m_lastPoint != element.points[0]) { 52 52 subpathFinder->m_pathIsZeroLength = false; 53 subpathFinder->m_lastPoint = element ->points[0];53 subpathFinder->m_lastPoint = element.points[0]; 54 54 } 55 55 subpathFinder->m_haveSeenMoveOnly = false; 56 56 break; 57 57 case PathElementAddQuadCurveToPoint: 58 if (subpathFinder->m_lastPoint != element ->points[0] || element->points[0] != element->points[1]) {58 if (subpathFinder->m_lastPoint != element.points[0] || element.points[0] != element.points[1]) { 59 59 subpathFinder->m_pathIsZeroLength = false; 60 subpathFinder->m_lastPoint = element ->points[1];60 subpathFinder->m_lastPoint = element.points[1]; 61 61 } 62 62 subpathFinder->m_haveSeenMoveOnly = false; 63 63 break; 64 64 case PathElementAddCurveToPoint: 65 if (subpathFinder->m_lastPoint != element ->points[0] || element->points[0] != element->points[1] || element->points[1] != element->points[2]) {65 if (subpathFinder->m_lastPoint != element.points[0] || element.points[0] != element.points[1] || element.points[1] != element.points[2]) { 66 66 subpathFinder->m_pathIsZeroLength = false; 67 subpathFinder->m_lastPoint = element ->points[2];67 subpathFinder->m_lastPoint = element.points[2]; 68 68 } 69 69 subpathFinder->m_haveSeenMoveOnly = false; -
trunk/Source/WebCore/svg/SVGPathUtilities.cpp
r187018 r187492 332 332 } 333 333 334 static void pathIteratorForBuildingString(void* info, const PathElement *pathElement)334 static void pathIteratorForBuildingString(void* info, const PathElement& pathElement) 335 335 { 336 336 SVGPathConsumer* consumer = static_cast<SVGPathConsumer*>(info); 337 337 338 switch (pathElement ->type) {338 switch (pathElement.type) { 339 339 case PathElementMoveToPoint: 340 consumer->moveTo(pathElement ->points[0], false, AbsoluteCoordinates);340 consumer->moveTo(pathElement.points[0], false, AbsoluteCoordinates); 341 341 break; 342 342 case PathElementAddLineToPoint: 343 consumer->lineTo(pathElement ->points[0], AbsoluteCoordinates);343 consumer->lineTo(pathElement.points[0], AbsoluteCoordinates); 344 344 break; 345 345 case PathElementAddQuadCurveToPoint: 346 consumer->curveToQuadratic(pathElement ->points[0], pathElement->points[1], AbsoluteCoordinates);346 consumer->curveToQuadratic(pathElement.points[0], pathElement.points[1], AbsoluteCoordinates); 347 347 break; 348 348 case PathElementAddCurveToPoint: 349 consumer->curveToCubic(pathElement ->points[0], pathElement->points[1], pathElement->points[2], AbsoluteCoordinates);349 consumer->curveToCubic(pathElement.points[0], pathElement.points[1], pathElement.points[2], AbsoluteCoordinates); 350 350 break; 351 351 case PathElementCloseSubpath: -
trunk/Source/WebKit2/ChangeLog
r187491 r187492 1 2015-07-27 Simon Fraser <simon.fraser@apple.com> 2 3 PathApplierFunction should take a reference to a PathElement 4 https://bugs.webkit.org/show_bug.cgi?id=147337 5 6 Reviewed by Dan Bates. 7 8 Convert PathApplierFunction to take a const PathElement&, since it can never be null. 9 10 * Shared/WebCoreArgumentCoders.cpp: 11 (IPC::pathPointCountApplierFunction): 12 (IPC::pathEncodeApplierFunction): 13 1 14 2015-07-28 Jer Noble <jer.noble@apple.com> 2 15 -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
r186002 r187492 374 374 } 375 375 376 static void pathPointCountApplierFunction(void* info, const PathElement *)376 static void pathPointCountApplierFunction(void* info, const PathElement&) 377 377 { 378 378 uint64_t* pointCount = static_cast<uint64_t*>(info); … … 380 380 } 381 381 382 static void pathEncodeApplierFunction(void* info, const PathElement *element)382 static void pathEncodeApplierFunction(void* info, const PathElement& element) 383 383 { 384 384 ArgumentEncoder& encoder = *static_cast<ArgumentEncoder*>(info); 385 385 386 encoder.encodeEnum(element ->type);387 388 switch (element ->type) {386 encoder.encodeEnum(element.type); 387 388 switch (element.type) { 389 389 case PathElementMoveToPoint: // The points member will contain 1 value. 390 encoder << element ->points[0];390 encoder << element.points[0]; 391 391 break; 392 392 case PathElementAddLineToPoint: // The points member will contain 1 value. 393 encoder << element ->points[0];393 encoder << element.points[0]; 394 394 break; 395 395 case PathElementAddQuadCurveToPoint: // The points member will contain 2 values. 396 encoder << element ->points[0];397 encoder << element ->points[1];396 encoder << element.points[0]; 397 encoder << element.points[1]; 398 398 break; 399 399 case PathElementAddCurveToPoint: // The points member will contain 3 values. 400 encoder << element ->points[0];401 encoder << element ->points[1];402 encoder << element ->points[2];400 encoder << element.points[0]; 401 encoder << element.points[1]; 402 encoder << element.points[2]; 403 403 break; 404 404 case PathElementCloseSubpath: // The points member will contain no values.
Note: See TracChangeset
for help on using the changeset viewer.