Cleanup transform-related methods in RenderLayer.

-Get rid of paintsWithTransform.
-Remove currentTransform. It was only ever called with
IncludeTransformOrigin and on non-null transforms.
-Remove renderableTransform. It was only called on
non-null transforms.
-Remove a layer()->parent() branch. The ASSERT had been
added in a previous patch, but the branch wasn't removed.
-Inline makeMatrixRenderable. It was only called in one
place.
-Add a test to make sure that transform origin is corrrectly
excluded from the transform computedStyle.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/958463002
This commit is contained in:
Ojan Vafai 2015-02-24 14:31:48 -08:00
parent 8da87cd781
commit 9d1f53dfb7
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,8 @@
CONSOLE: unittest-suite-wait-for-done
CONSOLE: PASS: pixel translate should roundtrip
CONSOLE: PASS: percent translate should roundtrip
CONSOLE: PASS: scale should roundtrip
CONSOLE:
CONSOLE: All 3 tests passed.
CONSOLE: unittest-suite-success
DONE

View File

@ -0,0 +1,52 @@
<style>
.container {
height: 100px;
width: 200px;
margin: 30px;
outline: 1px solid black;
}
.box {
height: 100%;
width: 100%;
padding: 5px;
margin: 5px;
border: 5px solid gray;
background-color: green;
transform-origin: 20% 50%;
}
</style>
<div class="container">
<div id="test-box" class="box"></div>
</div>
<script type="text/javascript" charset="utf-8">
import "../resources/third_party/unittest/unittest.dart";
import "../resources/unit.dart";
import "dart:sky";
void main() {
initUnit();
var testBox = document.getElementById('test-box');
void testTransformRoundTrip(transform, resultMatrix) {
testBox.style['transform'] = transform;
var computedTransform = window.getComputedStyle(testBox)['transform'];
expect(computedTransform, equals(resultMatrix));
}
test('pixel translate should roundtrip', () {
testTransformRoundTrip('translate(80px, 90px)', 'matrix(1, 0, 0, 1, 80, 90)');
});
test('percent translate should roundtrip', () {
testTransformRoundTrip('translate(10px, 50%)', 'matrix(1, 0, 0, 1, 10, 60)');
});
test('scale should roundtrip', () {
testTransformRoundTrip('scale(1.2, 0.8)', 'matrix(1.2, 0, 0, 0.8, 0, 0)');
});
}
</script>