Changeset 261966 in webkit


Ignore:
Timestamp:
May 20, 2020 3:33:59 PM (4 years ago)
Author:
Megan Gardner
Message:

Hide password echo when screen is being captured.
https://bugs.webkit.org/show_bug.cgi?id=212060
<rdar://problem/47653578>

Reviewed by Wenson Hsieh.

Source/WebCore:

When the screen is being captured, turn off the password echo.

  • editing/InsertIntoTextNodeCommand.cpp:

(WebCore::InsertIntoTextNodeCommand::doApply):

  • page/EditorClient.h:

(WebCore::EditorClient::isScreenCaptured const):

Source/WebKit:

Use the UIScreen state and notification to determine if the
screen is being shared or captured. This flag is for all
capture methods, Air Play, Screen Recording, etc. If the screen is
being captured, turn off the password echo to prevent the password from
being leaked.

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/WKContentView.mm:

(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
(-[WKContentView _screenCapturedDidChange:]):

  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::setIsScreenCaptured):

  • WebProcess/WebCoreSupport/WebEditorClient.h:
  • WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:

(WebKit::WebEditorClient::isScreenCaptured const):

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::isScreenCaptured const):

  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::setIsScreenCaptured):

Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r261965 r261966  
     12020-05-20  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Hide password echo when screen is being captured.
     4        https://bugs.webkit.org/show_bug.cgi?id=212060
     5        <rdar://problem/47653578>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        When the screen is being captured, turn off the password echo.
     10
     11        * editing/InsertIntoTextNodeCommand.cpp:
     12        (WebCore::InsertIntoTextNodeCommand::doApply):
     13        * page/EditorClient.h:
     14        (WebCore::EditorClient::isScreenCaptured const):
     15
    1162020-05-20  ChangSeok Oh  <changseok@webkit.org>
    217
  • trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp

    r260831 r261966  
    2828
    2929#include "Document.h"
     30#include "Editor.h"
     31#include "EditorClient.h"
    3032#include "Frame.h"
    3133#include "RenderText.h"
     
    5254{
    5355    bool passwordEchoEnabled = document().settings().passwordEchoEnabled();
    54     if (passwordEchoEnabled)
     56    bool shouldSuppressPasswordEcho = document().editor().client()->shouldSuppressPasswordEcho();
     57    if (passwordEchoEnabled && !shouldSuppressPasswordEcho)
    5558        document().updateLayoutIgnorePendingStylesheets();
    5659
     
    5861        return;
    5962
    60     if (passwordEchoEnabled) {
     63    if (passwordEchoEnabled && !shouldSuppressPasswordEcho) {
    6164        if (RenderText* renderText = m_node->renderer())
    6265            renderText->momentarilyRevealLastTypedCharacter(m_offset + m_text.length());
  • trunk/Source/WebCore/page/EditorClient.h

    r256864 r261966  
    7272    virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting) = 0;
    7373    virtual bool shouldRevealCurrentSelectionAfterInsertion() const { return true; };
     74    virtual bool shouldSuppressPasswordEcho() const { return false; };
    7475   
    7576    virtual bool shouldApplyStyle(StyleProperties*, Range*) = 0;
  • trunk/Source/WebKit/ChangeLog

    r261965 r261966  
     12020-05-20  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Hide password echo when screen is being captured.
     4        https://bugs.webkit.org/show_bug.cgi?id=212060
     5        <rdar://problem/47653578>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Use the UIScreen state and notification to determine if the
     10        screen is being shared or captured. This flag is for all
     11        capture methods, Air Play, Screen Recording, etc. If the screen is
     12        being captured, turn off the password echo to prevent the password from
     13        being leaked.
     14
     15        * UIProcess/WebPageProxy.h:
     16        * UIProcess/ios/WKContentView.mm:
     17        (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
     18        (-[WKContentView _screenCapturedDidChange:]):
     19        * UIProcess/ios/WebPageProxyIOS.mm:
     20        (WebKit::WebPageProxy::setIsScreenCaptured):
     21        * WebProcess/WebCoreSupport/WebEditorClient.h:
     22        * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
     23        (WebKit::WebEditorClient::isScreenCaptured const):
     24        * WebProcess/WebPage/WebPage.h:
     25        (WebKit::WebPage::isScreenCaptured const):
     26        * WebProcess/WebPage/WebPage.messages.in:
     27        * WebProcess/WebPage/ios/WebPageIOS.mm:
     28        (WebKit::WebPage::setIsScreenCaptured):
     29
    1302020-05-20  ChangSeok Oh  <changseok@webkit.org>
    231
  • trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp

    r261044 r261966  
    108108    encoder << keyboardIsAttached;
    109109    encoder << canShowWhileLocked;
     110    encoder << isCapturingScreen;
    110111#endif
    111112#if PLATFORM(COCOA)
     
    341342    if (!decoder.decode(parameters.canShowWhileLocked))
    342343        return WTF::nullopt;
     344    if (!decoder.decode(parameters.isCapturingScreen))
     345        return WTF::nullopt;
    343346#endif
    344347
  • trunk/Source/WebKit/Shared/WebPageCreationParameters.h

    r261044 r261966  
    168168    bool keyboardIsAttached { false };
    169169    bool canShowWhileLocked { false };
     170    bool isCapturingScreen { false };
    170171#endif
    171172#if PLATFORM(COCOA)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r261948 r261966  
    719719
    720720    void setShouldRevealCurrentSelectionAfterInsertion(bool);
     721       
     722    void setScreenIsBeingCaptured(bool);
    721723
    722724    void insertTextPlaceholder(const WebCore::IntSize&, CompletionHandler<void(const Optional<WebCore::ElementContext>&)>&&);
  • trunk/Source/WebKit/UIProcess/ios/WKContentView.mm

    r261088 r261966  
    170170    _page->setUseFixedLayout(true);
    171171    _page->setDelegatesScrolling(true);
     172    _page->setScreenIsBeingCaptured([[[self window] screen] isCaptured]);
    172173
    173174#if ENABLE(FULLSCREEN_API)
     
    209210    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication]];
    210211    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];
     212    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_screenCapturedDidChange:) name:UIScreenCapturedDidChangeNotification object:[UIScreen mainScreen]];
    211213
    212214#if USE(UIKIT_KEYBOARD_ADDITIONS)
     
    772774}
    773775
     776- (void)_screenCapturedDidChange:(NSNotification *)notification
     777{
     778    _page->setScreenIsBeingCaptured([[[self window] screen] isCaptured]);
     779}
     780
    774781@end
    775782
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r261906 r261966  
    897897
    898898    _page->process().updateTextCheckerState();
     899    _page->setScreenIsBeingCaptured([[[self window] screen] isCaptured]);
    899900
    900901    _hasSetUpInteractions = YES;
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r261940 r261966  
    15821582}
    15831583
     1584void WebPageProxy::setScreenIsBeingCaptured(bool captured)
     1585{
     1586    if (hasRunningProcess())
     1587        send(Messages::WebPage::SetScreenIsBeingCaptured(captured));
     1588}
     1589
    15841590void WebPageProxy::willOpenAppLink()
    15851591{
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h

    r256864 r261966  
    189189    bool shouldAllowSingleClickToChangeSelection(WebCore::Node&, const WebCore::VisibleSelection&) const final;
    190190    bool shouldRevealCurrentSelectionAfterInsertion() const final;
     191    bool shouldSuppressPasswordEcho() const final;
    191192#endif
    192193
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm

    r256864 r261966  
    120120}
    121121
     122bool WebEditorClient::shouldSuppressPasswordEcho() const
     123{
     124    return m_page->screenIsBeingCaptured() || m_page->hardwareKeyboardIsAttached();
     125}
     126
    122127} // namespace WebKit
    123128
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r261948 r261966  
    668668    int32_t deviceOrientation() const { return m_deviceOrientation; }
    669669    void didReceiveMobileDocType(bool);
     670   
     671    bool screenIsBeingCaptured() const { return m_screenIsBeingCaptured; }
     672    void setScreenIsBeingCaptured(bool);
    670673
    671674    double minimumPageScaleFactor() const;
     
    10171020
    10181021    void hardwareKeyboardAvailabilityChanged(bool keyboardIsAttached);
     1022    bool hardwareKeyboardIsAttached() const { return m_keyboardIsAttached; }
    10191023
    10201024    void updateStringForFind(const String&);
     
    19911995    bool m_isInStableState { true };
    19921996    bool m_shouldRevealCurrentSelectionAfterInsertion { true };
     1997    bool m_screenIsBeingCaptured { false };
    19931998    MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
    19941999    Seconds m_estimatedLatency { 0 };
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r261948 r261966  
    5353    SetOverrideViewportArguments(Optional<WebCore::ViewportArguments> arguments)
    5454    DynamicViewportSizeUpdate(WebCore::FloatSize viewLayoutSize, WebCore::FloatSize maximumUnobscuredSize, WebCore::FloatRect targetExposedContentRect, WebCore::FloatRect targetUnobscuredRect, WebCore::FloatRect targetUnobscuredRectInScrollViewCoordinates, WebCore::RectEdges<float> targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, double minimumEffectiveDeviceWidth, uint64_t dynamicViewportSizeUpdateID)
     55   
     56    SetScreenIsBeingCaptured(bool captured)
    5557
    5658    HandleTap(WebCore::IntPoint point, OptionSet<WebKit::WebEvent::Modifier> modifiers, WebKit::TransactionID lastLayerTreeTransactionId)
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r261848 r261966  
    42934293}
    42944294
     4295void WebPage::setScreenIsBeingCaptured(bool captured)
     4296{
     4297    m_screenIsBeingCaptured = captured;
     4298}
     4299
    42954300void WebPage::textInputContextsInRect(FloatRect searchRect, CompletionHandler<void(const Vector<ElementContext>&)>&& completionHandler)
    42964301{
  • trunk/Source/WebKitLegacy/ios/DefaultDelegates/WebDefaultUIKitDelegate.m

    r261714 r261966  
    269269#endif
    270270
     271- (BOOL)shouldSuppressPasswordEcho
     272{
     273    return NO;
     274}
     275
    271276- (BOOL)hasRichlyEditableSelection
    272277{
  • trunk/Source/WebKitLegacy/ios/WebView/WebUIKitDelegate.h

    r261714 r261966  
    129129- (BOOL)shouldRevealCurrentSelectionAfterInsertion;
    130130
     131- (BOOL)shouldSuppressPasswordEcho;
     132
    131133#if ENABLE_ORIENTATION_EVENTS
    132134- (int)deviceOrientation;
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h

    r258182 r261966  
    150150    bool performsTwoStepPaste(WebCore::DocumentFragment*) final;
    151151    void updateStringForFind(const String&) final { }
    152 
    153152    bool shouldRevealCurrentSelectionAfterInsertion() const final;
     153    bool shouldSuppressPasswordEcho() const final;
    154154#endif
    155155
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm

    r261138 r261966  
    829829        return [[m_webView _UIKitDelegateForwarder] shouldRevealCurrentSelectionAfterInsertion];
    830830    return true;
     831}
     832
     833bool WebEditorClient::shouldSuppressPasswordEcho() const
     834{
     835    if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(shouldSuppressPasswordEcho)])
     836        return [[m_webView _UIKitDelegateForwarder] shouldSuppressPasswordEcho];
     837    return false;
    831838}
    832839
  • trunk/Source/WebKitLegacy/mac/WebView/WebView.mm

    r261948 r261966  
    15261526    _private->deviceOrientation = [[self _UIKitDelegateForwarder] deviceOrientation];
    15271527#endif
     1528    if ([[self _UIKitDelegateForwarder] respondsToSelector:@selector(shouldSuppressPasswordEcho)])
     1529        _private->shouldSuppressPasswordEcho = [[self _UIKitDelegateForwarder] shouldSuppressPasswordEcho];
    15281530#endif
    15291531
  • trunk/Source/WebKitLegacy/mac/WebView/WebViewData.h

    r261232 r261966  
    246246    NSUInteger deviceOrientation;
    247247#endif
     248    BOOL shouldSuppressPasswordEcho;
    248249#endif
    249250    BOOL shouldCloseWithWindow;
Note: See TracChangeset for help on using the changeset viewer.