/platform/external/webkit/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp

https://github.com/aharish/totoro-gb-opensource-update2 · C++ · 106 lines · 72 code · 5 blank · 29 comment · 2 complexity · a38ca51c61d95d5d8776b47cf5813911 MD5 · raw file

  1. /*
  2. * Copyright (C) 2010 Google Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above
  11. * copyright notice, this list of conditions and the following disclaimer
  12. * in the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Google Inc. nor the names of its
  15. * contributors may be used to endorse or promote products derived from
  16. * this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #include "config.h"
  31. #include "V8SVGPathSeg.h"
  32. #include "V8DOMWindow.h"
  33. #include "V8DOMWrapper.h"
  34. #include "V8SVGPathSegArcAbs.h"
  35. #include "V8SVGPathSegArcRel.h"
  36. #include "V8SVGPathSegClosePath.h"
  37. #include "V8SVGPathSegCurvetoCubicAbs.h"
  38. #include "V8SVGPathSegCurvetoCubicRel.h"
  39. #include "V8SVGPathSegCurvetoCubicSmoothAbs.h"
  40. #include "V8SVGPathSegCurvetoCubicSmoothRel.h"
  41. #include "V8SVGPathSegCurvetoQuadraticAbs.h"
  42. #include "V8SVGPathSegCurvetoQuadraticRel.h"
  43. #include "V8SVGPathSegCurvetoQuadraticSmoothAbs.h"
  44. #include "V8SVGPathSegCurvetoQuadraticSmoothRel.h"
  45. #include "V8SVGPathSegLinetoAbs.h"
  46. #include "V8SVGPathSegLinetoHorizontalAbs.h"
  47. #include "V8SVGPathSegLinetoHorizontalRel.h"
  48. #include "V8SVGPathSegLinetoRel.h"
  49. #include "V8SVGPathSegLinetoVerticalAbs.h"
  50. #include "V8SVGPathSegLinetoVerticalRel.h"
  51. #include "V8SVGPathSegMovetoAbs.h"
  52. #include "V8SVGPathSegMovetoRel.h"
  53. namespace WebCore {
  54. v8::Handle<v8::Value> toV8(SVGPathSeg* impl)
  55. {
  56. if (!impl)
  57. return v8::Null();
  58. switch (impl->pathSegType()) {
  59. case SVGPathSeg::PATHSEG_CLOSEPATH:
  60. return toV8(static_cast<SVGPathSegClosePath*>(impl));
  61. case SVGPathSeg::PATHSEG_MOVETO_ABS:
  62. return toV8(static_cast<SVGPathSegMovetoAbs*>(impl));
  63. case SVGPathSeg::PATHSEG_MOVETO_REL:
  64. return toV8(static_cast<SVGPathSegMovetoRel*>(impl));
  65. case SVGPathSeg::PATHSEG_LINETO_ABS:
  66. return toV8(static_cast<SVGPathSegLinetoAbs*>(impl));
  67. case SVGPathSeg::PATHSEG_LINETO_REL:
  68. return toV8(static_cast<SVGPathSegLinetoRel*>(impl));
  69. case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
  70. return toV8(static_cast<SVGPathSegCurvetoCubicAbs*>(impl));
  71. case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
  72. return toV8(static_cast<SVGPathSegCurvetoCubicRel*>(impl));
  73. case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
  74. return toV8(static_cast<SVGPathSegCurvetoQuadraticAbs*>(impl));
  75. case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
  76. return toV8(static_cast<SVGPathSegCurvetoQuadraticRel*>(impl));
  77. case SVGPathSeg::PATHSEG_ARC_ABS:
  78. return toV8(static_cast<SVGPathSegArcAbs*>(impl));
  79. case SVGPathSeg::PATHSEG_ARC_REL:
  80. return toV8(static_cast<SVGPathSegArcRel*>(impl));
  81. case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
  82. return toV8(static_cast<SVGPathSegLinetoHorizontalAbs*>(impl));
  83. case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
  84. return toV8(static_cast<SVGPathSegLinetoHorizontalRel*>(impl));
  85. case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
  86. return toV8(static_cast<SVGPathSegLinetoVerticalAbs*>(impl));
  87. case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
  88. return toV8(static_cast<SVGPathSegLinetoVerticalRel*>(impl));
  89. case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
  90. return toV8(static_cast<SVGPathSegCurvetoCubicSmoothAbs*>(impl));
  91. case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
  92. return toV8(static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl));
  93. case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
  94. return toV8(static_cast<SVGPathSegCurvetoQuadraticSmoothAbs*>(impl));
  95. case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
  96. return toV8(static_cast<SVGPathSegCurvetoQuadraticSmoothRel*>(impl));
  97. }
  98. ASSERT_NOT_REACHED();
  99. return V8SVGPathSeg::wrap(impl);
  100. }
  101. } // namespace WebCore