ASSIGNED 104166
Navigation begun in response to a drag should have a unique NavigationType
https://bugs.webkit.org/show_bug.cgi?id=104166
Summary Navigation begun in response to a drag should have a unique NavigationType
Conrad Shultz
Reported 2012-12-05 13:48:33 PST
Currently, navigation commenced in DragController::performDrag(), via FrameLoader::load(), ends up as type NavigationTypeOther. In certain situations it would be desirable for client code to be able to distinguish drag-initiated navigation from other types of navigation, so a new navigation type should be declared, to be used by performDrag().
Attachments
Patch (7.85 KB, patch)
2012-12-07 15:03 PST, Conrad Shultz
no flags
Patch (7.92 KB, patch)
2012-12-07 16:30 PST, Conrad Shultz
no flags
Conrad Shultz
Comment 1 2012-12-07 15:03:37 PST
WebKit Review Bot
Comment 2 2012-12-07 15:09:57 PST
Attachment 178291 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebKit2/ChangeLog:11: Line contains tab character. [whitespace/tab] [5] Source/WebKit2/ChangeLog:12: Line contains tab character. [whitespace/tab] [5] Source/WebKit2/ChangeLog:16: Line contains tab character. [whitespace/tab] [5] Source/WebCore/ChangeLog:8: Line contains tab character. [whitespace/tab] [5] Source/WebCore/ChangeLog:14: Line contains tab character. [whitespace/tab] [5] Source/WebCore/ChangeLog:16: Line contains tab character. [whitespace/tab] [5] Source/WebCore/ChangeLog:17: Line contains tab character. [whitespace/tab] [5] Source/WebCore/ChangeLog:21: Line contains tab character. [whitespace/tab] [5] Source/WebCore/ChangeLog:24: Line contains tab character. [whitespace/tab] [5] Source/WebCore/ChangeLog:25: Line contains tab character. [whitespace/tab] [5] Source/WebCore/ChangeLog:29: Line contains tab character. [whitespace/tab] [5] Source/WebKit2/Shared/API/c/WKPageLoadTypes.h:39: enum members should use InterCaps with an initial capital letter. [readability/enum_casing] [4] Source/WebKit2/Shared/API/c/WKPageLoadTypes.h:40: enum members should use InterCaps with an initial capital letter. [readability/enum_casing] [4] Total errors found: 13 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Conrad Shultz
Comment 3 2012-12-07 16:30:02 PST
WebKit Review Bot
Comment 4 2012-12-07 16:33:26 PST
Attachment 178299 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebKit2/Shared/API/c/WKPageLoadTypes.h:39: enum members should use InterCaps with an initial capital letter. [readability/enum_casing] [4] Source/WebKit2/Shared/API/c/WKPageLoadTypes.h:40: enum members should use InterCaps with an initial capital letter. [readability/enum_casing] [4] Total errors found: 2 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 5 2012-12-07 18:55:46 PST
Comment on attachment 178299 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=178299&action=review > Source/WebCore/ChangeLog:8 > + Currently, navigation commenced in DragController::performDrag(), via FrameLoader::load(), ends up as type NavigationTypeOther. In certain situations it would be desirable for client code to be able to distinguish drag-initiated navigation from other types of navigation. To this end, this patch adds a new navigation type (NavigationTypeDragInitiated) and an associated WKFrameNavigationType (kWKFrameNavigationTypeDragInitiated), and revises, particularly, DragController and FrameLoader to set this navigation type accordingly. Please wrap lines. > Source/WebKit2/ChangeLog:8 > + Currently, navigation commenced in DragController::performDrag(), via FrameLoader::load(), ends up as type NavigationTypeOther. In certain situations it would be desirable for client code to be able to distinguish drag-initiated navigation from other types of navigation. To this end, this patch adds a new navigation type (NavigationTypeDragInitiated) and an associated WKFrameNavigationType (kWKFrameNavigationTypeDragInitiated), and revises, particularly, DragController and FrameLoader to set this navigation type accordingly. Ditto. Also, you don’t have to repeat this description here since it’s included in WebCore. > Source/WebCore/loader/FrameLoader.cpp:1266 > +void FrameLoader::load(const FrameLoadRequest& passedRequest, bool isDrag) Would it make sense to add a new member variable to FrameLoadRequest or add a new type to FrameLoadType instead?
Ryosuke Niwa
Comment 6 2012-12-07 18:56:27 PST
Comment on attachment 178299 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=178299&action=review > Source/WebCore/loader/FrameLoader.cpp:1297 > + if (isDrag) > + loader.get()->setTriggeringAction(NavigationAction(request.resourceRequest(), NavigationTypeDragInitiated)); I don’t think it makes much sense to override the action here.
Conrad Shultz
Comment 7 2012-12-09 20:42:48 PST
(In reply to comment #5) > > Please wrap lines. Will fix. > > Ditto. Also, you don’t have to repeat this description here since it’s included in WebCore. Ditto. (It wasn't clear to me from the contributor instructions what to do when a patch spans multiple sub-projects; now I know. > > > Source/WebCore/loader/FrameLoader.cpp:1266 > > +void FrameLoader::load(const FrameLoadRequest& passedRequest, bool isDrag) > > Would it make sense to add a new member variable to FrameLoadRequest or add a new type to FrameLoadType instead? What were you thinking in terms of a new FrameLoadType? From what I can see, the only method that lets you pass one in, FrameLoader::loadWithNavigationAction(), is private, and I don't necessarily want to make it public just for this. I do like the idea of adding a member variable to FrameLoadRequest, however, and that seems like a better approach than my admittedly inelegant first pass. I will take a look. Thanks for reading the patch!
Conrad Shultz
Comment 8 2012-12-09 20:47:50 PST
(In reply to comment #6) > (From update of attachment 178299 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=178299&action=review > > > Source/WebCore/loader/FrameLoader.cpp:1297 > > + if (isDrag) > > + loader.get()->setTriggeringAction(NavigationAction(request.resourceRequest(), NavigationTypeDragInitiated)); > > I don’t think it makes much sense to override the action here. Do you think it should be done deeper down, such as in FrameLoader::loadWithDocumentLoader(), where the triggering action is currently set if empty?
Sam Weinig
Comment 9 2012-12-10 00:22:27 PST
What is the use case for distinguishing loads that are drag initiated? Also, please don't add an overload of FrameLoader::load(). If this data is needed, it should probably be incorporated into the FrameLoadRequest.
Conrad Shultz
Comment 10 2012-12-12 20:20:50 PST
(In reply to comment #9) > What is the use case for distinguishing loads that are drag initiated? Also, please don't add an overload of FrameLoader::load(). If this data is needed, it should probably be incorporated into the FrameLoadRequest. I agree that overloading load() is suboptimal; I will rework and submit a patch that modifies FrameLoadRequest.
Ryosuke Niwa
Comment 11 2012-12-13 20:25:23 PST
Comment on attachment 178299 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=178299&action=review >>> Source/WebCore/loader/FrameLoader.cpp:1297 >>> + loader.get()->setTriggeringAction(NavigationAction(request.resourceRequest(), NavigationTypeDragInitiated)); >> >> I don’t think it makes much sense to override the action here. > > Do you think it should be done deeper down, such as in FrameLoader::loadWithDocumentLoader(), where the triggering action is currently set if empty? Yes. I thought I explicitly stated in my previous comment but it got cut off somehow :/
Alexey Proskuryakov
Comment 12 2012-12-14 11:02:15 PST
A few points from IRC discussion: - care should be taken to not break WebKit1 API, as these navigation types are basically typecast to an API type; - the concept of drag is not very well defined - a drag from Finder is very different from an HTML link drag. - is drag really the only case that needs to be addressed? For example, I'd test AppleScript.
Note You need to log in before you can comment on or make changes to this bug.