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

Unified Diff: Source/core/paint/BoxPainter.cpp

Issue 659913003: Background image should clamp to minimum size(1, 1) after scale. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed the regressions Created 6 years, 1 month 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/platform/linux/fast/backgrounds/size/zero-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/BoxPainter.cpp
diff --git a/Source/core/paint/BoxPainter.cpp b/Source/core/paint/BoxPainter.cpp
index 2a9a2b6bfb27d10f04fcfec381748385601f1d87..5a454a94cd7cb23809f30d635551dfd4ea5142e8 100644
--- a/Source/core/paint/BoxPainter.cpp
+++ b/Source/core/paint/BoxPainter.cpp
@@ -830,11 +830,19 @@ IntSize BoxPainter::calculateFillTileSize(const RenderBoxModelObject& obj, const
// If one of the values is auto we have to use the appropriate
// scale to maintain our aspect ratio.
if (layerWidth.isAuto() && !layerHeight.isAuto()) {
- if (imageIntrinsicSize.height())
- tileSize.setWidth(imageIntrinsicSize.width() * tileSize.height() / imageIntrinsicSize.height());
+ if (imageIntrinsicSize.height()) {
+ LayoutUnit adjustedWidth = imageIntrinsicSize.width() * tileSize.height() / imageIntrinsicSize.height();
+ if (imageIntrinsicSize.width() >= 1 && adjustedWidth < 1)
+ adjustedWidth = 1;
+ tileSize.setWidth(adjustedWidth);
+ }
} else if (!layerWidth.isAuto() && layerHeight.isAuto()) {
- if (imageIntrinsicSize.width())
- tileSize.setHeight(imageIntrinsicSize.height() * tileSize.width() / imageIntrinsicSize.width());
+ if (imageIntrinsicSize.width()) {
+ LayoutUnit adjustedHeight = imageIntrinsicSize.height() * tileSize.width() / imageIntrinsicSize.width();
+ if (imageIntrinsicSize.height() >= 1 && adjustedHeight < 1)
+ adjustedHeight = 1;
+ tileSize.setHeight(adjustedHeight);
+ }
} else if (layerWidth.isAuto() && layerHeight.isAuto()) {
// If both width and height are auto, use the image's intrinsic size.
tileSize = imageIntrinsicSize;
« no previous file with comments | « LayoutTests/platform/linux/fast/backgrounds/size/zero-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698