Diff
Modified: trunk/Source/WebCore/ChangeLog (200342 => 200343)
--- trunk/Source/WebCore/ChangeLog 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/ChangeLog 2016-05-02 22:19:33 UTC (rev 200343)
@@ -1,5 +1,42 @@
2016-05-02 Simon Fraser <[email protected]>
+ Make Length, LengthSize and LengthPoint blending not use member functions
+ https://bugs.webkit.org/show_bug.cgi?id=157281
+
+ Reviewed by Zalan Bujtas.
+
+ Having blend() be a member function is ambiguous because it's hard to tell which are
+ the 'from' and 'to' values. Fix Length, LengthSize and LengthPoint accordingly.
+
+ No behavior change.
+
+ * page/animation/CSSPropertyAnimation.cpp:
+ (WebCore::blendFunc):
+ * platform/Length.cpp:
+ (WebCore::blendMixedTypes):
+ (WebCore::blend):
+ (WebCore::Length::blendMixedTypes): Deleted.
+ * platform/Length.h:
+ (WebCore::Length::blend): Deleted.
+ * platform/LengthPoint.h:
+ (WebCore::blend):
+ (WebCore::LengthPoint::blend): Deleted.
+ * platform/LengthSize.h:
+ (WebCore::blend):
+ (WebCore::LengthSize::blend): Deleted.
+ * platform/graphics/filters/FilterOperation.cpp:
+ (WebCore::BlurFilterOperation::blend):
+ * platform/graphics/transforms/TranslateTransformOperation.cpp:
+ (WebCore::TranslateTransformOperation::blend):
+ * rendering/style/BasicShapes.cpp:
+ (WebCore::BasicShapePolygon::blend):
+ (WebCore::BasicShapeInset::blend):
+ * rendering/style/BasicShapes.h:
+ (WebCore::BasicShapeCenterCoordinate::blend):
+ (WebCore::BasicShapeRadius::blend):
+
+2016-05-02 Simon Fraser <[email protected]>
+
Fix shouldUpdateScrollLayerPositionSynchronously() for non-main frames. Remove updatesScrollLayerPositionOnMainThread()
https://bugs.webkit.org/show_bug.cgi?id=157277
Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (200342 => 200343)
--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp 2016-05-02 22:19:33 UTC (rev 200343)
@@ -84,7 +84,7 @@
static inline Length blendFunc(const AnimationBase*, const Length& from, const Length& to, double progress)
{
- return to.blend(from, progress);
+ return blend(from, to, progress);
}
static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress)
Modified: trunk/Source/WebCore/platform/Length.cpp (200342 => 200343)
--- trunk/Source/WebCore/platform/Length.cpp 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/platform/Length.cpp 2016-05-02 22:19:33 UTC (rev 200343)
@@ -251,18 +251,6 @@
{
m_calculationValueHandle = calculationValues().insert(WTFMove(value));
}
-
-Length Length::blendMixedTypes(const Length& from, double progress) const
-{
- if (progress <= 0.0)
- return from;
-
- if (progress >= 1.0)
- return *this;
-
- auto blend = std::make_unique<CalcExpressionBlendLength>(from, *this, progress);
- return Length(CalculationValue::create(WTFMove(blend), CalculationRangeAll));
-}
CalculationValue& Length::calculationValue() const
{
@@ -296,6 +284,44 @@
return calculationValue() == other.calculationValue();
}
+static Length blendMixedTypes(const Length& from, const Length& to, double progress)
+{
+ if (progress <= 0.0)
+ return from;
+
+ if (progress >= 1.0)
+ return to;
+
+ auto blend = std::make_unique<CalcExpressionBlendLength>(from, to, progress);
+ return Length(CalculationValue::create(WTFMove(blend), CalculationRangeAll));
+}
+
+Length blend(const Length& from, const Length& to, double progress)
+{
+ if (from.type() == Calculated || to.type() == Calculated)
+ return blendMixedTypes(from, to, progress);
+
+ if (!from.isZero() && !to.isZero() && from.type() != to.type())
+ return blendMixedTypes(from, to, progress);
+
+ if (from.isZero() && to.isZero())
+ return progress ? to : from; // Pick up 'auto' from 'from' if progress is zero.
+
+ LengthType resultType = to.type();
+ if (to.isZero())
+ resultType = from.type();
+
+ if (resultType == Percent) {
+ float fromPercent = from.isZero() ? 0 : from.percent();
+ float toPercent = to.isZero() ? 0 : to.percent();
+ return Length(WebCore::blend(fromPercent, toPercent, progress), Percent);
+ }
+
+ float fromValue = from.isZero() ? 0 : from.value();
+ float toValue = to.isZero() ? 0 : to.value();
+ return Length(WebCore::blend(fromValue, toValue, progress), resultType);
+}
+
struct SameSizeAsLength {
int32_t value;
int32_t metaData;
Modified: trunk/Source/WebCore/platform/Length.h (200342 => 200343)
--- trunk/Source/WebCore/platform/Length.h 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/platform/Length.h 2016-05-02 22:19:33 UTC (rev 200343)
@@ -107,17 +107,12 @@
bool isSpecified() const;
bool isSpecifiedOrIntrinsic() const;
- // Blend two lengths to produce a new length that is in between them. Used for animation.
- // FIXME: Why is this a member function?
- Length blend(const Length& from, double progress) const;
-
float nonNanCalculatedValue(int maxValue) const;
private:
bool isLegacyIntrinsic() const;
bool isCalculatedEqual(const Length&) const;
- Length blendMixedTypes(const Length& from, double progress) const;
WEBCORE_EXPORT void ref() const;
WEBCORE_EXPORT void deref() const;
@@ -132,6 +127,9 @@
bool m_isFloat;
};
+// Blend two lengths to produce a new length that is in between them. Used for animation.
+Length blend(const Length& from, const Length& to, double progress);
+
std::unique_ptr<Length[]> newCoordsArray(const String&, int& length);
std::unique_ptr<Length[]> newLengthArray(const String&, int& length);
@@ -412,33 +410,6 @@
return type() == FitContent;
}
-// FIXME: Does this need to be in the header? Is it valuable to inline? Does it get inlined?
-inline Length Length::blend(const Length& from, double progress) const
-{
- if (from.type() == Calculated || type() == Calculated)
- return blendMixedTypes(from, progress);
-
- if (!from.isZero() && !isZero() && from.type() != type())
- return blendMixedTypes(from, progress);
-
- if (from.isZero() && isZero())
- return progress ? *this : from; // Pick up 'auto' from 'from' if progress is zero.
-
- LengthType resultType = type();
- if (isZero())
- resultType = from.type();
-
- if (resultType == Percent) {
- float fromPercent = from.isZero() ? 0 : from.percent();
- float toPercent = isZero() ? 0 : percent();
- return Length(WebCore::blend(fromPercent, toPercent, progress), Percent);
- }
-
- float fromValue = from.isZero() ? 0 : from.value();
- float toValue = isZero() ? 0 : value();
- return Length(WebCore::blend(fromValue, toValue, progress), resultType);
-}
-
TextStream& operator<<(TextStream&, Length);
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/LengthPoint.h (200342 => 200343)
--- trunk/Source/WebCore/platform/LengthPoint.h 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/platform/LengthPoint.h 2016-05-02 22:19:33 UTC (rev 200343)
@@ -58,17 +58,17 @@
void setY(Length y) { m_y = WTFMove(y); }
const Length& y() const { return m_y; }
- LengthPoint blend(const LengthPoint& from, double progress) const
- {
- return LengthPoint(m_x.blend(from.x(), progress), m_y.blend(from.y(), progress));
- }
-
private:
// FIXME: it would be nice to pack the two Lengths together better somehow (to avoid padding between them).
Length m_x;
Length m_y;
};
+inline LengthPoint blend(const LengthPoint& from, const LengthPoint& to, double progress)
+{
+ return LengthPoint(blend(from.x(), to.x(), progress), blend(from.y(), to.y(), progress));
+}
+
TextStream& operator<<(TextStream&, const LengthPoint&);
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/LengthSize.h (200342 => 200343)
--- trunk/Source/WebCore/platform/LengthSize.h 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/platform/LengthSize.h 2016-05-02 22:19:33 UTC (rev 200343)
@@ -48,16 +48,16 @@
void setHeight(Length height) { m_height = WTFMove(height); }
const Length& height() const { return m_height; }
- LengthSize blend(const LengthSize& from, double progress) const
- {
- return LengthSize(m_width.blend(from.width(), progress), m_height.blend(from.height(), progress));
- }
-
private:
Length m_width;
Length m_height;
};
+inline LengthSize blend(const LengthSize& from, const LengthSize& to, double progress)
+{
+ return LengthSize(blend(from.width(), to.width(), progress), blend(from.height(), to.height(), progress));
+}
+
TextStream& operator<<(TextStream&, const LengthSize&);
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp (200342 => 200343)
--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp 2016-05-02 22:19:33 UTC (rev 200343)
@@ -162,11 +162,11 @@
LengthType lengthType = m_stdDeviation.type();
if (blendToPassthrough)
- return BlurFilterOperation::create(Length(lengthType).blend(m_stdDeviation, progress));
+ return BlurFilterOperation::create(WebCore::blend(m_stdDeviation, Length(lengthType), progress));
const BlurFilterOperation* fromOperation = downcast<BlurFilterOperation>(from);
Length fromLength = fromOperation ? fromOperation->m_stdDeviation : Length(lengthType);
- return BlurFilterOperation::create(m_stdDeviation.blend(fromLength, progress));
+ return BlurFilterOperation::create(WebCore::blend(fromLength, m_stdDeviation, progress));
}
bool DropShadowFilterOperation::operator==(const FilterOperation& operation) const
Modified: trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp (200342 => 200343)
--- trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp 2016-05-02 22:19:33 UTC (rev 200343)
@@ -42,13 +42,13 @@
Length zeroLength(0, Fixed);
if (blendToIdentity)
- return TranslateTransformOperation::create(zeroLength.blend(m_x, progress), zeroLength.blend(m_y, progress), zeroLength.blend(m_z, progress), m_type);
+ return TranslateTransformOperation::create(WebCore::blend(m_x, zeroLength, progress), WebCore::blend(m_y, zeroLength, progress), WebCore::blend(m_z, zeroLength, progress), m_type);
const TranslateTransformOperation* fromOp = downcast<TranslateTransformOperation>(from);
Length fromX = fromOp ? fromOp->m_x : zeroLength;
Length fromY = fromOp ? fromOp->m_y : zeroLength;
Length fromZ = fromOp ? fromOp->m_z : zeroLength;
- return TranslateTransformOperation::create(m_x.blend(fromX, progress), m_y.blend(fromY, progress), m_z.blend(fromZ, progress), m_type);
+ return TranslateTransformOperation::create(WebCore::blend(fromX, x(), progress), WebCore::blend(fromY, y(), progress), WebCore::blend(fromZ, z(), progress), m_type);
}
void TranslateTransformOperation::dump(TextStream& ts) const
Modified: trunk/Source/WebCore/rendering/style/BasicShapes.cpp (200342 => 200343)
--- trunk/Source/WebCore/rendering/style/BasicShapes.cpp 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/rendering/style/BasicShapes.cpp 2016-05-02 22:19:33 UTC (rev 200343)
@@ -319,8 +319,9 @@
result->setWindRule(otherPolygon.windRule());
for (size_t i = 0; i < length; i = i + 2) {
- result->appendPoint(m_values.at(i).blend(otherPolygon.values().at(i), progress),
- m_values.at(i + 1).blend(otherPolygon.values().at(i + 1), progress));
+ result->appendPoint(
+ WebCore::blend(otherPolygon.values().at(i), m_values.at(i), progress),
+ WebCore::blend(otherPolygon.values().at(i + 1), m_values.at(i + 1), progress));
}
return WTFMove(result);
@@ -411,21 +412,21 @@
return type() == other.type();
}
-Ref<BasicShape> BasicShapeInset::blend(const BasicShape& other, double progress) const
+Ref<BasicShape> BasicShapeInset::blend(const BasicShape& from, double progress) const
{
- ASSERT(type() == other.type());
+ ASSERT(type() == from.type());
- auto& otherInset = downcast<BasicShapeInset>(other);
+ auto& fromInset = downcast<BasicShapeInset>(from);
auto result = BasicShapeInset::create();
- result->setTop(m_top.blend(otherInset.top(), progress));
- result->setRight(m_right.blend(otherInset.right(), progress));
- result->setBottom(m_bottom.blend(otherInset.bottom(), progress));
- result->setLeft(m_left.blend(otherInset.left(), progress));
+ result->setTop(WebCore::blend(fromInset.top(), top(), progress));
+ result->setRight(WebCore::blend(fromInset.right(), right(), progress));
+ result->setBottom(WebCore::blend(fromInset.bottom(), bottom(), progress));
+ result->setLeft(WebCore::blend(fromInset.left(), left(), progress));
- result->setTopLeftRadius(m_topLeftRadius.blend(otherInset.topLeftRadius(), progress));
- result->setTopRightRadius(m_topRightRadius.blend(otherInset.topRightRadius(), progress));
- result->setBottomRightRadius(m_bottomRightRadius.blend(otherInset.bottomRightRadius(), progress));
- result->setBottomLeftRadius(m_bottomLeftRadius.blend(otherInset.bottomLeftRadius(), progress));
+ result->setTopLeftRadius(WebCore::blend(fromInset.topLeftRadius(), topLeftRadius(), progress));
+ result->setTopRightRadius(WebCore::blend(fromInset.topRightRadius(), topRightRadius(), progress));
+ result->setBottomRightRadius(WebCore::blend(fromInset.bottomRightRadius(), bottomRightRadius(), progress));
+ result->setBottomLeftRadius(WebCore::blend(fromInset.bottomLeftRadius(), bottomLeftRadius(), progress));
return WTFMove(result);
}
Modified: trunk/Source/WebCore/rendering/style/BasicShapes.h (200342 => 200343)
--- trunk/Source/WebCore/rendering/style/BasicShapes.h 2016-05-02 22:19:29 UTC (rev 200342)
+++ trunk/Source/WebCore/rendering/style/BasicShapes.h 2016-05-02 22:19:33 UTC (rev 200343)
@@ -64,7 +64,7 @@
virtual WindRule windRule() const { return RULE_NONZERO; }
virtual bool canBlend(const BasicShape&) const = 0;
- virtual Ref<BasicShape> blend(const BasicShape&, double) const = 0;
+ virtual Ref<BasicShape> blend(const BasicShape& from, double) const = 0;
virtual bool operator==(const BasicShape&) const = 0;
};
@@ -101,9 +101,9 @@
const Length& length() const { return m_length; }
const Length& computedLength() const { return m_computedLength; }
- BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& other, double progress) const
+ BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& from, double progress) const
{
- return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other.m_computedLength, progress));
+ return BasicShapeCenterCoordinate(TopLeft, WebCore::blend(from.m_computedLength, m_computedLength, progress));
}
bool operator==(const BasicShapeCenterCoordinate& other) const
@@ -155,12 +155,12 @@
return m_type == Value && other.type() == Value;
}
- BasicShapeRadius blend(const BasicShapeRadius& other, double progress) const
+ BasicShapeRadius blend(const BasicShapeRadius& from, double progress) const
{
- if (m_type != Value || other.type() != Value)
- return BasicShapeRadius(other);
+ if (m_type != Value || from.type() != Value)
+ return BasicShapeRadius(from);
- return BasicShapeRadius(m_value.blend(other.value(), progress));
+ return BasicShapeRadius(WebCore::blend(from.value(), value(), progress));
}
bool operator==(const BasicShapeRadius& other) const
@@ -195,7 +195,7 @@
const Path& path(const FloatRect&) override;
bool canBlend(const BasicShape&) const override;
- Ref<BasicShape> blend(const BasicShape&, double) const override;
+ Ref<BasicShape> blend(const BasicShape& from, double) const override;
bool operator==(const BasicShape&) const override;
@@ -227,7 +227,7 @@
const Path& path(const FloatRect&) override;
bool canBlend(const BasicShape&) const override;
- Ref<BasicShape> blend(const BasicShape&, double) const override;
+ Ref<BasicShape> blend(const BasicShape& from, double) const override;
bool operator==(const BasicShape&) const override;
@@ -258,7 +258,7 @@
const Path& path(const FloatRect&) override;
bool canBlend(const BasicShape&) const override;
- Ref<BasicShape> blend(const BasicShape&, double) const override;
+ Ref<BasicShape> blend(const BasicShape& from, double) const override;
bool operator==(const BasicShape&) const override;
@@ -286,7 +286,7 @@
const Path& path(const FloatRect&) override;
bool canBlend(const BasicShape&) const override;
- Ref<BasicShape> blend(const BasicShape&, double) const override;
+ Ref<BasicShape> blend(const BasicShape& from, double) const override;
bool operator==(const BasicShape&) const override;
@@ -326,7 +326,7 @@
const Path& path(const FloatRect&) override;
bool canBlend(const BasicShape&) const override;
- Ref<BasicShape> blend(const BasicShape&, double) const override;
+ Ref<BasicShape> blend(const BasicShape& from, double) const override;
bool operator==(const BasicShape&) const override;