From 151db532d738bd275b22bba79fc43d33cb18a26c Mon Sep 17 00:00:00 2001 From: Ojan Vafai Date: Mon, 2 Mar 2015 14:37:12 -0800 Subject: [PATCH] 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 --- engine/src/flutter/tests/styles/transforms-expected.txt | 3 ++- engine/src/flutter/tests/styles/transforms.sky | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/tests/styles/transforms-expected.txt b/engine/src/flutter/tests/styles/transforms-expected.txt index 95a2ab9b31..e76c7bf17d 100644 --- a/engine/src/flutter/tests/styles/transforms-expected.txt +++ b/engine/src/flutter/tests/styles/transforms-expected.txt @@ -2,7 +2,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: PASS: removing a transform should not crash CONSOLE: -CONSOLE: All 3 tests passed. +CONSOLE: All 4 tests passed. CONSOLE: unittest-suite-success DONE diff --git a/engine/src/flutter/tests/styles/transforms.sky b/engine/src/flutter/tests/styles/transforms.sky index 9473c915ea..49c44de476 100644 --- a/engine/src/flutter/tests/styles/transforms.sky +++ b/engine/src/flutter/tests/styles/transforms.sky @@ -48,5 +48,12 @@ test('scale should roundtrip', () { 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(); + }); }