Bug 1577236 - clang-10: Fix -Wimplicit-int-float-conversion warnings in /layout/ r=jwatt

Differential Revision: https://phabricator.services.mozilla.com/D43784

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sylvestre Ledru 2019-09-11 13:50:36 +00:00
parent 1b10416bd7
commit 3029c376ad
3 changed files with 8 additions and 13 deletions

View File

@ -2261,8 +2261,8 @@ static void ConstrainToCoordValues(float& aStart, float& aSize) {
// can't return a value greater than nscoord_MAX. If aSize is greater than
// nscoord_MAX then we reduce it to nscoord_MAX while keeping the rect
// centered:
if (aSize > nscoord_MAX) {
float excess = aSize - nscoord_MAX;
if (aSize > float(nscoord_MAX)) {
float excess = aSize - float(nscoord_MAX);
excess /= 2;
aStart += excess;
aSize = (float)nscoord_MAX;

View File

@ -2092,9 +2092,9 @@ void FrameLayerBuilder::Init(nsDisplayListBuilder* aBuilder,
}
void FrameLayerBuilder::FlashPaint(gfxContext* aContext) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
float r = float(rand()) / float(RAND_MAX);
float g = float(rand()) / float(RAND_MAX);
float b = float(rand()) / float(RAND_MAX);
aContext->SetColor(Color(r, g, b, 0.4f));
aContext->Paint();
}

View File

@ -447,13 +447,7 @@ nscoord StyleCSSPixelLength::ToAppUnits() const {
return 0;
}
float length = _0 * float(mozilla::AppUnitsPerCSSPixel());
if (length >= nscoord_MAX) {
return nscoord_MAX;
}
if (length <= nscoord_MIN) {
return nscoord_MIN;
}
return NSToIntRound(length);
return NSToCoordRoundWithClamp(length);
}
constexpr LengthPercentage LengthPercentage::Zero() {
@ -700,7 +694,8 @@ constexpr const auto kPaintOrderShift = StylePAINT_ORDER_SHIFT;
constexpr const auto kPaintOrderMask = StylePAINT_ORDER_MASK;
template <>
inline nsRect StyleGenericClipRect<LengthOrAuto>::ToLayoutRect(nscoord aAutoSize) const {
inline nsRect StyleGenericClipRect<LengthOrAuto>::ToLayoutRect(
nscoord aAutoSize) const {
nscoord x = left.IsLength() ? left.ToLength() : 0;
nscoord y = top.IsLength() ? top.ToLength() : 0;
nscoord width = right.IsLength() ? right.ToLength() - x : aAutoSize;