Changeset 187492 in webkit


Ignore:
Timestamp:
Jul 28, 2015 11:22:00 AM (9 years ago)
Author:
Simon Fraser
Message:

PathApplierFunction should take a reference to a PathElement
https://bugs.webkit.org/show_bug.cgi?id=147337

Reviewed by Dan Bates.

Convert PathApplierFunction to take a const PathElement&, since it can never be null.

Source/WebCore:

  • accessibility/mac/WebAccessibilityObjectWrapperBase.mm:

(ConvertPathToScreenSpaceFunction):

  • inspector/InspectorOverlay.cpp:

(WebCore::appendPathSegment):

  • platform/graphics/Path.cpp:

(WebCore::pathLengthApplierFunction):

  • platform/graphics/Path.h:
  • platform/graphics/PathTraversalState.h:

(WebCore::PathTraversalState::processPathElement):

  • platform/graphics/cg/PathCG.cpp:

(WebCore::CGPathApplierToPathApplier):

  • rendering/svg/SVGMarkerData.h:

(WebCore::SVGMarkerData::updateFromPathElement):
(WebCore::SVGMarkerData::updateMarkerDataForPathElement):

  • rendering/svg/SVGSubpathData.h:

(WebCore::SVGSubpathData::updateFromPathElement):

  • svg/SVGPathUtilities.cpp:

(WebCore::pathIteratorForBuildingString):

Source/WebKit2:

  • Shared/WebCoreArgumentCoders.cpp:

(IPC::pathPointCountApplierFunction):
(IPC::pathEncodeApplierFunction):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r187491 r187492  
     12015-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
    1292015-07-28  Jer Noble  <jer.noble@apple.com>
    230
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm

    r185924 r187492  
    248248};
    249249
    250 static void ConvertPathToScreenSpaceFunction(void* info, const PathElement* element)
     250static void ConvertPathToScreenSpaceFunction(void* info, const PathElement& element)
    251251{
    252252    PathConversionInfo* conversion = (PathConversionInfo*)info;
    253253    WebAccessibilityObjectWrapperBase *wrapper = conversion->wrapper;
    254254    CGMutablePathRef newPath = conversion->path;
    255     switch (element->type) {
     255    switch (element.type) {
    256256    case PathElementMoveToPoint:
    257257    {
    258         CGPoint newPoint = [wrapper convertPointToScreenSpace:element->points[0]];
     258        CGPoint newPoint = [wrapper convertPointToScreenSpace:element.points[0]];
    259259        CGPathMoveToPoint(newPath, nil, newPoint.x, newPoint.y);
    260260        break;
     
    262262    case PathElementAddLineToPoint:
    263263    {
    264         CGPoint newPoint = [wrapper convertPointToScreenSpace:element->points[0]];
     264        CGPoint newPoint = [wrapper convertPointToScreenSpace:element.points[0]];
    265265        CGPathAddLineToPoint(newPath, nil, newPoint.x, newPoint.y);
    266266        break;
     
    268268    case PathElementAddQuadCurveToPoint:
    269269    {
    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]];
    272272        CGPathAddQuadCurveToPoint(newPath, nil, newPoint1.x, newPoint1.y, newPoint2.x, newPoint2.y);
    273273        break;
     
    275275    case PathElementAddCurveToPoint:
    276276    {
    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]];
    280280        CGPathAddCurveToPoint(newPath, nil, newPoint1.x, newPoint1.y, newPoint2.x, newPoint2.y, newPoint3.x, newPoint3.y);
    281281        break;
  • trunk/Source/WebCore/inspector/InspectorOverlay.cpp

    r187145 r187492  
    610610
    611611// 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)
     612static void appendPathSegment(void* info, const PathElement& pathElement)
    613613{
    614614    PathApplyInfo& pathApplyInfo = *static_cast<PathApplyInfo*>(info);
    615615    FloatPoint point;
    616     switch (pathElement->type) {
     616    switch (pathElement.type) {
    617617    // The points member will contain 1 value.
    618618    case PathElementMoveToPoint:
    619         appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("M"), pathElement->points, 1);
     619        appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("M"), pathElement.points, 1);
    620620        break;
    621621    // The points member will contain 1 value.
    622622    case PathElementAddLineToPoint:
    623         appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("L"), pathElement->points, 1);
     623        appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("L"), pathElement.points, 1);
    624624        break;
    625625    // The points member will contain 3 values.
    626626    case PathElementAddCurveToPoint:
    627         appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("C"), pathElement->points, 3);
     627        appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("C"), pathElement.points, 3);
    628628        break;
    629629    // The points member will contain 2 values.
    630630    case PathElementAddQuadCurveToPoint:
    631         appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("Q"), pathElement->points, 2);
     631        appendPathCommandAndPoints(pathApplyInfo, ASCIILiteral("Q"), pathElement.points, 2);
    632632        break;
    633633    // The points member will contain no values.
  • trunk/Source/WebCore/platform/graphics/Path.cpp

    r182828 r187492  
    4040namespace WebCore {
    4141
    42 static void pathLengthApplierFunction(void* info, const PathElement* element)
     42static void pathLengthApplierFunction(void* info, const PathElement& element)
    4343{
    4444    PathTraversalState& traversalState = *static_cast<PathTraversalState*>(info);
  • trunk/Source/WebCore/platform/graphics/Path.h

    r186858 r187492  
    8181    };
    8282
    83     typedef void (*PathApplierFunction)(void* info, const PathElement*);
     83    typedef void (*PathApplierFunction)(void* info, const PathElement&);
    8484
    8585    class Path {
  • trunk/Source/WebCore/platform/graphics/PathTraversalState.h

    r182828 r187492  
    4545public:
    4646    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); }
    4848
    4949    Action action() const { return m_action; }
  • trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp

    r179398 r187492  
    175175// It keeps track of the leftmost and rightmost intersection in  GlyphIterationState::minX and
    176176// GlyphIterationState::maxX.
    177 static void findPathIntersections(void* stateAsVoidPointer, const PathElement* element)
     177static void findPathIntersections(void* stateAsVoidPointer, const PathElement& element)
    178178{
    179179    auto& state = *static_cast<GlyphIterationState*>(stateAsVoidPointer);
    180180    bool doIntersection = false;
    181181    FloatPoint point = FloatPoint();
    182     switch (element->type) {
     182    switch (element.type) {
    183183    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];
    186186        break;
    187187    case PathElementAddLineToPoint:
    188188        doIntersection = true;
    189         point = element->points[0];
     189        point = element.points[0];
    190190        break;
    191191    case PathElementAddQuadCurveToPoint:
    192192        doIntersection = true;
    193         point = element->points[1];
     193        point = element.points[1];
    194194        break;
    195195    case PathElementAddCurveToPoint:
    196196        doIntersection = true;
    197         point = element->points[2];
     197        point = element.points[2];
    198198        break;
    199199    case PathElementCloseSubpath:
  • trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp

    r187009 r187492  
    381381};
    382382
    383 static void CGPathApplierToPathApplier(void *info, const CGPathElement *element)
     383static void CGPathApplierToPathApplier(void *info, const CGPathElement* element)
    384384{
    385385    PathApplierInfo* pinfo = (PathApplierInfo*)info;
     
    406406        break;
    407407    }
    408     pinfo->function(pinfo->info, &pelement);
     408    pinfo->function(pinfo->info, pelement);
    409409}
    410410
  • trunk/Source/WebCore/rendering/svg/SVGMarkerData.h

    r167473 r187492  
    5555    }
    5656
    57     static void updateFromPathElement(void* info, const PathElement* element)
     57    static void updateFromPathElement(void* info, const PathElement& element)
    5858    {
    5959        SVGMarkerData* markerData = static_cast<SVGMarkerData*>(info);
    6060
    6161        // First update the outslope for the previous element.
    62         markerData->updateOutslope(element->points[0]);
     62        markerData->updateOutslope(element.points[0]);
    6363
    6464        // Record the marker for the previous element.
     
    110110    }
    111111
    112     void updateMarkerDataForPathElement(const PathElement* element)
     112    void updateMarkerDataForPathElement(const PathElement& element)
    113113    {
    114         FloatPoint* points = element->points;
     114        FloatPoint* points = element.points;
    115115
    116         switch (element->type) {
     116        switch (element.type) {
    117117        case PathElementAddQuadCurveToPoint:
    118118            // FIXME: https://bugs.webkit.org/show_bug.cgi?id=33115 (PathElementAddQuadCurveToPoint not handled for <marker>)
  • trunk/Source/WebCore/rendering/svg/SVGSubpathData.h

    r163440 r187492  
    3737    }
    3838
    39     static void updateFromPathElement(void* info, const PathElement* element)
     39    static void updateFromPathElement(void* info, const PathElement& element)
    4040    {
    4141        SVGSubpathData* subpathFinder = static_cast<SVGSubpathData*>(info);
    42         switch (element->type) {
     42        switch (element.type) {
    4343        case PathElementMoveToPoint:
    4444            if (subpathFinder->m_pathIsZeroLength && !subpathFinder->m_haveSeenMoveOnly)
    4545                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];
    4747            subpathFinder->m_haveSeenMoveOnly = true;
    4848            subpathFinder->m_pathIsZeroLength = true;
    4949            break;
    5050        case PathElementAddLineToPoint:
    51             if (subpathFinder->m_lastPoint != element->points[0]) {
     51            if (subpathFinder->m_lastPoint != element.points[0]) {
    5252                subpathFinder->m_pathIsZeroLength = false;
    53                 subpathFinder->m_lastPoint = element->points[0];
     53                subpathFinder->m_lastPoint = element.points[0];
    5454            }
    5555            subpathFinder->m_haveSeenMoveOnly = false;
    5656            break;
    5757        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]) {
    5959                subpathFinder->m_pathIsZeroLength = false;
    60                 subpathFinder->m_lastPoint = element->points[1];
     60                subpathFinder->m_lastPoint = element.points[1];
    6161            }
    6262            subpathFinder->m_haveSeenMoveOnly = false;
    6363            break;
    6464        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]) {
    6666                subpathFinder->m_pathIsZeroLength = false;
    67                 subpathFinder->m_lastPoint = element->points[2];
     67                subpathFinder->m_lastPoint = element.points[2];
    6868            }
    6969            subpathFinder->m_haveSeenMoveOnly = false;
  • trunk/Source/WebCore/svg/SVGPathUtilities.cpp

    r187018 r187492  
    332332}
    333333
    334 static void pathIteratorForBuildingString(void* info, const PathElement* pathElement)
     334static void pathIteratorForBuildingString(void* info, const PathElement& pathElement)
    335335{
    336336    SVGPathConsumer* consumer = static_cast<SVGPathConsumer*>(info);
    337337
    338     switch (pathElement->type) {
     338    switch (pathElement.type) {
    339339    case PathElementMoveToPoint:
    340         consumer->moveTo(pathElement->points[0], false, AbsoluteCoordinates);
     340        consumer->moveTo(pathElement.points[0], false, AbsoluteCoordinates);
    341341        break;
    342342    case PathElementAddLineToPoint:
    343         consumer->lineTo(pathElement->points[0], AbsoluteCoordinates);
     343        consumer->lineTo(pathElement.points[0], AbsoluteCoordinates);
    344344        break;
    345345    case PathElementAddQuadCurveToPoint:
    346         consumer->curveToQuadratic(pathElement->points[0], pathElement->points[1], AbsoluteCoordinates);
     346        consumer->curveToQuadratic(pathElement.points[0], pathElement.points[1], AbsoluteCoordinates);
    347347        break;
    348348    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);
    350350        break;
    351351    case PathElementCloseSubpath:
  • trunk/Source/WebKit2/ChangeLog

    r187491 r187492  
     12015-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
    1142015-07-28  Jer Noble  <jer.noble@apple.com>
    215
  • trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp

    r186002 r187492  
    374374}
    375375
    376 static void pathPointCountApplierFunction(void* info, const PathElement*)
     376static void pathPointCountApplierFunction(void* info, const PathElement&)
    377377{
    378378    uint64_t* pointCount = static_cast<uint64_t*>(info);
     
    380380}
    381381
    382 static void pathEncodeApplierFunction(void* info, const PathElement* element)
     382static void pathEncodeApplierFunction(void* info, const PathElement& element)
    383383{
    384384    ArgumentEncoder& encoder = *static_cast<ArgumentEncoder*>(info);
    385385
    386     encoder.encodeEnum(element->type);
    387 
    388     switch (element->type) {
     386    encoder.encodeEnum(element.type);
     387
     388    switch (element.type) {
    389389    case PathElementMoveToPoint: // The points member will contain 1 value.
    390         encoder << element->points[0];
     390        encoder << element.points[0];
    391391        break;
    392392    case PathElementAddLineToPoint: // The points member will contain 1 value.
    393         encoder << element->points[0];
     393        encoder << element.points[0];
    394394        break;
    395395    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];
    398398        break;
    399399    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];
    403403        break;
    404404    case PathElementCloseSubpath: // The points member will contain no values.
Note: See TracChangeset for help on using the changeset viewer.