Bug 65220

Summary: [Chromium] WebViewImpl doesn't proper deactivate focus
Product: WebKit Reporter: Nate Chapin <japhet>
Component: WebKit Misc.Assignee: Nate Chapin <japhet>
Status: RESOLVED FIXED    
Severity: Normal CC: fishd, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch + unit test
none
fix header ordering
none
fix style issues
fishd: review-
Refactor helpers into a separate file none

Nate Chapin
Reported 2011-07-26 16:46:11 PDT
Original report: http://code.google.com/p/chromium/issues/detail?id=64846 The problem is in WebViewImpl::setFocus(). We call setActive(true) when we set focus, but don't call setActive(false) when we unset it. There's a very old (pre-release) comment indicating that this behavior is to avoid sending spurious focus/blur events, but all tests still appear to be passing, so I don't think this is an issue.
Attachments
patch + unit test (6.74 KB, patch)
2011-07-26 16:49 PDT, Nate Chapin
no flags
fix header ordering (6.74 KB, patch)
2011-07-27 09:49 PDT, Nate Chapin
no flags
fix style issues (6.73 KB, patch)
2011-08-11 16:07 PDT, Nate Chapin
fishd: review-
Refactor helpers into a separate file (21.89 KB, patch)
2011-09-21 14:02 PDT, Nate Chapin
no flags
Nate Chapin
Comment 1 2011-07-26 16:49:41 PDT
Created attachment 102073 [details] patch + unit test
WebKit Review Bot
Comment 2 2011-07-26 16:52:25 PDT
Attachment 102073 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit/chromium/ChangeLog', u'Sourc..." exit_code: 1 Source/WebKit/chromium/tests/WebViewTest.cpp:35: Alphabetical sorting problem. [build/include_order] [4] Source/WebKit/chromium/tests/WebViewTest.cpp:43: Alphabetical sorting problem. [build/include_order] [4] Source/WebKit/chromium/tests/WebViewTest.cpp:44: Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4] Total errors found: 3 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Nate Chapin
Comment 3 2011-07-27 09:49:29 PDT
Created attachment 102153 [details] fix header ordering
Darin Fisher (:fishd, Google)
Comment 4 2011-07-28 10:16:43 PDT
Comment on attachment 102153 [details] fix header ordering View in context: https://bugs.webkit.org/attachment.cgi?id=102153&action=review > Source/WebKit/chromium/tests/WebViewTest.cpp:72 > + webkit_support::RegisterMockedURL(WebURL(GURL(baseURL + fileName)), response, WebString::fromUTF8(filePath)); nit: you shouldn't need to manually specify the WebURL constructor. there should be an implicit conversion constructor for WebURL that takes a GURL. > Source/WebKit/chromium/tests/WebViewTest.cpp:84 > + urlRequest.setURL(WebURL(GURL(baseURL + fileName))); ditto > Source/WebKit/chromium/tests/WebViewTest.cpp:89 > + std::string baseURL; nit: m_baseURL > Source/WebKit/chromium/tests/WebViewTest.cpp:108 > + WebFrameImpl* frame = static_cast<WebFrameImpl*>(webView->mainFrame()); it'd be nice if this could be done using only WebKit APIs, which it almost can be: WebDocument doc = webView->mainFrame()->document(); EXPECT_TRUE(doc.isHTMLDocument()); But, we don't have a WebHTMLDocument interface, and we don't have hasFocus(). We do have WebDocument::focusedNode() though. Could that be used? It just makes this test more fragile if it depends on WebCore and static casting to WebKit API implementation types. > Source/WebKit/chromium/src/WebViewImpl.cpp:-1297 > - // focus/blur events to be dispatched. i seem to recall that there was some very tricky focus/blur logic required to make popup lists work properly. we should make sure that those don't regress. i'm pretty sure that we lack layout test coverage.
Nate Chapin
Comment 5 2011-08-11 15:39:32 PDT
> > Source/WebKit/chromium/src/WebViewImpl.cpp:-1297 > > - // focus/blur events to be dispatched. > > i seem to recall that there was some very tricky focus/blur logic required > to make popup lists work properly. we should make sure that those don't > regress. i'm pretty sure that we lack layout test coverage. I tried the test case linked in http://code.google.com/p/chromium/issues/detail?id=23499 and the events were identical before and after. Is there anything else I should try?
Nate Chapin
Comment 6 2011-08-11 16:07:12 PDT
Created attachment 103694 [details] fix style issues Since focusedNode() means something completely different, we really need to test some variant of an HTMLDocument. I don't think it makes sense to expose a new class just to test this bug.
Darin Fisher (:fishd, Google)
Comment 7 2011-09-20 16:57:25 PDT
Comment on attachment 103694 [details] fix style issues View in context: https://bugs.webkit.org/attachment.cgi?id=103694&action=review > Source/WebKit/chromium/tests/WebViewTest.cpp:50 > +class WebViewTest : public testing::Test { this looks like it is largely duplicating code from WebFrameTest.cpp. it seems like it would be better to refactor so you can share code?
Nate Chapin
Comment 8 2011-09-21 14:02:41 PDT
Created attachment 108229 [details] Refactor helpers into a separate file
Darin Fisher (:fishd, Google)
Comment 9 2011-10-06 23:24:28 PDT
Comment on attachment 108229 [details] Refactor helpers into a separate file R=me sorry for the delayed review, and thank you for refactoring the test code!
WebKit Review Bot
Comment 10 2011-10-07 00:42:18 PDT
Comment on attachment 108229 [details] Refactor helpers into a separate file Clearing flags on attachment: 108229 Committed r96912: <http://trac.webkit.org/changeset/96912>
WebKit Review Bot
Comment 11 2011-10-07 00:42:22 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.