Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
| 6 #include "core/layout/LayoutTreeAsText.h" | 6 #include "core/layout/LayoutTreeAsText.h" |
| 7 #include "core/layout/LayoutView.h" | 7 #include "core/layout/LayoutView.h" |
| 8 #include "core/paint/ObjectPaintProperties.h" | 8 #include "core/paint/ObjectPaintProperties.h" |
| 9 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 9 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 911 " <div style='position: relative; top: 100px; left: 100px'>" | 911 " <div style='position: relative; top: 100px; left: 100px'>" |
| 912 " <div id='spanner' style='column-span: all; opacity: 0.5; width: 100 px; height: 100px;'></div>" | 912 " <div id='spanner' style='column-span: all; opacity: 0.5; width: 100 px; height: 100px;'></div>" |
| 913 " </div>" | 913 " </div>" |
| 914 "</div>" | 914 "</div>" |
| 915 ); | 915 ); |
| 916 | 916 |
| 917 LayoutObject& spanner = *getLayoutObjectByElementId("spanner"); | 917 LayoutObject& spanner = *getLayoutObjectByElementId("spanner"); |
| 918 EXPECT_EQ(LayoutPoint(55, 44), spanner.objectPaintProperties()->localBorderB oxProperties()->paintOffset); | 918 EXPECT_EQ(LayoutPoint(55, 44), spanner.objectPaintProperties()->localBorderB oxProperties()->paintOffset); |
| 919 } | 919 } |
| 920 | 920 |
| 921 TEST_F(PaintPropertyTreeBuilderTest, PaintOffsetPixelSnapping) | |
| 922 { | |
| 923 setBodyInnerHTML( | |
| 924 "<style>" | |
| 925 " * { margin: 0; }" | |
| 926 " div { position: relative; }" | |
| 927 "</style>" | |
| 928 "<div id='a' style='width: 70px; height: 70px; left: 0.7px; top: 0.7px;' >" | |
| 929 " <div id='b' style='background: red; width: 40px; height: 40px; transf orm: translateZ(0);'>" | |
| 930 " <div id='c' style='background: white; width: 40px; height: 40px; le ft: 0.7px; top: 0.7px;'></div>" | |
| 931 " </div>" | |
| 932 "</div>" | |
| 933 ); | |
| 934 | |
| 935 ObjectPaintProperties* bProperties = document().getElementById("b")->layoutO bject()->objectPaintProperties(); | |
| 936 EXPECT_EQ(TransformationMatrix().translate3d(0, 0, 0), bProperties->transfor m()->matrix()); | |
| 937 // The paint offset transform should be snapped from (0.7,0.7) to (1,1). | |
| 938 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
| |
| 939 } | |
| 940 | |
| 921 } // namespace blink | 941 } // namespace blink |
| OLD | NEW |