Changeset 132731 in webkit
- Timestamp:
- Oct 27, 2012, 10:18:12 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r132728 r132731 1 2012-10-27 Levi Weintraub <leviw@chromium.org> 2 3 Background images can incorrectly repeat with sub-pixel layout 4 https://bugs.webkit.org/show_bug.cgi?id=94622 5 6 Reviewed by Emil A Eklund. 7 8 * fast/sub-pixel/scaled-background-image-expected.html: Added. 9 * fast/sub-pixel/scaled-background-image.html: Added. 10 1 11 2012-10-26 Balazs Kelemen <kbalazs@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r132730 r132731 1 2012-10-27 Levi Weintraub <leviw@chromium.org> 2 3 Background images can incorrectly repeat with sub-pixel layout 4 https://bugs.webkit.org/show_bug.cgi?id=94622 5 6 Reviewed by Emil A Eklund. 7 8 Attempting to better match author expectations when painting tiled background images. When under 9 the effects of zoom with sub-pixel layout enabled, the drawn size of a rendered element can 10 differ depending on its location. This change looks at the size of the scaled tiled background 11 image size, and either ceils or floors that value depending on if tiling that value will 12 result in us being one pixel or less short of covering the background size. This is a heuristic, 13 as sub-pixel/zooming isn't specced. 14 15 Test: fast/sub-pixel/scaled-background-image.html 16 17 * rendering/RenderBoxModelObject.cpp: 18 (WebCore::applySubPixelHeuristicForTileSize): 19 (WebCore): 20 (WebCore::RenderBoxModelObject::calculateFillTileSize): 21 1 22 2012-10-27 Sheriff Bot <webkit.review.bot@gmail.com> 2 23 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r131402 r132731 1047 1047 } 1048 1048 1049 static inline void applySubPixelHeuristicForTileSize(LayoutSize& tileSize, const IntSize& positioningAreaSize) 1050 { 1051 tileSize.setWidth(positioningAreaSize.width() - tileSize.width() <= 1 ? tileSize.width().ceil() : tileSize.width().floor()); 1052 tileSize.setHeight(positioningAreaSize.height() - tileSize.height() <= 1 ? tileSize.height().ceil() : tileSize.height().floor()); 1053 } 1054 1049 1055 IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, const IntSize& positioningAreaSize) const 1050 1056 { … … 1057 1063 switch (type) { 1058 1064 case SizeLength: { 1059 int w = positioningAreaSize.width(); 1060 int h = positioningAreaSize.height(); 1065 LayoutSize tileSize = positioningAreaSize; 1061 1066 1062 1067 Length layerWidth = fillLayer->size().size.width(); … … 1064 1069 1065 1070 if (layerWidth.isFixed()) 1066 w = layerWidth.value();1071 tileSize.setWidth(layerWidth.value()); 1067 1072 else if (layerWidth.isPercent() || layerHeight.isViewportPercentage()) 1068 w = valueForLength(layerWidth, positioningAreaSize.width(), renderView);1073 tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.width(), renderView)); 1069 1074 1070 1075 if (layerHeight.isFixed()) 1071 h = layerHeight.value();1076 tileSize.setHeight(layerHeight.value()); 1072 1077 else if (layerHeight.isPercent() || layerHeight.isViewportPercentage()) 1073 h = valueForLength(layerHeight, positioningAreaSize.height(), renderView); 1074 1078 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.height(), renderView)); 1079 1080 applySubPixelHeuristicForTileSize(tileSize, positioningAreaSize); 1081 1075 1082 // If one of the values is auto we have to use the appropriate 1076 1083 // scale to maintain our aspect ratio. 1077 1084 if (layerWidth.isAuto() && !layerHeight.isAuto()) { 1078 1085 if (imageIntrinsicSize.height()) 1079 w = imageIntrinsicSize.width() * h / imageIntrinsicSize.height();1086 tileSize.setWidth(imageIntrinsicSize.width() * tileSize.height() / imageIntrinsicSize.height()); 1080 1087 } else if (!layerWidth.isAuto() && layerHeight.isAuto()) { 1081 1088 if (imageIntrinsicSize.width()) 1082 h = imageIntrinsicSize.height() * w / imageIntrinsicSize.width();1089 tileSize.setHeight(imageIntrinsicSize.height() * tileSize.width() / imageIntrinsicSize.width()); 1083 1090 } else if (layerWidth.isAuto() && layerHeight.isAuto()) { 1084 1091 // If both width and height are auto, use the image's intrinsic size. 1085 w = imageIntrinsicSize.width(); 1086 h = imageIntrinsicSize.height(); 1092 tileSize = imageIntrinsicSize; 1087 1093 } 1088 1094 1089 return IntSize(max(0, w), max(0, h)); 1095 tileSize.clampNegativeToZero(); 1096 return flooredIntSize(tileSize); 1090 1097 } 1091 1098 case SizeNone: {
Note:
See TracChangeset
for help on using the changeset viewer.