mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1013662 - Fix bad implicit conversion constructors in MFBT; r=froydnj,Waldo
This commit is contained in:
parent
247c93a42e
commit
d0ca596588
@ -190,13 +190,13 @@ static const nsAttrValue::EnumTable kInputInputmodeTable[] = {
|
||||
// Default inputmode value is "auto".
|
||||
static const nsAttrValue::EnumTable* kInputDefaultInputmode = &kInputInputmodeTable[0];
|
||||
|
||||
const Decimal HTMLInputElement::kStepScaleFactorDate = 86400000;
|
||||
const Decimal HTMLInputElement::kStepScaleFactorNumberRange = 1;
|
||||
const Decimal HTMLInputElement::kStepScaleFactorTime = 1000;
|
||||
const Decimal HTMLInputElement::kDefaultStepBase = 0;
|
||||
const Decimal HTMLInputElement::kDefaultStep = 1;
|
||||
const Decimal HTMLInputElement::kDefaultStepTime = 60;
|
||||
const Decimal HTMLInputElement::kStepAny = 0;
|
||||
const Decimal HTMLInputElement::kStepScaleFactorDate = Decimal(86400000);
|
||||
const Decimal HTMLInputElement::kStepScaleFactorNumberRange = Decimal(1);
|
||||
const Decimal HTMLInputElement::kStepScaleFactorTime = Decimal(1000);
|
||||
const Decimal HTMLInputElement::kDefaultStepBase = Decimal(0);
|
||||
const Decimal HTMLInputElement::kDefaultStep = Decimal(1);
|
||||
const Decimal HTMLInputElement::kDefaultStepTime = Decimal(60);
|
||||
const Decimal HTMLInputElement::kStepAny = Decimal(0);
|
||||
|
||||
#define NS_INPUT_ELEMENT_STATE_IID \
|
||||
{ /* dc3b3d14-23e2-4479-b513-7b369343e3a0 */ \
|
||||
@ -1754,7 +1754,7 @@ HTMLInputElement::ConvertStringToNumber(nsAString& aValue,
|
||||
return false;
|
||||
}
|
||||
|
||||
aResultValue = int32_t(milliseconds);
|
||||
aResultValue = Decimal(int32_t(milliseconds));
|
||||
return true;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Unrecognized input type");
|
||||
@ -1929,7 +1929,7 @@ HTMLInputElement::ConvertNumberToString(Decimal aValue,
|
||||
// Per spec, we need to truncate |aValue| and we should only represent
|
||||
// times inside a day [00:00, 24:00[, which means that we should do a
|
||||
// modulo on |aValue| using the number of milliseconds in a day (86400000).
|
||||
uint32_t value = NS_floorModulo(aValue.floor(), 86400000).toDouble();
|
||||
uint32_t value = NS_floorModulo(aValue.floor(), Decimal(86400000)).toDouble();
|
||||
|
||||
uint16_t milliseconds = value % 1000;
|
||||
value /= 1000;
|
||||
@ -2055,7 +2055,7 @@ HTMLInputElement::GetMinimum() const
|
||||
|
||||
// Only type=range has a default minimum
|
||||
Decimal defaultMinimum =
|
||||
mType == NS_FORM_INPUT_RANGE ? 0 : Decimal::nan();
|
||||
mType == NS_FORM_INPUT_RANGE ? Decimal(0) : Decimal::nan();
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::min)) {
|
||||
return defaultMinimum;
|
||||
@ -2076,7 +2076,7 @@ HTMLInputElement::GetMaximum() const
|
||||
|
||||
// Only type=range has a default maximum
|
||||
Decimal defaultMaximum =
|
||||
mType == NS_FORM_INPUT_RANGE ? 100 : Decimal::nan();
|
||||
mType == NS_FORM_INPUT_RANGE ? Decimal(100) : Decimal::nan();
|
||||
|
||||
if (!HasAttr(kNameSpaceID_None, nsGkAtoms::max)) {
|
||||
return defaultMaximum;
|
||||
@ -2138,7 +2138,7 @@ HTMLInputElement::GetValueIfStepped(int32_t aStep,
|
||||
|
||||
Decimal value = GetValueAsDecimal();
|
||||
if (value.isNaN()) {
|
||||
value = 0;
|
||||
value = Decimal(0);
|
||||
}
|
||||
|
||||
Decimal minimum = GetMinimum();
|
||||
@ -2176,14 +2176,14 @@ HTMLInputElement::GetValueIfStepped(int32_t aStep,
|
||||
}
|
||||
}
|
||||
|
||||
value += step * aStep;
|
||||
value += step * Decimal(aStep);
|
||||
|
||||
// For date inputs, the value can hold a string that is not a day. We do not
|
||||
// want to round it, as it might result in a step mismatch. Instead we want to
|
||||
// clamp to the next valid value.
|
||||
if (mType == NS_FORM_INPUT_DATE &&
|
||||
NS_floorModulo(value - GetStepBase(), GetStepScaleFactor()) != 0) {
|
||||
MOZ_ASSERT(GetStep() > 0);
|
||||
NS_floorModulo(Decimal(value - GetStepBase()), GetStepScaleFactor()) != Decimal(0)) {
|
||||
MOZ_ASSERT(GetStep() > Decimal(0));
|
||||
Decimal validStep = EuclidLCM<Decimal>(GetStep().floor(),
|
||||
GetStepScaleFactor().floor());
|
||||
if (aStep > 0) {
|
||||
@ -4116,10 +4116,10 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
case NS_VK_PAGE_UP:
|
||||
// For PgUp/PgDn we jump 10% of the total range, unless step
|
||||
// requires us to jump more.
|
||||
newValue = value + std::max(step, (maximum - minimum) / 10);
|
||||
newValue = value + std::max(step, (maximum - minimum) / Decimal(10));
|
||||
break;
|
||||
case NS_VK_PAGE_DOWN:
|
||||
newValue = value - std::max(step, (maximum - minimum) / 10);
|
||||
newValue = value - std::max(step, (maximum - minimum) / Decimal(10));
|
||||
break;
|
||||
}
|
||||
SetValueOfRangeForUserEvent(newValue);
|
||||
@ -4567,7 +4567,7 @@ HTMLInputElement::SanitizeValue(nsAString& aValue)
|
||||
if (!ok) {
|
||||
needSanitization = true;
|
||||
// Set value to midway between minimum and maximum.
|
||||
value = maximum <= minimum ? minimum : minimum + (maximum - minimum)/2;
|
||||
value = maximum <= minimum ? minimum : minimum + (maximum - minimum)/Decimal(2);
|
||||
} else if (value < minimum || maximum < minimum) {
|
||||
needSanitization = true;
|
||||
value = minimum;
|
||||
@ -4583,17 +4583,17 @@ HTMLInputElement::SanitizeValue(nsAString& aValue)
|
||||
// numbers, but let's ignore that until ECMAScript supplies us with a
|
||||
// decimal number type.
|
||||
Decimal deltaToStep = NS_floorModulo(value - stepBase, step);
|
||||
if (deltaToStep != 0) {
|
||||
if (deltaToStep != Decimal(0)) {
|
||||
// "suffering from a step mismatch"
|
||||
// Round the element's value to the nearest number for which the
|
||||
// element would not suffer from a step mismatch, and which is
|
||||
// greater than or equal to the minimum, and, if the maximum is not
|
||||
// less than the minimum, which is less than or equal to the
|
||||
// maximum, if there is a number that matches these constraints:
|
||||
MOZ_ASSERT(deltaToStep > 0, "stepBelow/stepAbove will be wrong");
|
||||
MOZ_ASSERT(deltaToStep > Decimal(0), "stepBelow/stepAbove will be wrong");
|
||||
Decimal stepBelow = value - deltaToStep;
|
||||
Decimal stepAbove = value - deltaToStep + step;
|
||||
Decimal halfStep = step / 2;
|
||||
Decimal halfStep = step / Decimal(2);
|
||||
bool stepAboveIsClosest = (stepAbove - value) <= halfStep;
|
||||
bool stepAboveInRange = stepAbove >= minimum &&
|
||||
stepAbove <= maximum;
|
||||
@ -6276,7 +6276,7 @@ HTMLInputElement::GetStep() const
|
||||
}
|
||||
|
||||
Decimal step = StringToDecimal(stepStr);
|
||||
if (!step.isFinite() || step <= 0) {
|
||||
if (!step.isFinite() || step <= Decimal(0)) {
|
||||
step = GetDefaultStep();
|
||||
}
|
||||
|
||||
@ -6462,7 +6462,7 @@ HTMLInputElement::HasStepMismatch(bool aUseZeroIfValueNaN) const
|
||||
Decimal value = GetValueAsDecimal();
|
||||
if (value.isNaN()) {
|
||||
if (aUseZeroIfValueNaN) {
|
||||
value = 0;
|
||||
value = Decimal(0);
|
||||
} else {
|
||||
// The element can't suffer from step mismatch if it's value isn't a number.
|
||||
return false;
|
||||
@ -6475,7 +6475,7 @@ HTMLInputElement::HasStepMismatch(bool aUseZeroIfValueNaN) const
|
||||
}
|
||||
|
||||
// Value has to be an integral multiple of step.
|
||||
return NS_floorModulo(value - GetStepBase(), step) != 0;
|
||||
return NS_floorModulo(value - GetStepBase(), step) != Decimal(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6881,7 +6881,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
|
||||
MOZ_ASSERT(!value.isNaN());
|
||||
|
||||
Decimal step = GetStep();
|
||||
MOZ_ASSERT(step != kStepAny && step > 0);
|
||||
MOZ_ASSERT(step != kStepAny && step > Decimal(0));
|
||||
|
||||
// In case this is a date and the step is not an integer, we don't want to
|
||||
// display the dates corresponding to the truncated timestamps of valueLow
|
||||
|
@ -526,7 +526,7 @@ nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent)
|
||||
nscoord posAtStart = rangeContentRect.x + thumbSize.width/2;
|
||||
nscoord posAtEnd = posAtStart + traversableDistance;
|
||||
nscoord posOfPoint = mozilla::clamped(point.x, posAtStart, posAtEnd);
|
||||
fraction = Decimal(posOfPoint - posAtStart) / traversableDistance;
|
||||
fraction = Decimal(posOfPoint - posAtStart) / Decimal(traversableDistance);
|
||||
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
fraction = Decimal(1) - fraction;
|
||||
}
|
||||
@ -540,10 +540,10 @@ nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent)
|
||||
nscoord posOfPoint = mozilla::clamped(point.y, posAtStart, posAtEnd);
|
||||
// For a vertical range, the top (posAtStart) is the highest value, so we
|
||||
// subtract the fraction from 1.0 to get that polarity correct.
|
||||
fraction = Decimal(1) - Decimal(posOfPoint - posAtStart) / traversableDistance;
|
||||
fraction = Decimal(1) - Decimal(posOfPoint - posAtStart) / Decimal(traversableDistance);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(fraction >= 0 && fraction <= 1);
|
||||
MOZ_ASSERT(fraction >= Decimal(0) && fraction <= Decimal(1));
|
||||
return minimum + fraction * range;
|
||||
}
|
||||
|
||||
|
@ -942,7 +942,7 @@ protected:
|
||||
|
||||
public:
|
||||
MOZ_CONSTEXPR AtomicBase() : mValue() {}
|
||||
MOZ_CONSTEXPR AtomicBase(T aInit) : mValue(aInit) {}
|
||||
explicit MOZ_CONSTEXPR AtomicBase(T aInit) : mValue(aInit) {}
|
||||
|
||||
// Note: we can't provide operator T() here because Atomic<bool> inherits
|
||||
// from AtomcBase with T=uint32_t and not T=bool. If we implemented
|
||||
@ -992,7 +992,7 @@ class AtomicBaseIncDec : public AtomicBase<T, Order>
|
||||
|
||||
public:
|
||||
MOZ_CONSTEXPR AtomicBaseIncDec() : Base() {}
|
||||
MOZ_CONSTEXPR AtomicBaseIncDec(T aInit) : Base(aInit) {}
|
||||
explicit MOZ_CONSTEXPR AtomicBaseIncDec(T aInit) : Base(aInit) {}
|
||||
|
||||
using Base::operator=;
|
||||
|
||||
@ -1048,7 +1048,7 @@ class Atomic<T, Order, typename EnableIf<IsIntegral<T>::value &&
|
||||
|
||||
public:
|
||||
MOZ_CONSTEXPR Atomic() : Base() {}
|
||||
MOZ_CONSTEXPR Atomic(T aInit) : Base(aInit) {}
|
||||
explicit MOZ_CONSTEXPR Atomic(T aInit) : Base(aInit) {}
|
||||
|
||||
using Base::operator=;
|
||||
|
||||
@ -1096,7 +1096,7 @@ class Atomic<T*, Order> : public detail::AtomicBaseIncDec<T*, Order>
|
||||
|
||||
public:
|
||||
MOZ_CONSTEXPR Atomic() : Base() {}
|
||||
MOZ_CONSTEXPR Atomic(T* aInit) : Base(aInit) {}
|
||||
explicit MOZ_CONSTEXPR Atomic(T* aInit) : Base(aInit) {}
|
||||
|
||||
using Base::operator=;
|
||||
|
||||
@ -1127,7 +1127,7 @@ class Atomic<T, Order, typename EnableIf<IsEnum<T>::value>::Type>
|
||||
|
||||
public:
|
||||
MOZ_CONSTEXPR Atomic() : Base() {}
|
||||
MOZ_CONSTEXPR Atomic(T aInit) : Base(aInit) {}
|
||||
explicit MOZ_CONSTEXPR Atomic(T aInit) : Base(aInit) {}
|
||||
|
||||
operator T() const { return Base::Intrinsics::load(Base::mValue); }
|
||||
|
||||
@ -1161,7 +1161,7 @@ class Atomic<bool, Order>
|
||||
|
||||
public:
|
||||
MOZ_CONSTEXPR Atomic() : Base() {}
|
||||
MOZ_CONSTEXPR Atomic(bool aInit) : Base(aInit) {}
|
||||
explicit MOZ_CONSTEXPR Atomic(bool aInit) : Base(aInit) {}
|
||||
|
||||
// We provide boolean wrappers for the underlying AtomicBase methods.
|
||||
operator bool() const
|
||||
|
@ -12,6 +12,8 @@
|
||||
#ifndef mozilla_DebugOnly_h
|
||||
#define mozilla_DebugOnly_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
@ -39,7 +41,7 @@ public:
|
||||
T value;
|
||||
|
||||
DebugOnly() { }
|
||||
DebugOnly(const T& aOther) : value(aOther) { }
|
||||
MOZ_IMPLICIT DebugOnly(const T& aOther) : value(aOther) { }
|
||||
DebugOnly(const DebugOnly& aOther) : value(aOther.value) { }
|
||||
DebugOnly& operator=(const T& aRhs) {
|
||||
value = aRhs;
|
||||
@ -59,7 +61,7 @@ public:
|
||||
|
||||
#else
|
||||
DebugOnly() { }
|
||||
DebugOnly(const T&) { }
|
||||
MOZ_IMPLICIT DebugOnly(const T&) { }
|
||||
DebugOnly(const DebugOnly&) { }
|
||||
DebugOnly& operator=(const T&) { return *this; }
|
||||
void operator++(int) { }
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define mozilla_EnumSet_h
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -28,7 +29,7 @@ class EnumSet
|
||||
: mBitField(0)
|
||||
{ }
|
||||
|
||||
EnumSet(T aEnum)
|
||||
MOZ_IMPLICIT EnumSet(T aEnum)
|
||||
: mBitField(bitFor(aEnum))
|
||||
{ }
|
||||
|
||||
|
@ -232,7 +232,7 @@ class LinkedListElement
|
||||
NODE_KIND_SENTINEL
|
||||
};
|
||||
|
||||
LinkedListElement(NodeKind nodeKind)
|
||||
explicit LinkedListElement(NodeKind nodeKind)
|
||||
: next(MOZ_THIS_IN_INITIALIZER_LIST()),
|
||||
prev(MOZ_THIS_IN_INITIALIZER_LIST()),
|
||||
isSentinel(nodeKind == NODE_KIND_SENTINEL)
|
||||
|
@ -25,8 +25,8 @@ EuclidGCD(IntegerType a, IntegerType b)
|
||||
{
|
||||
// Euclid's algorithm; O(N) in the worst case. (There are better
|
||||
// ways, but we don't need them for the current use of this algo.)
|
||||
MOZ_ASSERT(a > 0);
|
||||
MOZ_ASSERT(b > 0);
|
||||
MOZ_ASSERT(a > IntegerType(0));
|
||||
MOZ_ASSERT(b > IntegerType(0));
|
||||
|
||||
while (a != b) {
|
||||
if (a > b) {
|
||||
|
@ -222,8 +222,8 @@ class RefPtr
|
||||
public:
|
||||
RefPtr() : ptr(0) { }
|
||||
RefPtr(const RefPtr& o) : ptr(ref(o.ptr)) {}
|
||||
RefPtr(const TemporaryRef<T>& o) : ptr(o.drop()) {}
|
||||
RefPtr(T* t) : ptr(ref(t)) {}
|
||||
MOZ_IMPLICIT RefPtr(const TemporaryRef<T>& o) : ptr(o.drop()) {}
|
||||
MOZ_IMPLICIT RefPtr(T* t) : ptr(ref(t)) {}
|
||||
|
||||
template<typename U>
|
||||
RefPtr(const RefPtr<U>& o) : ptr(ref(o.get())) {}
|
||||
@ -297,7 +297,7 @@ class TemporaryRef
|
||||
typedef typename RefPtr<T>::DontRef DontRef;
|
||||
|
||||
public:
|
||||
TemporaryRef(T* t) : ptr(RefPtr<T>::ref(t)) {}
|
||||
MOZ_IMPLICIT TemporaryRef(T* t) : ptr(RefPtr<T>::ref(t)) {}
|
||||
TemporaryRef(const TemporaryRef& o) : ptr(o.drop()) {}
|
||||
|
||||
template<typename U>
|
||||
@ -348,7 +348,7 @@ class OutParamRef
|
||||
operator T**() { return &tmp; }
|
||||
|
||||
private:
|
||||
OutParamRef(RefPtr<T>& p) : refPtr(p), tmp(p.get()) {}
|
||||
explicit OutParamRef(RefPtr<T>& p) : refPtr(p), tmp(p.get()) {}
|
||||
|
||||
RefPtr<T>& refPtr;
|
||||
T* tmp;
|
||||
|
@ -39,7 +39,7 @@ class RollingMean
|
||||
"floating-point types are unsupported due to rounding "
|
||||
"errors");
|
||||
|
||||
RollingMean(size_t aMaxValues)
|
||||
explicit RollingMean(size_t aMaxValues)
|
||||
: mInsertIndex(0),
|
||||
mMaxValues(aMaxValues),
|
||||
mTotal(0)
|
||||
|
@ -319,8 +319,8 @@ class VectorBase : private AllocPolicy
|
||||
|
||||
typedef T ElementType;
|
||||
|
||||
VectorBase(AllocPolicy = AllocPolicy());
|
||||
VectorBase(ThisVector&&); /* Move constructor. */
|
||||
explicit VectorBase(AllocPolicy = AllocPolicy());
|
||||
explicit VectorBase(ThisVector&&); /* Move constructor. */
|
||||
ThisVector& operator=(ThisVector&&); /* Move assignment. */
|
||||
~VectorBase();
|
||||
|
||||
@ -1209,7 +1209,7 @@ class Vector
|
||||
typedef VectorBase<T, MinInlineCapacity, AllocPolicy, Vector> Base;
|
||||
|
||||
public:
|
||||
Vector(AllocPolicy alloc = AllocPolicy()) : Base(alloc) {}
|
||||
explicit Vector(AllocPolicy alloc = AllocPolicy()) : Base(alloc) {}
|
||||
Vector(Vector&& vec) : Base(Move(vec)) {}
|
||||
Vector& operator=(Vector&& vec) {
|
||||
return Base::operator=(Move(vec));
|
||||
|
@ -191,7 +191,7 @@ class WeakPtr : public WeakPtrBase<T, detail::WeakReference<T> >
|
||||
typedef WeakPtrBase<T, detail::WeakReference<T> > Base;
|
||||
public:
|
||||
WeakPtr(const WeakPtr<T>& o) : Base(o) {}
|
||||
WeakPtr(const Base& o) : Base(o) {}
|
||||
MOZ_IMPLICIT WeakPtr(const Base& o) : Base(o) {}
|
||||
WeakPtr() {}
|
||||
};
|
||||
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
Sign m_sign;
|
||||
};
|
||||
|
||||
MFBT_API Decimal(int32_t = 0);
|
||||
MFBT_API explicit Decimal(int32_t = 0);
|
||||
MFBT_API Decimal(Sign, int exponent, uint64_t coefficient);
|
||||
MFBT_API Decimal(const Decimal&);
|
||||
|
||||
@ -185,7 +185,7 @@ private:
|
||||
int exponent;
|
||||
};
|
||||
|
||||
MFBT_API Decimal(double);
|
||||
MFBT_API explicit Decimal(double);
|
||||
MFBT_API Decimal compareTo(const Decimal&) const;
|
||||
|
||||
static MFBT_API AlignedOperands alignOperands(const Decimal& lhs, const Decimal& rhs);
|
||||
|
@ -20,7 +20,7 @@ struct Person
|
||||
struct GetAge
|
||||
{
|
||||
Vector<Person> &v;
|
||||
GetAge(Vector<Person> &v) : v(v) {}
|
||||
explicit GetAge(Vector<Person> &v) : v(v) {}
|
||||
int operator[](size_t index) const { return v[index].age; }
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@ using mozilla::BloomFilter;
|
||||
class FilterChecker
|
||||
{
|
||||
public:
|
||||
FilterChecker(uint32_t hash) : mHash(hash) { }
|
||||
explicit FilterChecker(uint32_t hash) : mHash(hash) { }
|
||||
|
||||
uint32_t hash() const { return mHash; }
|
||||
|
||||
|
@ -13,7 +13,7 @@ class MyClass
|
||||
public:
|
||||
uint32_t value;
|
||||
|
||||
MyClass(uint32_t val = 0) : value(val) {
|
||||
explicit MyClass(uint32_t val = 0) : value(val) {
|
||||
}
|
||||
|
||||
bool operator==(const MyClass& other) const {
|
||||
|
Loading…
Reference in New Issue
Block a user