Title: [271823] branches/safari-611-branch
- Revision
- 271823
- Author
- alanc...@apple.com
- Date
- 2021-01-25 14:11:06 -0800 (Mon, 25 Jan 2021)
Log Message
Cherry-pick r271446. rdar://problem/73469344
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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271446 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-611-branch/LayoutTests/ChangeLog (271822 => 271823)
--- branches/safari-611-branch/LayoutTests/ChangeLog 2021-01-25 22:11:02 UTC (rev 271822)
+++ branches/safari-611-branch/LayoutTests/ChangeLog 2021-01-25 22:11:06 UTC (rev 271823)
@@ -1,5 +1,55 @@
2021-01-25 Alan Coon <alanc...@apple.com>
+ Cherry-pick r271446. rdar://problem/73469344
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271446 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-01-13 Antti Koivisto <an...@apple.com>
+
+ 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-25 Alan Coon <alanc...@apple.com>
+
Cherry-pick r271425. rdar://problem/73469655
Multi-codepoint CJK grapheme clusters are not oriented correctly in vertical writing mode
Added: branches/safari-611-branch/LayoutTests/fast/dom/focus-style-resolution-attribute-change-expected.html (0 => 271823)
--- branches/safari-611-branch/LayoutTests/fast/dom/focus-style-resolution-attribute-change-expected.html (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/dom/focus-style-resolution-attribute-change-expected.html 2021-01-25 22:11:06 UTC (rev 271823)
@@ -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: branches/safari-611-branch/LayoutTests/fast/dom/focus-style-resolution-attribute-change.html (0 => 271823)
--- branches/safari-611-branch/LayoutTests/fast/dom/focus-style-resolution-attribute-change.html (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/dom/focus-style-resolution-attribute-change.html 2021-01-25 22:11:06 UTC (rev 271823)
@@ -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: branches/safari-611-branch/Source/WebCore/ChangeLog (271822 => 271823)
--- branches/safari-611-branch/Source/WebCore/ChangeLog 2021-01-25 22:11:02 UTC (rev 271822)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog 2021-01-25 22:11:06 UTC (rev 271823)
@@ -1,5 +1,71 @@
2021-01-25 Alan Coon <alanc...@apple.com>
+ Cherry-pick r271446. rdar://problem/73469344
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271446 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-01-13 Antti Koivisto <an...@apple.com>
+
+ 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-25 Alan Coon <alanc...@apple.com>
+
Cherry-pick r271425. rdar://problem/73469655
Multi-codepoint CJK grapheme clusters are not oriented correctly in vertical writing mode
Modified: branches/safari-611-branch/Source/WebCore/dom/Element.cpp (271822 => 271823)
--- branches/safari-611-branch/Source/WebCore/dom/Element.cpp 2021-01-25 22:11:02 UTC (rev 271822)
+++ branches/safari-611-branch/Source/WebCore/dom/Element.cpp 2021-01-25 22:11:06 UTC (rev 271823)
@@ -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: branches/safari-611-branch/Source/WebCore/dom/Node.cpp (271822 => 271823)
--- branches/safari-611-branch/Source/WebCore/dom/Node.cpp 2021-01-25 22:11:02 UTC (rev 271822)
+++ branches/safari-611-branch/Source/WebCore/dom/Node.cpp 2021-01-25 22:11:06 UTC (rev 271823)
@@ -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: branches/safari-611-branch/Source/WebCore/html/InputType.cpp (271822 => 271823)
--- branches/safari-611-branch/Source/WebCore/html/InputType.cpp 2021-01-25 22:11:02 UTC (rev 271822)
+++ branches/safari-611-branch/Source/WebCore/html/InputType.cpp 2021-01-25 22:11:06 UTC (rev 271823)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes