Title: [267345] trunk
- Revision
- 267345
- Author
- wenson_hs...@apple.com
- Date
- 2020-09-21 08:11:43 -0700 (Mon, 21 Sep 2020)
Log Message
REGRESSION (r257839): Can't add a memo when transferring funds in First Tech Credit Union App
https://bugs.webkit.org/show_bug.cgi?id=216754
<rdar://problem/67045862>
Reviewed by Antti Koivisto.
Source/WebCore:
After r257839, attempting to add a memo by tapping on a text box in the First Tech Credit Union app on iOS fails
to cause the text box (a `textarea` element) to be focused. This is because the `textarea` is initially hidden
away in a `display: none;` parent container, which becomes `display: block;` immediately before `focus()` is
called from the page's script.
Augment the mechanism added in r266887, so that we avoid consulting stale computed styles when checking for
hidden ancestors in `Element::isVisibleWithoutResolvingFullStyle()`. To do this, we pull logic to get or compute
the `RenderStyle` for the current element or one of its composed ancestors (which respects
`IsComputedStyleInvalidFlag`) into a lambda function, and use this lambda function below, when we walk up the
ancestor chain in search of a hidden element.
Note that in Speedometer 2.0, this change does not have any significant impact on the number of partial (i.e.
`RenderedOnly`) style resolutions we attempt to perform underneath `Element::resolveComputedStyle` (a little
over 3000 before and after this change).
Test: fast/forms/programmatic-focus-after-displaying-parent.html
* dom/Element.cpp:
(WebCore::Element::isVisibleWithoutResolvingFullStyle const):
LayoutTests:
Add a new layout test to exercise the bug by programmatically focusing a textarea element that was just shown by
setting `display: block;` on a parent container that was previously `display: none;`.
* fast/forms/programmatic-focus-after-displaying-parent-expected.txt: Added.
* fast/forms/programmatic-focus-after-displaying-parent.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (267344 => 267345)
--- trunk/LayoutTests/ChangeLog 2020-09-21 14:57:59 UTC (rev 267344)
+++ trunk/LayoutTests/ChangeLog 2020-09-21 15:11:43 UTC (rev 267345)
@@ -1,3 +1,17 @@
+2020-09-21 Wenson Hsieh <wenson_hs...@apple.com>
+
+ REGRESSION (r257839): Can't add a memo when transferring funds in First Tech Credit Union App
+ https://bugs.webkit.org/show_bug.cgi?id=216754
+ <rdar://problem/67045862>
+
+ Reviewed by Antti Koivisto.
+
+ Add a new layout test to exercise the bug by programmatically focusing a textarea element that was just shown by
+ setting `display: block;` on a parent container that was previously `display: none;`.
+
+ * fast/forms/programmatic-focus-after-displaying-parent-expected.txt: Added.
+ * fast/forms/programmatic-focus-after-displaying-parent.html: Added.
+
2020-09-21 Philippe Normand <pnorm...@igalia.com>
[GTK] media/media-can-play-mp3.html is failing since added in r267210
Added: trunk/LayoutTests/fast/forms/programmatic-focus-after-displaying-parent-expected.txt (0 => 267345)
--- trunk/LayoutTests/fast/forms/programmatic-focus-after-displaying-parent-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/programmatic-focus-after-displaying-parent-expected.txt 2020-09-21 15:11:43 UTC (rev 267345)
@@ -0,0 +1,11 @@
+This test verifies that programmatically focusing a textarea in a newly displayed container changes the active element. To test manually, tap or click below.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.activeElement is textarea
+PASS didFinishActivatingElement became true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/programmatic-focus-after-displaying-parent.html (0 => 267345)
--- trunk/LayoutTests/fast/forms/programmatic-focus-after-displaying-parent.html (rev 0)
+++ trunk/LayoutTests/fast/forms/programmatic-focus-after-displaying-parent.html 2020-09-21 15:11:43 UTC (rev 267345)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<head>
+ <script src=""
+ <script src=""
+ <style>
+ input {
+ font-size: 20px;
+ }
+
+ #container {
+ display: none;
+ }
+ </style>
+</head>
+<body>
+ <input type="text" value="Click me">
+ <div id="container">
+ <textarea></textarea>
+ </div>
+ <script>
+ jsTestIsAsync = true;
+ didFinishActivatingElement = false;
+ input = document.querySelector("input[type='text']");
+ textarea = document.querySelector("textarea");
+ container = document.getElementById("container");
+
+ input.addEventListener("focus", async () => {
+ getComputedStyle(container).display; // This is necessary in order to reproduce the bug.
+ container.style.display = "block";
+ textarea.focus();
+
+ shouldBe("document.activeElement", "textarea");
+ container.remove();
+ input.remove();
+
+ await new Promise(resolve => shouldBecomeEqual("didFinishActivatingElement", "true", resolve));
+ finishJSTest();
+ });
+
+ addEventListener("load", async () => {
+ description("This test verifies that programmatically focusing a textarea in a newly displayed container changes the active element. To test manually, tap or click below.");
+ if (window.testRunner)
+ await UIHelper.activateElement(input);
+ didFinishActivatingElement = true;
+ });
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (267344 => 267345)
--- trunk/Source/WebCore/ChangeLog 2020-09-21 14:57:59 UTC (rev 267344)
+++ trunk/Source/WebCore/ChangeLog 2020-09-21 15:11:43 UTC (rev 267345)
@@ -1,3 +1,31 @@
+2020-09-21 Wenson Hsieh <wenson_hs...@apple.com>
+
+ REGRESSION (r257839): Can't add a memo when transferring funds in First Tech Credit Union App
+ https://bugs.webkit.org/show_bug.cgi?id=216754
+ <rdar://problem/67045862>
+
+ Reviewed by Antti Koivisto.
+
+ After r257839, attempting to add a memo by tapping on a text box in the First Tech Credit Union app on iOS fails
+ to cause the text box (a `textarea` element) to be focused. This is because the `textarea` is initially hidden
+ away in a `display: none;` parent container, which becomes `display: block;` immediately before `focus()` is
+ called from the page's script.
+
+ Augment the mechanism added in r266887, so that we avoid consulting stale computed styles when checking for
+ hidden ancestors in `Element::isVisibleWithoutResolvingFullStyle()`. To do this, we pull logic to get or compute
+ the `RenderStyle` for the current element or one of its composed ancestors (which respects
+ `IsComputedStyleInvalidFlag`) into a lambda function, and use this lambda function below, when we walk up the
+ ancestor chain in search of a hidden element.
+
+ Note that in Speedometer 2.0, this change does not have any significant impact on the number of partial (i.e.
+ `RenderedOnly`) style resolutions we attempt to perform underneath `Element::resolveComputedStyle` (a little
+ over 3000 before and after this change).
+
+ Test: fast/forms/programmatic-focus-after-displaying-parent.html
+
+ * dom/Element.cpp:
+ (WebCore::Element::isVisibleWithoutResolvingFullStyle const):
+
2020-09-21 Zalan Bujtas <za...@apple.com>
[LFC][BFC] Move hasClearance out of BoxGeometry
Modified: trunk/Source/WebCore/dom/Element.cpp (267344 => 267345)
--- trunk/Source/WebCore/dom/Element.cpp 2020-09-21 14:57:59 UTC (rev 267344)
+++ trunk/Source/WebCore/dom/Element.cpp 2020-09-21 15:11:43 UTC (rev 267345)
@@ -3383,12 +3383,14 @@
if (renderStyle() || hasValidStyle())
return renderStyle() && renderStyle()->visibility() == Visibility::Visible;
+ auto computedStyleForElement = [](Element& element) -> const RenderStyle* {
+ auto* style = element.hasNodeFlag(NodeFlag::IsComputedStyleInvalidFlag) ? nullptr : element.existingComputedStyle();
+ return style ? style : element.resolveComputedStyle(ResolveComputedStyleMode::RenderedOnly);
+ };
+
// Compute style in yet unstyled subtree.
- auto* style = hasNodeFlag(NodeFlag::IsComputedStyleInvalidFlag) ? nullptr : existingComputedStyle();
+ auto* style = computedStyleForElement(const_cast<Element&>(*this));
if (!style)
- style = const_cast<Element&>(*this).resolveComputedStyle(ResolveComputedStyleMode::RenderedOnly);
-
- if (!style)
return false;
if (style->display() == DisplayType::None || style->display() == DisplayType::Contents)
@@ -3398,9 +3400,7 @@
return false;
for (auto& element : composedTreeAncestors(const_cast<Element&>(*this))) {
- auto* style = element.existingComputedStyle();
- if (!style)
- style = element.resolveComputedStyle(ResolveComputedStyleMode::RenderedOnly);
+ auto* style = computedStyleForElement(element);
if (!style || style->display() == DisplayType::None)
return false;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes