Reviewed by Oliver.
- test case for <rdar://problem/5326303> REGRESSION: blur event fires upon navigating away from a page with focused element
(Test mostly by Alice.)
* fast/events/no-blur-on-page-leave-expected.txt: Added.
* fast/events/no-blur-on-page-leave.html: Added.
* fast/events/resources/no-blur-result.html: Added.
WebCore:
Reviewed by Oliver.
<rdar://problem/5326303> REGRESSION: blur event fires upon navigating away from a page with focused element
The proximate cause was the recent change to keep focus on the
WebHTMLView when switching views. But the reason this happend was
that didCommitLoadForFrame got called at a time when the new view
was in place, but the old document was still there. This was a
longstanding problem with the delegate, and fixing it cleans it
up.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::begin): Don't send dispatchWindowObjectAvailable if
caller asked not to (this is to allow order of delegates to be the same).
(WebCore::FrameLoader::transitionToCommitted): Don't emit didCommitLoadForFrame here.
(WebCore::FrameLoader::receivedFirstData): Instead do it here, after calling begin(),
so the new document is set up.
* loader/FrameLoader.h: Add new optional parameter to begin().
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24490
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-07-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ - test case for <rdar://problem/5326303> REGRESSION: blur event fires upon navigating away from a page with focused element
+
+ (Test mostly by Alice.)
+
+ * fast/events/no-blur-on-page-leave-expected.txt: Added.
+ * fast/events/no-blur-on-page-leave.html: Added.
+ * fast/events/resources/no-blur-result.html: Added.
+
2007-07-20 Sam Weinig <sam@webkit.org>
Reviewed by Mitz.
--- /dev/null
+onblur should not fire if an element has focus when navigating away from the page
+rdar://problem/5326303
+
+
--- /dev/null
+<script>
+function test()
+{
+ if (!window.layoutTestController)
+ return;
+
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntiDone();
+
+ var element = document.getElementById("elem");
+ element.focus();
+ element.onchange();
+}
+function failed()
+{
+ document.getElementById("console").innerHTML = "blur event fired, FAILED!";
+ window.location = 'resources/no-blur-result.html/#FAILED';
+ layoutTestController.notifyDone();
+}
+
+</script>
+<body onload="test();">
+onblur should not fire if an element has focus when navigating away from the page<br>
+<a href="rdar://problem/5326303">rdar://problem/5326303</a><br>
+<select id="elem" onchange="window.location='resources/no-blur-result.html';" onblur="failed()">
+<option>CHANGE ME</option>
+<option>PICK ME</option>
+</select>
+<pre id=console>
+</pre>
+</body>
--- /dev/null
+<script>
+function test()
+{
+ if (window.location.hash == "#FAILED")
+ document.getElementById("succeededDiv").setAttribute("style", "display:none;");
+ else
+ document.getElementById("failedDiv").setAttribute("style", "display:none;");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+</script>
+
+<body onload="test();">
+
+<div id="succeededDiv">
+<span style="color:green;">SUCCESS</span>
+</div>
+
+<div id="failedDiv">
+<a name="FAILED"><span style="color:red;">FAILED</span></a>
+</div>
+
+</body>
+2007-07-20 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Oliver.
+
+ <rdar://problem/5326303> REGRESSION: blur event fires upon navigating away from a page with focused element
+
+
+
+ The proximate cause was the recent change to keep focus on the
+ WebHTMLView when switching views. But the reason this happend was
+ that didCommitLoadForFrame got called at a time when the new view
+ was in place, but the old document was still there. This was a
+ longstanding problem with the delegate, and fixing it cleans it
+ up.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::begin): Don't send dispatchWindowObjectAvailable if
+ caller asked not to (this is to allow order of delegates to be the same).
+ (WebCore::FrameLoader::transitionToCommitted): Don't emit didCommitLoadForFrame here.
+ (WebCore::FrameLoader::receivedFirstData): Instead do it here, after calling begin(),
+ so the new document is set up.
+ * loader/FrameLoader.h: Add new optional parameter to begin().
+
2007-07-20 Sam Weinig <sam@webkit.org>
Reviewed by Beth Dakin.
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
+ projectRoot = "";
targets = (
93F198A508245E59001E9ABC /* WebCore */,
DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
void FrameLoader::receivedFirstData()
{
- begin(m_workingURL);
+ begin(m_workingURL, false);
+
+ dispatchDidCommitLoad();
+ dispatchWindowObjectAvailable();
+
+ String ptitle = m_documentLoader->title();
+ // If we have a title let the WebView know about it.
+ if (!ptitle.isNull())
+ m_client->dispatchDidReceiveTitle(ptitle);
m_frame->document()->docLoader()->setCachePolicy(m_cachePolicy);
m_workingURL = KURL();
begin(KURL());
}
-void FrameLoader::begin(const KURL& url)
+void FrameLoader::begin(const KURL& url, bool dispatch)
{
clear();
- dispatchWindowObjectAvailable();
+ if (dispatch)
+ dispatchWindowObjectAvailable();
m_needsClear = true;
m_shouldClearWindowProperties = true;
// Handle adding the URL to the back/forward list.
DocumentLoader* dl = m_documentLoader.get();
- String ptitle = dl->title();
switch (m_loadType) {
case FrameLoadTypeForward:
return;
m_committedFirstRealDocumentLoad = true;
-
- dispatchDidCommitLoad();
-
- // If we have a title let the WebView know about it.
- if (!ptitle.isNull())
- m_client->dispatchDidReceiveTitle(ptitle);
}
bool FrameLoader::privateBrowsingEnabled() const
KURL historyURL(int distance);
void begin();
- void begin(const KURL&);
+ void begin(const KURL&, bool dispatchWindowObjectAvailable = true);
+
void write(const char* str, int len = -1, bool flush = false);
void write(const String&);
void end();