| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * | 21 * |
| 22 * You should have received a copy of the GNU Library General Public License | 22 * You should have received a copy of the GNU Library General Public License |
| 23 * along with this library; see the file COPYING.LIB. If not, write to | 23 * along with this library; see the file COPYING.LIB. If not, write to |
| 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 #include "CSSToStyleMap.h" | 29 #include "CSSToStyleMap.h" |
| 30 | 30 |
| 31 #include "Animation.h" | 31 #include "PrimitiveAnimation.h" |
| 32 #include "CSSBorderImageSliceValue.h" | 32 #include "CSSBorderImageSliceValue.h" |
| 33 #include "CSSPrimitiveValue.h" | 33 #include "CSSPrimitiveValue.h" |
| 34 #include "CSSPrimitiveValueMappings.h" | 34 #include "CSSPrimitiveValueMappings.h" |
| 35 #include "CSSTimingFunctionValue.h" | 35 #include "CSSTimingFunctionValue.h" |
| 36 #include "CSSValueKeywords.h" | 36 #include "CSSValueKeywords.h" |
| 37 #include "FillLayer.h" | 37 #include "FillLayer.h" |
| 38 #include "Pair.h" | 38 #include "Pair.h" |
| 39 #include "Rect.h" | 39 #include "Rect.h" |
| 40 #include "StyleResolver.h" | 40 #include "StyleResolver.h" |
| 41 | 41 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 else if (primitiveValue->isViewportPercentageLength()) | 292 else if (primitiveValue->isViewportPercentageLength()) |
| 293 length = primitiveValue->viewportPercentageLength(); | 293 length = primitiveValue->viewportPercentageLength(); |
| 294 else | 294 else |
| 295 return; | 295 return; |
| 296 | 296 |
| 297 layer->setYPosition(length); | 297 layer->setYPosition(length); |
| 298 if (pair) | 298 if (pair) |
| 299 layer->setBackgroundYOrigin(*(pair->first())); | 299 layer->setBackgroundYOrigin(*(pair->first())); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void CSSToStyleMap::mapAnimationDelay(Animation* animation, CSSValue* value) | 302 void CSSToStyleMap::mapAnimationDelay(PrimitiveAnimation* animation, CSSValue* v
alue) |
| 303 { | 303 { |
| 304 if (value->isInitialValue()) { | 304 if (value->isInitialValue()) { |
| 305 animation->setDelay(Animation::initialAnimationDelay()); | 305 animation->setDelay(PrimitiveAnimation::initialAnimationDelay()); |
| 306 return; | 306 return; |
| 307 } | 307 } |
| 308 | 308 |
| 309 if (!value->isPrimitiveValue()) | 309 if (!value->isPrimitiveValue()) |
| 310 return; | 310 return; |
| 311 | 311 |
| 312 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); | 312 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
| 313 animation->setDelay(primitiveValue->computeTime<double, CSSPrimitiveValue::S
econds>()); | 313 animation->setDelay(primitiveValue->computeTime<double, CSSPrimitiveValue::S
econds>()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void CSSToStyleMap::mapAnimationDirection(Animation* layer, CSSValue* value) | 316 void CSSToStyleMap::mapAnimationDirection(PrimitiveAnimation* layer, CSSValue* v
alue) |
| 317 { | 317 { |
| 318 if (value->isInitialValue()) { | 318 if (value->isInitialValue()) { |
| 319 layer->setDirection(Animation::initialAnimationDirection()); | 319 layer->setDirection(PrimitiveAnimation::initialAnimationDirection()); |
| 320 return; | 320 return; |
| 321 } | 321 } |
| 322 | 322 |
| 323 if (!value->isPrimitiveValue()) | 323 if (!value->isPrimitiveValue()) |
| 324 return; | 324 return; |
| 325 | 325 |
| 326 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); | 326 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
| 327 switch (primitiveValue->getIdent()) { | 327 switch (primitiveValue->getIdent()) { |
| 328 case CSSValueNormal: | 328 case CSSValueNormal: |
| 329 layer->setDirection(Animation::AnimationDirectionNormal); | 329 layer->setDirection(PrimitiveAnimation::AnimationDirectionNormal); |
| 330 break; | 330 break; |
| 331 case CSSValueAlternate: | 331 case CSSValueAlternate: |
| 332 layer->setDirection(Animation::AnimationDirectionAlternate); | 332 layer->setDirection(PrimitiveAnimation::AnimationDirectionAlternate); |
| 333 break; | 333 break; |
| 334 case CSSValueReverse: | 334 case CSSValueReverse: |
| 335 layer->setDirection(Animation::AnimationDirectionReverse); | 335 layer->setDirection(PrimitiveAnimation::AnimationDirectionReverse); |
| 336 break; | 336 break; |
| 337 case CSSValueAlternateReverse: | 337 case CSSValueAlternateReverse: |
| 338 layer->setDirection(Animation::AnimationDirectionAlternateReverse); | 338 layer->setDirection(PrimitiveAnimation::AnimationDirectionAlternateRever
se); |
| 339 break; | 339 break; |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 | 342 |
| 343 void CSSToStyleMap::mapAnimationDuration(Animation* animation, CSSValue* value) | 343 void CSSToStyleMap::mapAnimationDuration(PrimitiveAnimation* animation, CSSValue
* value) |
| 344 { | 344 { |
| 345 if (value->isInitialValue()) { | 345 if (value->isInitialValue()) { |
| 346 animation->setDuration(Animation::initialAnimationDuration()); | 346 animation->setDuration(PrimitiveAnimation::initialAnimationDuration()); |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 | 349 |
| 350 if (!value->isPrimitiveValue()) | 350 if (!value->isPrimitiveValue()) |
| 351 return; | 351 return; |
| 352 | 352 |
| 353 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); | 353 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
| 354 animation->setDuration(primitiveValue->computeTime<double, CSSPrimitiveValue
::Seconds>()); | 354 animation->setDuration(primitiveValue->computeTime<double, CSSPrimitiveValue
::Seconds>()); |
| 355 } | 355 } |
| 356 | 356 |
| 357 void CSSToStyleMap::mapAnimationFillMode(Animation* layer, CSSValue* value) | 357 void CSSToStyleMap::mapAnimationFillMode(PrimitiveAnimation* layer, CSSValue* va
lue) |
| 358 { | 358 { |
| 359 if (value->isInitialValue()) { | 359 if (value->isInitialValue()) { |
| 360 layer->setFillMode(Animation::initialAnimationFillMode()); | 360 layer->setFillMode(PrimitiveAnimation::initialAnimationFillMode()); |
| 361 return; | 361 return; |
| 362 } | 362 } |
| 363 | 363 |
| 364 if (!value->isPrimitiveValue()) | 364 if (!value->isPrimitiveValue()) |
| 365 return; | 365 return; |
| 366 | 366 |
| 367 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); | 367 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
| 368 switch (primitiveValue->getIdent()) { | 368 switch (primitiveValue->getIdent()) { |
| 369 case CSSValueNone: | 369 case CSSValueNone: |
| 370 layer->setFillMode(AnimationFillModeNone); | 370 layer->setFillMode(AnimationFillModeNone); |
| 371 break; | 371 break; |
| 372 case CSSValueForwards: | 372 case CSSValueForwards: |
| 373 layer->setFillMode(AnimationFillModeForwards); | 373 layer->setFillMode(AnimationFillModeForwards); |
| 374 break; | 374 break; |
| 375 case CSSValueBackwards: | 375 case CSSValueBackwards: |
| 376 layer->setFillMode(AnimationFillModeBackwards); | 376 layer->setFillMode(AnimationFillModeBackwards); |
| 377 break; | 377 break; |
| 378 case CSSValueBoth: | 378 case CSSValueBoth: |
| 379 layer->setFillMode(AnimationFillModeBoth); | 379 layer->setFillMode(AnimationFillModeBoth); |
| 380 break; | 380 break; |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 | 383 |
| 384 void CSSToStyleMap::mapAnimationIterationCount(Animation* animation, CSSValue* v
alue) | 384 void CSSToStyleMap::mapAnimationIterationCount(PrimitiveAnimation* animation, CS
SValue* value) |
| 385 { | 385 { |
| 386 if (value->isInitialValue()) { | 386 if (value->isInitialValue()) { |
| 387 animation->setIterationCount(Animation::initialAnimationIterationCount()
); | 387 animation->setIterationCount(PrimitiveAnimation::initialAnimationIterati
onCount()); |
| 388 return; | 388 return; |
| 389 } | 389 } |
| 390 | 390 |
| 391 if (!value->isPrimitiveValue()) | 391 if (!value->isPrimitiveValue()) |
| 392 return; | 392 return; |
| 393 | 393 |
| 394 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); | 394 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
| 395 if (primitiveValue->getIdent() == CSSValueInfinite) | 395 if (primitiveValue->getIdent() == CSSValueInfinite) |
| 396 animation->setIterationCount(Animation::IterationCountInfinite); | 396 animation->setIterationCount(PrimitiveAnimation::IterationCountInfinite)
; |
| 397 else | 397 else |
| 398 animation->setIterationCount(primitiveValue->getFloatValue()); | 398 animation->setIterationCount(primitiveValue->getFloatValue()); |
| 399 } | 399 } |
| 400 | 400 |
| 401 void CSSToStyleMap::mapAnimationName(Animation* layer, CSSValue* value) | 401 void CSSToStyleMap::mapAnimationName(PrimitiveAnimation* layer, CSSValue* value) |
| 402 { | 402 { |
| 403 if (value->isInitialValue()) { | 403 if (value->isInitialValue()) { |
| 404 layer->setName(Animation::initialAnimationName()); | 404 layer->setName(PrimitiveAnimation::initialAnimationName()); |
| 405 return; | 405 return; |
| 406 } | 406 } |
| 407 | 407 |
| 408 if (!value->isPrimitiveValue()) | 408 if (!value->isPrimitiveValue()) |
| 409 return; | 409 return; |
| 410 | 410 |
| 411 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); | 411 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
| 412 if (primitiveValue->getIdent() == CSSValueNone) | 412 if (primitiveValue->getIdent() == CSSValueNone) |
| 413 layer->setIsNoneAnimation(true); | 413 layer->setIsNoneAnimation(true); |
| 414 else | 414 else |
| 415 layer->setName(primitiveValue->getStringValue()); | 415 layer->setName(primitiveValue->getStringValue()); |
| 416 } | 416 } |
| 417 | 417 |
| 418 void CSSToStyleMap::mapAnimationPlayState(Animation* layer, CSSValue* value) | 418 void CSSToStyleMap::mapAnimationPlayState(PrimitiveAnimation* layer, CSSValue* v
alue) |
| 419 { | 419 { |
| 420 if (value->isInitialValue()) { | 420 if (value->isInitialValue()) { |
| 421 layer->setPlayState(Animation::initialAnimationPlayState()); | 421 layer->setPlayState(PrimitiveAnimation::initialAnimationPlayState()); |
| 422 return; | 422 return; |
| 423 } | 423 } |
| 424 | 424 |
| 425 if (!value->isPrimitiveValue()) | 425 if (!value->isPrimitiveValue()) |
| 426 return; | 426 return; |
| 427 | 427 |
| 428 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); | 428 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
| 429 EAnimPlayState playState = (primitiveValue->getIdent() == CSSValuePaused) ?
AnimPlayStatePaused : AnimPlayStatePlaying; | 429 EAnimPlayState playState = (primitiveValue->getIdent() == CSSValuePaused) ?
AnimPlayStatePaused : AnimPlayStatePlaying; |
| 430 layer->setPlayState(playState); | 430 layer->setPlayState(playState); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void CSSToStyleMap::mapAnimationProperty(Animation* animation, CSSValue* value) | 433 void CSSToStyleMap::mapAnimationProperty(PrimitiveAnimation* animation, CSSValue
* value) |
| 434 { | 434 { |
| 435 if (value->isInitialValue()) { | 435 if (value->isInitialValue()) { |
| 436 animation->setAnimationMode(Animation::AnimateAll); | 436 animation->setAnimationMode(PrimitiveAnimation::AnimateAll); |
| 437 animation->setProperty(CSSPropertyInvalid); | 437 animation->setProperty(CSSPropertyInvalid); |
| 438 return; | 438 return; |
| 439 } | 439 } |
| 440 | 440 |
| 441 if (!value->isPrimitiveValue()) | 441 if (!value->isPrimitiveValue()) |
| 442 return; | 442 return; |
| 443 | 443 |
| 444 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); | 444 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); |
| 445 if (primitiveValue->getIdent() == CSSValueAll) { | 445 if (primitiveValue->getIdent() == CSSValueAll) { |
| 446 animation->setAnimationMode(Animation::AnimateAll); | 446 animation->setAnimationMode(PrimitiveAnimation::AnimateAll); |
| 447 animation->setProperty(CSSPropertyInvalid); | 447 animation->setProperty(CSSPropertyInvalid); |
| 448 } else if (primitiveValue->getIdent() == CSSValueNone) { | 448 } else if (primitiveValue->getIdent() == CSSValueNone) { |
| 449 animation->setAnimationMode(Animation::AnimateNone); | 449 animation->setAnimationMode(PrimitiveAnimation::AnimateNone); |
| 450 animation->setProperty(CSSPropertyInvalid); | 450 animation->setProperty(CSSPropertyInvalid); |
| 451 } else { | 451 } else { |
| 452 animation->setAnimationMode(Animation::AnimateSingleProperty); | 452 animation->setAnimationMode(PrimitiveAnimation::AnimateSingleProperty); |
| 453 animation->setProperty(static_cast<CSSPropertyID>(primitiveValue->getIde
nt())); | 453 animation->setProperty(static_cast<CSSPropertyID>(primitiveValue->getIde
nt())); |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 void CSSToStyleMap::mapAnimationTimingFunction(Animation* animation, CSSValue* v
alue) | 457 void CSSToStyleMap::mapAnimationTimingFunction(PrimitiveAnimation* animation, CS
SValue* value) |
| 458 { | 458 { |
| 459 if (value->isInitialValue()) { | 459 if (value->isInitialValue()) { |
| 460 animation->setTimingFunction(Animation::initialAnimationTimingFunction()
); | 460 animation->setTimingFunction(PrimitiveAnimation::initialAnimationTimingF
unction()); |
| 461 return; | 461 return; |
| 462 } | 462 } |
| 463 | 463 |
| 464 if (value->isPrimitiveValue()) { | 464 if (value->isPrimitiveValue()) { |
| 465 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); | 465 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); |
| 466 switch (primitiveValue->getIdent()) { | 466 switch (primitiveValue->getIdent()) { |
| 467 case CSSValueLinear: | 467 case CSSValueLinear: |
| 468 animation->setTimingFunction(LinearTimingFunction::create()); | 468 animation->setTimingFunction(LinearTimingFunction::create()); |
| 469 break; | 469 break; |
| 470 case CSSValueEase: | 470 case CSSValueEase: |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 verticalRule = SpaceImageRule; | 682 verticalRule = SpaceImageRule; |
| 683 break; | 683 break; |
| 684 default: // CSSValueRepeat | 684 default: // CSSValueRepeat |
| 685 verticalRule = RepeatImageRule; | 685 verticalRule = RepeatImageRule; |
| 686 break; | 686 break; |
| 687 } | 687 } |
| 688 image.setVerticalRule(verticalRule); | 688 image.setVerticalRule(verticalRule); |
| 689 } | 689 } |
| 690 | 690 |
| 691 }; | 691 }; |
| OLD | NEW |