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

Side by Side Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 22925002: Add support to resolve unprefixed CSS animations properties. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "core/platform/graphics/filters/custom/CustomFilterTransformParameter.h " 76 #include "core/platform/graphics/filters/custom/CustomFilterTransformParameter.h "
77 77
78 #include "core/rendering/style/StyleCustomFilterProgram.h" 78 #include "core/rendering/style/StyleCustomFilterProgram.h"
79 79
80 namespace WebCore { 80 namespace WebCore {
81 81
82 // List of all properties we know how to compute, omitting shorthands. 82 // List of all properties we know how to compute, omitting shorthands.
83 // NOTE: Do not use this list, use computableProperties() instead 83 // NOTE: Do not use this list, use computableProperties() instead
84 // to respect runtime enabling of CSS properties. 84 // to respect runtime enabling of CSS properties.
85 static const CSSPropertyID staticComputableProperties[] = { 85 static const CSSPropertyID staticComputableProperties[] = {
86 CSSPropertyAnimationDelay,
87 CSSPropertyAnimationDirection,
88 CSSPropertyAnimationDuration,
89 CSSPropertyAnimationFillMode,
90 CSSPropertyAnimationIterationCount,
91 CSSPropertyAnimationName,
92 CSSPropertyAnimationPlayState,
93 CSSPropertyAnimationTimingFunction,
86 CSSPropertyBackgroundAttachment, 94 CSSPropertyBackgroundAttachment,
87 CSSPropertyBackgroundBlendMode, 95 CSSPropertyBackgroundBlendMode,
88 CSSPropertyBackgroundClip, 96 CSSPropertyBackgroundClip,
89 CSSPropertyBackgroundColor, 97 CSSPropertyBackgroundColor,
90 CSSPropertyBackgroundImage, 98 CSSPropertyBackgroundImage,
91 CSSPropertyBackgroundOrigin, 99 CSSPropertyBackgroundOrigin,
92 CSSPropertyBackgroundPosition, // more-specific background-position-x/y are non-standard 100 CSSPropertyBackgroundPosition, // more-specific background-position-x/y are non-standard
93 CSSPropertyBackgroundRepeat, 101 CSSPropertyBackgroundRepeat,
94 CSSPropertyBackgroundSize, 102 CSSPropertyBackgroundSize,
95 CSSPropertyBorderBottomColor, 103 CSSPropertyBorderBottomColor,
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 return cssValuePool().createIdentifierValue(CSSValueAuto); 2331 return cssValuePool().createIdentifierValue(CSSValueAuto);
2324 return cssValuePool().createValue(style->zIndex(), CSSPrimitiveValue ::CSS_NUMBER); 2332 return cssValuePool().createValue(style->zIndex(), CSSPrimitiveValue ::CSS_NUMBER);
2325 case CSSPropertyZoom: 2333 case CSSPropertyZoom:
2326 return cssValuePool().createValue(style->zoom(), CSSPrimitiveValue:: CSS_NUMBER); 2334 return cssValuePool().createValue(style->zoom(), CSSPrimitiveValue:: CSS_NUMBER);
2327 case CSSPropertyBoxSizing: 2335 case CSSPropertyBoxSizing:
2328 if (style->boxSizing() == CONTENT_BOX) 2336 if (style->boxSizing() == CONTENT_BOX)
2329 return cssValuePool().createIdentifierValue(CSSValueContentBox); 2337 return cssValuePool().createIdentifierValue(CSSValueContentBox);
2330 return cssValuePool().createIdentifierValue(CSSValueBorderBox); 2338 return cssValuePool().createIdentifierValue(CSSValueBorderBox);
2331 case CSSPropertyWebkitAppRegion: 2339 case CSSPropertyWebkitAppRegion:
2332 return cssValuePool().createIdentifierValue(style->getDraggableRegio nMode() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); 2340 return cssValuePool().createIdentifierValue(style->getDraggableRegio nMode() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag);
2341 case CSSPropertyAnimationDelay:
2342 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
2343 break;
2333 case CSSPropertyWebkitAnimationDelay: 2344 case CSSPropertyWebkitAnimationDelay:
2334 return getDelayValue(style->animations()); 2345 return getDelayValue(style->animations());
2346 case CSSPropertyAnimationDirection:
2347 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
2348 break;
2335 case CSSPropertyWebkitAnimationDirection: { 2349 case CSSPropertyWebkitAnimationDirection: {
2336 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 2350 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2337 const CSSAnimationDataList* t = style->animations(); 2351 const CSSAnimationDataList* t = style->animations();
2338 if (t) { 2352 if (t) {
2339 for (size_t i = 0; i < t->size(); ++i) { 2353 for (size_t i = 0; i < t->size(); ++i) {
2340 if (t->animation(i)->direction()) 2354 if (t->animation(i)->direction())
2341 list->append(cssValuePool().createIdentifierValue(CSSVal ueAlternate)); 2355 list->append(cssValuePool().createIdentifierValue(CSSVal ueAlternate));
2342 else 2356 else
2343 list->append(cssValuePool().createIdentifierValue(CSSVal ueNormal)); 2357 list->append(cssValuePool().createIdentifierValue(CSSVal ueNormal));
2344 } 2358 }
2345 } else 2359 } else
2346 list->append(cssValuePool().createIdentifierValue(CSSValueNormal )); 2360 list->append(cssValuePool().createIdentifierValue(CSSValueNormal ));
2347 return list.release(); 2361 return list.release();
2348 } 2362 }
2363 case CSSPropertyAnimationDuration:
2364 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
2365 break;
2349 case CSSPropertyWebkitAnimationDuration: 2366 case CSSPropertyWebkitAnimationDuration:
2350 return getDurationValue(style->animations()); 2367 return getDurationValue(style->animations());
2368 case CSSPropertyAnimationFillMode:
2369 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
2370 break;
2351 case CSSPropertyWebkitAnimationFillMode: { 2371 case CSSPropertyWebkitAnimationFillMode: {
2352 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 2372 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2353 const CSSAnimationDataList* t = style->animations(); 2373 const CSSAnimationDataList* t = style->animations();
2354 if (t) { 2374 if (t) {
2355 for (size_t i = 0; i < t->size(); ++i) { 2375 for (size_t i = 0; i < t->size(); ++i) {
2356 switch (t->animation(i)->fillMode()) { 2376 switch (t->animation(i)->fillMode()) {
2357 case AnimationFillModeNone: 2377 case AnimationFillModeNone:
2358 list->append(cssValuePool().createIdentifierValue(CSSVal ueNone)); 2378 list->append(cssValuePool().createIdentifierValue(CSSVal ueNone));
2359 break; 2379 break;
2360 case AnimationFillModeForwards: 2380 case AnimationFillModeForwards:
2361 list->append(cssValuePool().createIdentifierValue(CSSVal ueForwards)); 2381 list->append(cssValuePool().createIdentifierValue(CSSVal ueForwards));
2362 break; 2382 break;
2363 case AnimationFillModeBackwards: 2383 case AnimationFillModeBackwards:
2364 list->append(cssValuePool().createIdentifierValue(CSSVal ueBackwards)); 2384 list->append(cssValuePool().createIdentifierValue(CSSVal ueBackwards));
2365 break; 2385 break;
2366 case AnimationFillModeBoth: 2386 case AnimationFillModeBoth:
2367 list->append(cssValuePool().createIdentifierValue(CSSVal ueBoth)); 2387 list->append(cssValuePool().createIdentifierValue(CSSVal ueBoth));
2368 break; 2388 break;
2369 } 2389 }
2370 } 2390 }
2371 } else 2391 } else
2372 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ; 2392 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ;
2373 return list.release(); 2393 return list.release();
2374 } 2394 }
2395 case CSSPropertyAnimationIterationCount:
2396 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
2397 break;
2375 case CSSPropertyWebkitAnimationIterationCount: { 2398 case CSSPropertyWebkitAnimationIterationCount: {
2376 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 2399 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2377 const CSSAnimationDataList* t = style->animations(); 2400 const CSSAnimationDataList* t = style->animations();
2378 if (t) { 2401 if (t) {
2379 for (size_t i = 0; i < t->size(); ++i) { 2402 for (size_t i = 0; i < t->size(); ++i) {
2380 double iterationCount = t->animation(i)->iterationCount(); 2403 double iterationCount = t->animation(i)->iterationCount();
2381 if (iterationCount == CSSAnimationData::IterationCountInfini te) 2404 if (iterationCount == CSSAnimationData::IterationCountInfini te)
2382 list->append(cssValuePool().createIdentifierValue(CSSVal ueInfinite)); 2405 list->append(cssValuePool().createIdentifierValue(CSSVal ueInfinite));
2383 else 2406 else
2384 list->append(cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER)); 2407 list->append(cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER));
2385 } 2408 }
2386 } else 2409 } else
2387 list->append(cssValuePool().createValue(CSSAnimationData::initia lAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER)); 2410 list->append(cssValuePool().createValue(CSSAnimationData::initia lAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
2388 return list.release(); 2411 return list.release();
2389 } 2412 }
2413 case CSSPropertyAnimationName:
2414 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
2415 break;
2390 case CSSPropertyWebkitAnimationName: { 2416 case CSSPropertyWebkitAnimationName: {
2391 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 2417 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2392 const CSSAnimationDataList* t = style->animations(); 2418 const CSSAnimationDataList* t = style->animations();
2393 if (t) { 2419 if (t) {
2394 for (size_t i = 0; i < t->size(); ++i) 2420 for (size_t i = 0; i < t->size(); ++i)
2395 list->append(cssValuePool().createValue(t->animation(i)->nam e(), CSSPrimitiveValue::CSS_STRING)); 2421 list->append(cssValuePool().createValue(t->animation(i)->nam e(), CSSPrimitiveValue::CSS_STRING));
2396 } else 2422 } else
2397 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ; 2423 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ;
2398 return list.release(); 2424 return list.release();
2399 } 2425 }
2426 case CSSPropertyAnimationPlayState:
2427 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
2428 break;
2400 case CSSPropertyWebkitAnimationPlayState: { 2429 case CSSPropertyWebkitAnimationPlayState: {
2401 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 2430 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
2402 const CSSAnimationDataList* t = style->animations(); 2431 const CSSAnimationDataList* t = style->animations();
2403 if (t) { 2432 if (t) {
2404 for (size_t i = 0; i < t->size(); ++i) { 2433 for (size_t i = 0; i < t->size(); ++i) {
2405 int prop = t->animation(i)->playState(); 2434 int prop = t->animation(i)->playState();
2406 if (prop == AnimPlayStatePlaying) 2435 if (prop == AnimPlayStatePlaying)
2407 list->append(cssValuePool().createIdentifierValue(CSSVal ueRunning)); 2436 list->append(cssValuePool().createIdentifierValue(CSSVal ueRunning));
2408 else 2437 else
2409 list->append(cssValuePool().createIdentifierValue(CSSVal uePaused)); 2438 list->append(cssValuePool().createIdentifierValue(CSSVal uePaused));
2410 } 2439 }
2411 } else 2440 } else
2412 list->append(cssValuePool().createIdentifierValue(CSSValueRunnin g)); 2441 list->append(cssValuePool().createIdentifierValue(CSSValueRunnin g));
2413 return list.release(); 2442 return list.release();
2414 } 2443 }
2444 case CSSPropertyAnimationTimingFunction:
2445 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
2446 break;
2415 case CSSPropertyWebkitAnimationTimingFunction: 2447 case CSSPropertyWebkitAnimationTimingFunction:
2416 return getTimingFunctionValue(style->animations()); 2448 return getTimingFunctionValue(style->animations());
2417 case CSSPropertyWebkitAppearance: 2449 case CSSPropertyWebkitAppearance:
2418 return cssValuePool().createValue(style->appearance()); 2450 return cssValuePool().createValue(style->appearance());
2419 case CSSPropertyWebkitAspectRatio: 2451 case CSSPropertyWebkitAspectRatio:
2420 if (!style->hasAspectRatio()) 2452 if (!style->hasAspectRatio())
2421 return cssValuePool().createIdentifierValue(CSSValueNone); 2453 return cssValuePool().createIdentifierValue(CSSValueNone);
2422 return CSSAspectRatioValue::create(style->aspectRatioNumerator(), st yle->aspectRatioDenominator()); 2454 return CSSAspectRatioValue::create(style->aspectRatioNumerator(), st yle->aspectRatioDenominator());
2423 case CSSPropertyWebkitBackfaceVisibility: 2455 case CSSPropertyWebkitBackfaceVisibility:
2424 return cssValuePool().createIdentifierValue((style->backfaceVisibili ty() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); 2456 return cssValuePool().createIdentifierValue((style->backfaceVisibili ty() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 case CSSPropertyUnicodeRange: 2791 case CSSPropertyUnicodeRange:
2760 break; 2792 break;
2761 2793
2762 /* Other unimplemented properties */ 2794 /* Other unimplemented properties */
2763 case CSSPropertyPage: // for @page 2795 case CSSPropertyPage: // for @page
2764 case CSSPropertyQuotes: // FIXME: needs implementation 2796 case CSSPropertyQuotes: // FIXME: needs implementation
2765 case CSSPropertySize: // for @page 2797 case CSSPropertySize: // for @page
2766 break; 2798 break;
2767 2799
2768 /* Unimplemented -webkit- properties */ 2800 /* Unimplemented -webkit- properties */
2801 case CSSPropertyAnimation:
2769 case CSSPropertyWebkitAnimation: 2802 case CSSPropertyWebkitAnimation:
2770 case CSSPropertyWebkitBorderRadius: 2803 case CSSPropertyWebkitBorderRadius:
2771 case CSSPropertyWebkitMarginCollapse: 2804 case CSSPropertyWebkitMarginCollapse:
2772 case CSSPropertyWebkitMarquee: 2805 case CSSPropertyWebkitMarquee:
2773 case CSSPropertyWebkitMarqueeSpeed: 2806 case CSSPropertyWebkitMarqueeSpeed:
2774 case CSSPropertyWebkitMask: 2807 case CSSPropertyWebkitMask:
2775 case CSSPropertyWebkitMaskRepeatX: 2808 case CSSPropertyWebkitMaskRepeatX:
2776 case CSSPropertyWebkitMaskRepeatY: 2809 case CSSPropertyWebkitMaskRepeatY:
2777 case CSSPropertyWebkitPerspectiveOriginX: 2810 case CSSPropertyWebkitPerspectiveOriginX:
2778 case CSSPropertyWebkitPerspectiveOriginY: 2811 case CSSPropertyWebkitPerspectiveOriginY:
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3104 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3072 CSSPropertyB ackgroundClip }; 3105 CSSPropertyB ackgroundClip };
3073 3106
3074 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3107 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
3075 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator)))); 3108 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator))));
3076 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator)))); 3109 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator))));
3077 return list.release(); 3110 return list.release();
3078 } 3111 }
3079 3112
3080 } // namespace WebCore 3113 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698