Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: sky/engine/core/css/parser/CSSPropertyParser.cpp

Issue 892903002: Remove -webkit-mask-*. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix goofups Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 } 620 }
621 break; 621 break;
622 } 622 }
623 623
624 case CSSPropertyBackgroundAttachment: 624 case CSSPropertyBackgroundAttachment:
625 case CSSPropertyBackgroundClip: 625 case CSSPropertyBackgroundClip:
626 case CSSPropertyWebkitBackgroundClip: 626 case CSSPropertyWebkitBackgroundClip:
627 case CSSPropertyWebkitBackgroundComposite: 627 case CSSPropertyWebkitBackgroundComposite:
628 case CSSPropertyBackgroundImage: 628 case CSSPropertyBackgroundImage:
629 case CSSPropertyBackgroundOrigin: 629 case CSSPropertyBackgroundOrigin:
630 case CSSPropertyMaskSourceType:
631 case CSSPropertyWebkitBackgroundOrigin: 630 case CSSPropertyWebkitBackgroundOrigin:
632 case CSSPropertyBackgroundPosition: 631 case CSSPropertyBackgroundPosition:
633 case CSSPropertyBackgroundPositionX: 632 case CSSPropertyBackgroundPositionX:
634 case CSSPropertyBackgroundPositionY: 633 case CSSPropertyBackgroundPositionY:
635 case CSSPropertyBackgroundSize: 634 case CSSPropertyBackgroundSize:
636 case CSSPropertyWebkitBackgroundSize: 635 case CSSPropertyWebkitBackgroundSize:
637 case CSSPropertyBackgroundRepeat: 636 case CSSPropertyBackgroundRepeat:
638 case CSSPropertyWebkitMaskClip:
639 case CSSPropertyWebkitMaskComposite:
640 case CSSPropertyWebkitMaskImage:
641 case CSSPropertyWebkitMaskOrigin:
642 case CSSPropertyWebkitMaskPosition:
643 case CSSPropertyWebkitMaskPositionX:
644 case CSSPropertyWebkitMaskPositionY:
645 case CSSPropertyWebkitMaskSize:
646 case CSSPropertyWebkitMaskRepeat:
647 case CSSPropertyWebkitMaskRepeatX:
648 case CSSPropertyWebkitMaskRepeatY:
649 { 637 {
650 RefPtr<CSSValue> val1 = nullptr; 638 RefPtr<CSSValue> val1 = nullptr;
651 RefPtr<CSSValue> val2 = nullptr; 639 RefPtr<CSSValue> val2 = nullptr;
652 CSSPropertyID propId1, propId2; 640 CSSPropertyID propId1, propId2;
653 bool result = false; 641 bool result = false;
654 if (parseFillProperty(propId, propId1, propId2, val1, val2)) { 642 if (parseFillProperty(propId, propId1, propId2, val1, val2)) {
655 if (propId == CSSPropertyBackgroundPosition || 643 if (propId == CSSPropertyBackgroundPosition ||
656 propId == CSSPropertyBackgroundRepeat || 644 propId == CSSPropertyBackgroundRepeat) {
657 propId == CSSPropertyWebkitMaskPosition ||
658 propId == CSSPropertyWebkitMaskRepeat) {
659 ShorthandScope scope(this, propId); 645 ShorthandScope scope(this, propId);
660 addProperty(propId1, val1.release()); 646 addProperty(propId1, val1.release());
661 if (val2) 647 if (val2)
662 addProperty(propId2, val2.release()); 648 addProperty(propId2, val2.release());
663 } else { 649 } else {
664 addProperty(propId1, val1.release()); 650 addProperty(propId1, val1.release());
665 if (val2) 651 if (val2)
666 addProperty(propId2, val2.release()); 652 addProperty(propId2, val2.release());
667 } 653 }
668 result = true; 654 result = true;
669 } 655 }
670 m_implicitShorthand = false; 656 m_implicitShorthand = false;
671 return result; 657 return result;
672 } 658 }
673 case CSSPropertyObjectPosition: 659 case CSSPropertyObjectPosition:
674 ASSERT(RuntimeEnabledFeatures::objectFitPositionEnabled()); 660 ASSERT(RuntimeEnabledFeatures::objectFitPositionEnabled());
675 parsedValue = parseObjectPosition(); 661 parsedValue = parseObjectPosition();
676 break; 662 break;
677 case CSSPropertyListStyleImage: // <uri> | none | inherit 663 case CSSPropertyListStyleImage: // <uri> | none | inherit
678 case CSSPropertyBorderImageSource: 664 case CSSPropertyBorderImageSource:
679 case CSSPropertyWebkitMaskBoxImageSource:
680 if (id == CSSValueNone) { 665 if (id == CSSValueNone) {
681 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); 666 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone);
682 m_valueList->next(); 667 m_valueList->next();
683 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { 668 } else if (value->unit == CSSPrimitiveValue::CSS_URI) {
684 parsedValue = createCSSImageValueWithReferrer(value->string, complet eURL(value->string)); 669 parsedValue = createCSSImageValueWithReferrer(value->string, complet eURL(value->string));
685 m_valueList->next(); 670 m_valueList->next();
686 } else if (isGeneratedImageValue(value)) { 671 } else if (isGeneratedImageValue(value)) {
687 if (parseGeneratedImage(m_valueList, parsedValue)) 672 if (parseGeneratedImage(m_valueList, parsedValue))
688 m_valueList->next(); 673 m_valueList->next();
689 else 674 else
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 parsedValue = parseFontFaceSrc(); 821 parsedValue = parseFontFaceSrc();
837 break; 822 break;
838 823
839 case CSSPropertyUnicodeRange: 824 case CSSPropertyUnicodeRange:
840 parsedValue = parseFontFaceUnicodeRange(); 825 parsedValue = parseFontFaceUnicodeRange();
841 break; 826 break;
842 827
843 /* CSS3 properties */ 828 /* CSS3 properties */
844 829
845 case CSSPropertyBorderImage: 830 case CSSPropertyBorderImage:
846 case CSSPropertyWebkitMaskBoxImage:
847 return parseBorderImageShorthand(propId); 831 return parseBorderImageShorthand(propId);
848 case CSSPropertyWebkitBorderImage: { 832 case CSSPropertyWebkitBorderImage: {
849 if (RefPtr<CSSValue> result = parseBorderImage(propId)) { 833 if (RefPtr<CSSValue> result = parseBorderImage(propId)) {
850 addProperty(propId, result); 834 addProperty(propId, result);
851 return true; 835 return true;
852 } 836 }
853 return false; 837 return false;
854 } 838 }
855 839
856 case CSSPropertyBorderImageOutset: 840 case CSSPropertyBorderImageOutset: {
857 case CSSPropertyWebkitMaskBoxImageOutset: {
858 RefPtr<CSSPrimitiveValue> result = nullptr; 841 RefPtr<CSSPrimitiveValue> result = nullptr;
859 if (parseBorderImageOutset(result)) { 842 if (parseBorderImageOutset(result)) {
860 addProperty(propId, result); 843 addProperty(propId, result);
861 return true; 844 return true;
862 } 845 }
863 break; 846 break;
864 } 847 }
865 case CSSPropertyBorderImageRepeat: 848 case CSSPropertyBorderImageRepeat: {
866 case CSSPropertyWebkitMaskBoxImageRepeat: {
867 RefPtr<CSSValue> result = nullptr; 849 RefPtr<CSSValue> result = nullptr;
868 if (parseBorderImageRepeat(result)) { 850 if (parseBorderImageRepeat(result)) {
869 addProperty(propId, result); 851 addProperty(propId, result);
870 return true; 852 return true;
871 } 853 }
872 break; 854 break;
873 } 855 }
874 case CSSPropertyBorderImageSlice: 856 case CSSPropertyBorderImageSlice: {
875 case CSSPropertyWebkitMaskBoxImageSlice: {
876 RefPtr<CSSBorderImageSliceValue> result = nullptr; 857 RefPtr<CSSBorderImageSliceValue> result = nullptr;
877 if (parseBorderImageSlice(propId, result)) { 858 if (parseBorderImageSlice(propId, result)) {
878 addProperty(propId, result); 859 addProperty(propId, result);
879 return true; 860 return true;
880 } 861 }
881 break; 862 break;
882 } 863 }
883 case CSSPropertyBorderImageWidth: 864 case CSSPropertyBorderImageWidth: {
884 case CSSPropertyWebkitMaskBoxImageWidth: {
885 RefPtr<CSSPrimitiveValue> result = nullptr; 865 RefPtr<CSSPrimitiveValue> result = nullptr;
886 if (parseBorderImageWidth(result)) { 866 if (parseBorderImageWidth(result)) {
887 addProperty(propId, result); 867 addProperty(propId, result);
888 return true; 868 return true;
889 } 869 }
890 break; 870 break;
891 } 871 }
892 case CSSPropertyBorderTopRightRadius: 872 case CSSPropertyBorderTopRightRadius:
893 case CSSPropertyBorderTopLeftRadius: 873 case CSSPropertyBorderTopLeftRadius:
894 case CSSPropertyBorderBottomLeftRadius: 874 case CSSPropertyBorderBottomLeftRadius:
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 1094
1115 /* shorthand properties */ 1095 /* shorthand properties */
1116 case CSSPropertyBackground: { 1096 case CSSPropertyBackground: {
1117 // Position must come before color in this array because a plain old "0" is a legal color 1097 // Position must come before color in this array because a plain old "0" is a legal color
1118 // in quirks mode but it's usually the X coordinate of a position. 1098 // in quirks mode but it's usually the X coordinate of a position.
1119 const CSSPropertyID properties[] = { CSSPropertyBackgroundImage, CSSProp ertyBackgroundRepeat, 1099 const CSSPropertyID properties[] = { CSSPropertyBackgroundImage, CSSProp ertyBackgroundRepeat,
1120 CSSPropertyBackgroundAttachment, CSSPropertyB ackgroundPosition, CSSPropertyBackgroundOrigin, 1100 CSSPropertyBackgroundAttachment, CSSPropertyB ackgroundPosition, CSSPropertyBackgroundOrigin,
1121 CSSPropertyBackgroundClip, CSSPropertyBackgro undColor, CSSPropertyBackgroundSize }; 1101 CSSPropertyBackgroundClip, CSSPropertyBackgro undColor, CSSPropertyBackgroundSize };
1122 return parseFillShorthand(propId, properties, WTF_ARRAY_LENGTH(propertie s)); 1102 return parseFillShorthand(propId, properties, WTF_ARRAY_LENGTH(propertie s));
1123 } 1103 }
1124 case CSSPropertyWebkitMask: {
1125 const CSSPropertyID properties[] = { CSSPropertyWebkitMaskImage, CSSProp ertyWebkitMaskRepeat,
1126 CSSPropertyWebkitMaskPosition, CSSPropertyWebkitMaskOrigin, CSSPrope rtyWebkitMaskClip, CSSPropertyWebkitMaskSize };
1127 return parseFillShorthand(propId, properties, WTF_ARRAY_LENGTH(propertie s));
1128 }
1129 case CSSPropertyBorder: 1104 case CSSPropertyBorder:
1130 // [ 'border-width' || 'border-style' || <color> ] | inherit 1105 // [ 'border-width' || 'border-style' || <color> ] | inherit
1131 { 1106 {
1132 if (parseShorthand(propId, parsingShorthandForProperty(CSSPropertyBorder ))) { 1107 if (parseShorthand(propId, parsingShorthandForProperty(CSSPropertyBorder ))) {
1133 // The CSS3 Borders and Backgrounds specification says that border a lso resets border-image. It's as 1108 // The CSS3 Borders and Backgrounds specification says that border a lso resets border-image. It's as
1134 // though a value of none was specified for the image. 1109 // though a value of none was specified for the image.
1135 addExpandedPropertyForValue(CSSPropertyBorderImage, cssValuePool().c reateImplicitInitialValue()); 1110 addExpandedPropertyForValue(CSSPropertyBorderImage, cssValuePool().c reateImplicitInitialValue());
1136 return true; 1111 return true;
1137 } 1112 }
1138 return false; 1113 return false;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 // We hit the end. Fill in all remaining values with the initial va lue. 1296 // We hit the end. Fill in all remaining values with the initial va lue.
1322 m_valueList->next(); 1297 m_valueList->next();
1323 for (i = 0; i < numProperties; ++i) { 1298 for (i = 0; i < numProperties; ++i) {
1324 if (properties[i] == CSSPropertyBackgroundColor && parsedPropert y[i]) 1299 if (properties[i] == CSSPropertyBackgroundColor && parsedPropert y[i])
1325 // Color is not allowed except as the last item in a list fo r backgrounds. 1300 // Color is not allowed except as the last item in a list fo r backgrounds.
1326 // Reject the entire property. 1301 // Reject the entire property.
1327 return false; 1302 return false;
1328 1303
1329 if (!parsedProperty[i] && properties[i] != CSSPropertyBackground Color) { 1304 if (!parsedProperty[i] && properties[i] != CSSPropertyBackground Color) {
1330 addFillValue(values[i], cssValuePool().createImplicitInitial Value()); 1305 addFillValue(values[i], cssValuePool().createImplicitInitial Value());
1331 if (properties[i] == CSSPropertyBackgroundPosition || proper ties[i] == CSSPropertyWebkitMaskPosition) 1306 if (properties[i] == CSSPropertyBackgroundPosition)
1332 addFillValue(positionYValue, cssValuePool().createImplic itInitialValue()); 1307 addFillValue(positionYValue, cssValuePool().createImplic itInitialValue());
1333 if (properties[i] == CSSPropertyBackgroundRepeat || properti es[i] == CSSPropertyWebkitMaskRepeat) 1308 if (properties[i] == CSSPropertyBackgroundRepeat)
1334 addFillValue(repeatYValue, cssValuePool().createImplicit InitialValue()); 1309 addFillValue(repeatYValue, cssValuePool().createImplicit InitialValue());
1335 if ((properties[i] == CSSPropertyBackgroundOrigin || propert ies[i] == CSSPropertyWebkitMaskOrigin) && !parsedProperty[i]) { 1310 if (properties[i] == CSSPropertyBackgroundOrigin && !parsedP roperty[i]) {
1336 // If background-origin wasn't present, then reset backg round-clip also. 1311 // If background-origin wasn't present, then reset backg round-clip also.
1337 addFillValue(clipValue, cssValuePool().createImplicitIni tialValue()); 1312 addFillValue(clipValue, cssValuePool().createImplicitIni tialValue());
1338 } 1313 }
1339 } 1314 }
1340 parsedProperty[i] = false; 1315 parsedProperty[i] = false;
1341 } 1316 }
1342 if (!m_valueList->current()) 1317 if (!m_valueList->current())
1343 break; 1318 break;
1344 } 1319 }
1345 1320
1346 bool sizeCSSPropertyExpected = false; 1321 bool sizeCSSPropertyExpected = false;
1347 if (isForwardSlashOperator(val) && foundPositionCSSProperty) { 1322 if (isForwardSlashOperator(val) && foundPositionCSSProperty) {
1348 sizeCSSPropertyExpected = true; 1323 sizeCSSPropertyExpected = true;
1349 m_valueList->next(); 1324 m_valueList->next();
1350 } 1325 }
1351 1326
1352 foundPositionCSSProperty = false; 1327 foundPositionCSSProperty = false;
1353 bool found = false; 1328 bool found = false;
1354 for (i = 0; !found && i < numProperties; ++i) { 1329 for (i = 0; !found && i < numProperties; ++i) {
1355 1330
1356 if (sizeCSSPropertyExpected && (properties[i] != CSSPropertyBackgrou ndSize && properties[i] != CSSPropertyWebkitMaskSize)) 1331 if (sizeCSSPropertyExpected && properties[i] != CSSPropertyBackgroun dSize)
1357 continue; 1332 continue;
1358 if (!sizeCSSPropertyExpected && (properties[i] == CSSPropertyBackgro undSize || properties[i] == CSSPropertyWebkitMaskSize)) 1333 if (!sizeCSSPropertyExpected && properties[i] == CSSPropertyBackgrou ndSize)
1359 continue; 1334 continue;
1360 1335
1361 if (!parsedProperty[i]) { 1336 if (!parsedProperty[i]) {
1362 RefPtr<CSSValue> val1 = nullptr; 1337 RefPtr<CSSValue> val1 = nullptr;
1363 RefPtr<CSSValue> val2 = nullptr; 1338 RefPtr<CSSValue> val2 = nullptr;
1364 CSSPropertyID propId1, propId2; 1339 CSSPropertyID propId1, propId2;
1365 CSSParserValue* parserValue = m_valueList->current(); 1340 CSSParserValue* parserValue = m_valueList->current();
1366 // parseFillProperty() may modify m_implicitShorthand, so we MUS T reset it 1341 // parseFillProperty() may modify m_implicitShorthand, so we MUS T reset it
1367 // before EACH return below. 1342 // before EACH return below.
1368 if (parseFillProperty(properties[i], propId1, propId2, val1, val 2)) { 1343 if (parseFillProperty(properties[i], propId1, propId2, val1, val 2)) {
1369 parsedProperty[i] = found = true; 1344 parsedProperty[i] = found = true;
1370 addFillValue(values[i], val1.release()); 1345 addFillValue(values[i], val1.release());
1371 if (properties[i] == CSSPropertyBackgroundPosition || proper ties[i] == CSSPropertyWebkitMaskPosition) 1346 if (properties[i] == CSSPropertyBackgroundPosition)
1372 addFillValue(positionYValue, val2.release()); 1347 addFillValue(positionYValue, val2.release());
1373 if (properties[i] == CSSPropertyBackgroundRepeat || properti es[i] == CSSPropertyWebkitMaskRepeat) 1348 if (properties[i] == CSSPropertyBackgroundRepeat)
1374 addFillValue(repeatYValue, val2.release()); 1349 addFillValue(repeatYValue, val2.release());
1375 if (properties[i] == CSSPropertyBackgroundOrigin || properti es[i] == CSSPropertyWebkitMaskOrigin) { 1350 if (properties[i] == CSSPropertyBackgroundOrigin) {
1376 // Reparse the value as a clip, and see if we succeed. 1351 // Reparse the value as a clip, and see if we succeed.
1377 if (parseBackgroundClip(parserValue, val1)) 1352 if (parseBackgroundClip(parserValue, val1))
1378 addFillValue(clipValue, val1.release()); // The prop erty parsed successfully. 1353 addFillValue(clipValue, val1.release()); // The prop erty parsed successfully.
1379 else 1354 else
1380 addFillValue(clipValue, cssValuePool().createImplici tInitialValue()); // Some value was used for origin that is not supported by cli p. Just reset clip instead. 1355 addFillValue(clipValue, cssValuePool().createImplici tInitialValue()); // Some value was used for origin that is not supported by cli p. Just reset clip instead.
1381 } 1356 }
1382 if (properties[i] == CSSPropertyBackgroundClip || properties [i] == CSSPropertyWebkitMaskClip) { 1357 if (properties[i] == CSSPropertyBackgroundClip) {
1383 // Update clipValue 1358 // Update clipValue
1384 addFillValue(clipValue, val1.release()); 1359 addFillValue(clipValue, val1.release());
1385 foundClip = true; 1360 foundClip = true;
1386 } 1361 }
1387 if (properties[i] == CSSPropertyBackgroundPosition || proper ties[i] == CSSPropertyWebkitMaskPosition) 1362 if (properties[i] == CSSPropertyBackgroundPosition)
1388 foundPositionCSSProperty = true; 1363 foundPositionCSSProperty = true;
1389 } 1364 }
1390 } 1365 }
1391 } 1366 }
1392 1367
1393 // if we didn't find at least one match, this is an 1368 // if we didn't find at least one match, this is an
1394 // invalid shorthand and we have to ignore it 1369 // invalid shorthand and we have to ignore it
1395 if (!found) { 1370 if (!found) {
1396 m_implicitShorthand = false; 1371 m_implicitShorthand = false;
1397 return false; 1372 return false;
1398 } 1373 }
1399 } 1374 }
1400 1375
1401 // Now add all of the properties we found. 1376 // Now add all of the properties we found.
1402 for (i = 0; i < numProperties; i++) { 1377 for (i = 0; i < numProperties; i++) {
1403 // Fill in any remaining properties with the initial value. 1378 // Fill in any remaining properties with the initial value.
1404 if (!parsedProperty[i]) { 1379 if (!parsedProperty[i]) {
1405 addFillValue(values[i], cssValuePool().createImplicitInitialValue()) ; 1380 addFillValue(values[i], cssValuePool().createImplicitInitialValue()) ;
1406 if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition) 1381 if (properties[i] == CSSPropertyBackgroundPosition)
1407 addFillValue(positionYValue, cssValuePool().createImplicitInitia lValue()); 1382 addFillValue(positionYValue, cssValuePool().createImplicitInitia lValue());
1408 if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] == CSSPropertyWebkitMaskRepeat) 1383 if (properties[i] == CSSPropertyBackgroundRepeat)
1409 addFillValue(repeatYValue, cssValuePool().createImplicitInitialV alue()); 1384 addFillValue(repeatYValue, cssValuePool().createImplicitInitialV alue());
1410 if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) { 1385 if (properties[i] == CSSPropertyBackgroundOrigin) {
1411 // If background-origin wasn't present, then reset background-cl ip also. 1386 // If background-origin wasn't present, then reset background-cl ip also.
1412 addFillValue(clipValue, cssValuePool().createImplicitInitialValu e()); 1387 addFillValue(clipValue, cssValuePool().createImplicitInitialValu e());
1413 } 1388 }
1414 } 1389 }
1415 if (properties[i] == CSSPropertyBackgroundPosition) { 1390 if (properties[i] == CSSPropertyBackgroundPosition) {
1416 addProperty(CSSPropertyBackgroundPositionX, values[i].release()); 1391 addProperty(CSSPropertyBackgroundPositionX, values[i].release());
1417 // it's OK to call positionYValue.release() since we only see CSSPro pertyBackgroundPosition once 1392 // it's OK to call positionYValue.release() since we only see CSSPro pertyBackgroundPosition once
1418 addProperty(CSSPropertyBackgroundPositionY, positionYValue.release() ); 1393 addProperty(CSSPropertyBackgroundPositionY, positionYValue.release() );
1419 } else if (properties[i] == CSSPropertyWebkitMaskPosition) {
1420 addProperty(CSSPropertyWebkitMaskPositionX, values[i].release());
1421 // it's OK to call positionYValue.release() since we only see CSSPro pertyWebkitMaskPosition once
1422 addProperty(CSSPropertyWebkitMaskPositionY, positionYValue.release() );
1423 } else if (properties[i] == CSSPropertyBackgroundRepeat) { 1394 } else if (properties[i] == CSSPropertyBackgroundRepeat) {
1424 addProperty(CSSPropertyBackgroundRepeatX, values[i].release()); 1395 addProperty(CSSPropertyBackgroundRepeatX, values[i].release());
1425 // it's OK to call repeatYValue.release() since we only see CSSPrope rtyBackgroundPosition once 1396 // it's OK to call repeatYValue.release() since we only see CSSPrope rtyBackgroundPosition once
1426 addProperty(CSSPropertyBackgroundRepeatY, repeatYValue.release()); 1397 addProperty(CSSPropertyBackgroundRepeatY, repeatYValue.release());
1427 } else if (properties[i] == CSSPropertyWebkitMaskRepeat) { 1398 } else if (properties[i] == CSSPropertyBackgroundClip && !foundClip)
1428 addProperty(CSSPropertyWebkitMaskRepeatX, values[i].release());
1429 // it's OK to call repeatYValue.release() since we only see CSSPrope rtyBackgroundPosition once
1430 addProperty(CSSPropertyWebkitMaskRepeatY, repeatYValue.release());
1431 } else if ((properties[i] == CSSPropertyBackgroundClip || properties[i] == CSSPropertyWebkitMaskClip) && !foundClip)
1432 // Value is already set while updating origin 1399 // Value is already set while updating origin
1433 continue; 1400 continue;
1434 else 1401 else
1435 addProperty(properties[i], values[i].release()); 1402 addProperty(properties[i], values[i].release());
1436 1403
1437 // Add in clip values when we hit the corresponding origin property. 1404 // Add in clip values when we hit the corresponding origin property.
1438 if (properties[i] == CSSPropertyBackgroundOrigin && !foundClip) 1405 if (properties[i] == CSSPropertyBackgroundOrigin && !foundClip)
1439 addProperty(CSSPropertyBackgroundClip, clipValue.release()); 1406 addProperty(CSSPropertyBackgroundClip, clipValue.release());
1440 else if (properties[i] == CSSPropertyWebkitMaskOrigin && !foundClip)
1441 addProperty(CSSPropertyWebkitMaskClip, clipValue.release());
1442 } 1407 }
1443 1408
1444 m_implicitShorthand = false; 1409 m_implicitShorthand = false;
1445 return true; 1410 return true;
1446 } 1411 }
1447 1412
1448 static bool isValidTransitionPropertyList(CSSValueList* value) 1413 static bool isValidTransitionPropertyList(CSSValueList* value)
1449 { 1414 {
1450 if (value->length() < 2) 1415 if (value->length() < 2)
1451 return true; 1416 return true;
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 RefPtr<CSSValue> value2 = nullptr; 2251 RefPtr<CSSValue> value2 = nullptr;
2287 2252
2288 bool allowComma = false; 2253 bool allowComma = false;
2289 2254
2290 retValue1 = retValue2 = nullptr; 2255 retValue1 = retValue2 = nullptr;
2291 propId1 = propId; 2256 propId1 = propId;
2292 propId2 = propId; 2257 propId2 = propId;
2293 if (propId == CSSPropertyBackgroundPosition) { 2258 if (propId == CSSPropertyBackgroundPosition) {
2294 propId1 = CSSPropertyBackgroundPositionX; 2259 propId1 = CSSPropertyBackgroundPositionX;
2295 propId2 = CSSPropertyBackgroundPositionY; 2260 propId2 = CSSPropertyBackgroundPositionY;
2296 } else if (propId == CSSPropertyWebkitMaskPosition) {
2297 propId1 = CSSPropertyWebkitMaskPositionX;
2298 propId2 = CSSPropertyWebkitMaskPositionY;
2299 } else if (propId == CSSPropertyBackgroundRepeat) { 2261 } else if (propId == CSSPropertyBackgroundRepeat) {
2300 propId1 = CSSPropertyBackgroundRepeatX; 2262 propId1 = CSSPropertyBackgroundRepeatX;
2301 propId2 = CSSPropertyBackgroundRepeatY; 2263 propId2 = CSSPropertyBackgroundRepeatY;
2302 } else if (propId == CSSPropertyWebkitMaskRepeat) {
2303 propId1 = CSSPropertyWebkitMaskRepeatX;
2304 propId2 = CSSPropertyWebkitMaskRepeatY;
2305 } 2264 }
2306 2265
2307 for (CSSParserValue* val = m_valueList->current(); val; val = m_valueList->c urrent()) { 2266 for (CSSParserValue* val = m_valueList->current(); val; val = m_valueList->c urrent()) {
2308 RefPtr<CSSValue> currValue = nullptr; 2267 RefPtr<CSSValue> currValue = nullptr;
2309 RefPtr<CSSValue> currValue2 = nullptr; 2268 RefPtr<CSSValue> currValue2 = nullptr;
2310 2269
2311 if (allowComma) { 2270 if (allowComma) {
2312 if (!isComma(val)) 2271 if (!isComma(val))
2313 return false; 2272 return false;
2314 m_valueList->next(); 2273 m_valueList->next();
2315 allowComma = false; 2274 allowComma = false;
2316 } else { 2275 } else {
2317 allowComma = true; 2276 allowComma = true;
2318 switch (propId) { 2277 switch (propId) {
2319 case CSSPropertyBackgroundColor: 2278 case CSSPropertyBackgroundColor:
2320 currValue = parseBackgroundColor(); 2279 currValue = parseBackgroundColor();
2321 if (currValue) 2280 if (currValue)
2322 m_valueList->next(); 2281 m_valueList->next();
2323 break; 2282 break;
2324 case CSSPropertyBackgroundAttachment: 2283 case CSSPropertyBackgroundAttachment:
2325 if (val->id == CSSValueFixed || val->id == CSSValueLocal) { 2284 if (val->id == CSSValueFixed || val->id == CSSValueLocal) {
2326 currValue = cssValuePool().createIdentifierValue(val->id ); 2285 currValue = cssValuePool().createIdentifierValue(val->id );
2327 m_valueList->next(); 2286 m_valueList->next();
2328 } 2287 }
2329 break; 2288 break;
2330 case CSSPropertyBackgroundImage: 2289 case CSSPropertyBackgroundImage:
2331 case CSSPropertyWebkitMaskImage:
2332 if (parseFillImage(m_valueList, currValue)) 2290 if (parseFillImage(m_valueList, currValue))
2333 m_valueList->next(); 2291 m_valueList->next();
2334 break; 2292 break;
2335 case CSSPropertyWebkitBackgroundClip: 2293 case CSSPropertyWebkitBackgroundClip:
2336 case CSSPropertyWebkitBackgroundOrigin: 2294 case CSSPropertyWebkitBackgroundOrigin:
2337 case CSSPropertyWebkitMaskClip:
2338 case CSSPropertyWebkitMaskOrigin:
2339 // The first three values here are deprecated and do not app ly to the version of the property that has 2295 // The first three values here are deprecated and do not app ly to the version of the property that has
2340 // the -webkit- prefix removed. 2296 // the -webkit- prefix removed.
2341 if (val->id == CSSValueBorder || val->id == CSSValuePadding || val->id == CSSValueContent || 2297 if (val->id == CSSValueBorder || val->id == CSSValuePadding || val->id == CSSValueContent ||
2342 val->id == CSSValueBorderBox || val->id == CSSValuePaddi ngBox || val->id == CSSValueContentBox || 2298 val->id == CSSValueBorderBox || val->id == CSSValuePaddi ngBox || val->id == CSSValueContentBox ||
2343 ((propId == CSSPropertyWebkitBackgroundClip || propId == CSSPropertyWebkitMaskClip) && 2299 (propId == CSSPropertyWebkitBackgroundClip &&
2344 (val->id == CSSValueText))) { 2300 (val->id == CSSValueText))) {
2345 currValue = cssValuePool().createIdentifierValue(val->id ); 2301 currValue = cssValuePool().createIdentifierValue(val->id );
2346 m_valueList->next(); 2302 m_valueList->next();
2347 } 2303 }
2348 break; 2304 break;
2349 case CSSPropertyBackgroundClip: 2305 case CSSPropertyBackgroundClip:
2350 if (parseBackgroundClip(val, currValue)) 2306 if (parseBackgroundClip(val, currValue))
2351 m_valueList->next(); 2307 m_valueList->next();
2352 break; 2308 break;
2353 case CSSPropertyBackgroundOrigin: 2309 case CSSPropertyBackgroundOrigin:
2354 if (val->id == CSSValueBorderBox || val->id == CSSValuePaddi ngBox || val->id == CSSValueContentBox) { 2310 if (val->id == CSSValueBorderBox || val->id == CSSValuePaddi ngBox || val->id == CSSValueContentBox) {
2355 currValue = cssValuePool().createIdentifierValue(val->id ); 2311 currValue = cssValuePool().createIdentifierValue(val->id );
2356 m_valueList->next(); 2312 m_valueList->next();
2357 } 2313 }
2358 break; 2314 break;
2359 case CSSPropertyBackgroundPosition: 2315 case CSSPropertyBackgroundPosition:
2360 case CSSPropertyWebkitMaskPosition:
2361 parseFillPosition(m_valueList, currValue, currValue2); 2316 parseFillPosition(m_valueList, currValue, currValue2);
2362 // parseFillPosition advances the m_valueList pointer. 2317 // parseFillPosition advances the m_valueList pointer.
2363 break; 2318 break;
2364 case CSSPropertyBackgroundPositionX: 2319 case CSSPropertyBackgroundPositionX: {
2365 case CSSPropertyWebkitMaskPositionX: {
2366 currValue = parseFillPositionX(m_valueList); 2320 currValue = parseFillPositionX(m_valueList);
2367 if (currValue) 2321 if (currValue)
2368 m_valueList->next(); 2322 m_valueList->next();
2369 break; 2323 break;
2370 } 2324 }
2371 case CSSPropertyBackgroundPositionY: 2325 case CSSPropertyBackgroundPositionY: {
2372 case CSSPropertyWebkitMaskPositionY: {
2373 currValue = parseFillPositionY(m_valueList); 2326 currValue = parseFillPositionY(m_valueList);
2374 if (currValue) 2327 if (currValue)
2375 m_valueList->next(); 2328 m_valueList->next();
2376 break; 2329 break;
2377 } 2330 }
2378 case CSSPropertyWebkitBackgroundComposite: 2331 case CSSPropertyWebkitBackgroundComposite:
2379 case CSSPropertyWebkitMaskComposite:
2380 if (val->id >= CSSValueClear && val->id <= CSSValuePlusLight er) { 2332 if (val->id >= CSSValueClear && val->id <= CSSValuePlusLight er) {
2381 currValue = cssValuePool().createIdentifierValue(val->id ); 2333 currValue = cssValuePool().createIdentifierValue(val->id );
2382 m_valueList->next(); 2334 m_valueList->next();
2383 } 2335 }
2384 break; 2336 break;
2385 case CSSPropertyBackgroundRepeat: 2337 case CSSPropertyBackgroundRepeat:
2386 case CSSPropertyWebkitMaskRepeat:
2387 parseFillRepeat(currValue, currValue2); 2338 parseFillRepeat(currValue, currValue2);
2388 // parseFillRepeat advances the m_valueList pointer 2339 // parseFillRepeat advances the m_valueList pointer
2389 break; 2340 break;
2390 case CSSPropertyBackgroundSize: 2341 case CSSPropertyBackgroundSize:
2391 case CSSPropertyWebkitBackgroundSize: 2342 case CSSPropertyWebkitBackgroundSize: {
2392 case CSSPropertyWebkitMaskSize: {
2393 currValue = parseFillSize(propId, allowComma); 2343 currValue = parseFillSize(propId, allowComma);
2394 if (currValue) 2344 if (currValue)
2395 m_valueList->next(); 2345 m_valueList->next();
2396 break; 2346 break;
2397 } 2347 }
2398 case CSSPropertyMaskSourceType: {
2399 ASSERT(RuntimeEnabledFeatures::cssMaskSourceTypeEnabled());
2400 if (val->id == CSSValueAuto || val->id == CSSValueAlpha || v al->id == CSSValueLuminance) {
2401 currValue = cssValuePool().createIdentifierValue(val->id );
2402 m_valueList->next();
2403 } else {
2404 currValue = nullptr;
2405 }
2406 break;
2407 }
2408 default: 2348 default:
2409 break; 2349 break;
2410 } 2350 }
2411 if (!currValue) 2351 if (!currValue)
2412 return false; 2352 return false;
2413 2353
2414 if (value && !values) { 2354 if (value && !values) {
2415 values = CSSValueList::createCommaSeparated(); 2355 values = CSSValueList::createCommaSeparated();
2416 values->append(value.release()); 2356 values->append(value.release());
2417 } 2357 }
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
4453 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require Outset = false; 4393 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require Outset = false;
4454 m_allowImageSlice = !m_imageSlice; 4394 m_allowImageSlice = !m_imageSlice;
4455 m_allowImage = !m_image; 4395 m_allowImage = !m_image;
4456 } 4396 }
4457 4397
4458 PassRefPtr<CSSValue> commitCSSValue() 4398 PassRefPtr<CSSValue> commitCSSValue()
4459 { 4399 {
4460 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth .get(), m_outset.get(), m_repeat.get()); 4400 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth .get(), m_outset.get(), m_repeat.get());
4461 } 4401 }
4462 4402
4463 void commitMaskBoxImage(CSSPropertyParser* parser)
4464 {
4465 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSource, parser, m _image);
4466 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSlice, parser, m_ imageSlice.get());
4467 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageWidth, parser, m_ borderWidth.get());
4468 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageOutset, parser, m _outset.get());
4469 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, parser, m _repeat.get());
4470 }
4471
4472 void commitBorderImage(CSSPropertyParser* parser) 4403 void commitBorderImage(CSSPropertyParser* parser)
4473 { 4404 {
4474 commitBorderImageProperty(CSSPropertyBorderImageSource, parser, m_image) ; 4405 commitBorderImageProperty(CSSPropertyBorderImageSource, parser, m_image) ;
4475 commitBorderImageProperty(CSSPropertyBorderImageSlice, parser, m_imageSl ice.get()); 4406 commitBorderImageProperty(CSSPropertyBorderImageSlice, parser, m_imageSl ice.get());
4476 commitBorderImageProperty(CSSPropertyBorderImageWidth, parser, m_borderW idth.get()); 4407 commitBorderImageProperty(CSSPropertyBorderImageWidth, parser, m_borderW idth.get());
4477 commitBorderImageProperty(CSSPropertyBorderImageOutset, parser, m_outset .get()); 4408 commitBorderImageProperty(CSSPropertyBorderImageOutset, parser, m_outset .get());
4478 commitBorderImageProperty(CSSPropertyBorderImageRepeat, parser, m_repeat ); 4409 commitBorderImageProperty(CSSPropertyBorderImageRepeat, parser, m_repeat );
4479 } 4410 }
4480 4411
4481 void commitBorderImageProperty(CSSPropertyID propId, CSSPropertyParser* pars er, PassRefPtr<CSSValue> value) 4412 void commitBorderImageProperty(CSSPropertyID propId, CSSPropertyParser* pars er, PassRefPtr<CSSValue> value)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4565 parser.m_valueList->next(); 4496 parser.m_valueList->next();
4566 } 4497 }
4567 4498
4568 return context.allowCommit(); 4499 return context.allowCommit();
4569 } 4500 }
4570 4501
4571 bool CSSPropertyParser::parseBorderImageShorthand(CSSPropertyID propId) 4502 bool CSSPropertyParser::parseBorderImageShorthand(CSSPropertyID propId)
4572 { 4503 {
4573 BorderImageParseContext context; 4504 BorderImageParseContext context;
4574 if (BorderImageParseContext::buildFromParser(*this, propId, context)) { 4505 if (BorderImageParseContext::buildFromParser(*this, propId, context)) {
4575 switch (propId) { 4506 ASSERT(propId == CSSPropertyBorderImage);
4576 case CSSPropertyWebkitMaskBoxImage: 4507 context.commitBorderImage(this);
4577 context.commitMaskBoxImage(this); 4508 return true;
4578 return true;
4579 case CSSPropertyBorderImage:
4580 context.commitBorderImage(this);
4581 return true;
4582 default:
4583 ASSERT_NOT_REACHED();
4584 return false;
4585 }
4586 } 4509 }
4587 return false; 4510 return false;
4588 } 4511 }
4589 4512
4590 PassRefPtr<CSSValue> CSSPropertyParser::parseBorderImage(CSSPropertyID propId) 4513 PassRefPtr<CSSValue> CSSPropertyParser::parseBorderImage(CSSPropertyID propId)
4591 { 4514 {
4592 BorderImageParseContext context; 4515 BorderImageParseContext context;
4593 if (BorderImageParseContext::buildFromParser(*this, propId, context)) { 4516 if (BorderImageParseContext::buildFromParser(*this, propId, context)) {
4594 return context.commitCSSValue(); 4517 return context.commitCSSValue();
4595 } 4518 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
4728 // We're going to successfully parse, but we don't want to consu me this token. 4651 // We're going to successfully parse, but we don't want to consu me this token.
4729 m_valueList->previous(); 4652 m_valueList->previous();
4730 } 4653 }
4731 break; 4654 break;
4732 } 4655 }
4733 } 4656 }
4734 4657
4735 if (context.allowFinalCommit()) { 4658 if (context.allowFinalCommit()) {
4736 // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mas k-box-image and -webkit-box-reflect have to do a fill by default. 4659 // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mas k-box-image and -webkit-box-reflect have to do a fill by default.
4737 // FIXME: What do we do with -webkit-box-reflect and -webkit-mask-box-im age? Probably just have to leave them filling... 4660 // FIXME: What do we do with -webkit-box-reflect and -webkit-mask-box-im age? Probably just have to leave them filling...
4738 if (propId == CSSPropertyWebkitBorderImage || propId == CSSPropertyWebki tMaskBoxImage) 4661 if (propId == CSSPropertyWebkitBorderImage)
4739 context.commitFill(); 4662 context.commitFill();
4740 4663
4741 // Need to fully commit as a single value. 4664 // Need to fully commit as a single value.
4742 result = context.commitBorderImageSlice(); 4665 result = context.commitBorderImageSlice();
4743 return true; 4666 return true;
4744 } 4667 }
4745 4668
4746 return false; 4669 return false;
4747 } 4670 }
4748 4671
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
6108 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 6031 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
6109 } 6032 }
6110 6033
6111 bool CSSPropertyParser::isSystemColor(int id) 6034 bool CSSPropertyParser::isSystemColor(int id)
6112 { 6035 {
6113 // FIXME(sky): remove 6036 // FIXME(sky): remove
6114 return false; 6037 return false;
6115 } 6038 }
6116 6039
6117 } // namespace blink 6040 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/StylePropertySerializer.cpp ('k') | sky/engine/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698