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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 2647343012: cc: Ensure that layer bounds * content scale doesn't overflow (Closed)
Patch Set: Typo Created 3 years, 11 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 | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 4c4f88391284a6b2a64d852127b0d7529f9fc7bc..6078b07e7c7fdb4c68e6a6ea888d496f544b1a7d 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -710,6 +710,36 @@ TEST_F(PictureLayerImplTest, ZoomOutCrash) {
EXPECT_EQ(active_layer()->tilings()->NumHighResTilings(), 1);
}
+TEST_F(PictureLayerImplTest, ScaledBoundsOverflowInt) {
+ // Limit visible size.
+ gfx::Size viewport_size(1, 1);
+ host_impl()->SetViewportSize(viewport_size);
+
+ gfx::Size layer_bounds(600000, 60);
+
+ // Set up the high and low res tilings before pinch zoom.
+ SetupDefaultTrees(layer_bounds);
+ ResetTilingsAndRasterScales();
+ EXPECT_EQ(0u, active_layer()->tilings()->num_tilings());
+ float scale = 8000.f;
+
+ // Verify this will overflow an int.
+ EXPECT_GT(static_cast<float>(layer_bounds.width()) * scale,
+ static_cast<float>(std::numeric_limits<int>::max()));
+
+ SetContentsScaleOnBothLayers(scale, 1.0f, scale, 1.0f, 0.f, false);
+ float adjusted_scale = active_layer()->HighResTiling()->contents_scale();
+ EXPECT_LT(adjusted_scale, scale);
+
+ // PopulateSharedQuadState CHECKs for overflows.
+ // See http://crbug.com/679035
+ active_layer()->draw_properties().visible_layer_rect =
+ gfx::Rect(layer_bounds);
+ SharedQuadState state;
+ active_layer()->PopulateScaledSharedQuadState(&state, adjusted_scale,
+ adjusted_scale);
+}
+
TEST_F(PictureLayerImplTest, PinchGestureTilings) {
gfx::Size layer_bounds(1300, 1900);
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698