RESOLVED FIXED 49085
Spatial Navigation: Add a helper function isSpatialNavigationEnabled()
https://bugs.webkit.org/show_bug.cgi?id=49085
Summary Spatial Navigation: Add a helper function isSpatialNavigationEnabled()
Chang Shu
Reported 2010-11-05 12:09:52 PDT
Add a helper function isSpatialNavigationEnabled() in spatialnavigation.h to avoid duplicate code.
Attachments
fix patch (6.21 KB, patch)
2010-11-05 13:31 PDT, Chang Shu
no flags
fix patch 2 (6.25 KB, patch)
2010-11-05 14:19 PDT, Chang Shu
no flags
Chang Shu
Comment 1 2010-11-05 13:31:08 PDT
Created attachment 73109 [details] fix patch
Antonio Gomes
Comment 2 2010-11-05 13:49:25 PDT
Comment on attachment 73109 [details] fix patch Looks good! I still think we could pass Page* or Settings* as a parameter. Any specific reason for Frame?
Chang Shu
Comment 3 2010-11-05 13:59:16 PDT
(In reply to comment #2) > (From update of attachment 73109 [details]) > Looks good! I still think we could pass Page* or Settings* as a parameter. > > Any specific reason for Frame? The reason I prefer using Frame over Settings is that the caller doesn't have to do an additional check against pointer frame, which is taken care of inside the helper function. Design-wise, a user is asking if spatial navigation is enabled in a frame. The user shouldn't know about the internal implementation of Frame. In terms of Page, it's pretty much the same as Frame. Frame::settings() returns the page->settings(). In case its implementation changes for any reason, say, each frame has its own settings, this helper function needs no change.
Darin Adler
Comment 4 2010-11-05 14:10:32 PDT
Comment on attachment 73109 [details] fix patch View in context: https://bugs.webkit.org/attachment.cgi?id=73109&action=review > WebCore/page/SpatialNavigation.cpp:58 > + if (frame && frame->settings() && frame->settings()->isSpatialNavigationEnabled()) > + return true; > + > + return false; This: if (x) return true; return false; Is the same as this: return x; You should remove the if.
Chang Shu
Comment 5 2010-11-05 14:11:49 PDT
sure! > This: > > if (x) > return true; > return false; > > Is the same as this: > > return x; > > You should remove the if.
Chang Shu
Comment 6 2010-11-05 14:19:45 PDT
Created attachment 73116 [details] fix patch 2
Antonio Gomes
Comment 7 2010-11-06 05:45:22 PDT
(In reply to comment #3) > (In reply to comment #2) > > (From update of attachment 73109 [details] [details]) > > Looks good! I still think we could pass Page* or Settings* as a parameter. > > > > Any specific reason for Frame? > > The reason I prefer using Frame over Settings is that the caller doesn't have to do an additional check against pointer frame, which is taken care of inside the helper function. Design-wise, a user is asking if spatial navigation is enabled in a frame. The user shouldn't know about the internal implementation of Frame. > In terms of Page, it's pretty much the same as Frame. Frame::settings() returns the page->settings(). In case its implementation changes for any reason, say, each frame has its own settings, this helper function needs no change. I do not think there is any plan to make settings per Frame. It is essentially a Page concept.
WebKit Commit Bot
Comment 8 2010-11-07 01:23:40 PST
The commit-queue encountered the following flaky tests while processing attachment 73116 [details]: http/tests/security/cross-origin-css.html Please file bugs against the tests. These tests were authored by cevans@google.com. The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 9 2010-11-07 01:24:41 PST
Comment on attachment 73116 [details] fix patch 2 Clearing flags on attachment: 73116 Committed r71479: <http://trac.webkit.org/changeset/71479>
WebKit Commit Bot
Comment 10 2010-11-07 01:24:46 PST
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.