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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp

Issue 1457623003: Clamp animated numbers according to ComputedStyle data type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: var Created 5 years, 1 month 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 style->setMinWidth(animatableValueToLength(value, state, ValueRangeNonNe gative)); 460 style->setMinWidth(animatableValueToLength(value, state, ValueRangeNonNe gative));
461 return; 461 return;
462 case CSSPropertyObjectPosition: 462 case CSSPropertyObjectPosition:
463 style->setObjectPosition(animatableValueToLengthPoint(value, state)); 463 style->setObjectPosition(animatableValueToLengthPoint(value, state));
464 return; 464 return;
465 case CSSPropertyOpacity: 465 case CSSPropertyOpacity:
466 // Avoiding a value of 1 forces a layer to be created. 466 // Avoiding a value of 1 forces a layer to be created.
467 style->setOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, nextafterf(1, 0))); 467 style->setOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, nextafterf(1, 0)));
468 return; 468 return;
469 case CSSPropertyOrphans: 469 case CSSPropertyOrphans:
470 style->setOrphans(clampTo<unsigned short>(round(toAnimatableDouble(value )->toDouble()), 1)); 470 style->setOrphans(clampTo<short>(round(toAnimatableDouble(value)->toDoub le()), 1));
471 return; 471 return;
472 case CSSPropertyOutlineColor: 472 case CSSPropertyOutlineColor:
473 style->setOutlineColor(toAnimatableColor(value)->color()); 473 style->setOutlineColor(toAnimatableColor(value)->color());
474 style->setVisitedLinkOutlineColor(toAnimatableColor(value)->visitedLinkC olor()); 474 style->setVisitedLinkOutlineColor(toAnimatableColor(value)->visitedLinkC olor());
475 return; 475 return;
476 case CSSPropertyOutlineOffset: 476 case CSSPropertyOutlineOffset:
477 style->setOutlineOffset(animatableValueClampTo<int>(value)); 477 style->setOutlineOffset(animatableValueClampTo<int>(value));
478 return; 478 return;
479 case CSSPropertyOutlineWidth: 479 case CSSPropertyOutlineWidth:
480 style->setOutlineWidth(animatableLineWidthClamp<unsigned short>(value)); 480 style->setOutlineWidth(animatableLineWidthClamp<unsigned short>(value));
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 case CSSPropertyWebkitTransformOriginX: 656 case CSSPropertyWebkitTransformOriginX:
657 style->setTransformOriginX(animatableValueToLength(value, state)); 657 style->setTransformOriginX(animatableValueToLength(value, state));
658 return; 658 return;
659 case CSSPropertyWebkitTransformOriginY: 659 case CSSPropertyWebkitTransformOriginY:
660 style->setTransformOriginY(animatableValueToLength(value, state)); 660 style->setTransformOriginY(animatableValueToLength(value, state));
661 return; 661 return;
662 case CSSPropertyWebkitTransformOriginZ: 662 case CSSPropertyWebkitTransformOriginZ:
663 style->setTransformOriginZ(toAnimatableDouble(value)->toDouble()); 663 style->setTransformOriginZ(toAnimatableDouble(value)->toDouble());
664 return; 664 return;
665 case CSSPropertyWidows: 665 case CSSPropertyWidows:
666 style->setWidows(clampTo<unsigned short>(round(toAnimatableDouble(value) ->toDouble()), 1)); 666 style->setWidows(clampTo<short>(round(toAnimatableDouble(value)->toDoubl e()), 1));
667 return; 667 return;
668 case CSSPropertyWidth: 668 case CSSPropertyWidth:
669 style->setWidth(animatableValueToLength(value, state, ValueRangeNonNegat ive)); 669 style->setWidth(animatableValueToLength(value, state, ValueRangeNonNegat ive));
670 return; 670 return;
671 case CSSPropertyWordSpacing: 671 case CSSPropertyWordSpacing:
672 style->setWordSpacing(clampTo<float>(toAnimatableDouble(value)->toDouble ())); 672 style->setWordSpacing(clampTo<float>(toAnimatableDouble(value)->toDouble ()));
673 return; 673 return;
674 case CSSPropertyVerticalAlign: 674 case CSSPropertyVerticalAlign:
675 style->setVerticalAlignLength(animatableValueToLength(value, state)); 675 style->setVerticalAlignLength(animatableValueToLength(value, state));
676 return; 676 return;
(...skipping 24 matching lines...) Expand all
701 case CSSPropertyRy: 701 case CSSPropertyRy:
702 style->setRy(animatableValueToLength(value, state, ValueRangeNonNegative )); 702 style->setRy(animatableValueToLength(value, state, ValueRangeNonNegative ));
703 return; 703 return;
704 704
705 default: 705 default:
706 ASSERT_NOT_REACHED(); 706 ASSERT_NOT_REACHED();
707 } 707 }
708 } 708 }
709 709
710 } // namespace blink 710 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698