Diff
Modified: branches/chromium/1271/LayoutTests/fast/images/zoomed-img-size.html (130677 => 130678)
--- branches/chromium/1271/LayoutTests/fast/images/zoomed-img-size.html 2012-10-08 20:22:42 UTC (rev 130677)
+++ branches/chromium/1271/LayoutTests/fast/images/zoomed-img-size.html 2012-10-08 20:24:55 UTC (rev 130678)
@@ -6,9 +6,19 @@
testRunner.dumpAsText();
function update() {
+ var el = document.getElementById('subpixel-test');
+ var hasSubpixelSupport = el.getBoundingClientRect().width == 4.5;
+ el.parentNode.removeChild(el);
+
// These arrays will become unnecessary if we fix the rounding issues that make us not always report "37x33".
- var expectedWidths = [100, 50, 33, 25, 20, 36, 36, 36, 35, 37, 37, 37, 37, 37, 37];
- var expectedHeights = [100, 50, 33, 25, 20, 30, 30, 32, 32, 33, 33, 33, 33, 33, 33];
+ var expectedWidths, expectedHeights;
+ if (hasSubpixelSupport) {
+ expectedWidths = [100, 50, 33, 25, 40, 36, 36, 38, 37, 37, 37, 38, 37, 37, 37];
+ expectedHeights = [100, 50, 33, 25, 40, 33, 33, 34, 32, 33, 34, 34, 33, 33, 33];
+ } else {
+ expectedWidths = [100, 50, 33, 25, 20, 36, 36, 36, 35, 37, 37, 37, 37, 37, 37];
+ expectedHeights = [100, 50, 33, 25, 20, 30, 30, 32, 32, 33, 33, 33, 33, 33, 33];
+ }
for (i = 0; i < 15; ++i) {
var oval = document.getElementById('oval' + i);
var status = document.getElementById('status' + i);
@@ -59,5 +69,6 @@
<p>Zoom 400% <span id="status13"></span>: <span id="sizes13"></span></p>
<img id="oval14" src="" style="zoom: 1234%">
<p>Zoom 1234% <span id="status14"></span>: <span id="sizes14"></span></p>
+ <div id="subpixel-test" style="width: 4.5px; height: 10px;"></div>
</body>
</html>
Copied: branches/chromium/1271/LayoutTests/fast/sub-pixel/zoomed-image-tiles-expected.html (from rev 130329, trunk/LayoutTests/fast/sub-pixel/zoomed-image-tiles-expected.html) (0 => 130678)
--- branches/chromium/1271/LayoutTests/fast/sub-pixel/zoomed-image-tiles-expected.html (rev 0)
+++ branches/chromium/1271/LayoutTests/fast/sub-pixel/zoomed-image-tiles-expected.html 2012-10-08 20:24:55 UTC (rev 130678)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body style="zoom: 1.1">
+ <div style="z-index: 1; overflow: hidden; width: 740px; height: 100px; position: relative;">
+ <div style="width: 165888px; height: 100px; position: absolute; z-index: -1; left: -69267px; top: 0px;">
+ <img src="" style="opacity: 0.75; background: blue; left: 67584px; z-index: -1; position: absolute; width: 4096px; height: 100px;">
+ </div>
+ </div>
+</body>
+</html>
Copied: branches/chromium/1271/LayoutTests/fast/sub-pixel/zoomed-image-tiles.html (from rev 130329, trunk/LayoutTests/fast/sub-pixel/zoomed-image-tiles.html) (0 => 130678)
--- branches/chromium/1271/LayoutTests/fast/sub-pixel/zoomed-image-tiles.html (rev 0)
+++ branches/chromium/1271/LayoutTests/fast/sub-pixel/zoomed-image-tiles.html 2012-10-08 20:24:55 UTC (rev 130678)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body style="zoom: 1.1">
+ <div style="z-index: 1; overflow: hidden; width: 740px; height: 100px; position: relative;">
+ <div style="width: 165888px; height: 100px; position: absolute; z-index: -1; left: -69267px; top: 0px;">
+ <img src="" style="opacity: 0.75; background: blue; left: 67584px; z-index: -1; position: absolute; width: 2048px; height: 100px;">
+ <img src="" style="opacity: 0.75; background: blue; left: 69632px; z-index: -1; position: absolute; width: 2048px; height: 100px;">
+ </div>
+ </div>
+</body>
+</html>
Copied: branches/chromium/1271/LayoutTests/platform/chromium/fast/images/zoomed-img-size-expected.txt (from rev 130329, trunk/LayoutTests/platform/chromium/fast/images/zoomed-img-size-expected.txt) (0 => 130678)
--- branches/chromium/1271/LayoutTests/platform/chromium/fast/images/zoomed-img-size-expected.txt (rev 0)
+++ branches/chromium/1271/LayoutTests/platform/chromium/fast/images/zoomed-img-size-expected.txt 2012-10-08 20:24:55 UTC (rev 130678)
@@ -0,0 +1,46 @@
+Ideally, all ovals below should be reported as having width=37, height=33. Currently rounding prevents us from doing this.
+
+
+Zoom 1% PASS: 100x100 close enough to 37x33
+
+
+Zoom 2% PASS: 50x50 close enough to 37x33
+
+
+Zoom 3% PASS: 33x33 close enough to 37x33
+
+
+Zoom 4% PASS: 25x25 close enough to 37x33
+
+
+Zoom 5% PASS: 40x40 close enough to 37x33
+
+
+Zoom 30% PASS: 36x33 close enough to 37x33
+
+
+Zoom 33% PASS: 36x33 close enough to 37x33
+
+
+Zoom 50% PASS: 38x34 close enough to 37x33
+
+
+Zoom 70% PASS: 37x32 close enough to 37x33
+
+
+Zoom 100% PASS: 37x33
+
+
+Zoom 111% PASS: 37x34 close enough to 37x33
+
+
+Zoom 150% PASS: 38x34 close enough to 37x33
+
+
+Zoom 333% PASS: 37x33
+
+
+Zoom 400% PASS: 37x33
+
+
+Zoom 1234% PASS: 37x33
Modified: branches/chromium/1271/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt (130677 => 130678)
--- branches/chromium/1271/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt 2012-10-08 20:22:42 UTC (rev 130677)
+++ branches/chromium/1271/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt 2012-10-08 20:24:55 UTC (rev 130678)
@@ -15,15 +15,15 @@
RenderText {#text} at (0,0) size 478x25
text run at (0,0) width 478: "Both sides should have identical size after zooming"
RenderTableRow {tr} at (0,67) size 490x24
- RenderTableCell {td} at (1,67) size 243x24 [r=1 c=0 rs=1 cs=1]
- RenderText {#text} at (96,5) size 51x14
- text run at (96,5) width 51: "SVG Image"
- RenderTableCell {td} at (245,67) size 244x24 [r=1 c=1 rs=1 cs=1]
- RenderText {#text} at (95,5) size 54x14
- text run at (95,5) width 54: "PNG Image"
+ RenderTableCell {td} at (1,67) size 242x24 [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (96,5) size 50x14
+ text run at (96,5) width 50: "SVG Image"
+ RenderTableCell {td} at (244,67) size 245x24 [r=1 c=1 rs=1 cs=1]
+ RenderText {#text} at (96,5) size 53x14
+ text run at (96,5) width 53: "PNG Image"
RenderTableRow {tr} at (0,92) size 490x82
- RenderTableCell {td} at (1,92) size 243x82 [r=2 c=0 rs=1 cs=1]
- RenderEmbeddedObject {object} at (100,5) size 138x69
+ RenderTableCell {td} at (1,92) size 242x82 [r=2 c=0 rs=1 cs=1]
+ RenderEmbeddedObject {object} at (99,5) size 138x69
layer at (0,0) size 139x69
RenderView at (0,0) size 138x69
layer at (0,0) size 139x69
@@ -42,6 +42,6 @@
chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 269.61: "$Revision: 1.7 $"
RenderSVGRect {rect} at (23,0) size 93x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
RenderText {#text} at (0,0) size 0x0
- RenderTableCell {td} at (245,92) size 244x82 [r=2 c=1 rs=1 cs=1]
- RenderImage {img} at (5,5) size 138x69
+ RenderTableCell {td} at (244,92) size 245x82 [r=2 c=1 rs=1 cs=1]
+ RenderImage {img} at (5,5) size 139x69
RenderText {#text} at (0,0) size 0x0
Modified: branches/chromium/1271/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt (130677 => 130678)
--- branches/chromium/1271/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt 2012-10-08 20:22:42 UTC (rev 130677)
+++ branches/chromium/1271/LayoutTests/platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt 2012-10-08 20:24:55 UTC (rev 130678)
@@ -15,15 +15,15 @@
RenderText {#text} at (0,0) size 478x25
text run at (0,0) width 478: "Both sides should have identical size after zooming"
RenderTableRow {tr} at (0,67) size 490x24
- RenderTableCell {td} at (1,67) size 244x24 [r=1 c=0 rs=1 cs=1]
- RenderText {#text} at (97,5) size 50x14
- text run at (97,5) width 50: "SVG Image"
- RenderTableCell {td} at (246,67) size 243x24 [r=1 c=1 rs=1 cs=1]
- RenderText {#text} at (95,5) size 53x14
- text run at (95,5) width 53: "PNG Image"
+ RenderTableCell {td} at (1,67) size 243x24 [r=1 c=0 rs=1 cs=1]
+ RenderText {#text} at (96,5) size 51x14
+ text run at (96,5) width 51: "SVG Image"
+ RenderTableCell {td} at (245,67) size 244x24 [r=1 c=1 rs=1 cs=1]
+ RenderText {#text} at (95,5) size 54x14
+ text run at (95,5) width 54: "PNG Image"
RenderTableRow {tr} at (0,92) size 490x82
- RenderTableCell {td} at (1,92) size 244x82 [r=2 c=0 rs=1 cs=1]
- RenderEmbeddedObject {object} at (100,4) size 139x70
+ RenderTableCell {td} at (1,92) size 243x82 [r=2 c=0 rs=1 cs=1]
+ RenderEmbeddedObject {object} at (99,4) size 139x70
layer at (0,0) size 139x69
RenderView at (0,0) size 139x69
layer at (0,0) size 139x69
@@ -42,6 +42,6 @@
chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 269.61: "$Revision: 1.7 $"
RenderSVGRect {rect} at (23,0) size 93x69 [stroke={[type=SOLID] [color=#000000]}] [x=1.00] [y=1.00] [width=478.00] [height=358.00]
RenderText {#text} at (0,0) size 0x0
- RenderTableCell {td} at (246,92) size 243x82 [r=2 c=1 rs=1 cs=1]
- RenderImage {img} at (5,5) size 138x69
+ RenderTableCell {td} at (245,92) size 244x82 [r=2 c=1 rs=1 cs=1]
+ RenderImage {img} at (5,5) size 139x69
RenderText {#text} at (0,0) size 0x0
Modified: branches/chromium/1271/Source/WebCore/loader/cache/CachedImage.cpp (130677 => 130678)
--- branches/chromium/1271/Source/WebCore/loader/cache/CachedImage.cpp 2012-10-08 20:22:42 UTC (rev 130677)
+++ branches/chromium/1271/Source/WebCore/loader/cache/CachedImage.cpp 2012-10-08 20:24:55 UTC (rev 130678)
@@ -264,7 +264,12 @@
float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier;
float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier;
IntSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0);
+#if ENABLE(SUBPIXEL_LAYOUT)
+ imageSize.setWidth(lroundf(imageSize.width() * widthScale));
+ imageSize.setHeight(lroundf(imageSize.height() * heightScale));
+#else
imageSize.scale(widthScale, heightScale);
+#endif
imageSize.clampToMinimumSize(minimumSize);
return imageSize;
}