Changeset 173259 in webkit
- Timestamp:
- Sep 4, 2014 9:13:35 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r173258 r173259 1 2014-09-04 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 3 Introduce CSS_BASIC_SHAPES_TYPE_CASTS, and use it 4 https://bugs.webkit.org/show_bug.cgi?id=136403 5 6 Reviewed by Daniel Bates. 7 8 toCSSBasicShapeFoo() will help to detect wrong type casting. So this patch generates it, and use it 9 instead of static_cast<const CSSBasicShapeFoo*>(). 10 11 No new tests no behavior changes. 12 13 * css/BasicShapeFunctions.cpp: 14 (WebCore::basicShapeForValue): 15 * css/CSSBasicShapes.cpp: 16 (WebCore::CSSBasicShapeCircle::equals): 17 (WebCore::CSSBasicShapeEllipse::equals): 18 (WebCore::CSSBasicShapePolygon::equals): 19 (WebCore::CSSBasicShapeInset::equals): 20 * css/CSSBasicShapes.h: 21 1 22 2014-09-04 Daniel Bates <dabates@apple.com> 2 23 -
trunk/Source/WebCore/css/BasicShapeFunctions.cpp
r173177 r173259 206 206 switch (basicShapeValue->type()) { 207 207 case CSSBasicShape::CSSBasicShapeCircleType: { 208 const CSSBasicShapeCircle* circleValue = static_cast<const CSSBasicShapeCircle *>(basicShapeValue);208 const CSSBasicShapeCircle* circleValue = toCSSBasicShapeCircle(basicShapeValue); 209 209 RefPtr<BasicShapeCircle> circle = BasicShapeCircle::create(); 210 210 … … 217 217 } 218 218 case CSSBasicShape::CSSBasicShapeEllipseType: { 219 const CSSBasicShapeEllipse* ellipseValue = static_cast<const CSSBasicShapeEllipse *>(basicShapeValue);219 const CSSBasicShapeEllipse* ellipseValue = toCSSBasicShapeEllipse(basicShapeValue); 220 220 RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create(); 221 221 … … 230 230 } 231 231 case CSSBasicShape::CSSBasicShapePolygonType: { 232 const CSSBasicShapePolygon* polygonValue = static_cast<const CSSBasicShapePolygon *>(basicShapeValue);232 const CSSBasicShapePolygon* polygonValue = toCSSBasicShapePolygon(basicShapeValue); 233 233 RefPtr<BasicShapePolygon> polygon = BasicShapePolygon::create(); 234 234 … … 242 242 } 243 243 case CSSBasicShape::CSSBasicShapeInsetType: { 244 const CSSBasicShapeInset* rectValue = static_cast<const CSSBasicShapeInset* >(basicShapeValue);244 const CSSBasicShapeInset* rectValue = toCSSBasicShapeInset(basicShapeValue); 245 245 RefPtr<BasicShapeInset> rect = BasicShapeInset::create(); 246 246 -
trunk/Source/WebCore/css/CSSBasicShapes.cpp
r173177 r173259 129 129 return false; 130 130 131 const CSSBasicShapeCircle& other = static_cast<const CSSBasicShapeCircle&>(shape);131 const CSSBasicShapeCircle& other = toCSSBasicShapeCircle(shape); 132 132 return compareCSSValuePtr(m_centerX, other.m_centerX) 133 133 && compareCSSValuePtr(m_centerY, other.m_centerY) … … 202 202 return false; 203 203 204 const CSSBasicShapeEllipse& other = static_cast<const CSSBasicShapeEllipse&>(shape);204 const CSSBasicShapeEllipse& other = toCSSBasicShapeEllipse(shape); 205 205 return compareCSSValuePtr(m_centerX, other.m_centerX) 206 206 && compareCSSValuePtr(m_centerY, other.m_centerY) … … 273 273 return false; 274 274 275 const CSSBasicShapePolygon& rhs = static_cast<const CSSBasicShapePolygon&>(shape);275 const CSSBasicShapePolygon& rhs = toCSSBasicShapePolygon(shape); 276 276 return compareCSSValuePtr(m_referenceBox, rhs.m_referenceBox) 277 277 && compareCSSValueVector<CSSPrimitiveValue>(m_values, rhs.m_values); … … 408 408 return false; 409 409 410 const CSSBasicShapeInset& other = static_cast<const CSSBasicShapeInset&>(shape);410 const CSSBasicShapeInset& other = toCSSBasicShapeInset(shape); 411 411 return compareCSSValuePtr(m_top, other.m_top) 412 412 && compareCSSValuePtr(m_right, other.m_right) -
trunk/Source/WebCore/css/CSSBasicShapes.h
r173177 r173259 63 63 }; 64 64 65 #define CSS_BASIC_SHAPES_TYPE_CASTS(ToValueTypeName, predicate) \ 66 TYPE_CASTS_BASE(ToValueTypeName, CSSBasicShape, basicShape, basicShape->type() == predicate, basicShape.type() == predicate) 67 65 68 class CSSBasicShapeInset : public CSSBasicShape { 66 69 public: … … 128 131 }; 129 132 133 CSS_BASIC_SHAPES_TYPE_CASTS(CSSBasicShapeInset, CSSBasicShape::CSSBasicShapeInsetType) 134 130 135 class CSSBasicShapeCircle : public CSSBasicShape { 131 136 public: … … 151 156 RefPtr<CSSPrimitiveValue> m_radius; 152 157 }; 158 159 CSS_BASIC_SHAPES_TYPE_CASTS(CSSBasicShapeCircle, CSSBasicShape::CSSBasicShapeCircleType) 153 160 154 161 class CSSBasicShapeEllipse : public CSSBasicShape { … … 179 186 }; 180 187 188 CSS_BASIC_SHAPES_TYPE_CASTS(CSSBasicShapeEllipse, CSSBasicShape::CSSBasicShapeEllipseType) 189 181 190 class CSSBasicShapePolygon : public CSSBasicShape { 182 191 public: … … 210 219 }; 211 220 221 CSS_BASIC_SHAPES_TYPE_CASTS(CSSBasicShapePolygon, CSSBasicShape::CSSBasicShapePolygonType) 222 212 223 } // namespace WebCore 213 224
Note: See TracChangeset
for help on using the changeset viewer.