Expand r209943 to suppress paste during provisional navigation as well
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 20:43:41 +0000 (20:43 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 20:43:41 +0000 (20:43 +0000)
commitdda15fdbd10a0e70cd9363ef00bef09c6e11a5fb
tree1f33fe0715d8d6cd3ce2b12e544c85238d1c3b37
parentc7b444c23eb597c98aea9e1e17bad6fc5015dbef
Expand r209943 to suppress paste during provisional navigation as well
https://bugs.webkit.org/show_bug.cgi?id=178429
<rdar://problem/33952830>

Reviewed by Dean Jackson.

Source/WebCore:

No new tests; adjusted an existing test to cover this case.

* editing/Editor.cpp:
(WebCore::Editor::canPaste const):
Disable pasting during provisional navigation, like r209943 did for
various other forms of text input.

(WebCore::Editor::shouldInsertText const):
* dom/EventDispatcher.cpp:
(WebCore::shouldSuppressEventDispatchInDOM):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::shouldSuppressTextInputFromEditing const):
(WebCore::FrameLoader::shouldSuppressKeyboardInput const): Deleted.
* loader/FrameLoader.h:
* page/Settings.in:
Rename the setting to be about editing-related text input, not "keyboard" input.

* editing/EditorCommand.cpp:
(WebCore::allowExecutionWhenDisabled):
(WebCore::doNotAllowExecutionWhenDisabled):
(WebCore::allowExecutionWhenDisabledCopyCut):
(WebCore::allowExecutionWhenDisabledPaste):
(WebCore::createCommandMap):
(WebCore::Editor::Command::allowExecutionWhenDisabled const):
Completely disable execution of paste events when in no-text-input-from-editing mode.
Otherwise, even though canPaste was false and we wouldn't do a default paste action,
we would still dispatch the paste event to the DOM.

Source/WebKit:

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation):
(WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation):
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]):
(-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Adjust to the changed preference name, except at the SPI level.

LayoutTests:

* http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
* http/tests/navigation/keyboard-events-during-provisional-navigation.html:
* http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt:
* http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html:
* http/tests/navigation/resources/keyboard-events-after-navigation.html:
* http/tests/navigation/resources/keyboard-events-test.js:
(runBeforeTest):
(runTest):
Copy a "d" to the clipboard before running the test, and paste it while running.
I put the copy before running the test so that if someone comes along and
blacklists copy during provisional load as well, the test for this behavior
still actually tests the paste portion.
Also ensure that paste events are not triggered during provisional navigation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223708 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt
LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation.html
LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt
LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html
LayoutTests/http/tests/navigation/resources/keyboard-events-after-navigation.html
LayoutTests/http/tests/navigation/resources/keyboard-events-test.js
Source/WebCore/ChangeLog
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/page/Settings.in
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferencesDefinitions.h
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp