mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
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:
parent
4e1056c43f
commit
2fa3e52b6d
@ -184,14 +184,15 @@ void RenderBox::updateTransform(const RenderStyle* oldStyle)
|
||||
m_transform.clear();
|
||||
|
||||
// Layers with transforms act as clip rects roots, so clear the cached clip rects here.
|
||||
layer()->clipper().clearClipRectsIncludingDescendants();
|
||||
} else if (localHasTransform) {
|
||||
if (layer())
|
||||
layer()->clipper().clearClipRectsIncludingDescendants();
|
||||
} else if (localHasTransform && layer()) {
|
||||
layer()->clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects);
|
||||
}
|
||||
|
||||
updateTransformationMatrix();
|
||||
|
||||
if (had3DTransform != has3DTransform())
|
||||
if (layer() && had3DTransform != has3DTransform())
|
||||
layer()->dirty3DTransformedDescendantStatus();
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user