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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 addProperty(propId, list.release(), important); | 1187 addProperty(propId, list.release(), important); |
1188 return true; | 1188 return true; |
1189 } | 1189 } |
1190 | 1190 |
1191 case CSSPropertyMotion: | 1191 case CSSPropertyMotion: |
1192 // <motion-path> && <motion-position> && <motion-rotation> | 1192 // <motion-path> && <motion-position> && <motion-rotation> |
1193 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | 1193 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); |
1194 return parseShorthand(propId, parsingShorthandForProperty(CSSPropertyMot
ion), important); | 1194 return parseShorthand(propId, parsingShorthandForProperty(CSSPropertyMot
ion), important); |
1195 case CSSPropertyMotionPath: | 1195 case CSSPropertyMotionPath: |
1196 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | 1196 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); |
1197 parsedValue = parseMotionPath(); | 1197 if (id == CSSValueNone) |
| 1198 validPrimitive = true; |
| 1199 else |
| 1200 parsedValue = parseMotionPath(); |
1198 break; | 1201 break; |
1199 case CSSPropertyMotionPosition: | 1202 case CSSPropertyMotionPosition: |
1200 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | 1203 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); |
1201 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg))
; | 1204 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg))
; |
1202 break; | 1205 break; |
1203 case CSSPropertyMotionRotation: | 1206 case CSSPropertyMotionRotation: |
1204 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); | 1207 ASSERT(RuntimeEnabledFeatures::cssMotionPathEnabled()); |
1205 parsedValue = parseMotionRotation(); | 1208 parsedValue = parseMotionRotation(); |
1206 break; | 1209 break; |
1207 | 1210 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 validPrimitive = true; | 1512 validPrimitive = true; |
1510 } else if (value->unit == CSSParserValue::Function) { | 1513 } else if (value->unit == CSSParserValue::Function) { |
1511 parsedValue = parseBasicShape(); | 1514 parsedValue = parseBasicShape(); |
1512 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { | 1515 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { |
1513 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::CSS_URI); | 1516 parsedValue = CSSPrimitiveValue::create(value->string, CSSPrimitiveV
alue::CSS_URI); |
1514 addProperty(propId, parsedValue.release(), important); | 1517 addProperty(propId, parsedValue.release(), important); |
1515 return true; | 1518 return true; |
1516 } | 1519 } |
1517 break; | 1520 break; |
1518 case CSSPropertyShapeOutside: | 1521 case CSSPropertyShapeOutside: |
1519 parsedValue = parseShapeProperty(propId); | 1522 if (id == CSSValueNone) |
| 1523 validPrimitive = true; |
| 1524 else |
| 1525 parsedValue = parseShapeProperty(propId); |
1520 break; | 1526 break; |
1521 case CSSPropertyShapeMargin: | 1527 case CSSPropertyShapeMargin: |
1522 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg))
; | 1528 validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg))
; |
1523 break; | 1529 break; |
1524 case CSSPropertyShapeImageThreshold: | 1530 case CSSPropertyShapeImageThreshold: |
1525 validPrimitive = (!id && validUnit(value, FNumber)); | 1531 validPrimitive = (!id && validUnit(value, FNumber)); |
1526 break; | 1532 break; |
1527 | 1533 |
1528 case CSSPropertyTouchAction: | 1534 case CSSPropertyTouchAction: |
1529 parsedValue = parseTouchAction(); | 1535 parsedValue = parseTouchAction(); |
1530 break; | 1536 break; |
1531 | 1537 |
1532 case CSSPropertyScrollBlocksOn: | 1538 case CSSPropertyScrollBlocksOn: |
1533 parsedValue = parseScrollBlocksOn(); | 1539 if (id == CSSValueNone) |
| 1540 validPrimitive = true; |
| 1541 else |
| 1542 parsedValue = parseScrollBlocksOn(); |
1534 break; | 1543 break; |
1535 | 1544 |
1536 case CSSPropertyAlignContent: | 1545 case CSSPropertyAlignContent: |
1537 parsedValue = parseContentDistributionOverflowPosition(); | 1546 parsedValue = parseContentDistributionOverflowPosition(); |
1538 break; | 1547 break; |
1539 | 1548 |
1540 case CSSPropertyAlignSelf: | 1549 case CSSPropertyAlignSelf: |
1541 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 1550 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
1542 return parseItemPositionOverflowPosition(propId, important); | 1551 return parseItemPositionOverflowPosition(propId, important); |
1543 | 1552 |
(...skipping 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4404 return true; | 4413 return true; |
4405 default: | 4414 default: |
4406 break; | 4415 break; |
4407 } | 4416 } |
4408 | 4417 |
4409 return false; | 4418 return false; |
4410 } | 4419 } |
4411 | 4420 |
4412 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseShapeProperty(CSSProper
tyID propId) | 4421 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseShapeProperty(CSSProper
tyID propId) |
4413 { | 4422 { |
4414 CSSParserValue* value = m_valueList->current(); | |
4415 CSSValueID valueId = value->id; | |
4416 | |
4417 if (valueId == CSSValueNone) { | |
4418 RefPtrWillBeRawPtr<CSSPrimitiveValue> keywordValue = parseValidPrimitive
(valueId, value); | |
4419 m_valueList->next(); | |
4420 return keywordValue.release(); | |
4421 } | |
4422 | |
4423 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr; | 4423 RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr; |
4424 if (valueId != CSSValueNone && parseFillImage(m_valueList, imageValue)) { | 4424 if (parseFillImage(m_valueList, imageValue)) { |
4425 m_valueList->next(); | 4425 m_valueList->next(); |
4426 return imageValue.release(); | 4426 return imageValue.release(); |
4427 } | 4427 } |
4428 | 4428 |
4429 return parseBasicShapeAndOrBox(); | 4429 return parseBasicShapeAndOrBox(); |
4430 } | 4430 } |
4431 | 4431 |
4432 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseBasicShapeAndOrBox() | 4432 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseBasicShapeAndOrBox() |
4433 { | 4433 { |
4434 CSSParserValue* value = m_valueList->current(); | 4434 CSSParserValue* value = m_valueList->current(); |
(...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7486 } | 7486 } |
7487 | 7487 |
7488 if (list->length()) | 7488 if (list->length()) |
7489 return list.release(); | 7489 return list.release(); |
7490 | 7490 |
7491 return nullptr; | 7491 return nullptr; |
7492 } | 7492 } |
7493 | 7493 |
7494 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollBlocksOn() | 7494 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollBlocksOn() |
7495 { | 7495 { |
| 7496 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; |
7496 CSSParserValue* value = m_valueList->current(); | 7497 CSSParserValue* value = m_valueList->current(); |
7497 if (value->id == CSSValueNone) { | |
7498 m_valueList->next(); | |
7499 return cssValuePool().createIdentifierValue(CSSValueNone); | |
7500 } | |
7501 | |
7502 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated()
; | |
7503 while (value) { | 7498 while (value) { |
7504 switch (value->id) { | 7499 switch (value->id) { |
7505 case CSSValueStartTouch: | 7500 case CSSValueStartTouch: |
7506 case CSSValueWheelEvent: | 7501 case CSSValueWheelEvent: |
7507 case CSSValueScrollEvent: { | 7502 case CSSValueScrollEvent: { |
7508 RefPtrWillBeRawPtr<CSSValue> flagValue = cssValuePool().createIdenti
fierValue(value->id); | 7503 RefPtrWillBeRawPtr<CSSValue> flagValue = cssValuePool().createIdenti
fierValue(value->id); |
7509 if (list->hasValue(flagValue.get())) | 7504 if (list->hasValue(flagValue.get())) |
7510 return nullptr; | 7505 return nullptr; |
7511 list->append(flagValue.release()); | 7506 list->append(flagValue.release()); |
7512 break; | 7507 break; |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8526 | 8521 |
8527 argNumber++; | 8522 argNumber++; |
8528 } | 8523 } |
8529 | 8524 |
8530 return transformValue.release(); | 8525 return transformValue.release(); |
8531 } | 8526 } |
8532 | 8527 |
8533 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionPath() | 8528 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseMotionPath() |
8534 { | 8529 { |
8535 CSSParserValue* value = m_valueList->current(); | 8530 CSSParserValue* value = m_valueList->current(); |
8536 if (value->id == CSSValueNone) { | |
8537 m_valueList->next(); | |
8538 return cssValuePool().createIdentifierValue(CSSValueNone); | |
8539 } | |
8540 | 8531 |
8541 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. | 8532 // FIXME: Add support for <url>, <basic-shape>, <geometry-box>. |
8542 if (value->unit != CSSParserValue::Function || value->function->id != CSSVal
uePath) | 8533 if (value->unit != CSSParserValue::Function || value->function->id != CSSVal
uePath) |
8543 return nullptr; | 8534 return nullptr; |
8544 | 8535 |
8545 // FIXME: Add support for <fill-rule>. | 8536 // FIXME: Add support for <fill-rule>. |
8546 CSSParserValueList* functionArgs = value->function->args.get(); | 8537 CSSParserValueList* functionArgs = value->function->args.get(); |
8547 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) | 8538 if (!functionArgs || functionArgs->size() != 1 || !functionArgs->current()) |
8548 return nullptr; | 8539 return nullptr; |
8549 | 8540 |
(...skipping 28 matching lines...) Expand all Loading... |
8578 } | 8569 } |
8579 } | 8570 } |
8580 | 8571 |
8581 if (!list->length()) | 8572 if (!list->length()) |
8582 return nullptr; | 8573 return nullptr; |
8583 | 8574 |
8584 return list.release(); | 8575 return list.release(); |
8585 } | 8576 } |
8586 | 8577 |
8587 } // namespace blink | 8578 } // namespace blink |
OLD | NEW |