Title: [222164] trunk/Source/WebCore
- Revision
- 222164
- Author
- [email protected]
- Date
- 2017-09-18 11:14:52 -0700 (Mon, 18 Sep 2017)
Log Message
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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (222163 => 222164)
--- trunk/Source/WebCore/ChangeLog 2017-09-18 18:01:48 UTC (rev 222163)
+++ trunk/Source/WebCore/ChangeLog 2017-09-18 18:14:52 UTC (rev 222164)
@@ -1,3 +1,24 @@
+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-18 Per Arne Vollan <[email protected]>
[WK1] Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing.
Modified: trunk/Source/WebCore/dom/Document.cpp (222163 => 222164)
--- trunk/Source/WebCore/dom/Document.cpp 2017-09-18 18:01:48 UTC (rev 222163)
+++ trunk/Source/WebCore/dom/Document.cpp 2017-09-18 18:14:52 UTC (rev 222164)
@@ -3840,8 +3840,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()) {
@@ -3915,7 +3921,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: trunk/Source/WebCore/html/HTMLInputElement.cpp (222163 => 222164)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2017-09-18 18:01:48 UTC (rev 222163)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2017-09-18 18:14:52 UTC (rev 222164)
@@ -1122,9 +1122,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