haikuwebkit/LayoutTests/compositing/hidpi-nested-compositing-la...

38 lines
931 B
HTML
Raw Permalink Normal View History

Subpixel rendering: Nested layers with subpixel accumulation paint to wrong position. https://bugs.webkit.org/show_bug.cgi?id=130153 Reviewed by Simon Fraser. Subpixels (fractional device pixels here) can accumulate through nested layers. Subpixels need to be propagated through the layer tree so that painting coordinates match layout coordinates. Subpixel accumulation through nesting (absolute positioning, 2x display): non-compositing case: (nested boxes) (layout pos) (norm.paint pos) (translate accumulation, subpixel accumulation, final paint pos) div -> top: 1.3px 1.3px 1.5px 1.5px 0.2px -> snapped 0.0px -> 1.5px div -> top: 1.3px 2.6px 2.5px 3.0px 0.4px -> snapped 0.5px -> 2.5px div -> top: 1.3px 3.9px 4.0px 4.5px 0.6px -> snapped 0.5px -> 4.0px div -> top: 1.3px 5.2px 5.0px 6.0px 0.8px -> snapped 1.0px -> 5.0px compositing case: (nested boxes) (layout pos) (norm.paint pos) (device pixel offset + fractional offset, final pos) div -> top: 1.3px 1.3px 1.5px 1.0px + 0.3px -> snapped -> 1.5px div -> top: 1.3px 2.6px 2.5px 2.5px + 0.1px -> snapped -> 2.5px div -> top: 1.3px 3.9px 4.0px 3.5px + 0.4px -> snapped -> 4.0px div -> top: 1.3px 5.2px 5.0px 5.0px + 0.2px -> snapped -> 5.0px Source/WebCore: Tests: compositing/hidpi-nested-compositing-layers-with-subpixel-accumulation.html fast/layers/hidpi-nested-layers-with-subpixel-accumulation.html * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerByApplyingTransform): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): * rendering/RenderLayerBacking.h: (WebCore::RenderLayerBacking::devicePixelFractionFromRenderer): LayoutTests: * compositing/hidpi-nested-compositing-layers-with-subpixel-accumulation-expected.html: Added. * compositing/hidpi-nested-compositing-layers-with-subpixel-accumulation.html: Added. * fast/layers/hidpi-nested-layers-with-subpixel-accumulation-expected.html: Added. * fast/layers/hidpi-nested-layers-with-subpixel-accumulation.html: Added. Canonical link: https://commits.webkit.org/148506@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-03-20 14:20:22 +00:00
<!DOCTYPE html>
<html>
<head>
<title>This tests that nested compositing layers with subpixel accumulation paint to the same position as regular, non-compositing content.</title>
<style>
div {
width: 50px;
height: 50px;
left: 0px;
border: 1px solid;
position: absolute;
}
</style>
</head>
<body>
<p id="container"></p>
<script>
left = 0;
for (i = 0; i < 6; ++i, left+=55.3) {
var container = document.getElementById("container");
dimension = 50;
for (j = 0; j < 10; ++j, dimension+=-4) {
var e = document.createElement("div");
e.style.top = "1.3px";
e.style.width = dimension + "px";
e.style.height = dimension + "px";
if (j == 0)
e.style.left = left + "px";
color = (j * 20);
e.style.borderColor = "rgb(" + color + ", " + color + ", " + color + ")";
container.appendChild(e);
container = e;
}
}
</script>
</body>
</html>