Hiding a focused element should unfocus it and fire a blur event
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Sep 2013 23:19:14 +0000 (23:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 22 Sep 2013 23:19:14 +0000 (23:19 +0000)
commitb08ffb474a6b9c1f40c6b359a1e56c39bae38842
treea45d6e4f8611116947764a307d11d862e0f7f006
parent35f9a16a1dafb3b8fa5df235988457746a4719a3
Hiding a focused element should unfocus it and fire a blur event
https://bugs.webkit.org/show_bug.cgi?id=29241

Patch by Arunprasad Rajkumar <ararunprasad@gmail.com> on 2013-09-22
Reviewed by Darin Adler.

Source/WebCore:

Test: fast/dom/HTMLDocument/active-element-gets-unfocusable.html

We check whether the current focus element is really focusable after
the style recalculation and layout change. If it is not focusable then schedule a
timer to reset it asynchronously.

* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::recalcStyle): Check isFocusable() on the focus element after
style recalculation.
(WebCore::Document::updateLayout): Check isFocusable() on the focus element after
layout.
(WebCore::Document::resetHiddenFocusElementSoon):
(WebCore::Document::resetHiddenFocusElementTimer):
* dom/Document.h:

LayoutTests:

* fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt: Added.
* fast/dom/HTMLDocument/active-element-gets-unfocusable.html: Added.

LayoutTest reused from https://chromium.googlesource.com/chromium/blink/+/c58f636fd18fc27944c42e27d6a92a36867c57e1
with little modification.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h