Changeset 223708 in webkit


Ignore:
Timestamp:
Oct 19, 2017 1:43:41 PM (7 years ago)
Author:
timothy_horton@apple.com
Message:

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.

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r223704 r223708  
     12017-10-19  Tim Horton  <timothy_horton@apple.com>
     2
     3        Expand r209943 to suppress paste during provisional navigation as well
     4        https://bugs.webkit.org/show_bug.cgi?id=178429
     5        <rdar://problem/33952830>
     6
     7        Reviewed by Dean Jackson.
     8
     9        * http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
     10        * http/tests/navigation/keyboard-events-during-provisional-navigation.html:
     11        * http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt:
     12        * http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html:
     13        * http/tests/navigation/resources/keyboard-events-after-navigation.html:
     14        * http/tests/navigation/resources/keyboard-events-test.js:
     15        (runBeforeTest):
     16        (runTest):
     17        Copy a "d" to the clipboard before running the test, and paste it while running.
     18        I put the copy before running the test so that if someone comes along and
     19        blacklists copy during provisional load as well, the test for this behavior
     20        still actually tests the paste portion.
     21        Also ensure that paste events are not triggered during provisional navigation.
     22
    1232017-10-19  Daniel Bates  <dabates@apple.com>
    224
  • trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt

    r216643 r223708  
    1 CONSOLE MESSAGE: line 14: Provisional navigation started.
    2 CONSOLE MESSAGE: line 15: No trusted events should be logged and the input element should have the value "".
    3 CONSOLE MESSAGE: line 20: Dispatching untrusted keypress event.
    4 CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: false).
    5 CONSOLE MESSAGE: line 28: Pressing tab.
    6 CONSOLE MESSAGE: line 30: Active element after pressing tab: [object HTMLInputElement].
    7 CONSOLE MESSAGE: line 32: Pressing "a".
    8 CONSOLE MESSAGE: line 35: Setting marked text to "b".
    9 CONSOLE MESSAGE: line 38: Inserting text "c".
    10 CONSOLE MESSAGE: line 41: Input element value after text input events: "".
    11 CONSOLE MESSAGE: line 18: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
     1CONSOLE MESSAGE: line 16: Provisional navigation started.
     2CONSOLE MESSAGE: line 17: No trusted events should be logged and the input element should have the value "".
     3CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
     4CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
     5CONSOLE MESSAGE: line 42: Pressing tab.
     6CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
     7CONSOLE MESSAGE: line 46: Pressing "a".
     8CONSOLE MESSAGE: line 49: Setting marked text to "b".
     9CONSOLE MESSAGE: line 52: Inserting text "c".
     10CONSOLE MESSAGE: line 55: Pasting text "d".
     11CONSOLE MESSAGE: line 58: Input element value after text input events: "".
     12CONSOLE MESSAGE: line 20: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
    1213CONSOLE MESSAGE: line 6: Finished navigating to resources/keyboard-events-after-navigation.html.
    13 CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "ac".
    14 CONSOLE MESSAGE: line 20: Dispatching untrusted keypress event.
    15 CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: false).
    16 CONSOLE MESSAGE: line 28: Pressing tab.
    17 CONSOLE MESSAGE: line 5: keydownevent dispatched (isTrusted: true).
    18 CONSOLE MESSAGE: line 5: keyupevent dispatched (isTrusted: true).
    19 CONSOLE MESSAGE: line 30: Active element after pressing tab: [object HTMLInputElement].
    20 CONSOLE MESSAGE: line 32: Pressing "a".
    21 CONSOLE MESSAGE: line 5: keydownevent dispatched (isTrusted: true).
    22 CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: true).
    23 CONSOLE MESSAGE: line 5: textInputevent dispatched (isTrusted: true).
    24 CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
    25 CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
    26 CONSOLE MESSAGE: line 5: keyupevent dispatched (isTrusted: true).
    27 CONSOLE MESSAGE: line 35: Setting marked text to "b".
    28 CONSOLE MESSAGE: line 5: compositionstartevent dispatched (isTrusted: true).
    29 CONSOLE MESSAGE: line 5: compositionupdateevent dispatched (isTrusted: true).
    30 CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
    31 CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
    32 CONSOLE MESSAGE: line 38: Inserting text "c".
    33 CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
    34 CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
    35 CONSOLE MESSAGE: line 5: textInputevent dispatched (isTrusted: true).
    36 CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
    37 CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
    38 CONSOLE MESSAGE: line 5: compositionendevent dispatched (isTrusted: true).
    39 CONSOLE MESSAGE: line 41: Input element value after text input events: "ac".
     14CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "acd".
     15CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
     16CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
     17CONSOLE MESSAGE: line 42: Pressing tab.
     18CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
     19CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
     20CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
     21CONSOLE MESSAGE: line 46: Pressing "a".
     22CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
     23CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: true).
     24CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
     25CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     26CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     27CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
     28CONSOLE MESSAGE: line 49: Setting marked text to "b".
     29CONSOLE MESSAGE: line 18: compositionstartevent dispatched (isTrusted: true).
     30CONSOLE MESSAGE: line 18: compositionupdateevent dispatched (isTrusted: true).
     31CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     32CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     33CONSOLE MESSAGE: line 52: Inserting text "c".
     34CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     35CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     36CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
     37CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     38CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     39CONSOLE MESSAGE: line 18: compositionendevent dispatched (isTrusted: true).
     40CONSOLE MESSAGE: line 55: Pasting text "d".
     41CONSOLE MESSAGE: line 18: pasteevent dispatched (isTrusted: true).
     42CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
     43CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     44CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     45CONSOLE MESSAGE: line 58: Input element value after text input events: "acd".
    4046
  • trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation.html

    r216599 r223708  
    88            testRunner.dumpAsText();
    99            testRunner.waitUntilDone();
    10             internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(true);
     10            internals.settings.setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(true);
    1111        }
     12
     13        runBeforeTest(window);
    1214
    1315        waitForProvisionalNavigation(function() {
  • trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt

    r216643 r223708  
    1 CONSOLE MESSAGE: line 16: Provisional navigation started.
    2 CONSOLE MESSAGE: line 17: No trusted events should be logged and the input element should have the value "".
    3 CONSOLE MESSAGE: line 20: Dispatching untrusted keypress event.
    4 CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: false).
    5 CONSOLE MESSAGE: line 28: Pressing tab.
    6 CONSOLE MESSAGE: line 30: Active element after pressing tab: [object HTMLInputElement].
    7 CONSOLE MESSAGE: line 32: Pressing "a".
    8 CONSOLE MESSAGE: line 35: Setting marked text to "b".
    9 CONSOLE MESSAGE: line 38: Inserting text "c".
    10 CONSOLE MESSAGE: line 41: Input element value after text input events: "".
    11 CONSOLE MESSAGE: line 20: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
     1CONSOLE MESSAGE: line 18: Provisional navigation started.
     2CONSOLE MESSAGE: line 19: No trusted events should be logged and the input element should have the value "".
     3CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
     4CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
     5CONSOLE MESSAGE: line 42: Pressing tab.
     6CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
     7CONSOLE MESSAGE: line 46: Pressing "a".
     8CONSOLE MESSAGE: line 49: Setting marked text to "b".
     9CONSOLE MESSAGE: line 52: Inserting text "c".
     10CONSOLE MESSAGE: line 55: Pasting text "d".
     11CONSOLE MESSAGE: line 58: Input element value after text input events: "".
     12CONSOLE MESSAGE: line 22: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
    1213CONSOLE MESSAGE: line 6: Finished navigating to resources/keyboard-events-after-navigation.html.
    13 CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "ac".
    14 CONSOLE MESSAGE: line 20: Dispatching untrusted keypress event.
    15 CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: false).
    16 CONSOLE MESSAGE: line 28: Pressing tab.
    17 CONSOLE MESSAGE: line 5: keydownevent dispatched (isTrusted: true).
    18 CONSOLE MESSAGE: line 5: keyupevent dispatched (isTrusted: true).
    19 CONSOLE MESSAGE: line 30: Active element after pressing tab: [object HTMLInputElement].
    20 CONSOLE MESSAGE: line 32: Pressing "a".
    21 CONSOLE MESSAGE: line 5: keydownevent dispatched (isTrusted: true).
    22 CONSOLE MESSAGE: line 5: keypressevent dispatched (isTrusted: true).
    23 CONSOLE MESSAGE: line 5: textInputevent dispatched (isTrusted: true).
    24 CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
    25 CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
    26 CONSOLE MESSAGE: line 5: keyupevent dispatched (isTrusted: true).
    27 CONSOLE MESSAGE: line 35: Setting marked text to "b".
    28 CONSOLE MESSAGE: line 5: compositionstartevent dispatched (isTrusted: true).
    29 CONSOLE MESSAGE: line 5: compositionupdateevent dispatched (isTrusted: true).
    30 CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
    31 CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
    32 CONSOLE MESSAGE: line 38: Inserting text "c".
    33 CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
    34 CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
    35 CONSOLE MESSAGE: line 5: textInputevent dispatched (isTrusted: true).
    36 CONSOLE MESSAGE: line 5: beforeinputevent dispatched (isTrusted: true).
    37 CONSOLE MESSAGE: line 5: inputevent dispatched (isTrusted: true).
    38 CONSOLE MESSAGE: line 5: compositionendevent dispatched (isTrusted: true).
    39 CONSOLE MESSAGE: line 41: Input element value after text input events: "ac".
     14CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "acd".
     15CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.
     16CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: false).
     17CONSOLE MESSAGE: line 42: Pressing tab.
     18CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
     19CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
     20CONSOLE MESSAGE: line 44: Active element after pressing tab: [object HTMLInputElement].
     21CONSOLE MESSAGE: line 46: Pressing "a".
     22CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
     23CONSOLE MESSAGE: line 18: keypressevent dispatched (isTrusted: true).
     24CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
     25CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     26CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     27CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
     28CONSOLE MESSAGE: line 49: Setting marked text to "b".
     29CONSOLE MESSAGE: line 18: compositionstartevent dispatched (isTrusted: true).
     30CONSOLE MESSAGE: line 18: compositionupdateevent dispatched (isTrusted: true).
     31CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     32CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     33CONSOLE MESSAGE: line 52: Inserting text "c".
     34CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     35CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     36CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
     37CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     38CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     39CONSOLE MESSAGE: line 18: compositionendevent dispatched (isTrusted: true).
     40CONSOLE MESSAGE: line 55: Pasting text "d".
     41CONSOLE MESSAGE: line 18: pasteevent dispatched (isTrusted: true).
     42CONSOLE MESSAGE: line 18: textInputevent dispatched (isTrusted: true).
     43CONSOLE MESSAGE: line 18: beforeinputevent dispatched (isTrusted: true).
     44CONSOLE MESSAGE: line 18: inputevent dispatched (isTrusted: true).
     45CONSOLE MESSAGE: line 58: Input element value after text input events: "acd".
    4046
  • trunk/LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation.html

    r216614 r223708  
    1010            testRunner.dumpChildFramesAsText();
    1111            testRunner.waitUntilDone();
    12             internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(true);
     12            internals.settings.setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(true);
    1313        }
     14
     15        runBeforeTest(window);
    1416
    1517        waitForProvisionalNavigation(function () {
  • trunk/LayoutTests/http/tests/navigation/resources/keyboard-events-after-navigation.html

    r216599 r223708  
    55    <script>
    66        console.log("Finished navigating to resources/keyboard-events-after-navigation.html.");
    7         console.log("Trusted events should be logged and the input element should have the value \"ac\".");
     7        console.log("Trusted events should be logged and the input element should have the value \"acd\".");
    88        runTest(window);
    99        testRunner.notifyDone();
  • trunk/LayoutTests/http/tests/navigation/resources/keyboard-events-test.js

    r216643 r223708  
     1function runBeforeTest(window)
     2{
     3    var document = window.document;
     4
     5    document.body.addEventListener("beforecopy", function (e) { e.preventDefault(); });
     6    document.body.addEventListener("copy", function (e) {
     7        e.clipboardData.setData("text/plain", "d");
     8        e.preventDefault();
     9    });
     10
     11    document.execCommand("copy");
     12}
     13
    114function runTest(window)
    215{
     
    1528    window.addEventListener("beforeinput", eventHandler, true);
    1629    window.addEventListener("input", eventHandler, true);
     30    window.addEventListener("paste", eventHandler, true);
    1731
    1832    var document = window.document;
     
    3953    textInputController.insertText("c");
    4054
     55    console.log("Pasting text \"d\".");
     56    document.execCommand("Paste");
     57
    4158    console.log("Input element value after text input events: \"" + textInput.value + "\".");
    4259}
  • trunk/Source/WebCore/ChangeLog

    r223707 r223708  
     12017-10-19  Tim Horton  <timothy_horton@apple.com>
     2
     3        Expand r209943 to suppress paste during provisional navigation as well
     4        https://bugs.webkit.org/show_bug.cgi?id=178429
     5        <rdar://problem/33952830>
     6
     7        Reviewed by Dean Jackson.
     8
     9        No new tests; adjusted an existing test to cover this case.
     10
     11        * editing/Editor.cpp:
     12        (WebCore::Editor::canPaste const):
     13        Disable pasting during provisional navigation, like r209943 did for
     14        various other forms of text input.
     15
     16        (WebCore::Editor::shouldInsertText const):
     17        * dom/EventDispatcher.cpp:
     18        (WebCore::shouldSuppressEventDispatchInDOM):
     19        * loader/FrameLoader.cpp:
     20        (WebCore::FrameLoader::shouldSuppressTextInputFromEditing const):
     21        (WebCore::FrameLoader::shouldSuppressKeyboardInput const): Deleted.
     22        * loader/FrameLoader.h:
     23        * page/Settings.in:
     24        Rename the setting to be about editing-related text input, not "keyboard" input.
     25
     26        * editing/EditorCommand.cpp:
     27        (WebCore::allowExecutionWhenDisabled):
     28        (WebCore::doNotAllowExecutionWhenDisabled):
     29        (WebCore::allowExecutionWhenDisabledCopyCut):
     30        (WebCore::allowExecutionWhenDisabledPaste):
     31        (WebCore::createCommandMap):
     32        (WebCore::Editor::Command::allowExecutionWhenDisabled const):
     33        Completely disable execution of paste events when in no-text-input-from-editing mode.
     34        Otherwise, even though canPaste was false and we wouldn't do a default paste action,
     35        we would still dispatch the paste event to the DOM.
     36
    1372017-10-19  Dean Jackson  <dino@apple.com>
    238
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r219051 r223708  
    118118        return false;
    119119
    120     if (!frame->mainFrame().loader().shouldSuppressKeyboardInput())
     120    if (!frame->mainFrame().loader().shouldSuppressTextInputFromEditing())
    121121        return false;
    122122
  • trunk/Source/WebCore/editing/Editor.cpp

    r223644 r223708  
    457457bool Editor::canPaste() const
    458458{
     459    if (m_frame.mainFrame().loader().shouldSuppressTextInputFromEditing())
     460        return false;
     461
    459462    return canEdit();
    460463}
     
    705708bool Editor::shouldInsertText(const String& text, Range* range, EditorInsertAction action) const
    706709{
    707     if (m_frame.mainFrame().loader().shouldSuppressKeyboardInput() && action == EditorInsertAction::Typed)
     710    if (m_frame.mainFrame().loader().shouldSuppressTextInputFromEditing() && action == EditorInsertAction::Typed)
    708711        return false;
    709712
  • trunk/Source/WebCore/editing/EditorCommand.cpp

    r223644 r223708  
    4040#include "FormatBlockCommand.h"
    4141#include "Frame.h"
     42#include "FrameLoader.h"
    4243#include "FrameView.h"
    4344#include "HTMLFontElement.h"
     
    4748#include "IndentOutdentCommand.h"
    4849#include "InsertListCommand.h"
     50#include "MainFrame.h"
    4951#include "Page.h"
    5052#include "Pasteboard.h"
     
    7577    String (*value)(Frame&, Event*);
    7678    bool isTextInsertion;
    77     bool (*allowExecutionWhenDisabled)(EditorCommandSource);
     79    bool (*allowExecutionWhenDisabled)(Frame&, EditorCommandSource);
    7880};
    7981
     
    14911493// allowExecutionWhenDisabled functions
    14921494
    1493 static bool allowExecutionWhenDisabled(EditorCommandSource)
    1494 {
    1495     return true;
    1496 }
    1497 
    1498 static bool doNotAllowExecutionWhenDisabled(EditorCommandSource)
     1495static bool allowExecutionWhenDisabled(Frame&, EditorCommandSource)
     1496{
     1497    return true;
     1498}
     1499
     1500static bool doNotAllowExecutionWhenDisabled(Frame&, EditorCommandSource)
    14991501{
    15001502    return false;
    15011503}
    15021504
    1503 static bool allowExecutionWhenDisabledCopyCut(EditorCommandSource source)
     1505static bool allowExecutionWhenDisabledCopyCut(Frame&, EditorCommandSource source)
    15041506{
    15051507    switch (source) {
     
    15131515    ASSERT_NOT_REACHED();
    15141516    return false;
     1517}
     1518
     1519static bool allowExecutionWhenDisabledPaste(Frame& frame, EditorCommandSource)
     1520{
     1521    if (frame.mainFrame().loader().shouldSuppressTextInputFromEditing())
     1522        return false;
     1523    return true;
    15151524}
    15161525
     
    16261635        { "Outdent", { executeOutdent, supported, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    16271636        { "OverWrite", { executeToggleOverwrite, supportedFromMenuOrKeyBinding, enabledInRichlyEditableText, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    1628         { "Paste", { executePaste, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
    1629         { "PasteAndMatchStyle", { executePasteAndMatchStyle, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
    1630         { "PasteAsPlainText", { executePasteAsPlainText, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabled } },
     1637        { "Paste", { executePaste, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
     1638        { "PasteAndMatchStyle", { executePasteAndMatchStyle, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
     1639        { "PasteAsPlainText", { executePasteAsPlainText, supportedPaste, enabledPaste, stateNone, valueNull, notTextInsertion, allowExecutionWhenDisabledPaste } },
    16311640        { "Print", { executePrint, supported, enabled, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
    16321641        { "Redo", { executeRedo, supported, enabledRedo, stateNone, valueNull, notTextInsertion, doNotAllowExecutionWhenDisabled } },
     
    18281837    if (!isSupported() || !m_frame)
    18291838        return false;
    1830     return m_command->allowExecutionWhenDisabled(m_source);
     1839    return m_command->allowExecutionWhenDisabled(*m_frame, m_source);
    18311840}
    18321841
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r223697 r223708  
    38213821}
    38223822
    3823 bool FrameLoader::shouldSuppressKeyboardInput() const
    3824 {
    3825     return m_frame.settings().shouldSuppressKeyboardInputDuringProvisionalNavigation() && m_state == FrameStateProvisional;
     3823bool FrameLoader::shouldSuppressTextInputFromEditing() const
     3824{
     3825    return m_frame.settings().shouldSuppressTextInputFromEditingDuringProvisionalNavigation() && m_state == FrameStateProvisional;
    38263826}
    38273827
  • trunk/Source/WebCore/loader/FrameLoader.h

    r223697 r223708  
    300300
    301301    bool isAlwaysOnLoggingAllowed() const;
    302     bool shouldSuppressKeyboardInput() const;
     302    bool shouldSuppressTextInputFromEditing() const;
    303303
    304304private:
  • trunk/Source/WebCore/page/Settings.in

    r223653 r223708  
    289289webkitImageReadyEventEnabled initial=false
    290290
    291 shouldSuppressKeyboardInputDuringProvisionalNavigation initial=false
     291shouldSuppressTextInputFromEditingDuringProvisionalNavigation initial=false
    292292
    293293langAttributeAwareFormControlUIEnabled initial=false
  • trunk/Source/WebKit/ChangeLog

    r223702 r223708  
     12017-10-19  Tim Horton  <timothy_horton@apple.com>
     2
     3        Expand r209943 to suppress paste during provisional navigation as well
     4        https://bugs.webkit.org/show_bug.cgi?id=178429
     5        <rdar://problem/33952830>
     6
     7        Reviewed by Dean Jackson.
     8
     9        * Shared/WebPreferencesDefinitions.h:
     10        * UIProcess/API/C/WKPreferences.cpp:
     11        (WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation):
     12        (WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation):
     13        * UIProcess/API/Cocoa/WKPreferences.mm:
     14        (-[WKPreferences _shouldSuppressKeyboardInputDuringProvisionalNavigation]):
     15        (-[WKPreferences _setShouldSuppressKeyboardInputDuringProvisionalNavigation:]):
     16        * WebProcess/WebPage/WebPage.cpp:
     17        (WebKit::WebPage::updatePreferences):
     18        Adjust to the changed preference name, except at the SPI level.
     19
    1202017-10-19  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h

    r223433 r223708  
    290290    macro(IntersectionObserverEnabled, intersectionObserverEnabled, Bool, bool, false, "Intersection Observer", "Enable Intersection Observer support") \
    291291    macro(InteractiveFormValidationEnabled, interactiveFormValidationEnabled, Bool, bool, true, "HTML Interactive Form Validation", "HTML interactive form validation") \
    292     macro(ShouldSuppressKeyboardInputDuringProvisionalNavigation, shouldSuppressKeyboardInputDuringProvisionalNavigation, Bool, bool, false, "", "") \
     292    macro(ShouldSuppressTextInputFromEditingDuringProvisionalNavigation, shouldSuppressTextInputFromEditingDuringProvisionalNavigation, Bool, bool, false, "", "") \
    293293    macro(CSSGridLayoutEnabled, cssGridLayoutEnabled, Bool, bool, true, "CSS Grid", "CSS Grid Layout Module support") \
    294294    macro(GamepadsEnabled, gamepadsEnabled, Bool, bool, true, "Gamepads", "Web Gamepad API support") \
  • trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp

    r223432 r223708  
    18131813void WKPreferencesSetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef preferencesRef, bool flag)
    18141814{
    1815     toImpl(preferencesRef)->setShouldSuppressKeyboardInputDuringProvisionalNavigation(flag);
     1815    toImpl(preferencesRef)->setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(flag);
    18161816}
    18171817
    18181818bool WKPreferencesGetShouldSuppressKeyboardInputDuringProvisionalNavigation(WKPreferencesRef preferencesRef)
    18191819{
    1820     return toImpl(preferencesRef)->shouldSuppressKeyboardInputDuringProvisionalNavigation();
     1820    return toImpl(preferencesRef)->shouldSuppressTextInputFromEditingDuringProvisionalNavigation();
    18211821}
    18221822
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm

    r222715 r223708  
    545545- (BOOL)_shouldSuppressKeyboardInputDuringProvisionalNavigation
    546546{
    547     return _preferences->shouldSuppressKeyboardInputDuringProvisionalNavigation();
     547    return _preferences->shouldSuppressTextInputFromEditingDuringProvisionalNavigation();
    548548}
    549549
    550550- (void)_setShouldSuppressKeyboardInputDuringProvisionalNavigation:(BOOL)shouldSuppress
    551551{
    552     _preferences->setShouldSuppressKeyboardInputDuringProvisionalNavigation(shouldSuppress);
     552    _preferences->setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(shouldSuppress);
    553553}
    554554
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r223644 r223708  
    34123412    settings.setLargeImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::largeImageAsyncDecodingEnabledKey()));
    34133413    settings.setAnimatedImageAsyncDecodingEnabled(store.getBoolValueForKey(WebPreferencesKey::animatedImageAsyncDecodingEnabledKey()));
    3414     settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(store.getBoolValueForKey(WebPreferencesKey::shouldSuppressKeyboardInputDuringProvisionalNavigationKey()));
     3414    settings.setShouldSuppressTextInputFromEditingDuringProvisionalNavigation(store.getBoolValueForKey(WebPreferencesKey::shouldSuppressTextInputFromEditingDuringProvisionalNavigationKey()));
    34153415    settings.setMediaContentTypesRequiringHardwareSupport(store.getStringValueForKey(WebPreferencesKey::mediaContentTypesRequiringHardwareSupportKey()));
    34163416    settings.setAllowMediaContentTypesRequiringHardwareSupportAsFallback(store.getBoolValueForKey(WebPreferencesKey::allowMediaContentTypesRequiringHardwareSupportAsFallbackKey()));
Note: See TracChangeset for help on using the changeset viewer.