OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 4132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4143 return nullptr; | 4143 return nullptr; |
4144 | 4144 |
4145 return createPrimitiveNumericValue(value); | 4145 return createPrimitiveNumericValue(value); |
4146 } | 4146 } |
4147 | 4147 |
4148 PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeCircle(C
SSParserValueList* args) | 4148 PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeCircle(C
SSParserValueList* args) |
4149 { | 4149 { |
4150 ASSERT(args); | 4150 ASSERT(args); |
4151 | 4151 |
4152 // circle(radius) | 4152 // circle(radius) |
4153 // circle(radius at <position> | 4153 // circle(radius at <position>) |
4154 // circle(at <position>) | 4154 // circle(at <position>) |
4155 // where position defines centerX and centerY using a CSS <position> data ty
pe. | 4155 // where position defines centerX and centerY using a CSS <position> data ty
pe. |
4156 RefPtrWillBeRawPtr<CSSBasicShapeCircle> shape = CSSBasicShapeCircle::create(
); | 4156 RefPtrWillBeRawPtr<CSSBasicShapeCircle> shape = CSSBasicShapeCircle::create(
); |
4157 | 4157 |
4158 for (CSSParserValue* argument = args->current(); argument; argument = args->
next()) { | 4158 for (CSSParserValue* argument = args->current(); argument; argument = args->
next()) { |
4159 // The call to parseFillPosition below should consume all of the | 4159 // The call to parseFillPosition below should consume all of the |
4160 // arguments except the first two. Thus, and index greater than one | 4160 // arguments except the first two. Thus, and index greater than one |
4161 // indicates an invalid production. | 4161 // indicates an invalid production. |
4162 if (args->currentIndex() > 1) | 4162 if (args->currentIndex() > 1) |
4163 return nullptr; | 4163 return nullptr; |
4164 | 4164 |
4165 if (!args->currentIndex() && argument->id != CSSValueAt) { | 4165 if (!args->currentIndex() && argument->id != CSSValueAt) { |
4166 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(
argument)) { | 4166 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(
argument)) { |
4167 shape->setRadius(radius); | 4167 shape->setRadius(radius); |
4168 continue; | 4168 continue; |
4169 } | 4169 } |
4170 | 4170 |
4171 return nullptr; | 4171 return nullptr; |
4172 } | 4172 } |
4173 | 4173 |
4174 if (argument->id == CSSValueAt) { | 4174 if (argument->id == CSSValueAt && args->next()) { |
4175 RefPtrWillBeRawPtr<CSSValue> centerX; | 4175 RefPtrWillBeRawPtr<CSSValue> centerX; |
4176 RefPtrWillBeRawPtr<CSSValue> centerY; | 4176 RefPtrWillBeRawPtr<CSSValue> centerY; |
4177 args->next(); // set list to start of position center | |
4178 parseFillPosition(args, centerX, centerY); | 4177 parseFillPosition(args, centerX, centerY); |
4179 if (centerX && centerY && !args->current()) { | 4178 if (centerX && centerY && !args->current()) { |
4180 ASSERT(centerX->isPrimitiveValue()); | 4179 ASSERT(centerX->isPrimitiveValue()); |
4181 ASSERT(centerY->isPrimitiveValue()); | 4180 ASSERT(centerY->isPrimitiveValue()); |
4182 shape->setCenterX(toCSSPrimitiveValue(centerX.get())); | 4181 shape->setCenterX(toCSSPrimitiveValue(centerX.get())); |
4183 shape->setCenterY(toCSSPrimitiveValue(centerY.get())); | 4182 shape->setCenterY(toCSSPrimitiveValue(centerY.get())); |
4184 } else { | 4183 } else { |
4185 return nullptr; | 4184 return nullptr; |
4186 } | 4185 } |
4187 } else { | 4186 } else { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4240 if (argumentNumber < 3) | 4239 if (argumentNumber < 3) |
4241 return nullptr; | 4240 return nullptr; |
4242 return shape; | 4241 return shape; |
4243 } | 4242 } |
4244 | 4243 |
4245 PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeEllipse(
CSSParserValueList* args) | 4244 PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeEllipse(
CSSParserValueList* args) |
4246 { | 4245 { |
4247 ASSERT(args); | 4246 ASSERT(args); |
4248 | 4247 |
4249 // ellipse(radiusX) | 4248 // ellipse(radiusX) |
4250 // ellipse(radiusX at <position> | 4249 // ellipse(radiusX at <position>) |
4251 // ellipse(radiusX radiusY) | 4250 // ellipse(radiusX radiusY) |
4252 // ellipse(radiusX radiusY at <position> | 4251 // ellipse(radiusX radiusY at <position>) |
4253 // ellipse(at <position>) | 4252 // ellipse(at <position>) |
4254 // where position defines centerX and centerY using a CSS <position> data ty
pe. | 4253 // where position defines centerX and centerY using a CSS <position> data ty
pe. |
4255 RefPtrWillBeRawPtr<CSSBasicShapeEllipse> shape = CSSBasicShapeEllipse::creat
e(); | 4254 RefPtrWillBeRawPtr<CSSBasicShapeEllipse> shape = CSSBasicShapeEllipse::creat
e(); |
4256 | 4255 |
4257 for (CSSParserValue* argument = args->current(); argument; argument = args->
next()) { | 4256 for (CSSParserValue* argument = args->current(); argument; argument = args->
next()) { |
4258 // The call to parseFillPosition below should consume all of the | 4257 // The call to parseFillPosition below should consume all of the |
4259 // arguments except the first three. Thus, an index greater than two | 4258 // arguments except the first three. Thus, an index greater than two |
4260 // indicates an invalid production. | 4259 // indicates an invalid production. |
4261 if (args->currentIndex() > 2) | 4260 if (args->currentIndex() > 2) |
4262 return nullptr; | 4261 return nullptr; |
4263 | 4262 |
4264 if (args->currentIndex() < 2 && argument->id != CSSValueAt) { | 4263 if (args->currentIndex() < 2 && argument->id != CSSValueAt) { |
4265 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(
argument)) { | 4264 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = parseShapeRadius(
argument)) { |
4266 if (!shape->radiusX()) | 4265 if (!shape->radiusX()) |
4267 shape->setRadiusX(radius); | 4266 shape->setRadiusX(radius); |
4268 else | 4267 else |
4269 shape->setRadiusY(radius); | 4268 shape->setRadiusY(radius); |
4270 continue; | 4269 continue; |
4271 } | 4270 } |
4272 | 4271 |
4273 return nullptr; | 4272 return nullptr; |
4274 } | 4273 } |
4275 | 4274 |
4276 if (argument->id != CSSValueAt) | 4275 if (argument->id != CSSValueAt || !args->next()) // expecting ellipse(..
at <position>) |
4277 return nullptr; | 4276 return nullptr; |
4278 RefPtrWillBeRawPtr<CSSValue> centerX; | 4277 RefPtrWillBeRawPtr<CSSValue> centerX; |
4279 RefPtrWillBeRawPtr<CSSValue> centerY; | 4278 RefPtrWillBeRawPtr<CSSValue> centerY; |
4280 args->next(); // set list to start of position center | |
4281 parseFillPosition(args, centerX, centerY); | 4279 parseFillPosition(args, centerX, centerY); |
4282 if (!centerX || !centerY || args->current()) | 4280 if (!centerX || !centerY || args->current()) |
4283 return nullptr; | 4281 return nullptr; |
4284 | 4282 |
4285 ASSERT(centerX->isPrimitiveValue()); | 4283 ASSERT(centerX->isPrimitiveValue()); |
4286 ASSERT(centerY->isPrimitiveValue()); | 4284 ASSERT(centerY->isPrimitiveValue()); |
4287 shape->setCenterX(toCSSPrimitiveValue(centerX.get())); | 4285 shape->setCenterX(toCSSPrimitiveValue(centerX.get())); |
4288 shape->setCenterY(toCSSPrimitiveValue(centerY.get())); | 4286 shape->setCenterY(toCSSPrimitiveValue(centerY.get())); |
4289 } | 4287 } |
4290 | 4288 |
(...skipping 4164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8455 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8453 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8456 if (!seenStroke) | 8454 if (!seenStroke) |
8457 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8455 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
8458 if (!seenMarkers) | 8456 if (!seenMarkers) |
8459 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8457 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
8460 | 8458 |
8461 return parsedValues.release(); | 8459 return parsedValues.release(); |
8462 } | 8460 } |
8463 | 8461 |
8464 } // namespace WebCore | 8462 } // namespace WebCore |
OLD | NEW |