Title: [271446] trunk
- Revision
- 271446
- Author
- [email protected]
- Date
- 2021-01-13 11:20:42 -0800 (Wed, 13 Jan 2021)
Log Message
REGRESSION (r257839): Broken focus when 'display' changes in an attribute selector
https://bugs.webkit.org/show_bug.cgi?id=217240
<rdar://problem/69891684>
Reviewed by Wenson Hsieh.
Source/WebCore:
Focus optimization that avoids full style resolution when setting focus in unrendered subtrees
misbehaves when the style is invalidated via an attribute change.
Test case by Ali Juma.
Test: fast/dom/focus-style-resolution-attribute-change.html
* dom/Element.cpp:
(WebCore::Element::invalidateStyle):
* dom/Node.cpp:
(WebCore::Node::invalidateStyle):
We need to set the computed style invalidity bit on all style invalidation code paths.
* html/InputType.cpp:
(WebCore::InputType::setValue):
Don't invalidate style when nothing changes.
LayoutTests:
* fast/dom/focus-style-resolution-attribute-change-expected.html: Added.
* fast/dom/focus-style-resolution-attribute-change.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (271445 => 271446)
--- trunk/LayoutTests/ChangeLog 2021-01-13 19:05:44 UTC (rev 271445)
+++ trunk/LayoutTests/ChangeLog 2021-01-13 19:20:42 UTC (rev 271446)
@@ -1,3 +1,14 @@
+2021-01-13 Antti Koivisto <[email protected]>
+
+ REGRESSION (r257839): Broken focus when 'display' changes in an attribute selector
+ https://bugs.webkit.org/show_bug.cgi?id=217240
+ <rdar://problem/69891684>
+
+ Reviewed by Wenson Hsieh.
+
+ * fast/dom/focus-style-resolution-attribute-change-expected.html: Added.
+ * fast/dom/focus-style-resolution-attribute-change.html: Added.
+
2021-01-13 Kenneth Russell <[email protected]>
[WebGL2] fbostatequery, negativebufferapi, negativevertexarrayapi, shaderstatequery conformance failures
Added: trunk/LayoutTests/fast/dom/focus-style-resolution-attribute-change-expected.html (0 => 271446)
--- trunk/LayoutTests/fast/dom/focus-style-resolution-attribute-change-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dom/focus-style-resolution-attribute-change-expected.html 2021-01-13 19:20:42 UTC (rev 271446)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<head>
+<script>
+window._onload_ = function() {
+ var inputEl = document.getElementById('searchbox');
+ inputEl.focus();
+}
+</script>
+</head>
+<body>
+<div class="container" data-mode="browsing">
+ <div class="wrapper">
+ <input id="searchbox" placeholder="Should be focused">
+ </div>
+</div>
+</body>
Added: trunk/LayoutTests/fast/dom/focus-style-resolution-attribute-change.html (0 => 271446)
--- trunk/LayoutTests/fast/dom/focus-style-resolution-attribute-change.html (rev 0)
+++ trunk/LayoutTests/fast/dom/focus-style-resolution-attribute-change.html 2021-01-13 19:20:42 UTC (rev 271446)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<head>
+<style>
+.container[data-mode="browsing"] .wrapper {
+ display:none;
+}
+
+.container[data-mode="searching"] .wrapper {
+ display:block;
+}
+</style>
+<script>
+window._onload_ = async function() {
+ var wrapper = document.getElementsByClassName('wrapper')[0];
+ window.getComputedStyle(wrapper).display;
+
+ await new Promise(requestAnimationFrame);
+
+ var inputEl = document.getElementById('searchbox');
+ var container = document.getElementsByClassName('container')[0];
+ container.setAttribute('data-mode', 'searching');
+ inputEl.focus();
+}
+</script>
+</head>
+<body>
+<div class="container" data-mode="browsing">
+ <div class="wrapper">
+ <input id="searchbox" placeholder="Should be focused">
+ </div>
+</div>
+</body>
Modified: trunk/Source/WebCore/ChangeLog (271445 => 271446)
--- trunk/Source/WebCore/ChangeLog 2021-01-13 19:05:44 UTC (rev 271445)
+++ trunk/Source/WebCore/ChangeLog 2021-01-13 19:20:42 UTC (rev 271446)
@@ -1,3 +1,30 @@
+2021-01-13 Antti Koivisto <[email protected]>
+
+ REGRESSION (r257839): Broken focus when 'display' changes in an attribute selector
+ https://bugs.webkit.org/show_bug.cgi?id=217240
+ <rdar://problem/69891684>
+
+ Reviewed by Wenson Hsieh.
+
+ Focus optimization that avoids full style resolution when setting focus in unrendered subtrees
+ misbehaves when the style is invalidated via an attribute change.
+
+ Test case by Ali Juma.
+
+ Test: fast/dom/focus-style-resolution-attribute-change.html
+
+ * dom/Element.cpp:
+ (WebCore::Element::invalidateStyle):
+ * dom/Node.cpp:
+ (WebCore::Node::invalidateStyle):
+
+ We need to set the computed style invalidity bit on all style invalidation code paths.
+
+ * html/InputType.cpp:
+ (WebCore::InputType::setValue):
+
+ Don't invalidate style when nothing changes.
+
2021-01-13 Kenneth Russell <[email protected]>
[WebGL2] fbostatequery, negativebufferapi, negativevertexarrayapi, shaderstatequery conformance failures
Modified: trunk/Source/WebCore/dom/Element.cpp (271445 => 271446)
--- trunk/Source/WebCore/dom/Element.cpp 2021-01-13 19:05:44 UTC (rev 271445)
+++ trunk/Source/WebCore/dom/Element.cpp 2021-01-13 19:20:42 UTC (rev 271446)
@@ -1966,10 +1966,6 @@
{
Node::invalidateStyle(Style::Validity::ElementInvalid);
invalidateSiblingsIfNeeded(*this);
-
- // FIXME: This flag should be set whenever styles are invalidated while computed styles are present,
- // not just in this codepath.
- setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
}
void Element::invalidateStyleAndLayerComposition()
Modified: trunk/Source/WebCore/dom/Node.cpp (271445 => 271446)
--- trunk/Source/WebCore/dom/Node.cpp 2021-01-13 19:05:44 UTC (rev 271445)
+++ trunk/Source/WebCore/dom/Node.cpp 2021-01-13 19:20:42 UTC (rev 271446)
@@ -890,6 +890,9 @@
if (document().inRenderTreeUpdate())
return;
+ // FIXME: This should be set on all descendants in case of a subtree invalidation.
+ setNodeFlag(NodeFlag::IsComputedStyleInvalidFlag);
+
// FIXME: Why the second condition?
bool markAncestors = styleValidity() == Style::Validity::Valid || validity == Style::Validity::SubtreeAndRenderersInvalid;
Modified: trunk/Source/WebCore/html/InputType.cpp (271445 => 271446)
--- trunk/Source/WebCore/html/InputType.cpp 2021-01-13 19:05:44 UTC (rev 271445)
+++ trunk/Source/WebCore/html/InputType.cpp 2021-01-13 19:20:42 UTC (rev 271446)
@@ -656,9 +656,9 @@
{
ASSERT(element());
element()->setValueInternal(sanitizedValue, eventBehavior);
- element()->invalidateStyleForSubtree();
if (!valueChanged)
return;
+ element()->invalidateStyleForSubtree();
switch (eventBehavior) {
case DispatchChangeEvent:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes