Fix hit-testing in the stocks apps when scrolled.
We were not passing the transformed HitTestLocation when we recursed into child layers, which meant that we wouldn't take transforms correctly into account when hit testing. R=abarth@chromium.org Review URL: https://codereview.chromium.org/1019723002
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
CONSOLE: unittest-suite-wait-for-done
|
||||
CONSOLE: PASS: should hit test toolbar
|
||||
CONSOLE: PASS: should hit test toolbar when transformed, but clipped element overlaps
|
||||
CONSOLE:
|
||||
CONSOLE: All 2 tests passed.
|
||||
CONSOLE: unittest-suite-success
|
||||
DONE
|
||||
@@ -0,0 +1,39 @@
|
||||
<style>
|
||||
toolbar {
|
||||
background: yellow;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
scrollable {
|
||||
overflow: hidden;
|
||||
height: 400px;
|
||||
background: red;
|
||||
}
|
||||
content {
|
||||
height: 400px;
|
||||
background-color: pink;
|
||||
transform: translateY(-100px);
|
||||
}
|
||||
</style>
|
||||
<toolbar>toolbar</toolbar>
|
||||
<scrollable><content>content</content></scrollable>
|
||||
<script>
|
||||
import "../resources/third_party/unittest/unittest.dart";
|
||||
import "../resources/unit.dart";
|
||||
|
||||
import "dart:async";
|
||||
import "dart:sky";
|
||||
|
||||
void main() {
|
||||
initUnit();
|
||||
|
||||
test("should hit test toolbar", () {
|
||||
expect(document.elementFromPoint(10, 10).textContent, equals("toolbar"));
|
||||
});
|
||||
|
||||
test("should hit test toolbar when transformed, but clipped element overlaps", () {
|
||||
document.querySelector("scrollable").style["transform"] = "translate(0, 0)";
|
||||
expect(document.elementFromPoint(10, 10).textContent, equals("toolbar"));
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user