Title: [222232] branches/safari-604-branch
- Revision
- 222232
- Author
- [email protected]
- Date
- 2017-09-19 15:25:53 -0700 (Tue, 19 Sep 2017)
Log Message
Cherry-pick r222167. rdar://problem/34508525
Modified Paths
Added Paths
Diff
Modified: branches/safari-604-branch/LayoutTests/ChangeLog (222231 => 222232)
--- branches/safari-604-branch/LayoutTests/ChangeLog 2017-09-19 22:25:50 UTC (rev 222231)
+++ branches/safari-604-branch/LayoutTests/ChangeLog 2017-09-19 22:25:53 UTC (rev 222232)
@@ -1,5 +1,20 @@
2017-09-19 Jason Marcell <[email protected]>
+ Cherry-pick r222167. rdar://problem/34508525
+
+ 2017-09-18 Antti Koivisto <[email protected]>
+
+ Avoid style resolution when clearing focused element.
+ https://bugs.webkit.org/show_bug.cgi?id=176224
+ <rdar://problem/34206409>
+
+ Reviewed by Zalan Bujtas.
+
+ * fast/dom/focus-style-resolution-expected.txt: Added.
+ * fast/dom/focus-style-resolution.html: Added.
+
+2017-09-19 Jason Marcell <[email protected]>
+
Cherry-pick r222114. rdar://problem/34508510
2017-09-15 Wenson Hsieh <[email protected]>
Added: branches/safari-604-branch/LayoutTests/fast/dom/focus-style-resolution-expected.txt (0 => 222232)
--- branches/safari-604-branch/LayoutTests/fast/dom/focus-style-resolution-expected.txt (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/dom/focus-style-resolution-expected.txt 2017-09-19 22:25:53 UTC (rev 222232)
@@ -0,0 +1,2 @@
+This test passes if it doesn't assert or crash.
+
Added: branches/safari-604-branch/LayoutTests/fast/dom/focus-style-resolution.html (0 => 222232)
--- branches/safari-604-branch/LayoutTests/fast/dom/focus-style-resolution.html (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/dom/focus-style-resolution.html 2017-09-19 22:25:53 UTC (rev 222232)
@@ -0,0 +1,31 @@
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+function eventhandler1() {
+txt.appendChild(kg);
+}
+
+function eventhandler2() {
+anim.appendChild(kg);
+}
+
+function eventhandler3() {
+table.scrollIntoView(true);
+testRunner.notifyDone();
+}
+
+</script>
+This test passes if it doesn't assert or crash.
+<table id="table"></table>
+<form>
+<input id="kg" autofocus="autofocus">
+</form>
+<svg>
+<animate id="anim" attributeName="text-anchor" from="middle" to="inherit" _onbegin_="eventhandler1()" />
+<text id="txt" _onload_="eventhandler3()">
+<font color="white"></font>
+<select _onfocus_="eventhandler2()" autofocus="autofocus">
+<textarea>a</textarea>
+<iframe _onload_="eventhandler1()"></iframe>
Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (222231 => 222232)
--- branches/safari-604-branch/Source/WebCore/ChangeLog 2017-09-19 22:25:50 UTC (rev 222231)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog 2017-09-19 22:25:53 UTC (rev 222232)
@@ -1,5 +1,30 @@
2017-09-19 Jason Marcell <[email protected]>
+ Cherry-pick r222167. rdar://problem/34508525
+
+ 2017-09-18 Antti Koivisto <[email protected]>
+
+ Avoid style resolution when clearing focused element.
+ https://bugs.webkit.org/show_bug.cgi?id=176224
+ <rdar://problem/34206409>
+
+ Reviewed by Zalan Bujtas.
+
+ Test: fast/dom/focus-style-resolution.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::setFocusedElement):
+
+ Don't do synchronous style resolution with FocusRemovalEventsMode::DoNotDispatch.
+ Style resolution may dispatch events.
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::didBlur):
+
+ Move resolveStyleIfNeeded call to setFocusedElement. It is the only client for didBlur.
+
+2017-09-19 Jason Marcell <[email protected]>
+
Cherry-pick r222163. rdar://problem/34508516
2017-09-18 Per Arne Vollan <[email protected]>
Modified: branches/safari-604-branch/Source/WebCore/dom/Document.cpp (222231 => 222232)
--- branches/safari-604-branch/Source/WebCore/dom/Document.cpp 2017-09-19 22:25:50 UTC (rev 222231)
+++ branches/safari-604-branch/Source/WebCore/dom/Document.cpp 2017-09-19 22:25:53 UTC (rev 222232)
@@ -3798,8 +3798,14 @@
view()->setFocus(false);
}
- if (is<HTMLInputElement>(oldFocusedElement.get()))
+ if (is<HTMLInputElement>(oldFocusedElement.get())) {
+ // HTMLInputElement::didBlur just scrolls text fields back to the beginning.
+ // FIXME: This could be done asynchronusly.
+ // Updating style may dispatch events due to PostResolutionCallback
+ if (eventsMode == FocusRemovalEventsMode::Dispatch)
+ updateStyleIfNeeded();
downcast<HTMLInputElement>(*oldFocusedElement).didBlur();
+ }
}
if (newFocusedElement && newFocusedElement->isFocusable()) {
@@ -3873,7 +3879,10 @@
page()->chrome().focusedElementChanged(m_focusedElement.get());
SetFocusedNodeDone:
- updateStyleIfNeeded();
+ // Updating style may dispatch events due to PostResolutionCallback
+ // FIXME: Why is synchronous style update needed here at all?
+ if (eventsMode == FocusRemovalEventsMode::Dispatch)
+ updateStyleIfNeeded();
return !focusChangeBlocked;
}
Modified: branches/safari-604-branch/Source/WebCore/html/HTMLInputElement.cpp (222231 => 222232)
--- branches/safari-604-branch/Source/WebCore/html/HTMLInputElement.cpp 2017-09-19 22:25:50 UTC (rev 222231)
+++ branches/safari-604-branch/Source/WebCore/html/HTMLInputElement.cpp 2017-09-19 22:25:53 UTC (rev 222232)
@@ -1119,9 +1119,6 @@
void HTMLInputElement::didBlur()
{
- // We need to update style here, rather than in InputType itself, since style recomputation may fire events
- // that could change the input's type.
- document().updateStyleIfNeeded();
m_inputType->elementDidBlur();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes