Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
:focus pseudo class fails to repaint on a shadow host when focus move…
…s from outside the page inside a shadow tree https://bugs.webkit.org/show_bug.cgi?id=205531 Reviewed by Simon Fraser, Darin Adler and Wenson Hsieh. The bug was caused by FrameSelection::focusedOrActiveStateChanged only invalidating the style of the focused element. Invalidate each outer shadow host when the focus status changes to fix the bug. * Source/WebCore/editing/FrameSelection.cpp: (WebCore::FrameSelection::focusedOrActiveStateChanged): Fixed the bug. * Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h: * Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm: (WTR::UIScriptControllerCocoa::becomeFirstResponder): Moved to UIScriptControllerIOS. (WTR::UIScriptControllerCocoa::resignFirstResponder): Ditto. * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h: * Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm: (WTR::UIScriptControllerIOS::becomeFirstResponder): Moved from UIScriptControllerCocoa. (WTR::UIScriptControllerIOS::resignFirstResponder): Ditto. * Tools/WebKitTestRunner/mac/UIScriptControllerMac.h: * Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptControllerMac::becomeFirstResponder): Added. (WTR::UIScriptControllerMac::resignFirstResponder): Added. * LayoutTests/fast/shadow-dom/focus-ring-on-shadow-host-expected.html: Added. * LayoutTests/fast/shadow-dom/focus-ring-on-shadow-host.html: Added. * LayoutTests/resources/ui-helper.js: (window.UIHelper.resignFirstResponder): Added the support for WebKit1. (window.UIHelper.becomeFirstResponder): Ditto. * LayoutTests/platform/gtk/TestExpectations: Skip the test as resignFirstResponder is not implemented on GTK+. * LayoutTests/platform/win/TestExpectations: Ditto on Windows. Canonical link: https://commits.webkit.org/252261@main
- Loading branch information
Showing
12 changed files
with
104 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<style> | ||
#host { | ||
width: 100px; | ||
height: 100px; | ||
background: green; | ||
} | ||
</style> | ||
<div id="host"></div> | ||
</body> | ||
</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,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<style> | ||
#host:focus { | ||
width: 50px; | ||
height: 50px; | ||
background: green; | ||
overflow: hidden; | ||
} | ||
</style> | ||
<div id="host"></div> | ||
<script src="../../resources/ui-helper.js"></script> | ||
<script> | ||
|
||
const shadowRoot = host.attachShadow({mode: 'closed', delegatesFocus: true}); | ||
shadowRoot.innerHTML = `<div tabindex="0"></div> | ||
<style> | ||
div { width: 100px; height: 100px; background: green; } | ||
</style>`; | ||
const foucsableElement = shadowRoot.querySelector('div'); | ||
|
||
onload = runTest; | ||
|
||
async function runTest() { | ||
if (!window.testRunner) | ||
return; | ||
|
||
testRunner.waitUntilDone(); | ||
|
||
eventSender.mouseMoveTo(host.offsetLeft + 5, host.offsetTop + 5); | ||
eventSender.mouseDown(); | ||
eventSender.mouseUp(); | ||
|
||
await new Promise((resolve) => requestAnimationFrame(() => setTimeout(resolve, 0))); | ||
|
||
if (UIHelper.isWebKit2()) | ||
await UIHelper.resignFirstResponder(); | ||
else | ||
window.testRunner.setMainFrameIsFirstResponder(false); | ||
|
||
await new Promise((resolve) => requestAnimationFrame(() => setTimeout(resolve, 0))); | ||
|
||
testRunner.notifyDone(); | ||
} | ||
|
||
</script> | ||
</body> | ||
</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
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
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
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
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
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