2011-05-20 Abhishek Arya <inferno@chromium.org>
authorAbhishek Arya <inferno@chromium.org>
Fri, 20 May 2011 19:36:02 +0000 (19:36 +0000)
committerAdemar de Souza Reis Jr <ademar.reis@openbossa.org>
Thu, 26 May 2011 20:33:14 +0000 (17:33 -0300)
commit60e2176c7bb3e07e48fba97e98eb775b6b06f6a1
treec9d169b10c73360726039b345f9023f5eb77cfa0
parent51381f81089dc86524e1ec27a40502aa97529e2f
2011-05-20  Abhishek Arya  <inferno@chromium.org>

        Reviewed by Kent Tamura.

        Tests that we do not crash when auto-focus triggers a attach.
        https://bugs.webkit.org/show_bug.cgi?id=32882

        * fast/forms/input-element-attach-crash-expected.txt: Added.
        * fast/forms/input-element-attach-crash.html: Added.
2011-05-20  Abhishek Arya  <inferno@chromium.org>

        Reviewed by Kent Tamura.

        Make auto-focus a post attach callback in
        HTMLFormControlElement::attach().
        https://bugs.webkit.org/show_bug.cgi?id=32882

        Original patch by Darin Adler. This one uses a part of it.

        Test: fast/forms/input-element-attach-crash.html

        * dom/Document.cpp:
        (WebCore::Document::recalcStyle): Make sure that m_inStyleRecalc is
        already false by the time post-attach callbacks are done so that
        layout triggered inside those callbacks can work properly.
        * html/HTMLFormControlElement.cpp:
        (WebCore::shouldAutofocus): Helper function that expresses
        the rule for which form control elements should auto-focus.
        (WebCore::focusPostAttach): Called post-attach to focus an
        element if we discover it should be focused during attach.
        (WebCore::HTMLFormControlElement::attach): Refactored code for
        which elements need auto-focus into a separate function. Instead
        of focusing right away, use the focusPostAttach function to focus
        after attach is done. Also added calls to suspendPostAttachCallbacks
        and resumePostAttachCallbacks so post-attach callbacks happen late
        enough. Before, they could run inside the base attach function.
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::attach): Added calls to
        suspendPostAttachCallbacks and resumePostAttachCallbacks so
        post-attach callbacks happen late enough

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/input-element-attach-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-element-attach-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLInputElement.cpp