WebCore:
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2007 14:50:03 +0000 (14:50 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2007 14:50:03 +0000 (14:50 +0000)
        Reviewed by Maciej.

        Fix <rdar://problem/5452112>
        REGRESSION: Initially focused textfield on www.mac.com login page has no insertion point, and doesn't accept typed characters

        Use updateLayoutIgnorePendingStylesheets() instead of updateLayout(). We need to have rendering to set input focus.

        Test: fast/forms/focus-style-pending.html

        * dom/Element.cpp:
        (WebCore::Element::focus):

LayoutTests:

        Reviewed by Maciej.

        Test for <rdar://problem/5452112>
        REGRESSION: Initially focused textfield on www.mac.com login page has no insertion point, and doesn't accept typed characters

        * fast/forms/focus-style-pending-expected.txt: Added.
        * fast/forms/focus-style-pending.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25353 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/focus-style-pending-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/focus-style-pending.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/Element.cpp

index 423776b30001b1f07967f545d40931cc13a92e90..9a211a396741c26ce092c174a03d61c0e24c7360 100644 (file)
@@ -1,3 +1,13 @@
+2007-09-04  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Maciej.
+        
+        Test for <rdar://problem/5452112>
+        REGRESSION: Initially focused textfield on www.mac.com login page has no insertion point, and doesn't accept typed characters
+
+        * fast/forms/focus-style-pending-expected.txt: Added.
+        * fast/forms/focus-style-pending.html: Added.
+
 2007-09-01  Darin Adler  <darin@apple.com>
 
         - rolled out the test case for 12988 until we re-fix it
diff --git a/LayoutTests/fast/forms/focus-style-pending-expected.txt b/LayoutTests/fast/forms/focus-style-pending-expected.txt
new file mode 100644 (file)
index 0000000..59bd230
--- /dev/null
@@ -0,0 +1,3 @@
+Test that focus() sets input focus correctly even when there are pending stylesheet loads.
+PASS
diff --git a/LayoutTests/fast/forms/focus-style-pending.html b/LayoutTests/fast/forms/focus-style-pending.html
new file mode 100644 (file)
index 0000000..6da7c05
--- /dev/null
@@ -0,0 +1,15 @@
+<html>
+<link rel=stylesheet href="data:text/css,bogus{}">
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<body>
+Test that focus() sets input focus correctly even when there are pending stylesheet loads.<br>
+<input id=t>
+<script>
+var t = document.getElementById('t');
+t.focus();
+var s = window.getSelection();
+document.write('<br>' + (s.focusNode ? "<span style='color:green'>PASS</span>" :  "<span style='color:red'>FAIL</span>"));
+</script>
index be8b2096feeedba085669f57842da6e629352932..cb6440d4216daa22eebcf7e62e967b4c8308e591 100644 (file)
@@ -1,3 +1,17 @@
+2007-09-04  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Maciej.
+        
+        Fix <rdar://problem/5452112>
+        REGRESSION: Initially focused textfield on www.mac.com login page has no insertion point, and doesn't accept typed characters
+        
+        Use updateLayoutIgnorePendingStylesheets() instead of updateLayout(). We need to have rendering to set input focus.
+
+        Test: fast/forms/focus-style-pending.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::focus):
+
 2007-09-04  Girish Ramakrishnan  <girish@trolltech.com>
 
         Reviewed by Simon.
index 9161868288bf248530b61131d56a94ff90ff2974..cc6e6e5b09fcc4e9cf975c5d8b5b7bf10133fbce 100644 (file)
@@ -989,7 +989,7 @@ void Element::focus(bool restorePreviousSelection)
     if (doc->focusedNode() == this)
         return;
 
-    doc->updateLayout();
+    doc->updateLayoutIgnorePendingStylesheets();
     
     if (!supportsFocus())
         return;