|
Lines 99-116
static inline ShadowStyle blendFunc(const AnimationBase* anim, ShadowStyle from,
a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec1
|
| 99 |
return result > 0 ? Normal : Inset; |
99 |
return result > 0 ? Normal : Inset; |
| 100 |
} |
100 |
} |
| 101 |
|
101 |
|
| 102 |
static inline PassOwnPtr<ShadowData> blendFunc(const AnimationBase* anim, const ShadowData* from, const ShadowData* to, double progress) |
102 |
static inline std::unique_ptr<ShadowData> blendFunc(const AnimationBase* anim, const ShadowData* from, const ShadowData* to, double progress) |
| 103 |
{ |
103 |
{ |
| 104 |
ASSERT(from && to); |
104 |
ASSERT(from && to); |
| 105 |
if (from->style() != to->style()) |
105 |
if (from->style() != to->style()) |
| 106 |
return adoptPtr(new ShadowData(*to)); |
106 |
return std::make_unique<ShadowData>(*to); |
| 107 |
|
107 |
|
| 108 |
return adoptPtr(new ShadowData(blend(from->location(), to->location(), progress), |
108 |
return std::make_unique<ShadowData>(blend(from->location(), to->location(), progress), |
| 109 |
blend(from->radius(), to->radius(), progress), |
109 |
blend(from->radius(), to->radius(), progress), |
| 110 |
blend(from->spread(), to->spread(), progress), |
110 |
blend(from->spread(), to->spread(), progress), |
| 111 |
blendFunc(anim, from->style(), to->style(), progress), |
111 |
blendFunc(anim, from->style(), to->style(), progress), |
| 112 |
from->isWebkitBoxShadow(), |
112 |
from->isWebkitBoxShadow(), |
| 113 |
blend(from->color(), to->color(), progress))); |
113 |
blend(from->color(), to->color(), progress)); |
| 114 |
} |
114 |
} |
| 115 |
|
115 |
|
| 116 |
static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress) |
116 |
static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress) |
|
Lines 601-607
static inline const ShadowData* shadowForBlending(const ShadowData* srcShadow, c
a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec2
|
| 601 |
|
601 |
|
| 602 |
class PropertyWrapperShadow : public AnimationPropertyWrapperBase { |
602 |
class PropertyWrapperShadow : public AnimationPropertyWrapperBase { |
| 603 |
public: |
603 |
public: |
| 604 |
PropertyWrapperShadow(CSSPropertyID prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassOwnPtr<ShadowData>, bool)) |
604 |
PropertyWrapperShadow(CSSPropertyID prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(std::unique_ptr<ShadowData>, bool)) |
| 605 |
: AnimationPropertyWrapperBase(prop) |
605 |
: AnimationPropertyWrapperBase(prop) |
| 606 |
, m_getter(getter) |
606 |
, m_getter(getter) |
| 607 |
, m_setter(setter) |
607 |
, m_setter(setter) |
|
Lines 649-670
public:
a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec3
|
| 649 |
} |
649 |
} |
| 650 |
|
650 |
|
| 651 |
private: |
651 |
private: |
| 652 |
PassOwnPtr<ShadowData> blendSimpleOrMatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const |
652 |
std::unique_ptr<ShadowData> blendSimpleOrMatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const |
| 653 |
{ |
653 |
{ |
| 654 |
OwnPtr<ShadowData> newShadowData; |
654 |
std::unique_ptr<ShadowData> newShadowData; |
| 655 |
ShadowData* lastShadow = 0; |
655 |
ShadowData* lastShadow = 0; |
| 656 |
|
656 |
|
| 657 |
while (shadowA || shadowB) { |
657 |
while (shadowA || shadowB) { |
| 658 |
const ShadowData* srcShadow = shadowForBlending(shadowA, shadowB); |
658 |
const ShadowData* srcShadow = shadowForBlending(shadowA, shadowB); |
| 659 |
const ShadowData* dstShadow = shadowForBlending(shadowB, shadowA); |
659 |
const ShadowData* dstShadow = shadowForBlending(shadowB, shadowA); |
| 660 |
|
660 |
|
| 661 |
OwnPtr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress); |
661 |
std::unique_ptr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress); |
| 662 |
ShadowData* blendedShadowPtr = blendedShadow.get(); |
662 |
ShadowData* blendedShadowPtr = blendedShadow.get(); |
| 663 |
|
663 |
|
| 664 |
if (!lastShadow) |
664 |
if (!lastShadow) |
| 665 |
newShadowData = blendedShadow.release(); |
665 |
newShadowData = std::move(blendedShadow); |
| 666 |
else |
666 |
else |
| 667 |
lastShadow->setNext(blendedShadow.release()); |
667 |
lastShadow->setNext(std::move(blendedShadow)); |
| 668 |
|
668 |
|
| 669 |
lastShadow = blendedShadowPtr; |
669 |
lastShadow = blendedShadowPtr; |
| 670 |
|
670 |
|
|
Lines 672-681
private:
a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec4
|
| 672 |
shadowB = shadowB ? shadowB->next() : 0; |
672 |
shadowB = shadowB ? shadowB->next() : 0; |
| 673 |
} |
673 |
} |
| 674 |
|
674 |
|
| 675 |
return newShadowData.release(); |
675 |
return newShadowData; |
| 676 |
} |
676 |
} |
| 677 |
|
677 |
|
| 678 |
PassOwnPtr<ShadowData> blendMismatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB, int fromLength, int toLength) const |
678 |
std::unique_ptr<ShadowData> blendMismatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB, int fromLength, int toLength) const |
| 679 |
{ |
679 |
{ |
| 680 |
// The shadows in ShadowData are stored in reverse order, so when animating mismatched lists, |
680 |
// The shadows in ShadowData are stored in reverse order, so when animating mismatched lists, |
| 681 |
// reverse them and match from the end. |
681 |
// reverse them and match from the end. |
|
Lines 691-697
private:
a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec5
|
| 691 |
shadowB = shadowB->next(); |
691 |
shadowB = shadowB->next(); |
| 692 |
} |
692 |
} |
| 693 |
|
693 |
|
| 694 |
OwnPtr<ShadowData> newShadowData; |
694 |
std::unique_ptr<ShadowData> newShadowData; |
| 695 |
|
695 |
|
| 696 |
int maxLength = std::max(fromLength, toLength); |
696 |
int maxLength = std::max(fromLength, toLength); |
| 697 |
for (int i = 0; i < maxLength; ++i) { |
697 |
for (int i = 0; i < maxLength; ++i) { |
|
Lines 701-717
private:
a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp_sec6
|
| 701 |
const ShadowData* srcShadow = shadowForBlending(fromShadow, toShadow); |
701 |
const ShadowData* srcShadow = shadowForBlending(fromShadow, toShadow); |
| 702 |
const ShadowData* dstShadow = shadowForBlending(toShadow, fromShadow); |
702 |
const ShadowData* dstShadow = shadowForBlending(toShadow, fromShadow); |
| 703 |
|
703 |
|
| 704 |
OwnPtr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress); |
704 |
std::unique_ptr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress); |
| 705 |
// Insert at the start of the list to preserve the order. |
705 |
// Insert at the start of the list to preserve the order. |
| 706 |
blendedShadow->setNext(newShadowData.release()); |
706 |
blendedShadow->setNext(std::move(newShadowData)); |
| 707 |
newShadowData = blendedShadow.release(); |
707 |
newShadowData = std::move(blendedShadow); |
| 708 |
} |
708 |
} |
| 709 |
|
709 |
|
| 710 |
return newShadowData.release(); |
710 |
return newShadowData; |
| 711 |
} |
711 |
} |
| 712 |
|
712 |
|
| 713 |
const ShadowData* (RenderStyle::*m_getter)() const; |
713 |
const ShadowData* (RenderStyle::*m_getter)() const; |
| 714 |
void (RenderStyle::*m_setter)(PassOwnPtr<ShadowData>, bool); |
714 |
void (RenderStyle::*m_setter)(std::unique_ptr<ShadowData>, bool); |
| 715 |
}; |
715 |
}; |
| 716 |
|
716 |
|
| 717 |
class PropertyWrapperMaybeInvalidColor : public AnimationPropertyWrapperBase { |
717 |
class PropertyWrapperMaybeInvalidColor : public AnimationPropertyWrapperBase { |