提交 5968e030 编写于 作者: O Ojan Vafai

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
上级 420098c9
......@@ -673,7 +673,7 @@ bool RenderBox::hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer
for (auto& currentLayer : layers) {
HitTestResult tempResult(result.hitTestLocation());
bool localHitLayer = currentLayer->hitTestLayer(rootLayer, layer(), request, tempResult,
hitTestRect, hitTestLocation, localTransformState.get(), zOffsetForDescendantsPtr);
localHitTestRect, localHitTestLocation, localTransformState.get(), zOffsetForDescendantsPtr);
// If it a rect-based test, we can safely append the temporary result since it might had hit
// nodes but not necesserily had hitLayer set.
......
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
<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>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册