diff --git a/engine/core/rendering/RenderLayer.cpp b/engine/core/rendering/RenderLayer.cpp index 4a2072f0435..640076b6cd2 100644 --- a/engine/core/rendering/RenderLayer.cpp +++ b/engine/core/rendering/RenderLayer.cpp @@ -1511,7 +1511,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont clipper().calculateRects(clipRectsContext, hitTestRect, layerBounds, backgroundRect, foregroundRect, outlineRect); // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. - if (isSelfPaintingLayer() && !foregroundRect.intersects(hitTestLocation)) { + if (isSelfPaintingLayer() && foregroundRect.intersects(hitTestLocation)) { // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost. HitTestResult tempResult(result.hitTestLocation()); if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, HitTestDescendants) @@ -1542,7 +1542,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont if (candidateLayer) return candidateLayer; - if (isSelfPaintingLayer() && !backgroundRect.intersects(hitTestLocation)) { + if (isSelfPaintingLayer() && backgroundRect.intersects(hitTestLocation)) { HitTestResult tempResult(result.hitTestLocation()); if (hitTestContents(request, tempResult, layerBounds, hitTestLocation, HitTestSelf) && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { diff --git a/tests/layout/document-elementFromPoint-expected.txt b/tests/layout/document-elementFromPoint-expected.txt new file mode 100644 index 00000000000..3f433590790 --- /dev/null +++ b/tests/layout/document-elementFromPoint-expected.txt @@ -0,0 +1,5 @@ +Running 1 tests +ok 1 elementFromPoint should hit test +1 tests +1 pass +0 fail diff --git a/tests/layout/document-elementFromPoint.sky b/tests/layout/document-elementFromPoint.sky new file mode 100644 index 00000000000..e4c12af9e23 --- /dev/null +++ b/tests/layout/document-elementFromPoint.sky @@ -0,0 +1,26 @@ + + + + + + +