Make removing a transform not crash.

This broke with https://codereview.chromium.org/965013003.
Before that patch, updateTransform was only called on the
RenderLayer itself. Now it's called on the RenderBox,
so we need to null check the RenderLayer.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/969893002
This commit is contained in:
Ojan Vafai 2015-03-02 14:37:12 -08:00
parent 4b2e936b19
commit 151db532d7
2 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,8 @@ CONSOLE: unittest-suite-wait-for-done
CONSOLE: PASS: pixel translate should roundtrip CONSOLE: PASS: pixel translate should roundtrip
CONSOLE: PASS: percent translate should roundtrip CONSOLE: PASS: percent translate should roundtrip
CONSOLE: PASS: scale should roundtrip CONSOLE: PASS: scale should roundtrip
CONSOLE: PASS: removing a transform should not crash
CONSOLE: CONSOLE:
CONSOLE: All 3 tests passed. CONSOLE: All 4 tests passed.
CONSOLE: unittest-suite-success CONSOLE: unittest-suite-success
DONE DONE

View File

@ -48,5 +48,12 @@
test('scale should roundtrip', () { test('scale should roundtrip', () {
testTransformRoundTrip('scale(1.2, 0.8)', 'matrix(1.2, 0, 0, 0.8, 0, 0)'); testTransformRoundTrip('scale(1.2, 0.8)', 'matrix(1.2, 0, 0, 0.8, 0, 0)');
}); });
test('removing a transform should not crash', () {
testBox.style['transform'] = 'translate(0, 0, 0)';
testBox.getBoundingClientRect();
testBox.style.removeProperty('transform');
testBox.getBoundingClientRect();
});
} }
</script> </script>