-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick r294012. rdar://problem/92425915
Fix inertness of pseudo-elements https://bugs.webkit.org/show_bug.cgi?id=239831 Reviewed by Antti Koivisto. When we adjust style for a pseudo-element, `m_element` and `document().activeModalDialog()` are both null. So we accidentally reset inertness to false in those cases. Fix this by making checking for m_element's existence too. LayoutTests/imported/w3c: * web-platform-tests/inert/inert-pseudo-element-hittest-expected.txt: Added. * web-platform-tests/inert/inert-pseudo-element-hittest.html: Added. Source/WebCore: Test: imported/w3c/web-platform-tests/inert/inert-pseudo-element-hittest.html * style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjust const): LayoutTests: * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-pseudo-element-hittest-expected.txt: Added. Canonical link: https://commits.webkit.org/250446@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294012 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/245886.580@safari-613-branch git-svn-id: https://svn.webkit.org/repository/webkit/branches/safari-613-branch@294305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
222 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
LayoutTests/imported/w3c/web-platform-tests/inert/inert-pseudo-element-hittest-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Manual test: hover the green square, pass if it does not turn red. | ||
|
||
|
||
PASS Hit-testing cannot reach pseudo elements of inert nodes | ||
PASS Hit-testing can reach pseudo elements of non-inert nodes | ||
|
65 changes: 65 additions & 0 deletions
65
LayoutTests/imported/w3c/web-platform-tests/inert/inert-pseudo-element-hittest.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Hit-testing on pseudo elements of inert nodes</title> | ||
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/resources/testdriver-actions.js"></script> | ||
<style> | ||
#target::before { | ||
content: ""; | ||
width: 50px; | ||
height: 50px; | ||
background-color: green; | ||
display: inline-block; | ||
} | ||
|
||
#target:hover::before, | ||
#target:active::before { | ||
background-color: red; | ||
} | ||
</style> | ||
<p>Manual test: hover the green square, pass if it does not turn red.</p> | ||
<div id="target" inert></div> | ||
<script> | ||
const events = [ | ||
"mousedown", "mouseenter", "mousemove", "mouseover", | ||
"pointerdown", "pointerenter", "pointermove", "pointerover", | ||
]; | ||
async function mouseDownAndGetEvents(test) { | ||
const receivedEvents = []; | ||
for (let event of events) { | ||
target.addEventListener(event, () => { | ||
receivedEvents.push(event); | ||
}, { once: true, capture: true }); | ||
} | ||
|
||
await new test_driver.Actions() | ||
.pointerMove(0, 0, { origin: target }) | ||
.pointerDown() | ||
.send(); | ||
test.add_cleanup(() => test_driver.click(document.body)); | ||
|
||
// Exact order of events is not interoperable. | ||
receivedEvents.sort(); | ||
return receivedEvents; | ||
} | ||
promise_test(async function() { | ||
const receivedEvents = await mouseDownAndGetEvents(this); | ||
assert_array_equals(receivedEvents, [], "target got no event"); | ||
assert_false(target.matches(":active"), "target is not active"); | ||
assert_false(target.matches(":hover"), "target is not hovered"); | ||
assert_equals(getComputedStyle(target, "::before").backgroundColor, "rgb(0, 128, 0)", "#target::before has no hover style"); | ||
}, "Hit-testing cannot reach pseudo elements of inert nodes"); | ||
|
||
promise_test(async function() { | ||
target.inert = false; | ||
const receivedEvents = await mouseDownAndGetEvents(this); | ||
assert_array_equals(receivedEvents, events, "target got all events"); | ||
assert_true(target.matches(":active"), "target is active"); | ||
assert_true(target.matches(":hover"), "target is hovered"); | ||
assert_equals(getComputedStyle(target, "::before").backgroundColor, "rgb(255, 0, 0)", "#target::before has hover style"); | ||
}, "Hit-testing can reach pseudo elements of non-inert nodes"); | ||
</script> |
6 changes: 6 additions & 0 deletions
6
...m/ios-wk2/imported/w3c/web-platform-tests/inert/inert-pseudo-element-hittest-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Manual test: hover the green square, pass if it does not turn red. | ||
|
||
|
||
PASS Hit-testing cannot reach pseudo elements of inert nodes | ||
FAIL Hit-testing can reach pseudo elements of non-inert nodes assert_array_equals: target got all events lengths differ, expected array ["mousedown", "mouseenter", "mousemove", "mouseover", "pointerdown", "pointerenter", "pointermove", "pointerover"] length 8, got [] length 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters