mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1043163. Avoid negative widths and heights due to overflow. r=mats
--HG-- extra : rebase_source : 62db3ad669f7a965672ea6bbab1b932c4a07040f
This commit is contained in:
parent
9479fff06b
commit
28409a4a31
@ -244,10 +244,11 @@ nsRect::ScaleToNearestPixels(float aXScale, float aYScale,
|
||||
nsIntRect rect;
|
||||
rect.x = NSToIntRoundUp(NSAppUnitsToDoublePixels(x, aAppUnitsPerPixel) * aXScale);
|
||||
rect.y = NSToIntRoundUp(NSAppUnitsToDoublePixels(y, aAppUnitsPerPixel) * aYScale);
|
||||
rect.width = NSToIntRoundUp(NSAppUnitsToDoublePixels(XMost(),
|
||||
aAppUnitsPerPixel) * aXScale) - rect.x;
|
||||
rect.height = NSToIntRoundUp(NSAppUnitsToDoublePixels(YMost(),
|
||||
aAppUnitsPerPixel) * aYScale) - rect.y;
|
||||
// Avoid negative widths and heights due to overflow
|
||||
rect.width = std::max(0, NSToIntRoundUp(NSAppUnitsToDoublePixels(XMost(),
|
||||
aAppUnitsPerPixel) * aXScale) - rect.x);
|
||||
rect.height = std::max(0, NSToIntRoundUp(NSAppUnitsToDoublePixels(YMost(),
|
||||
aAppUnitsPerPixel) * aYScale) - rect.y);
|
||||
return rect;
|
||||
}
|
||||
|
||||
@ -259,10 +260,11 @@ nsRect::ScaleToOutsidePixels(float aXScale, float aYScale,
|
||||
nsIntRect rect;
|
||||
rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale);
|
||||
rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale);
|
||||
rect.width = NSToIntCeil(NSAppUnitsToFloatPixels(XMost(),
|
||||
float(aAppUnitsPerPixel)) * aXScale) - rect.x;
|
||||
rect.height = NSToIntCeil(NSAppUnitsToFloatPixels(YMost(),
|
||||
float(aAppUnitsPerPixel)) * aYScale) - rect.y;
|
||||
// Avoid negative widths and heights due to overflow
|
||||
rect.width = std::max(0, NSToIntCeil(NSAppUnitsToFloatPixels(XMost(),
|
||||
float(aAppUnitsPerPixel)) * aXScale) - rect.x);
|
||||
rect.height = std::max(0, NSToIntCeil(NSAppUnitsToFloatPixels(YMost(),
|
||||
float(aAppUnitsPerPixel)) * aYScale) - rect.y);
|
||||
return rect;
|
||||
}
|
||||
|
||||
@ -274,10 +276,11 @@ nsRect::ScaleToInsidePixels(float aXScale, float aYScale,
|
||||
nsIntRect rect;
|
||||
rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)) * aXScale);
|
||||
rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)) * aYScale);
|
||||
rect.width = NSToIntFloor(NSAppUnitsToFloatPixels(XMost(),
|
||||
float(aAppUnitsPerPixel)) * aXScale) - rect.x;
|
||||
rect.height = NSToIntFloor(NSAppUnitsToFloatPixels(YMost(),
|
||||
float(aAppUnitsPerPixel)) * aYScale) - rect.y;
|
||||
// Avoid negative widths and heights due to overflow
|
||||
rect.width = std::max(0, NSToIntFloor(NSAppUnitsToFloatPixels(XMost(),
|
||||
float(aAppUnitsPerPixel)) * aXScale) - rect.x);
|
||||
rect.height = std::max(0, NSToIntFloor(NSAppUnitsToFloatPixels(YMost(),
|
||||
float(aAppUnitsPerPixel)) * aYScale) - rect.y);
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
2
layout/base/crashtests/1043163-1.html
Normal file
2
layout/base/crashtests/1043163-1.html
Normal file
@ -0,0 +1,2 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html style="mask: url(#none);"><canvas style="transform: scaleY(-118055395520340);"></canvas></html>
|
@ -439,3 +439,4 @@ load 935765-1.html
|
||||
load 942690.html
|
||||
load 973390-1.html
|
||||
load 1001237.html
|
||||
load 1043163-1.html
|
||||
|
Loading…
Reference in New Issue
Block a user