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 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/css/parser/CSSPropertyParser.h" | 28 #include "core/css/parser/CSSPropertyParser.h" |
29 | 29 |
30 #include "core/StylePropertyShorthand.h" | 30 #include "core/StylePropertyShorthand.h" |
31 #include "core/css/CSSBasicShapeValues.h" | 31 #include "core/css/CSSBasicShapeValues.h" |
32 #include "core/css/CSSBorderImage.h" | 32 #include "core/css/CSSBorderImage.h" |
33 #include "core/css/CSSContentDistributionValue.h" | 33 #include "core/css/CSSContentDistributionValue.h" |
34 #include "core/css/CSSCounterValue.h" | 34 #include "core/css/CSSCounterValue.h" |
35 #include "core/css/CSSCrossfadeValue.h" | 35 #include "core/css/CSSCrossfadeValue.h" |
36 #include "core/css/CSSCursorImageValue.h" | |
37 #include "core/css/CSSCustomIdentValue.h" | 36 #include "core/css/CSSCustomIdentValue.h" |
38 #include "core/css/CSSFunctionValue.h" | 37 #include "core/css/CSSFunctionValue.h" |
39 #include "core/css/CSSGridLineNamesValue.h" | 38 #include "core/css/CSSGridLineNamesValue.h" |
40 #include "core/css/CSSImageSetValue.h" | 39 #include "core/css/CSSImageSetValue.h" |
41 #include "core/css/CSSImageValue.h" | 40 #include "core/css/CSSImageValue.h" |
42 #include "core/css/CSSPrimitiveValueMappings.h" | 41 #include "core/css/CSSPrimitiveValueMappings.h" |
43 #include "core/css/CSSProperty.h" | 42 #include "core/css/CSSProperty.h" |
44 #include "core/css/CSSPropertyMetadata.h" | 43 #include "core/css/CSSPropertyMetadata.h" |
45 #include "core/css/CSSQuadValue.h" | 44 #include "core/css/CSSQuadValue.h" |
46 #include "core/css/CSSReflectValue.h" | 45 #include "core/css/CSSReflectValue.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser Value::Identifier); | 252 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser Value::Identifier); |
254 return CSSStringValue::create(value->string); | 253 return CSSStringValue::create(value->string); |
255 } | 254 } |
256 | 255 |
257 inline PassRefPtrWillBeRawPtr<CSSCustomIdentValue> CSSPropertyParser::createPrim itiveCustomIdentValue(CSSParserValue* value) | 256 inline PassRefPtrWillBeRawPtr<CSSCustomIdentValue> CSSPropertyParser::createPrim itiveCustomIdentValue(CSSParserValue* value) |
258 { | 257 { |
259 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser Value::Identifier); | 258 ASSERT(value->m_unit == CSSParserValue::String || value->m_unit == CSSParser Value::Identifier); |
260 return CSSCustomIdentValue::create(value->string); | 259 return CSSCustomIdentValue::create(value->string); |
261 } | 260 } |
262 | 261 |
263 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi thReferrer(const AtomicString& rawValue, const KURL& url) | 262 /*inline*/ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageVal ueWithReferrer(const AtomicString& rawValue, const KURL& url) |
Timothy Loh
2015/11/20 04:09:07
?
| |
264 { | 263 { |
265 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur l); | 264 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur l); |
266 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); | 265 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); |
267 return imageValue; | 266 return imageValue; |
268 } | 267 } |
269 | 268 |
270 static inline bool isComma(CSSParserValue* value) | 269 static inline bool isComma(CSSParserValue* value) |
271 { | 270 { |
272 ASSERT(value); | 271 ASSERT(value); |
273 return value->m_unit == CSSParserValue::Operator && value->iValue == ','; | 272 return value->m_unit == CSSParserValue::Operator && value->iValue == ','; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 case CSSPropertyBorderTopColor: // <color> | inherit | 422 case CSSPropertyBorderTopColor: // <color> | inherit |
424 case CSSPropertyBorderRightColor: | 423 case CSSPropertyBorderRightColor: |
425 case CSSPropertyBorderBottomColor: | 424 case CSSPropertyBorderBottomColor: |
426 case CSSPropertyBorderLeftColor: | 425 case CSSPropertyBorderLeftColor: |
427 case CSSPropertyWebkitColumnRuleColor: | 426 case CSSPropertyWebkitColumnRuleColor: |
428 parsedValue = parseColor(m_valueList->current(), acceptQuirkyColors(prop Id)); | 427 parsedValue = parseColor(m_valueList->current(), acceptQuirkyColors(prop Id)); |
429 if (parsedValue) | 428 if (parsedValue) |
430 m_valueList->next(); | 429 m_valueList->next(); |
431 break; | 430 break; |
432 | 431 |
433 case CSSPropertyCursor: { | |
434 // Grammar defined by CSS3 UI and modified by CSS4 images: | |
435 // [ [<image> [<x> <y>]?,]* | |
436 // [ auto | crosshair | default | pointer | progress | move | e-resize | ne-resize | | |
437 // nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | ew-resize | | |
438 // ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | tex t | wait | help | | |
439 // vertical-text | cell | context-menu | alias | copy | no-drop | not-al lowed | all-scroll | | |
440 // zoom-in | zoom-out | -webkit-grab | -webkit-grabbing | -webkit-zoom-i n | -webkit-zoom-out ] ] | inherit | |
441 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; | |
442 while (value) { | |
443 RefPtrWillBeRawPtr<CSSValue> image = nullptr; | |
444 if (value->m_unit == CSSParserValue::URI) { | |
445 AtomicString uri = value->string; | |
446 if (!uri.isNull()) | |
447 image = createCSSImageValueWithReferrer(uri, completeURL(uri )); | |
448 } else if (value->m_unit == CSSParserValue::Function && value->funct ion->id == CSSValueWebkitImageSet) { | |
449 image = parseImageSet(m_valueList); | |
450 if (!image) | |
451 break; | |
452 } else | |
453 break; | |
454 | |
455 Vector<int> coords; | |
456 value = m_valueList->next(); | |
457 while (value && validUnit(value, FNumber)) { | |
458 coords.append(int(value->fValue)); | |
459 value = m_valueList->next(); | |
460 } | |
461 bool hotSpotSpecified = false; | |
462 IntPoint hotSpot(-1, -1); | |
463 int nrcoords = coords.size(); | |
464 if (nrcoords > 0 && nrcoords != 2) | |
465 return false; | |
466 if (nrcoords == 2) { | |
467 hotSpotSpecified = true; | |
468 hotSpot = IntPoint(coords[0], coords[1]); | |
469 } | |
470 | |
471 if (!list) | |
472 list = CSSValueList::createCommaSeparated(); | |
473 | |
474 if (image) | |
475 list->append(CSSCursorImageValue::create(image, hotSpotSpecified , hotSpot)); | |
476 | |
477 if (!consumeComma(m_valueList)) | |
478 return false; | |
479 value = m_valueList->current(); | |
480 } | |
481 if (value && m_context.useCounter()) { | |
482 if (value->id == CSSValueWebkitZoomIn) | |
483 m_context.useCounter()->count(UseCounter::PrefixedCursorZoomIn); | |
484 else if (value->id == CSSValueWebkitZoomOut) | |
485 m_context.useCounter()->count(UseCounter::PrefixedCursorZoomOut) ; | |
486 } | |
487 if (list) { | |
488 if (!value) | |
489 return false; | |
490 if (inQuirksMode() && value->id == CSSValueHand) // MSIE 5 compatibi lity :/ | |
491 list->append(cssValuePool().createIdentifierValue(CSSValuePointe r)); | |
492 else if ((value->id >= CSSValueAuto && value->id <= CSSValueWebkitZo omOut) || value->id == CSSValueCopy || value->id == CSSValueNone) | |
493 list->append(cssValuePool().createIdentifierValue(value->id)); | |
494 m_valueList->next(); | |
495 parsedValue = list.release(); | |
496 break; | |
497 } else if (value) { | |
498 id = value->id; | |
499 if (inQuirksMode() && value->id == CSSValueHand) { // MSIE 5 compati bility :/ | |
500 id = CSSValuePointer; | |
501 validPrimitive = true; | |
502 } else if ((value->id >= CSSValueAuto && value->id <= CSSValueWebkit ZoomOut) || value->id == CSSValueCopy || value->id == CSSValueNone) | |
503 validPrimitive = true; | |
504 } else { | |
505 ASSERT_NOT_REACHED(); | |
506 return false; | |
507 } | |
508 break; | |
509 } | |
510 case CSSPropertyImageOrientation: | 432 case CSSPropertyImageOrientation: |
511 if (RuntimeEnabledFeatures::imageOrientationEnabled()) | 433 if (RuntimeEnabledFeatures::imageOrientationEnabled()) |
512 validPrimitive = value->id == CSSValueFromImage || (value->unit() != CSSPrimitiveValue::UnitType::Number && validUnit(value, FAngle) && value->fValu e == 0); | 434 validPrimitive = value->id == CSSValueFromImage || (value->unit() != CSSPrimitiveValue::UnitType::Number && validUnit(value, FAngle) && value->fValu e == 0); |
513 break; | 435 break; |
514 | 436 |
515 case CSSPropertyBackgroundBlendMode: | 437 case CSSPropertyBackgroundBlendMode: |
516 case CSSPropertyBackgroundAttachment: | 438 case CSSPropertyBackgroundAttachment: |
517 case CSSPropertyBackgroundClip: | 439 case CSSPropertyBackgroundClip: |
518 case CSSPropertyWebkitBackgroundClip: | 440 case CSSPropertyWebkitBackgroundClip: |
519 case CSSPropertyWebkitBackgroundComposite: | 441 case CSSPropertyWebkitBackgroundComposite: |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1152 case CSSPropertyPaintOrder: | 1074 case CSSPropertyPaintOrder: |
1153 case CSSPropertyMarker: | 1075 case CSSPropertyMarker: |
1154 case CSSPropertyMarkerStart: | 1076 case CSSPropertyMarkerStart: |
1155 case CSSPropertyMarkerMid: | 1077 case CSSPropertyMarkerMid: |
1156 case CSSPropertyMarkerEnd: | 1078 case CSSPropertyMarkerEnd: |
1157 case CSSPropertyFlex: | 1079 case CSSPropertyFlex: |
1158 case CSSPropertyFlexBasis: | 1080 case CSSPropertyFlexBasis: |
1159 case CSSPropertyFlexGrow: | 1081 case CSSPropertyFlexGrow: |
1160 case CSSPropertyFlexShrink: | 1082 case CSSPropertyFlexShrink: |
1161 case CSSPropertyFlexFlow: | 1083 case CSSPropertyFlexFlow: |
1084 case CSSPropertyCursor: | |
1162 validPrimitive = false; | 1085 validPrimitive = false; |
1163 break; | 1086 break; |
1164 | 1087 |
1165 case CSSPropertyScrollSnapPointsX: | 1088 case CSSPropertyScrollSnapPointsX: |
1166 case CSSPropertyScrollSnapPointsY: | 1089 case CSSPropertyScrollSnapPointsY: |
1167 parsedValue = parseScrollSnapPoints(); | 1090 parsedValue = parseScrollSnapPoints(); |
1168 break; | 1091 break; |
1169 case CSSPropertyScrollSnapCoordinate: | 1092 case CSSPropertyScrollSnapCoordinate: |
1170 parsedValue = parseScrollSnapCoordinate(); | 1093 parsedValue = parseScrollSnapCoordinate(); |
1171 break; | 1094 break; |
(...skipping 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5507 value = m_valueList->current(); | 5430 value = m_valueList->current(); |
5508 if (commaConsumed && !value) | 5431 if (commaConsumed && !value) |
5509 return nullptr; | 5432 return nullptr; |
5510 } | 5433 } |
5511 if (!validPrimitive) | 5434 if (!validPrimitive) |
5512 return nullptr; | 5435 return nullptr; |
5513 return ret.release(); | 5436 return ret.release(); |
5514 } | 5437 } |
5515 | 5438 |
5516 } // namespace blink | 5439 } // namespace blink |
OLD | NEW |