From 4dd83688b382a753c89a27f8e59e046d73fb3176 Mon Sep 17 00:00:00 2001 From: "antti@apple.com" Date: Mon, 18 Sep 2017 18:21:17 +0000 Subject: [PATCH] Rolling out the previous to land again with a test. * dom/Document.cpp: (WebCore::Document::setFocusedElement): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::didBlur): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222166 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 9 +++++++++ Source/WebCore/dom/Document.cpp | 13 ++----------- Source/WebCore/html/HTMLInputElement.cpp | 3 +++ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 18b65b3..cdf6e14 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,5 +1,14 @@ 2017-09-18 Antti Koivisto + Rolling out the previous to land again with a test. + + * dom/Document.cpp: + (WebCore::Document::setFocusedElement): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::didBlur): + +2017-09-18 Antti Koivisto + Avoid style resolution when clearing focused element. https://bugs.webkit.org/show_bug.cgi?id=176224 diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 7c2725a..fc96f1e 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -3840,14 +3840,8 @@ bool Document::setFocusedElement(Element* element, FocusDirection direction, Foc view()->setFocus(false); } - if (is(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(); + if (is(oldFocusedElement.get())) downcast(*oldFocusedElement).didBlur(); - } } if (newFocusedElement && newFocusedElement->isFocusable()) { @@ -3921,10 +3915,7 @@ bool Document::setFocusedElement(Element* element, FocusDirection direction, Foc page()->chrome().focusedElementChanged(m_focusedElement.get()); SetFocusedNodeDone: - // Updating style may dispatch events due to PostResolutionCallback - // FIXME: Why is synchronous style update needed here at all? - if (eventsMode == FocusRemovalEventsMode::Dispatch) - updateStyleIfNeeded(); + updateStyleIfNeeded(); return !focusChangeBlocked; } diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index f5d36af..40bf52f 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -1122,6 +1122,9 @@ void HTMLInputElement::didDispatchClickEvent(Event& event, const InputElementCli 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(); } -- 1.8.3.1