Diff
Modified: trunk/LayoutTests/ChangeLog (223707 => 223708)
--- trunk/LayoutTests/ChangeLog 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/LayoutTests/ChangeLog 2017-10-19 20:43:41 UTC (rev 223708)
@@ -1,3 +1,25 @@
+2017-10-19 Tim Horton <timothy_hor...@apple.com>
+
+ 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.
+
+ * 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.
+
2017-10-19 Daniel Bates <daba...@apple.com>
Referrer policy should be inherited from creator
Modified: trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt (223707 => 223708)
--- trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt 2017-10-19 20:43:41 UTC (rev 223708)
@@ -1,40 +1,46 @@
-CONSOLE MESSAGE: line 14: Provisional navigation started.
-CONSOLE MESSAGE: line 15: No trusted events should be logged and the input element should have the value "".
-CONSOLE MESSAGE: line 20: Dispatching untrusted keypress event.
-CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: false).
-CONSOLE MESSAGE: line 28: Pressing tab.
-CONSOLE MESSAGE: line 30: Active element after pressing tab: [object HTMLInputElement].
-CONSOLE MESSAGE: line 32: Pressing "a".
-CONSOLE MESSAGE: line 35: Setting marked text to "b".
-CONSOLE MESSAGE: line 38: Inserting text "c".
-CONSOLE MESSAGE: line 41: Input element value after text input events: "".
-CONSOLE MESSAGE: line 18: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
+CONSOLE MESSAGE: line 16: Provisional navigation started.
+CONSOLE MESSAGE: line 17: No trusted events should be logged and the input element should have the value "".
+CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
+CONSOLE MESSAGE: line 42: Pressing tab.
+CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
+CONSOLE MESSAGE: line 46: Pressing "a".
+CONSOLE MESSAGE: line 49: Setting marked text to "b".
+CONSOLE MESSAGE: line 52: Inserting text "c".
+CONSOLE MESSAGE: line 55: Pasting text "d".
+CONSOLE MESSAGE: line 58: Input element value after text input events: "".
+CONSOLE MESSAGE: line 20: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
CONSOLE MESSAGE: line 6: Finished navigating to resources/keyboard-events-after-navigation.html.
-CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "ac".
-CONSOLE MESSAGE: line 20: Dispatching untrusted keypress event.
-CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: false).
-CONSOLE MESSAGE: line 28: Pressing tab.
-CONSOLE MESSAGE: line 5: keydownevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: keyupevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 30: Active element after pressing tab: [object HTMLInputElement].
-CONSOLE MESSAGE: line 32: Pressing "a".
-CONSOLE MESSAGE: line 5: keydownevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: textInputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: keyupevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 35: Setting marked text to "b".
-CONSOLE MESSAGE: line 5: compositionstartevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: compositionupdateevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 38: Inserting text "c".
-CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: textInputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: compositionendevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 41: Input element value after text input events: "ac".
+CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "acd".
+CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
+CONSOLE MESSAGE: line 42: Pressing tab.
+CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
+CONSOLE MESSAGE: line 46: Pressing "a".
+CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 49: Setting marked text to "b".
+CONSOLE MESSAGE: line 18: compositionstartevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: compositionupdateevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 52: Inserting text "c".
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: compositionendevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 55: Pasting text "d".
+CONSOLE MESSAGE: line 18: pasteevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 58: Input element value after text input events: "acd".
Modified: trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation.html (223707 => 223708)
--- trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation.html 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation.html 2017-10-19 20:43:41 UTC (rev 223708)
@@ -7,9 +7,11 @@
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
- internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(true);
+ internals.settings.setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(true);
}
+ runBeforeTest(window);
+
waitForProvisionalNavigation(function() {
console.log("Provisional navigation started.");
console.log("No trusted events should be logged and the input element should have the value \"\".");
Modified: trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt (223707 => 223708)
--- trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt 2017-10-19 20:43:41 UTC (rev 223708)
@@ -1,40 +1,46 @@
-CONSOLE MESSAGE: line 16: Provisional navigation started.
-CONSOLE MESSAGE: line 17: No trusted events should be logged and the input element should have the value "".
-CONSOLE MESSAGE: line 20: Dispatching untrusted keypress event.
-CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: false).
-CONSOLE MESSAGE: line 28: Pressing tab.
-CONSOLE MESSAGE: line 30: Active element after pressing tab: [object HTMLInputElement].
-CONSOLE MESSAGE: line 32: Pressing "a".
-CONSOLE MESSAGE: line 35: Setting marked text to "b".
-CONSOLE MESSAGE: line 38: Inserting text "c".
-CONSOLE MESSAGE: line 41: Input element value after text input events: "".
-CONSOLE MESSAGE: line 20: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
+CONSOLE MESSAGE: line 18: Provisional navigation started.
+CONSOLE MESSAGE: line 19: No trusted events should be logged and the input element should have the value "".
+CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
+CONSOLE MESSAGE: line 42: Pressing tab.
+CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
+CONSOLE MESSAGE: line 46: Pressing "a".
+CONSOLE MESSAGE: line 49: Setting marked text to "b".
+CONSOLE MESSAGE: line 52: Inserting text "c".
+CONSOLE MESSAGE: line 55: Pasting text "d".
+CONSOLE MESSAGE: line 58: Input element value after text input events: "".
+CONSOLE MESSAGE: line 22: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
CONSOLE MESSAGE: line 6: Finished navigating to resources/keyboard-events-after-navigation.html.
-CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "ac".
-CONSOLE MESSAGE: line 20: Dispatching untrusted keypress event.
-CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: false).
-CONSOLE MESSAGE: line 28: Pressing tab.
-CONSOLE MESSAGE: line 5: keydownevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: keyupevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 30: Active element after pressing tab: [object HTMLInputElement].
-CONSOLE MESSAGE: line 32: Pressing "a".
-CONSOLE MESSAGE: line 5: keydownevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: textInputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: keyupevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 35: Setting marked text to "b".
-CONSOLE MESSAGE: line 5: compositionstartevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: compositionupdateevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 38: Inserting text "c".
-CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: textInputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 5: compositionendevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 41: Input element value after text input events: "ac".
+CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "acd".
+CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
+CONSOLE MESSAGE: line 42: Pressing tab.
+CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
+CONSOLE MESSAGE: line 46: Pressing "a".
+CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 49: Setting marked text to "b".
+CONSOLE MESSAGE: line 18: compositionstartevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: compositionupdateevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 52: Inserting text "c".
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: compositionendevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 55: Pasting text "d".
+CONSOLE MESSAGE: line 18: pasteevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
+CONSOLE MESSAGE: line 58: Input element value after text input events: "acd".
Modified: trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html (223707 => 223708)
--- trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html 2017-10-19 20:43:41 UTC (rev 223708)
@@ -9,9 +9,11 @@
testRunner.dumpAsText();
testRunner.dumpChildFramesAsText();
testRunner.waitUntilDone();
- internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(true);
+ internals.settings.setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(true);
}
+ runBeforeTest(window);
+
waitForProvisionalNavigation(function () {
console.log("Provisional navigation started.");
console.log("No trusted events should be logged and the input element should have the value \"\".");
Modified: trunk/LayoutTests/http/tests/navigation/resources/keyboard-events-after-navigation.html (223707 => 223708)
--- trunk/LayoutTests/http/tests/navigation/resources/keyboard-events-after-navigation.html 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/LayoutTests/http/tests/navigation/resources/keyboard-events-after-navigation.html 2017-10-19 20:43:41 UTC (rev 223708)
@@ -4,7 +4,7 @@
<script src=""
<script>
console.log("Finished navigating to resources/keyboard-events-after-navigation.html.");
- console.log("Trusted events should be logged and the input element should have the value \"ac\".");
+ console.log("Trusted events should be logged and the input element should have the value \"acd\".");
runTest(window);
testRunner.notifyDone();
</script>
Modified: trunk/LayoutTests/http/tests/navigation/resources/keyboard-events-test.js (223707 => 223708)
--- trunk/LayoutTests/http/tests/navigation/resources/keyboard-events-test.js 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/LayoutTests/http/tests/navigation/resources/keyboard-events-test.js 2017-10-19 20:43:41 UTC (rev 223708)
@@ -1,3 +1,16 @@
+function runBeforeTest(window)
+{
+ var document = window.document;
+
+ document.body.addEventListener("beforecopy", function (e) { e.preventDefault(); });
+ document.body.addEventListener("copy", function (e) {
+ e.clipboardData.setData("text/plain", "d");
+ e.preventDefault();
+ });
+
+ document.execCommand("copy");
+}
+
function runTest(window)
{
function eventHandler(event)
@@ -14,6 +27,7 @@
window.addEventListener("textInput", eventHandler, true);
window.addEventListener("beforeinput", eventHandler, true);
window.addEventListener("input", eventHandler, true);
+ window.addEventListener("paste", eventHandler, true);
var document = window.document;
@@ -38,6 +52,9 @@
console.log("Inserting text \"c\".");
textInputController.insertText("c");
+ console.log("Pasting text \"d\".");
+ document.execCommand("Paste");
+
console.log("Input element value after text input events: \"" + textInput.value + "\".");
}
Modified: trunk/Source/WebCore/ChangeLog (223707 => 223708)
--- trunk/Source/WebCore/ChangeLog 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebCore/ChangeLog 2017-10-19 20:43:41 UTC (rev 223708)
@@ -1,3 +1,39 @@
+2017-10-19 Tim Horton <timothy_hor...@apple.com>
+
+ 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.
+
+ 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.
+
2017-10-19 Dean Jackson <d...@apple.com>
Avoid duplicate multisample resolve before WebGL compositing
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (223707 => 223708)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2017-10-19 20:43:41 UTC (rev 223708)
@@ -117,7 +117,7 @@
if (!frame)
return false;
- if (!frame->mainFrame().loader().shouldSuppressKeyboardInput())
+ if (!frame->mainFrame().loader().shouldSuppressTextInputFromEditing())
return false;
if (is<TextEvent>(event)) {
Modified: trunk/Source/WebCore/editing/Editor.cpp (223707 => 223708)
--- trunk/Source/WebCore/editing/Editor.cpp 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebCore/editing/Editor.cpp 2017-10-19 20:43:41 UTC (rev 223708)
@@ -456,6 +456,9 @@
bool Editor::canPaste() const
{
+ if (m_frame.mainFrame().loader().shouldSuppressTextInputFromEditing())
+ return false;
+
return canEdit();
}
@@ -704,7 +707,7 @@
bool Editor::shouldInsertText(const String& text, Range* range, EditorInsertAction action) const
{
- if (m_frame.mainFrame().loader().shouldSuppressKeyboardInput() && action == EditorInsertAction::Typed)
+ if (m_frame.mainFrame().loader().shouldSuppressTextInputFromEditing() && action == EditorInsertAction::Typed)
return false;
return client() && client()->shouldInsertText(text, range, action);
Modified: trunk/Source/WebCore/editing/EditorCommand.cpp (223707 => 223708)
--- trunk/Source/WebCore/editing/EditorCommand.cpp 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebCore/editing/EditorCommand.cpp 2017-10-19 20:43:41 UTC (rev 223708)
@@ -39,6 +39,7 @@
#include "EventHandler.h"
#include "FormatBlockCommand.h"
#include "Frame.h"
+#include "FrameLoader.h"
#include "FrameView.h"
#include "HTMLFontElement.h"
#include "HTMLHRElement.h"
@@ -46,6 +47,7 @@
#include "HTMLNames.h"
#include "IndentOutdentCommand.h"
#include "InsertListCommand.h"
+#include "MainFrame.h"
#include "Page.h"
#include "Pasteboard.h"
#include "RenderBox.h"
@@ -74,7 +76,7 @@
TriState (*state)(Frame&, Event*);
String (*value)(Frame&, Event*);
bool isTextInsertion;
- bool (*allowExecutionWhenDisabled)(EditorCommandSource);
+ bool (*allowExecutionWhenDisabled)(Frame&, EditorCommandSource);
};
typedef HashMap<String, const EditorInternalCommand*, ASCIICaseInsensitiveHash> CommandMap;
@@ -1490,17 +1492,17 @@
// allowExecutionWhenDisabled functions
-static bool allowExecutionWhenDisabled(EditorCommandSource)
+static bool allowExecutionWhenDisabled(Frame&, EditorCommandSource)
{
return true;
}
-static bool doNotAllowExecutionWhenDisabled(EditorCommandSource)
+static bool doNotAllowExecutionWhenDisabled(Frame&, EditorCommandSource)
{
return false;
}
-static bool allowExecutionWhenDisabledCopyCut(EditorCommandSource source)
+static bool allowExecutionWhenDisabledCopyCut(Frame&, EditorCommandSource source)
{
switch (source) {
case CommandFromMenuOrKeyBinding:
@@ -1514,6 +1516,13 @@
return false;
}
+static bool allowExecutionWhenDisabledPaste(Frame& frame, EditorCommandSource)
+{
+ if (frame.mainFrame().loader().shouldSuppressTextInputFromEditing())
+ return false;
+ return true;
+}
+
// Map of functions
struct CommandEntry {
@@ -1625,9 +1634,9 @@
{ "MoveWordRightAndModifySelection", { executeMoveWordRightAndModifySelection, supportedFromMenuOrKeyBinding, enabledVisibleSelectionOrCaretBrowsing, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "Outdent", { executeOutdent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "OverWrite", { executeToggleOverwrite, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
- { "Paste", { executePaste, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
- { "PasteAndMatchStyle", { executePasteAndMatchStyle, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
- { "PasteAsPlainText", { executePasteAsPlainText, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
+ { "Paste", { executePaste, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
+ { "PasteAndMatchStyle", { executePasteAndMatchStyle, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
+ { "PasteAsPlainText", { executePasteAsPlainText, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
{ "Print", { executePrint, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "Redo", { executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
{ "RemoveFormat", { executeRemoveFormat, supported, enabledRangeInEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
@@ -1827,7 +1836,7 @@
{
if (!isSupported() || !m_frame)
return false;
- return m_command->allowExecutionWhenDisabled(m_source);
+ return m_command->allowExecutionWhenDisabled(*m_frame, m_source);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (223707 => 223708)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2017-10-19 20:43:41 UTC (rev 223708)
@@ -3820,9 +3820,9 @@
return frame;
}
-bool FrameLoader::shouldSuppressKeyboardInput() const
+bool FrameLoader::shouldSuppressTextInputFromEditing() const
{
- return m_frame.settings().shouldSuppressKeyboardInputDuringProvisionalNavigation() && m_state == FrameStateProvisional;
+ return m_frame.settings().shouldSuppressTextInputFromEditingDuringProvisionalNavigation() && m_state == FrameStateProvisional;
}
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/FrameLoader.h (223707 => 223708)
--- trunk/Source/WebCore/loader/FrameLoader.h 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2017-10-19 20:43:41 UTC (rev 223708)
@@ -299,7 +299,7 @@
void setProvisionalLoadErrorBeingHandledURL(const URL& url) { m_provisionalLoadErrorBeingHandledURL = url; }
bool isAlwaysOnLoggingAllowed() const;
- bool shouldSuppressKeyboardInput() const;
+ bool shouldSuppressTextInputFromEditing() const;
private:
enum FormSubmissionCacheLoadPolicy {
Modified: trunk/Source/WebCore/page/Settings.in (223707 => 223708)
--- trunk/Source/WebCore/page/Settings.in 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebCore/page/Settings.in 2017-10-19 20:43:41 UTC (rev 223708)
@@ -288,7 +288,7 @@
animatedImageAsyncDecodingEnabled initial=true
webkitImageReadyEventEnabled initial=false
-shouldSuppressKeyboardInputDuringProvisionalNavigation initial=false
+shouldSuppressTextInputFromEditingDuringProvisionalNavigation initial=false
langAttributeAwareFormControlUIEnabled initial=false
Modified: trunk/Source/WebKit/ChangeLog (223707 => 223708)
--- trunk/Source/WebKit/ChangeLog 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebKit/ChangeLog 2017-10-19 20:43:41 UTC (rev 223708)
@@ -1,3 +1,22 @@
+2017-10-19 Tim Horton <timothy_hor...@apple.com>
+
+ 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.
+
+ * 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.
+
2017-10-19 Youenn Fablet <you...@apple.com>
Add API to clean CacheStorage data
Modified: trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h (223707 => 223708)
--- trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h 2017-10-19 20:43:41 UTC (rev 223708)
@@ -289,7 +289,7 @@
macro(MediaPreloadingEnabled, mediaPreloadingEnabled, Bool, bool, false, "", "") \
macro(IntersectionObserverEnabled, intersectionObserverEnabled, Bool, bool, false, "Intersection Observer", "Enable Intersection Observer support") \
macro(InteractiveFormValidationEnabled, interactiveFormValidationEnabled, Bool, bool, true, "HTML Interactive Form Validation", "HTML interactive form validation") \
- macro(ShouldSuppressKeyboardInputDuringProvisionalNavigation, shouldSuppressKeyboardInputDuringProvisionalNavigation, Bool, bool, false, "", "") \
+ macro(ShouldSuppressTextInputFromEditingDuringProvisionalNavigation, shouldSuppressTextInputFromEditingDuringProvisionalNavigation, Bool, bool, false, "", "") \
macro(CSSGridLayoutEnabled, cssGridLayoutEnabled, Bool, bool, true, "CSS Grid", "CSS Grid Layout Module support") \
macro(GamepadsEnabled, gamepadsEnabled, Bool, bool, true, "Gamepads", "Web Gamepad API support") \
macro(InputEventsEnabled, inputEventsEnabled, Bool, bool, true, "Input Events", "Enable InputEvents support") \
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp (223707 => 223708)
--- trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp 2017-10-19 20:43:41 UTC (rev 223708)
@@ -1812,12 +1812,12 @@
void WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef preferencesRef, bool flag)
{
- toImpl(preferencesRef)->setShouldSuppressKeyboardInputDuringProvisionalNavigation(flag);
+ toImpl(preferencesRef)->setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(flag);
}
bool WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef preferencesRef)
{
- return toImpl(preferencesRef)->shouldSuppressKeyboardInputDuringProvisionalNavigation();
+ return toImpl(preferencesRef)->shouldSuppressTextInputFromEditingDuringProvisionalNavigation();
}
void WKPreferencesSetMediaUserGestureInheritsFromDocument(WKPreferencesRef preferencesRef, bool flag)
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm (223707 => 223708)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm 2017-10-19 20:43:41 UTC (rev 223708)
@@ -544,12 +544,12 @@
- (BOOL)_shouldSuppressKeyboardInputDuringProvisionalNavigation
{
- return _preferences->shouldSuppressKeyboardInputDuringProvisionalNavigation();
+ return _preferences->shouldSuppressTextInputFromEditingDuringProvisionalNavigation();
}
- (void)_setShouldSuppressKeyboardInputDuringProvisionalNavigation:(BOOL)shouldSuppress
{
- _preferences->setShouldSuppressKeyboardInputDuringProvisionalNavigation(shouldSuppress);
+ _preferences->setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(shouldSuppress);
}
- (BOOL)_loadsImagesAutomatically
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (223707 => 223708)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-10-19 20:32:10 UTC (rev 223707)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2017-10-19 20:43:41 UTC (rev 223708)
@@ -3411,7 +3411,7 @@
#endif
settings.setLargeImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::largeImageAsyncDecodingEnabledKey()));
settings.setAnimatedImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::animatedImageAsyncDecodingEnabledKey()));
- settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(store.getBoolValueForKey(WebPreferencesKey::shouldSuppressKeyboardInputDuringProvisionalNavigationKey()));
+ settings.setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(store.getBoolValueForKey(WebPreferencesKey::shouldSuppressTextInputFromEditingDuringProvisionalNavigationKey()));
settings.setMediaContentTypesRequiringHardwareSupport(store.getStringValueForKey(WebPreferencesKey::mediaContentTypesRequiringHardwareSupportKey()));
settings.setAllowMediaContentTypesRequiringHardwareSupportAsFallback(store.getBoolValueForKey(WebPreferencesKey::allowMediaContentTypesRequiringHardwareSupportAsFallbackKey()));