Traverse float descendants when computing event and touch-action regions
https://bugs.webkit.org/show_bug.cgi?id=209896
<rdar://problem/61196287>
Reviewed by Antti Koivisto.
Source/WebCore:
Consider floating objects when computing the event region and touch-action region.
For touch-action hit testing this means that CSS touch-action is honored on floating
objects.
Tests: fast/scrolling/ios/event-region-float.html
pointerevents/ios/touch-action-region-float.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
LayoutTests:
Add tests to ensure that floating objects are considered when computing the
event region and touch-action regions. Without this change, event-region-float.html
would not create an event region at all and touch-action-region-float.html
would not list the floating objects with "touch-action: none".
* fast/scrolling/ios/event-region-float-expected.txt: Added.
* fast/scrolling/ios/event-region-float.html: Added.
* pointerevents/ios/touch-action-region-float-expected.txt: Added.
* pointerevents/ios/touch-action-region-float.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259408 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 61336f7..c1a5cae 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2020-04-02 Daniel Bates <dabates@apple.com>
+
+ Traverse float descendants when computing event and touch-action regions
+ https://bugs.webkit.org/show_bug.cgi?id=209896
+ <rdar://problem/61196287>
+
+ Reviewed by Antti Koivisto.
+
+ Add tests to ensure that floating objects are considered when computing the
+ event region and touch-action regions. Without this change, event-region-float.html
+ would not create an event region at all and touch-action-region-float.html
+ would not list the floating objects with "touch-action: none".
+
+ * fast/scrolling/ios/event-region-float-expected.txt: Added.
+ * fast/scrolling/ios/event-region-float.html: Added.
+ * pointerevents/ios/touch-action-region-float-expected.txt: Added.
+ * pointerevents/ios/touch-action-region-float.html: Added.
+
2020-04-02 Jason Lawrence <lawrence.j@apple.com>
[ Mac wk1 Debug ] inspector/css/add-css-property.html is flaky timing out.
diff --git a/LayoutTests/fast/scrolling/ios/event-region-float-expected.txt b/LayoutTests/fast/scrolling/ios/event-region-float-expected.txt
new file mode 100644
index 0000000..43944cf
--- /dev/null
+++ b/LayoutTests/fast/scrolling/ios/event-region-float-expected.txt
@@ -0,0 +1,21 @@
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 8.00)
+ (bounds 200.00 200.00)
+ (drawsContent 1)
+ (event region
+ (rect (150,0) width=50 height=50)
+ )
+ )
+ )
+ )
+ )
+)
+
diff --git a/LayoutTests/fast/scrolling/ios/event-region-float.html b/LayoutTests/fast/scrolling/ios/event-region-float.html
new file mode 100644
index 0000000..f25c0e0
--- /dev/null
+++ b/LayoutTests/fast/scrolling/ios/event-region-float.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<style>
+.container {
+ background-color: blue;
+ width: 200px;
+ height: 200px;
+ will-change: transform; /* Needed to trigger event region creation */
+ visibility: hidden;
+}
+
+.inner {
+ background-color: green;
+ width: 50px;
+ height: 50px;
+ float: right;
+ visibility: visible;
+}
+</style>
+<body>
+<div class="container">
+ <div class="inner"></div>
+</div>
+<pre id="results"></pre>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+if (window.internals)
+ results.innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_EVENT_REGION);
+</script>
+</body>
+</html>
diff --git a/LayoutTests/pointerevents/ios/touch-action-region-float-expected.txt b/LayoutTests/pointerevents/ios/touch-action-region-float-expected.txt
new file mode 100644
index 0000000..f76f711
--- /dev/null
+++ b/LayoutTests/pointerevents/ios/touch-action-region-float-expected.txt
@@ -0,0 +1,22 @@
+(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)
+ (touch-action
+ (none
+ (rect (9,9) width=50 height=50)
+ (rect (259,9) width=50 height=50)
+ )
+ )
+ )
+ )
+ )
+)
+
diff --git a/LayoutTests/pointerevents/ios/touch-action-region-float.html b/LayoutTests/pointerevents/ios/touch-action-region-float.html
new file mode 100644
index 0000000..25e8f63
--- /dev/null
+++ b/LayoutTests/pointerevents/ios/touch-action-region-float.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+ border: 1px solid black;
+ width: 300px;
+ height: 300px;
+}
+
+.box {
+ background-color: blue;
+ width: 50px;
+ height: 50px;
+ touch-action: none;
+}
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="box" style="float: left"></div>
+ <div class="box" style="float: right"></div>
+</div>
+<pre id="results"></pre>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+if (window.internals)
+ results.innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_EVENT_REGION | internals.LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES);
+</script>
+</body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index d8d0009..f6261dc 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2020-04-02 Daniel Bates <dabates@apple.com>
+
+ Traverse float descendants when computing event and touch-action regions
+ https://bugs.webkit.org/show_bug.cgi?id=209896
+ <rdar://problem/61196287>
+
+ Reviewed by Antti Koivisto.
+
+ Consider floating objects when computing the event region and touch-action region.
+ For touch-action hit testing this means that CSS touch-action is honored on floating
+ objects.
+
+ Tests: fast/scrolling/ios/event-region-float.html
+ pointerevents/ios/touch-action-region-float.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::paintObject):
+
2020-04-02 Jer Noble <jer.noble@apple.com>
Hulu.com gets stuck in a "loading" state when seeking
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index bb8052e..ec6fd8c 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -1255,8 +1255,8 @@
paintInfo.eventRegionContext->unite(borderRegion, style());
}
- // No need to check descendants if we don't have overflow and the area is already covered.
- bool needsTraverseDescendants = hasVisualOverflow() || !paintInfo.eventRegionContext->contains(enclosingIntRect(borderRect));
+ // No need to check descendants if we don't have overflow and don't contain floats and the area is already covered.
+ bool needsTraverseDescendants = hasVisualOverflow() || containsFloats() || !paintInfo.eventRegionContext->contains(enclosingIntRect(borderRect));
#if PLATFORM(IOS_FAMILY)
needsTraverseDescendants = needsTraverseDescendants || document().mayHaveElementsWithNonAutoTouchAction();
#endif
@@ -1289,8 +1289,8 @@
paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on lines and between blocks.
// 4. paint floats.
- if (paintPhase == PaintPhase::Float || paintPhase == PaintPhase::Selection || paintPhase == PaintPhase::TextClip)
- paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhase::Selection || paintPhase == PaintPhase::TextClip);
+ if (paintPhase == PaintPhase::Float || paintPhase == PaintPhase::Selection || paintPhase == PaintPhase::TextClip || paintPhase == PaintPhase::EventRegion)
+ paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhase::Selection || paintPhase == PaintPhase::TextClip || paintPhase == PaintPhase::EventRegion);
// 5. paint outline.
if ((paintPhase == PaintPhase::Outline || paintPhase == PaintPhase::SelfOutline) && hasOutline() && style().visibility() == Visibility::Visible)