Diff
Modified: trunk/LayoutTests/ChangeLog (263178 => 263179)
--- trunk/LayoutTests/ChangeLog 2020-06-17 19:52:13 UTC (rev 263178)
+++ trunk/LayoutTests/ChangeLog 2020-06-17 20:09:26 UTC (rev 263179)
@@ -1,3 +1,23 @@
+2020-06-16 Antoine Quint <[email protected]>
+
+ quikr.com: unable to select item from dropdown
+ https://bugs.webkit.org/show_bug.cgi?id=213260
+ <rdar://problem/58106011>
+
+ Reviewed by Zalan Bujtas.
+
+ Add two new tests that check that we correctly do not consider content within a clipping container that
+ has 0-width or 0-height and box-shadow, with or without empty margins.
+
+ * fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container-expected.txt: Added.
+ * fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container.html: Added.
+ * fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container-expected.txt: Added.
+ * fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container.html: Added.
+ * fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container-expected.txt: Added.
+ * fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container.html: Added.
+ * fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container-expected.txt: Added.
+ * fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container.html: Added.
+
2020-06-17 Kate Cheney <[email protected]>
http/tests/in-app-browser-privacy/non-app-bound-domain-does-not-get-app-bound-session.html is a constant failure
Added: trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container-expected.txt (0 => 263179)
--- trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container-expected.txt 2020-06-17 20:09:26 UTC (rev 263179)
@@ -0,0 +1 @@
+PASS: target element is #container-with-height
Added: trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container.html (0 => 263179)
--- trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container.html (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container.html 2020-06-17 20:09:26 UTC (rev 263179)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+
+body {
+ margin: 0;
+}
+
+body > div {
+ position: absolute;
+ width: 500px;
+ height: 0;
+
+ /* box-shadow should not be accounted for to specify the clipping bounds */
+ box-shadow: 100px 100px 0px blue;
+ overflow-y: hidden;
+ margin: 100px;
+}
+
+#container-with-height {
+ height: 300px;
+ background-color: red;
+}
+
+#container-with-height:hover {
+ background-color: green;
+}
+
+#clipped-child {
+ width: 100%;
+ height: 100px;
+}
+
+</style>
+</head>
+<body>
+ <div id="container-with-height"></div>
+ <div id="container-without-height">
+ <div id="clipped-child"></div>
+ </div>
+<script>
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+const result = document.body.appendChild(document.createElement("span"));
+const hitTestElement = document.elementFromPoint(150, 150);
+const pass = hitTestElement.id == "container-with-height";
+result.textContent = `${pass ? "PASS" : "FAIL"}: target element is #${hitTestElement.id}`;
+
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container-expected.txt (0 => 263179)
--- trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container-expected.txt 2020-06-17 20:09:26 UTC (rev 263179)
@@ -0,0 +1 @@
+PASS: target element is #container-with-width
Added: trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container.html (0 => 263179)
--- trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container.html (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container.html 2020-06-17 20:09:26 UTC (rev 263179)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+
+body {
+ margin: 0;
+}
+
+body > div {
+ position: absolute;
+ width: 0;
+ height: 500px;
+
+ /* box-shadow should not be accounted for to specify the clipping bounds */
+ box-shadow: 100px 100px 0px blue;
+ overflow-x: hidden;
+ margin: 100px;
+}
+
+#container-with-width {
+ width: 300px;
+ background-color: red;
+}
+
+#container-with-width:hover {
+ background-color: green;
+}
+
+#clipped-child {
+ width: 100px;
+ height: 100%;
+}
+
+</style>
+</head>
+<body>
+ <div id="container-with-width"></div>
+ <div id="container-without-width">
+ <div id="clipped-child"></div>
+ </div>
+<script>
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+const result = document.body.appendChild(document.createElement("span"));
+const hitTestElement = document.elementFromPoint(150, 150);
+const pass = hitTestElement.id == "container-with-width";
+result.textContent = `${pass ? "PASS" : "FAIL"}: target element is #${hitTestElement.id}`;
+
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container-expected.txt (0 => 263179)
--- trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container-expected.txt 2020-06-17 20:09:26 UTC (rev 263179)
@@ -0,0 +1 @@
+PASS: target element is #container-with-height
Added: trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container.html (0 => 263179)
--- trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container.html (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container.html 2020-06-17 20:09:26 UTC (rev 263179)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+
+body {
+ margin: 0;
+}
+
+body > div {
+ position: absolute;
+ width: 500px;
+ height: 0;
+
+ /* box-shadow should not be accounted for to specify the clipping bounds */
+ box-shadow: 100px 100px 0px blue;
+ overflow-y: hidden;
+}
+
+#container-with-height {
+ height: 300px;
+ background-color: red;
+}
+
+#container-with-height:hover {
+ background-color: green;
+}
+
+#clipped-child {
+ width: 100%;
+ height: 100px;
+}
+
+</style>
+</head>
+<body>
+ <div id="container-with-height"></div>
+ <div id="container-without-height">
+ <div id="clipped-child"></div>
+ </div>
+<script>
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+const result = document.body.appendChild(document.createElement("span"));
+const hitTestElement = document.elementFromPoint(50, 50);
+const pass = hitTestElement.id == "container-with-height";
+result.textContent = `${pass ? "PASS" : "FAIL"}: target element is #${hitTestElement.id}`;
+
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container-expected.txt (0 => 263179)
--- trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container-expected.txt 2020-06-17 20:09:26 UTC (rev 263179)
@@ -0,0 +1 @@
+PASS: target element is #container-with-width
Added: trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container.html (0 => 263179)
--- trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container.html (rev 0)
+++ trunk/LayoutTests/fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container.html 2020-06-17 20:09:26 UTC (rev 263179)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+
+body {
+ margin: 0;
+}
+
+body > div {
+ position: absolute;
+ width: 0;
+ height: 500px;
+
+ /* box-shadow should not be accounted for to specify the clipping bounds */
+ box-shadow: 100px 100px 0px blue;
+ overflow-x: hidden;
+}
+
+#container-with-width {
+ width: 300px;
+ background-color: red;
+}
+
+#container-with-width:hover {
+ background-color: green;
+}
+
+#clipped-child {
+ width: 100px;
+ height: 100%;
+}
+
+</style>
+</head>
+<body>
+ <div id="container-with-width"></div>
+ <div id="container-without-width">
+ <div id="clipped-child"></div>
+ </div>
+<script>
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+const result = document.body.appendChild(document.createElement("span"));
+const hitTestElement = document.elementFromPoint(50, 50);
+const pass = hitTestElement.id == "container-with-width";
+result.textContent = `${pass ? "PASS" : "FAIL"}: target element is #${hitTestElement.id}`;
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (263178 => 263179)
--- trunk/Source/WebCore/ChangeLog 2020-06-17 19:52:13 UTC (rev 263178)
+++ trunk/Source/WebCore/ChangeLog 2020-06-17 20:09:26 UTC (rev 263179)
@@ -1,3 +1,21 @@
+2020-06-16 Antoine Quint <[email protected]>
+
+ quikr.com: unable to select item from dropdown
+ https://bugs.webkit.org/show_bug.cgi?id=213260
+ <rdar://problem/58106011>
+
+ Reviewed by Zalan Bujtas.
+
+ Only account for box-shadow when computing the background rect if the clipping element itself has non-zero used width and height.
+
+ Tests: fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-height-clipping-container.html
+ fast/box-shadow/hit-test-box-shadow-and-margin-on-zero-width-clipping-container.html
+ fast/box-shadow/hit-test-box-shadow-on-zero-height-clipping-container.html
+ fast/box-shadow/hit-test-box-shadow-on-zero-width-clipping-container.html
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::addVisualEffectOverflow):
+
2020-06-17 David Kilzer <[email protected]>
Replace OptionSetTraits/OptionSetValues with EnumTraits/EnumValues
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (263178 => 263179)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2020-06-17 19:52:13 UTC (rev 263178)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2020-06-17 20:09:26 UTC (rev 263179)
@@ -4580,11 +4580,20 @@
void RenderBox::addVisualEffectOverflow()
{
- if (!style().boxShadow() && !style().hasBorderImageOutsets() && !outlineStyleForRepaint().hasOutlineInVisualOverflow())
+ bool hasBoxShadow = style().boxShadow();
+ bool hasBorderImageOutsets = style().hasBorderImageOutsets();
+ bool hasOutline = outlineStyleForRepaint().hasOutlineInVisualOverflow();
+ if (!hasBoxShadow && !hasBorderImageOutsets && !hasOutline)
return;
- addVisualOverflow(applyVisualEffectOverflow(borderBoxRect()));
+ // If all we have is a box-shadow and the border box has either 0-width or 0-height,
+ // the box-shadow should not extend the visual overflow.
+ auto borderBox = borderBoxRect();
+ if (!hasBorderImageOutsets && !hasOutline && borderBox.isEmpty())
+ return;
+ addVisualOverflow(applyVisualEffectOverflow(borderBox));
+
RenderFragmentedFlow* fragmentedFlow = enclosingFragmentedFlow();
if (fragmentedFlow)
fragmentedFlow->addFragmentsVisualEffectOverflow(this);