Skip to content
Permalink
Browse files
Sibling element wheel event regions can be wrong
https://bugs.webkit.org/show_bug.cgi?id=220071
Source/WebCore:

<rdar://problem/72435466>

Reviewed by Daniel Bates.

RenderStyle contains eventListenerRegionTypes() data which derive from registered
wheel event handlers, so style sharing needs to avoid sharing style between elements
with different handlers. For now, just disable style sharing for any elements
which event handlers.

Test: fast/scrolling/mac/wheel-event-listener-region-siblings.html

* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement const):

LayoutTests:

Reviewed by Daniel Bates.

* fast/scrolling/mac/wheel-event-listener-region-siblings-expected.txt: Added.
* fast/scrolling/mac/wheel-event-listener-region-siblings.html: Added.


Canonical link: https://commits.webkit.org/232651@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271054 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
smfr committed Dec 22, 2020
1 parent f6996ff commit a06786a72625ed4179d90c3f5b872fafd0727696
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
@@ -1,3 +1,13 @@
2020-12-22 Simon Fraser <simon.fraser@apple.com>

Sibling element wheel event regions can be wrong
https://bugs.webkit.org/show_bug.cgi?id=220071

Reviewed by Daniel Bates.

* fast/scrolling/mac/wheel-event-listener-region-siblings-expected.txt: Added.
* fast/scrolling/mac/wheel-event-listener-region-siblings.html: Added.

2020-12-22 Simon Fraser <simon.fraser@apple.com>

Layout overflow is computed incorrectly inside flexbox (breaks sticky positioning)
@@ -0,0 +1,25 @@
Passive
Active
(GraphicsLayer
(anchor 0.00 0.00)
(bounds 800.00 600.00)
(children 1
(GraphicsLayer
(bounds 800.00 600.00)
(contentsOpaque 1)
(drawsContent 1)
(backgroundColor #FFFFFF)
(event region
(rect (0,0) width=800 height=600)
(wheel event listener region
(rect (28,20) width=102 height=102)
(rect (28,142) width=102 height=102)
(non-passive
(rect (28,142) width=102 height=102)
)
)
)
)
)
)

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<style>
.box {
margin: 20px;
width: 100px;
height: 100px;
border: 1px solid black;
}

</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();

window.addEventListener('load', () => {
document.getElementById('passive').addEventListener('wheel', () => {
console.log('passive listener');
}, { passive: true });

document.getElementById('active').addEventListener('wheel', () => {
console.log('active listener');
}, { passive: false });

if (window.internals)
document.getElementById('console').textContent = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_EVENT_REGION | internals.LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES);

}, false);
</script>
<body>
<div class="box" id="passive">Passive</div>
<div class="box" id="active">Active</div>
<pre id="console"></pre>
</body>
</html>
@@ -1,3 +1,21 @@
2020-12-22 Simon Fraser <simon.fraser@apple.com>

Sibling element wheel event regions can be wrong
https://bugs.webkit.org/show_bug.cgi?id=220071
<rdar://problem/72435466>

Reviewed by Daniel Bates.

RenderStyle contains eventListenerRegionTypes() data which derive from registered
wheel event handlers, so style sharing needs to avoid sharing style between elements
with different handlers. For now, just disable style sharing for any elements
which event handlers.

Test: fast/scrolling/mac/wheel-event-listener-region-siblings.html

* style/StyleSharingResolver.cpp:
(WebCore::Style::SharingResolver::canShareStyleWithElement const):

2020-12-22 Simon Fraser <simon.fraser@apple.com>

Layout overflow is computed incorrectly inside flexbox (breaks sticky positioning)
@@ -300,6 +300,11 @@ bool SharingResolver::canShareStyleWithElement(const Context& context, const Sty
if (candidateElement.shadowRoot() && !candidateElement.shadowRoot()->styleScope().resolver().ruleSets().authorStyle().hostPseudoClassRules().isEmpty())
return false;

#if ENABLE(WHEEL_EVENT_REGIONS)
if (candidateElement.hasEventListeners() || element.hasEventListeners())
return false;
#endif

#if ENABLE(FULLSCREEN_API)
if (&candidateElement == m_document.fullscreenManager().currentFullscreenElement() || &element == m_document.fullscreenManager().currentFullscreenElement())
return false;

0 comments on commit a06786a

Please sign in to comment.