Bug 104166 - Navigation begun in response to a drag should have a unique NavigationType
Summary: Navigation begun in response to a drag should have a unique NavigationType
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Conrad Shultz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-05 13:48 PST by Conrad Shultz
Modified: 2012-12-14 11:02 PST (History)
5 users (show)

See Also:


Attachments
Patch (7.85 KB, patch)
2012-12-07 15:03 PST, Conrad Shultz
no flags Details | Formatted Diff | Diff
Patch (7.92 KB, patch)
2012-12-07 16:30 PST, Conrad Shultz
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Conrad Shultz 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().
Comment 1 Conrad Shultz 2012-12-07 15:03:37 PST
Created attachment 178291 [details]
Patch
Comment 2 WebKit Review Bot 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.
Comment 3 Conrad Shultz 2012-12-07 16:30:02 PST
Created attachment 178299 [details]
Patch
Comment 4 WebKit Review Bot 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.
Comment 5 Ryosuke Niwa 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?
Comment 6 Ryosuke Niwa 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.
Comment 7 Conrad Shultz 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!
Comment 8 Conrad Shultz 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?
Comment 9 Sam Weinig 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.
Comment 10 Conrad Shultz 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.
Comment 11 Ryosuke Niwa 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 :/
Comment 12 Alexey Proskuryakov 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.