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

Unified Diff: Source/WebCore/platform/CalculationValue.h

Issue 10447005: Merge 116914 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/css3/calc/transition-crash2-expected.txt ('k') | Source/WebCore/platform/Length.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/CalculationValue.h
===================================================================
--- Source/WebCore/platform/CalculationValue.h (revision 118280)
+++ Source/WebCore/platform/CalculationValue.h (working copy)
@@ -51,20 +51,43 @@
CalculationRangeAll,
CalculationRangeNonNegative
};
+
+enum CalcExpressionNodeType {
+ CalcExpressionNodeUndefined,
+ CalcExpressionNodeNumber,
+ CalcExpressionNodeLength,
+ CalcExpressionNodeBinaryOperation
+};
class CalcExpressionNode {
public:
+ CalcExpressionNode()
+ : m_type(CalcExpressionNodeUndefined)
+ {
+ }
+
virtual ~CalcExpressionNode()
{
}
virtual float evaluate(float maxValue) const = 0;
+ virtual bool operator==(const CalcExpressionNode&) const = 0;
+
+ CalcExpressionNodeType type() const { return m_type; }
+
+protected:
+ CalcExpressionNodeType m_type;
};
class CalculationValue : public RefCounted<CalculationValue> {
public:
static PassRefPtr<CalculationValue> create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange);
float evaluate(float maxValue) const;
+
+ bool operator==(const CalculationValue& o) const
+ {
+ return m_value == o.m_value || *(m_value.get()) == *(o.m_value.get());
+ }
private:
CalculationValue(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange range)
@@ -82,8 +105,19 @@
explicit CalcExpressionNumber(float value)
: m_value(value)
{
+ m_type = CalcExpressionNodeNumber;
}
+ bool operator==(const CalcExpressionNumber& o) const
+ {
+ return m_value == o.m_value;
+ }
+
+ virtual bool operator==(const CalcExpressionNode& o) const
+ {
+ return type() == o.type() && *this == static_cast<const CalcExpressionNumber&>(o);
+ }
+
virtual float evaluate(float) const
{
return m_value;
@@ -98,8 +132,19 @@
explicit CalcExpressionLength(Length length)
: m_length(length)
{
+ m_type = CalcExpressionNodeLength;
}
+ bool operator==(const CalcExpressionLength& o) const
+ {
+ return m_length == o.m_length;
+ }
+
+ virtual bool operator==(const CalcExpressionNode& o) const
+ {
+ return type() == o.type() && *this == static_cast<const CalcExpressionLength&>(o);
+ }
+
virtual float evaluate(float maxValue) const
{
return floatValueForLength(m_length, maxValue);
@@ -116,8 +161,20 @@
, m_rightSide(rightSide)
, m_operator(op)
{
+ m_type = CalcExpressionNodeBinaryOperation;
}
+ bool operator==(const CalcExpressionBinaryOperation& o) const
+ {
+ return m_operator == o.m_operator && *m_leftSide == *o.m_leftSide && *m_rightSide == *o.m_rightSide;
+ }
+
+ virtual bool operator==(const CalcExpressionNode& o) const
+ {
+ return type() == o.type() && *this == static_cast<const CalcExpressionBinaryOperation&>(o);
+ }
+
+
virtual float evaluate(float) const;
private:
« no previous file with comments | « LayoutTests/css3/calc/transition-crash2-expected.txt ('k') | Source/WebCore/platform/Length.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698