OLD | NEW |
---|---|
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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1182 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1182 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
1183 if (animList) { | 1183 if (animList) { |
1184 for (size_t i = 0; i < animList->size(); ++i) | 1184 for (size_t i = 0; i < animList->size(); ++i) |
1185 list->append(createTimingFunctionValue(animList->animation(i)->timin gFunction().get())); | 1185 list->append(createTimingFunctionValue(animList->animation(i)->timin gFunction().get())); |
1186 } else | 1186 } else |
1187 // Note that initialAnimationTimingFunction() is used for both transitio ns and animations | 1187 // Note that initialAnimationTimingFunction() is used for both transitio ns and animations |
1188 list->append(createTimingFunctionValue(CSSAnimationData::initialAnimatio nTimingFunction().get())); | 1188 list->append(createTimingFunctionValue(CSSAnimationData::initialAnimatio nTimingFunction().get())); |
1189 return list.release(); | 1189 return list.release(); |
1190 } | 1190 } |
1191 | 1191 |
1192 static PassRefPtr<CSSValue> getAnimationFillModeValue(unsigned fillMode) | |
esprehn
2013/08/15 18:29:29
These methods are named wrong. Don't prefix with g
| |
1193 { | |
1194 switch (fillMode) { | |
1195 case AnimationFillModeNone: | |
1196 return cssValuePool().createIdentifierValue(CSSValueNone); | |
1197 case AnimationFillModeForwards: | |
1198 return cssValuePool().createIdentifierValue(CSSValueForwards); | |
1199 case AnimationFillModeBackwards: | |
1200 return cssValuePool().createIdentifierValue(CSSValueBackwards); | |
1201 case AnimationFillModeBoth: | |
1202 return cssValuePool().createIdentifierValue(CSSValueBoth); | |
1203 default: | |
1204 ASSERT_NOT_REACHED(); | |
1205 return cssValuePool().createIdentifierValue(CSSValueNone); | |
esprehn
2013/08/15 18:29:29
return null, you can't reach it anyway.
| |
1206 } | |
1207 } | |
1208 | |
1209 static PassRefPtr<CSSValue> getAnimationDirectionValue(CSSAnimationData::Animati onDirection direction) | |
1210 { | |
1211 switch (direction) { | |
1212 case CSSAnimationData::AnimationDirectionNormal: | |
1213 return cssValuePool().createIdentifierValue(CSSValueNormal); | |
1214 case CSSAnimationData::AnimationDirectionAlternate: | |
1215 return cssValuePool().createIdentifierValue(CSSValueAlternate); | |
1216 case CSSAnimationData::AnimationDirectionReverse: | |
1217 return cssValuePool().createIdentifierValue(CSSValueReverse); | |
1218 case CSSAnimationData::AnimationDirectionAlternateReverse: | |
1219 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); | |
1220 default: | |
1221 ASSERT_NOT_REACHED(); | |
1222 return cssValuePool().createIdentifierValue(CSSValueNormal); | |
esprehn
2013/08/15 18:29:29
ditto.
| |
1223 } | |
1224 } | |
1225 | |
1192 static PassRefPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain) | 1226 static PassRefPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain) |
1193 { | 1227 { |
1194 if (!lineBoxContain) | 1228 if (!lineBoxContain) |
1195 return cssValuePool().createIdentifierValue(CSSValueNone); | 1229 return cssValuePool().createIdentifierValue(CSSValueNone); |
1196 return CSSLineBoxContainValue::create(lineBoxContain); | 1230 return CSSLineBoxContainValue::create(lineBoxContain); |
1197 } | 1231 } |
1198 | 1232 |
1199 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, boo l allowVisitedStyle, const String& pseudoElementName) | 1233 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, boo l allowVisitedStyle, const String& pseudoElementName) |
1200 : m_node(n) | 1234 : m_node(n) |
1201 , m_allowVisitedStyle(allowVisitedStyle) | 1235 , m_allowVisitedStyle(allowVisitedStyle) |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2343 break; | 2377 break; |
2344 case CSSPropertyWebkitAnimationDelay: | 2378 case CSSPropertyWebkitAnimationDelay: |
2345 return getDelayValue(style->animations()); | 2379 return getDelayValue(style->animations()); |
2346 case CSSPropertyAnimationDirection: | 2380 case CSSPropertyAnimationDirection: |
2347 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) | 2381 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) |
2348 break; | 2382 break; |
2349 case CSSPropertyWebkitAnimationDirection: { | 2383 case CSSPropertyWebkitAnimationDirection: { |
2350 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2384 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
2351 const CSSAnimationDataList* t = style->animations(); | 2385 const CSSAnimationDataList* t = style->animations(); |
2352 if (t) { | 2386 if (t) { |
2353 for (size_t i = 0; i < t->size(); ++i) { | 2387 for (size_t i = 0; i < t->size(); ++i) |
2354 switch (t->animation(i)->direction()) { | 2388 list->append(getAnimationDirectionValue(t->animation(i)->dir ection())); |
2355 case CSSAnimationData::AnimationDirectionNormal: | |
2356 list->append(cssValuePool().createIdentifierValue(CSSVal ueNormal)); | |
2357 break; | |
2358 case CSSAnimationData::AnimationDirectionAlternate: | |
2359 list->append(cssValuePool().createIdentifierValue(CSSVal ueAlternate)); | |
2360 break; | |
2361 case CSSAnimationData::AnimationDirectionReverse: | |
2362 list->append(cssValuePool().createIdentifierValue(CSSVal ueReverse)); | |
2363 break; | |
2364 case CSSAnimationData::AnimationDirectionAlternateReverse: | |
2365 list->append(cssValuePool().createIdentifierValue(CSSVal ueAlternateReverse)); | |
2366 break; | |
2367 default: | |
2368 ASSERT_NOT_REACHED(); | |
2369 } | |
2370 } | |
2371 } else | 2389 } else |
2372 list->append(cssValuePool().createIdentifierValue(CSSValueNormal )); | 2390 list->append(cssValuePool().createIdentifierValue(CSSValueNormal )); |
2373 return list.release(); | 2391 return list.release(); |
2374 } | 2392 } |
2375 case CSSPropertyAnimationDuration: | 2393 case CSSPropertyAnimationDuration: |
2376 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) | 2394 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) |
2377 break; | 2395 break; |
2378 case CSSPropertyWebkitAnimationDuration: | 2396 case CSSPropertyWebkitAnimationDuration: |
2379 return getDurationValue(style->animations()); | 2397 return getDurationValue(style->animations()); |
2380 case CSSPropertyAnimationFillMode: | 2398 case CSSPropertyAnimationFillMode: |
2381 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) | 2399 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) |
2382 break; | 2400 break; |
2383 case CSSPropertyWebkitAnimationFillMode: { | 2401 case CSSPropertyWebkitAnimationFillMode: { |
2384 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2402 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
2385 const CSSAnimationDataList* t = style->animations(); | 2403 const CSSAnimationDataList* t = style->animations(); |
2386 if (t) { | 2404 if (t) { |
2387 for (size_t i = 0; i < t->size(); ++i) { | 2405 for (size_t i = 0; i < t->size(); ++i) |
2388 switch (t->animation(i)->fillMode()) { | 2406 list->append(getAnimationFillModeValue(t->animation(i)->fill Mode())); |
2389 case AnimationFillModeNone: | |
2390 list->append(cssValuePool().createIdentifierValue(CSSVal ueNone)); | |
2391 break; | |
2392 case AnimationFillModeForwards: | |
2393 list->append(cssValuePool().createIdentifierValue(CSSVal ueForwards)); | |
2394 break; | |
2395 case AnimationFillModeBackwards: | |
2396 list->append(cssValuePool().createIdentifierValue(CSSVal ueBackwards)); | |
2397 break; | |
2398 case AnimationFillModeBoth: | |
2399 list->append(cssValuePool().createIdentifierValue(CSSVal ueBoth)); | |
2400 break; | |
2401 } | |
2402 } | |
2403 } else | 2407 } else |
2404 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ; | 2408 list->append(cssValuePool().createIdentifierValue(CSSValueNone)) ; |
2405 return list.release(); | 2409 return list.release(); |
2406 } | 2410 } |
2407 case CSSPropertyAnimationIterationCount: | 2411 case CSSPropertyAnimationIterationCount: |
2408 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) | 2412 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) |
2409 break; | 2413 break; |
2410 case CSSPropertyWebkitAnimationIterationCount: { | 2414 case CSSPropertyWebkitAnimationIterationCount: { |
2411 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 2415 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
2412 const CSSAnimationDataList* t = style->animations(); | 2416 const CSSAnimationDataList* t = style->animations(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2451 } | 2455 } |
2452 } else | 2456 } else |
2453 list->append(cssValuePool().createIdentifierValue(CSSValueRunnin g)); | 2457 list->append(cssValuePool().createIdentifierValue(CSSValueRunnin g)); |
2454 return list.release(); | 2458 return list.release(); |
2455 } | 2459 } |
2456 case CSSPropertyAnimationTimingFunction: | 2460 case CSSPropertyAnimationTimingFunction: |
2457 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) | 2461 if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) |
2458 break; | 2462 break; |
2459 case CSSPropertyWebkitAnimationTimingFunction: | 2463 case CSSPropertyWebkitAnimationTimingFunction: |
2460 return getTimingFunctionValue(style->animations()); | 2464 return getTimingFunctionValue(style->animations()); |
2465 case CSSPropertyAnimation: | |
2466 case CSSPropertyWebkitAnimation: { | |
2467 const CSSAnimationDataList* animList = style->animations(); | |
esprehn
2013/08/15 18:29:29
don't abbreviate, -> animations
| |
2468 if (animList) { | |
2469 RefPtr<CSSValueList> animationsList = CSSValueList::createCommaS eparated(); | |
2470 for (size_t i = 0; i < animList->size(); ++i) { | |
2471 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparat ed(); | |
2472 const CSSAnimationData* animation = animList->animation(i); | |
2473 list->append(cssValuePool().createValue(animation->name(), C SSPrimitiveValue::CSS_STRING)); | |
2474 list->append(cssValuePool().createValue(animation->duration( ), CSSPrimitiveValue::CSS_S)); | |
2475 list->append(createTimingFunctionValue(animation->timingFunc tion().get())); | |
2476 list->append(cssValuePool().createValue(animation->delay(), CSSPrimitiveValue::CSS_S)); | |
2477 if (animation->iterationCount() == CSSAnimationData::Iterati onCountInfinite) | |
2478 list->append(cssValuePool().createIdentifierValue(CSSVal ueInfinite)); | |
2479 else | |
2480 list->append(cssValuePool().createValue(animation->itera tionCount(), CSSPrimitiveValue::CSS_NUMBER)); | |
2481 list->append(getAnimationDirectionValue(animation->direction ())); | |
2482 list->append(getAnimationFillModeValue(animation->fillMode() )); | |
2483 if (animation->playState() == AnimPlayStatePaused) | |
2484 list->append(cssValuePool().createIdentifierValue(CSSVal uePaused)); | |
2485 else | |
2486 list->append(cssValuePool().createIdentifierValue(CSSVal ueRunning)); | |
2487 animationsList->append(list); | |
2488 } | |
2489 return animationsList.release(); | |
2490 } | |
2491 | |
2492 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | |
2493 // animation-name default value. | |
2494 list->append(cssValuePool().createIdentifierValue(CSSValueNone)); | |
2495 list->append(cssValuePool().createValue(CSSAnimationData::initialAni mationDuration(), CSSPrimitiveValue::CSS_S)); | |
2496 list->append(createTimingFunctionValue(CSSAnimationData::initialAnim ationTimingFunction().get())); | |
2497 list->append(cssValuePool().createValue(CSSAnimationData::initialAni mationDelay(), CSSPrimitiveValue::CSS_S)); | |
2498 list->append(cssValuePool().createValue(CSSAnimationData::initialAni mationIterationCount(), CSSPrimitiveValue::CSS_NUMBER)); | |
2499 list->append(getAnimationDirectionValue(CSSAnimationData::initialAni mationDirection())); | |
2500 list->append(getAnimationFillModeValue(CSSAnimationData::initialAnim ationFillMode())); | |
2501 // Initial animation-play-state. | |
2502 list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); | |
2503 return list.release(); | |
2504 } | |
2461 case CSSPropertyWebkitAppearance: | 2505 case CSSPropertyWebkitAppearance: |
2462 return cssValuePool().createValue(style->appearance()); | 2506 return cssValuePool().createValue(style->appearance()); |
2463 case CSSPropertyWebkitAspectRatio: | 2507 case CSSPropertyWebkitAspectRatio: |
2464 if (!style->hasAspectRatio()) | 2508 if (!style->hasAspectRatio()) |
2465 return cssValuePool().createIdentifierValue(CSSValueNone); | 2509 return cssValuePool().createIdentifierValue(CSSValueNone); |
2466 return CSSAspectRatioValue::create(style->aspectRatioNumerator(), st yle->aspectRatioDenominator()); | 2510 return CSSAspectRatioValue::create(style->aspectRatioNumerator(), st yle->aspectRatioDenominator()); |
2467 case CSSPropertyWebkitBackfaceVisibility: | 2511 case CSSPropertyWebkitBackfaceVisibility: |
2468 return cssValuePool().createIdentifierValue((style->backfaceVisibili ty() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); | 2512 return cssValuePool().createIdentifierValue((style->backfaceVisibili ty() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); |
2469 case CSSPropertyWebkitBorderImage: | 2513 case CSSPropertyWebkitBorderImage: |
2470 return valueForNinePieceImage(style->borderImage()); | 2514 return valueForNinePieceImage(style->borderImage()); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2803 case CSSPropertyUnicodeRange: | 2847 case CSSPropertyUnicodeRange: |
2804 break; | 2848 break; |
2805 | 2849 |
2806 /* Other unimplemented properties */ | 2850 /* Other unimplemented properties */ |
2807 case CSSPropertyPage: // for @page | 2851 case CSSPropertyPage: // for @page |
2808 case CSSPropertyQuotes: // FIXME: needs implementation | 2852 case CSSPropertyQuotes: // FIXME: needs implementation |
2809 case CSSPropertySize: // for @page | 2853 case CSSPropertySize: // for @page |
2810 break; | 2854 break; |
2811 | 2855 |
2812 /* Unimplemented -webkit- properties */ | 2856 /* Unimplemented -webkit- properties */ |
2813 case CSSPropertyAnimation: | |
2814 case CSSPropertyWebkitAnimation: | |
2815 case CSSPropertyWebkitBorderRadius: | 2857 case CSSPropertyWebkitBorderRadius: |
2816 case CSSPropertyWebkitMarginCollapse: | 2858 case CSSPropertyWebkitMarginCollapse: |
2817 case CSSPropertyWebkitMarquee: | 2859 case CSSPropertyWebkitMarquee: |
2818 case CSSPropertyWebkitMarqueeSpeed: | 2860 case CSSPropertyWebkitMarqueeSpeed: |
2819 case CSSPropertyWebkitMask: | 2861 case CSSPropertyWebkitMask: |
2820 case CSSPropertyWebkitMaskRepeatX: | 2862 case CSSPropertyWebkitMaskRepeatX: |
2821 case CSSPropertyWebkitMaskRepeatY: | 2863 case CSSPropertyWebkitMaskRepeatY: |
2822 case CSSPropertyWebkitPerspectiveOriginX: | 2864 case CSSPropertyWebkitPerspectiveOriginX: |
2823 case CSSPropertyWebkitPerspectiveOriginY: | 2865 case CSSPropertyWebkitPerspectiveOriginY: |
2824 case CSSPropertyWebkitTextStroke: | 2866 case CSSPropertyWebkitTextStroke: |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3116 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, | 3158 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, |
3117 CSSPropertyB ackgroundClip }; | 3159 CSSPropertyB ackgroundClip }; |
3118 | 3160 |
3119 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 3161 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
3120 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator)))); | 3162 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(prope rtiesBeforeSlashSeperator)))); |
3121 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator)))); | 3163 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShortha nd(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(proper tiesAfterSlashSeperator)))); |
3122 return list.release(); | 3164 return list.release(); |
3123 } | 3165 } |
3124 | 3166 |
3125 } // namespace WebCore | 3167 } // namespace WebCore |
OLD | NEW |