Changeset 292901 in webkit
- Timestamp:
- Apr 14, 2022, 11:08:27 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/nicosia/NicosiaAnimation.cpp (modified) (2 diffs)
-
platform/graphics/transforms/TranslateTransformOperation.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r292900 r292901 1 2022-04-14 Martin Robinson <mrobinson@webkit.org> 2 3 [GTK] AddressSanitizer: heap-buffer-overflow in WebCore::Length::ref() 4 https://bugs.webkit.org/show_bug.cgi?id=237389 5 6 Reviewed by Žan Doberšek. 7 8 * platform/graphics/nicosia/NicosiaAnimation.cpp: 9 (Nicosia::createThreadsafeKeyFrames): Convert Length members of transform functions to 10 the fixed variety before they are moved to separate threads. 11 (Nicosia::Animation::Animation): Use the new helper. 12 * platform/graphics/transforms/TranslateTransformOperation.h: Added setters. 13 1 14 2022-04-14 Zan Dobersek <zdobersek@igalia.com> 2 15 -
trunk/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp
r290667 r292901 22 22 23 23 #include "LayoutSize.h" 24 #include "TranslateTransformOperation.h" 24 25 25 26 namespace Nicosia { … … 139 140 } 140 141 142 static KeyframeValueList createThreadsafeKeyFrames(const KeyframeValueList& originalKeyframes, const FloatSize& boxSize) 143 { 144 if (originalKeyframes.property() != AnimatedPropertyTransform) 145 return originalKeyframes; 146 147 // Currently translation operations are the only transform operations that store a non-fixed 148 // Length. Some Lengths, in particular those for calc() operations, are not thread-safe or 149 // multiprocess safe, because they maintain indices into a shared HashMap of CalculationValues. 150 // This code converts all possible unsafe Length parameters to fixed Lengths, which are safe to 151 // use in other threads and across IPC channels. 152 KeyframeValueList keyframes = originalKeyframes; 153 for (unsigned i = 0; i < keyframes.size(); i++) { 154 const auto& transformValue = static_cast<const TransformAnimationValue&>(keyframes.at(i)); 155 for (auto& operation : transformValue.value().operations()) { 156 if (is<TranslateTransformOperation>(operation)) { 157 TranslateTransformOperation* translation = static_cast<TranslateTransformOperation*>(operation.get()); 158 translation->setX(Length(translation->xAsFloat(boxSize), LengthType::Fixed)); 159 translation->setY(Length(translation->yAsFloat(boxSize), LengthType::Fixed)); 160 translation->setZ(Length(translation->zAsFloat(), LengthType::Fixed)); 161 } 162 } 163 } 164 165 return keyframes; 166 } 167 141 168 Animation::Animation(const String& name, const KeyframeValueList& keyframes, const FloatSize& boxSize, const WebCore::Animation& animation, MonotonicTime startTime, Seconds pauseTime, AnimationState state) 142 169 : m_name(name.isSafeToSendToAnotherThread() ? name : name.isolatedCopy()) 143 , m_keyframes( keyframes)170 , m_keyframes(createThreadsafeKeyFrames(keyframes, boxSize)) 144 171 , m_boxSize(boxSize) 145 172 , m_timingFunction(animation.timingFunction()->clone()) -
trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
r289032 r292901 59 59 Length z() const { return m_z; } 60 60 61 void setX(Length newX) { m_x = newX; } 62 void setY(Length newY) { m_y = newY; } 63 void setZ(Length newZ) { m_z = newZ; } 64 61 65 OperationType primitiveType() const final { return isRepresentableIn2D() ? TRANSLATE : TRANSLATE_3D; } 62 66
Note:
See TracChangeset
for help on using the changeset viewer.