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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2112753002: Snap paint offset paint property to pixel boundaries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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
Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 80a4da496abba79ce6c567a94452e6957754bc79..ba89b11f9657d8d7b2370c6110f1c11894bad63d 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -918,4 +918,24 @@ TEST_F(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned)
EXPECT_EQ(LayoutPoint(55, 44), spanner.objectPaintProperties()->localBorderBoxProperties()->paintOffset);
}
+TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetPixelSnapping)
+{
+ setBodyInnerHTML(
+ "<style>"
+ " * { margin: 0; }"
+ " div { position: relative; }"
+ "</style>"
+ "<div id='a' style='width: 70px; height: 70px; left: 0.7px; top: 0.7px;'>"
+ " <div id='b' style='background: red; width: 40px; height: 40px; transform: translateZ(0);'>"
+ " <div id='c' style='background: white; width: 40px; height: 40px; left: 0.7px; top: 0.7px;'></div>"
+ " </div>"
+ "</div>"
+ );
+
+ ObjectPaintProperties* bProperties = document().getElementById("b")->layoutObject()->objectPaintProperties();
+ EXPECT_EQ(TransformationMatrix().translate3d(0, 0, 0), bProperties->transform()->matrix());
+ // The paint offset transform should be snapped from (0.7,0.7) to (1,1).
+ EXPECT_EQ(TransformationMatrix().translate(1, 1), bProperties->transform()->parent()->matrix());
chrishtr 2016/06/29 23:46:30 Is there already a unittest for not snapping if th
pdr. 2016/06/30 16:03:12 Added one in PaintOffsetWithBasicPixelSnapping.
chrishtr 2016/06/30 16:57:17 That test still uses a transform. I was asking for
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698