Title: [198309] trunk
- Revision
- 198309
- Author
- [email protected]
- Date
- 2016-03-16 17:07:58 -0700 (Wed, 16 Mar 2016)
Log Message
Subpixel rendering: Directly composited image layers need pixelsnapping.
https://bugs.webkit.org/show_bug.cgi?id=155558
Reviewed by Simon Fraser.
In order to match non-composited image size/position, we need to pixelsnap both the contents and the clipping
layer bounds for directly composited images.
Source/WebCore:
Test: fast/images/hidpi-directly-composited-image-on-subpixel-position.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::resetContentsRect):
(WebCore::RenderLayerBacking::updateChildClippingStrategy):
(WebCore::RenderLayerBacking::updateImageContents):
LayoutTests:
* fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html: Added.
* fast/images/hidpi-directly-composited-image-on-subpixel-position.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (198308 => 198309)
--- trunk/LayoutTests/ChangeLog 2016-03-16 23:37:37 UTC (rev 198308)
+++ trunk/LayoutTests/ChangeLog 2016-03-17 00:07:58 UTC (rev 198309)
@@ -1,3 +1,16 @@
+2016-03-16 Zalan Bujtas <[email protected]>
+
+ Subpixel rendering: Directly composited image layers need pixelsnapping.
+ https://bugs.webkit.org/show_bug.cgi?id=155558
+
+ Reviewed by Simon Fraser.
+
+ In order to match non-composited image size/position, we need to pixelsnap both the contents and the clipping
+ layer bounds for directly composited images.
+
+ * fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html: Added.
+ * fast/images/hidpi-directly-composited-image-on-subpixel-position.html: Added.
+
2016-03-16 Ryan Haddad <[email protected]>
Skipping mathml/very-large-stretchy-operators.html on ios-simulator debug
Added: trunk/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html (0 => 198309)
--- trunk/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html (rev 0)
+++ trunk/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position-expected.html 2016-03-17 00:07:58 UTC (rev 198309)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we position directly composited images properly.</title>
+<style>
+img {
+ position: absolute;
+ width: 10px;
+ height: 10px;
+ }
+</style>
+</head>
+<body>
+<div id=container></div>
+</body>
+<script>
+var container = document.getElementById("container");
+var offset = 0;
+for (i = 0; i < 20; ++i) {
+ for (j = 0; j < 20; ++j) {
+ var element = document.createElement("img");
+ element.src = ""
+ element.style.top = 15 * i + offset;
+ element.style.left = 15 * j + offset;
+ container.appendChild(element);
+ }
+ offset += 0.2;
+}
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position.html (0 => 198309)
--- trunk/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position.html (rev 0)
+++ trunk/LayoutTests/fast/images/hidpi-directly-composited-image-on-subpixel-position.html 2016-03-17 00:07:58 UTC (rev 198309)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we position directly composited images properly.</title>
+<style>
+img {
+ position: absolute;
+ width: 10px;
+ height: 10px;
+ -webkit-transform: translateZ(0);
+ }
+</style>
+</head>
+<body>
+<div id=container></div>
+</body>
+<script>
+var container = document.getElementById("container");
+var offset = 0;
+for (i = 0; i < 20; ++i) {
+ for (j = 0; j < 20; ++j) {
+ var element = document.createElement("img");
+ element.src = ""
+ element.style.top = 15 * i + offset;
+ element.style.left = 15 * j + offset;
+ container.appendChild(element);
+ }
+ offset += 0.2;
+}
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (198308 => 198309)
--- trunk/Source/WebCore/ChangeLog 2016-03-16 23:37:37 UTC (rev 198308)
+++ trunk/Source/WebCore/ChangeLog 2016-03-17 00:07:58 UTC (rev 198309)
@@ -1,3 +1,20 @@
+2016-03-16 Zalan Bujtas <[email protected]>
+
+ Subpixel rendering: Directly composited image layers need pixelsnapping.
+ https://bugs.webkit.org/show_bug.cgi?id=155558
+
+ Reviewed by Simon Fraser.
+
+ In order to match non-composited image size/position, we need to pixelsnap both the contents and the clipping
+ layer bounds for directly composited images.
+
+ Test: fast/images/hidpi-directly-composited-image-on-subpixel-position.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::resetContentsRect):
+ (WebCore::RenderLayerBacking::updateChildClippingStrategy):
+ (WebCore::RenderLayerBacking::updateImageContents):
+
2016-03-16 Beth Dakin <[email protected]>
Provide NSSpellChecker spellChecking methods with the current insertion point
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (198308 => 198309)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2016-03-16 23:37:37 UTC (rev 198308)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2016-03-17 00:07:58 UTC (rev 198309)
@@ -1203,12 +1203,12 @@
void RenderLayerBacking::resetContentsRect()
{
- m_graphicsLayer->setContentsRect(snappedIntRect(contentsBox()));
+ m_graphicsLayer->setContentsRect(snapRectToDevicePixels(contentsBox(), deviceScaleFactor()));
if (is<RenderBox>(renderer())) {
LayoutRect boxRect(LayoutPoint(), downcast<RenderBox>(renderer()).size());
+ boxRect.move(contentOffsetInCompostingLayer());
FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
- contentsClippingRect.move(contentOffsetInCompostingLayer());
m_graphicsLayer->setContentsClippingRect(contentsClippingRect);
}
@@ -1547,8 +1547,8 @@
if (is<RenderBox>(renderer()) && (renderer().style().clipPath() || renderer().style().hasBorderRadius())) {
// FIXME: we shouldn't get geometry here as layout may not have been udpated.
LayoutRect boxRect(LayoutPoint(), downcast<RenderBox>(renderer()).size());
+ boxRect.move(contentOffsetInCompostingLayer());
FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
- contentsClippingRect.move(contentOffsetInCompostingLayer());
if (clippingLayer()->setMasksToBoundsRect(contentsClippingRect)) {
if (m_childClippingMaskLayer)
m_childClippingMaskLayer = nullptr;
@@ -2060,11 +2060,11 @@
return;
// This is a no-op if the layer doesn't have an inner layer for the image.
- m_graphicsLayer->setContentsRect(snappedIntRect(contentsBox()));
+ m_graphicsLayer->setContentsRect(snapRectToDevicePixels(contentsBox(), deviceScaleFactor()));
LayoutRect boxRect(LayoutPoint(), imageRenderer.size());
+ boxRect.move(contentOffsetInCompostingLayer());
FloatRoundedRect contentsClippingRect = renderer().style().getRoundedInnerBorderFor(boxRect).pixelSnappedRoundedRectForPainting(deviceScaleFactor());
- contentsClippingRect.move(contentOffsetInCompostingLayer());
m_graphicsLayer->setContentsClippingRect(contentsClippingRect);
m_graphicsLayer->setContentsToImage(image);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes