NavigationAction has too many constructors
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jun 2017 17:21:47 +0000 (17:21 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jun 2017 17:21:47 +0000 (17:21 +0000)
commit2ab2681a0106e5ca1515cc4f6e516c9ea7718d61
treeb0b2006a000c2912933274caf6d3decdf7d404e4
parent3801e0a9fac199ddbbb8cc520c1d50873d8484cb
NavigationAction has too many constructors
https://bugs.webkit.org/show_bug.cgi?id=173484

Reviewed by Brady Eidson.

A NavigationAction object is an immutable object that represents the details of a
navigation, including the type of a navigation (e.g. link click), what triggered
the navigation, and the external URL policy to use for the navigation. Over time
the number of NavigationAction constructor overloads (not including copy/move
constructors) has grown to 12 to support different combinations of details.
We can use default values to reduce the number of constructors to 2 (not including
copy/move constructors).

No behavior changed. So, no new tests.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Pass NavigationType::Other when
instantiating NavigationAction.
(WebCore::FrameLoader::loadDifferentDocumentItem): Fix order of arguments now that
the constructor overload that takes a NavigationType takes the Event* as the fourth argument,
not the third. Also, use C++11 brace initialization syntax when instantiating a NavigationAction.
(WebCore::createWindow):
* loader/NavigationAction.cpp: Remove unnecessary #include of header ScriptController.h.
Include header Event.h.
(WebCore::NavigationAction::NavigationAction):
* loader/NavigationAction.h: Forward declare class Event and remove #include of header Event.h.
Make copy constructor, copy assignment operator, move constructor, and move assignment operator
out-of-line to avoid the need to include header Event.h. Export the copy constructor so that it
can be used from WebKit on the Apple Windows port. Move ShouldOpenExternalURLsPolicy to be after
NavigationType to reduce the size of the class by 8 bytes.
(WebCore::NavigationAction::NavigationAction):
* loader/PolicyChecker.cpp: Include header Event.h.
* page/Performance.cpp: Ditto.
* replay/ReplayController.cpp: Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@218599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/NavigationAction.cpp
Source/WebCore/loader/NavigationAction.h
Source/WebCore/loader/PolicyChecker.cpp
Source/WebCore/page/Performance.cpp
Source/WebCore/replay/ReplayController.cpp