⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 244559 in webkit


Ignore:
Timestamp:
Apr 23, 2019, 1:27:24 PM (7 years ago)
Author:
pvollan@apple.com
Message:

[iOS] Input field on ddg.gg is auto focused when url is entered with the software keyboard
https://bugs.webkit.org/show_bug.cgi?id=196740

Reviewed by Megan Gardner.

When an url for a page with an autofocused input field is entered with the software keyboard,
the input field is auto selected, and the software keyboard reappears. This does not happen
when picking the url from favorites. After using the software keyboard to enter the url, the
activity state is being changed to focused. The method '_elementDidFocus' checks whether the
activity state changed, and allows the software keyboard to be shown in this case. To avoid
showing the software keyboard in this case, send the changing activity state bitfield to the
UI process, and check if the focus flag is the only flag set.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):

Location:
trunk/Source/WebKit
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r244557 r244559  
     12019-04-23  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [iOS] Input field on ddg.gg is auto focused when url is entered with the software keyboard
     4        https://bugs.webkit.org/show_bug.cgi?id=196740
     5
     6        Reviewed by Megan Gardner.
     7
     8        When an url for a page with an autofocused input field  is entered with the software keyboard,
     9        the input field is auto selected, and the software keyboard reappears. This does not happen
     10        when picking the url from favorites. After using the software keyboard to enter the url, the
     11        activity state is being changed to focused. The method '_elementDidFocus' checks whether the
     12        activity state changed, and allows the software keyboard to be shown in this case. To avoid
     13        showing the software keyboard in this case, send the changing activity state bitfield to the
     14        UI process, and check if the focus flag is the only flag set.
     15 
     16        * UIProcess/ios/WKContentViewInteraction.mm:
     17        (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
     18
    1192019-04-23  Guy Lewin  <guy@lewin.co.il>
    220
  • trunk/Source/WebKit/UIProcess/PageClient.h

    r244225 r244559  
    3232#include "WebDataListSuggestionsDropdown.h"
    3333#include "WebPopupMenuProxy.h"
     34#include <WebCore/ActivityState.h>
    3435#include <WebCore/AlternativeTextClient.h>
    3536#include <WebCore/DragActions.h>
     
    383384    virtual void restorePageCenterAndScale(Optional<WebCore::FloatPoint> center, double scale) = 0;
    384385
    385     virtual void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData) = 0;
     386    virtual void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, API::Object* userData) = 0;
    386387    virtual void elementDidBlur() = 0;
    387388    virtual void focusedElementDidChangeInputMode(WebCore::InputMode) = 0;
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r244540 r244559  
    348348    bool userIsInteracting;
    349349    bool blurPreviousNode;
    350     bool changingActivityState;
     350    OptionSet<WebCore::ActivityState::Flag> activityStateChanges;
    351351    RefPtr<API::Object> userData;
    352352};
     
    19081908    void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& geometries, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius, bool nodeHasBuiltInClickHandling);
    19091909
    1910     void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, const UserData&);
     1910    void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, const UserData&);
    19111911    void elementDidBlur();
    19121912    void focusedElementDidChangeInputMode(WebCore::InputMode);
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r244540 r244559  
    405405    DidGetTapHighlightGeometries(uint64_t requestID, WebCore::Color color, Vector<WebCore::FloatQuad> geometries, WebCore::IntSize topLeftRadius, WebCore::IntSize topRightRadius, WebCore::IntSize bottomLeftRadius, WebCore::IntSize bottomRightRadius, bool nodeHasBuiltInClickHandling)
    406406
    407     ElementDidFocus(struct WebKit::FocusedElementInformation information, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, WebKit::UserData userData)
     407    ElementDidFocus(struct WebKit::FocusedElementInformation information, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, WebKit::UserData userData)
    408408    ElementDidBlur()
    409409    FocusedElementDidChangeInputMode(enum:uint8_t WebCore::InputMode mode)
  • trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h

    r244085 r244559  
    150150    void restorePageCenterAndScale(Optional<WebCore::FloatPoint>, double) override;
    151151
    152     void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData) override;
     152    void elementDidFocus(const FocusedElementInformation&, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, API::Object* userData) override;
    153153    void elementDidBlur() override;
    154154    void focusedElementDidChangeInputMode(WebCore::InputMode) override;
  • trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm

    r244553 r244559  
    536536}
    537537
    538 void PageClientImpl::elementDidFocus(const FocusedElementInformation& nodeInformation, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, API::Object* userData)
     538void PageClientImpl::elementDidFocus(const FocusedElementInformation& nodeInformation, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, API::Object* userData)
    539539{
    540540    MESSAGE_CHECK(!userData || userData->type() == API::Object::Type::Data);
     
    551551    }
    552552
    553     [m_contentView _elementDidFocus:nodeInformation userIsInteracting:userIsInteracting blurPreviousNode:blurPreviousNode changingActivityState:changingActivityState userObject:userObject];
     553    [m_contentView _elementDidFocus:nodeInformation userIsInteracting:userIsInteracting blurPreviousNode:blurPreviousNode activityStateChanges:activityStateChanges userObject:userObject];
    554554}
    555555
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r244555 r244559  
    4848#import "_WKFormInputSession.h"
    4949#import <UIKit/UIView.h>
     50#import <WebCore/ActivityState.h>
    5051#import <WebCore/Color.h>
    5152#import <WebCore/FloatQuad.h>
     
    425426- (void)_disableDoubleTapGesturesDuringTapIfNecessary:(uint64_t)requestID;
    426427- (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale;
    427 - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode changingActivityState:(BOOL)changingActivityState userObject:(NSObject <NSSecureCoding> *)userObject;
     428- (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode activityStateChanges:(OptionSet<WebCore::ActivityState::Flag>)activityStateChanges userObject:(NSObject <NSSecureCoding> *)userObject;
    428429- (void)_elementDidBlur;
    429430- (void)_didUpdateInputMode:(WebCore::InputMode)mode;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r244555 r244559  
    49474947}
    49484948
    4949 - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode changingActivityState:(BOOL)changingActivityState userObject:(NSObject <NSSecureCoding> *)userObject
     4949- (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode activityStateChanges:(OptionSet<WebCore::ActivityState::Flag>)activityStateChanges userObject:(NSObject <NSSecureCoding> *)userObject
    49504950{
    49514951    SetForScope<BOOL> isChangingFocusForScope { _isChangingFocus, hasFocusedElement(_focusedElementInformation) };
     
    49834983
    49844984            if (self.isFirstResponder || _becomingFirstResponder) {
    4985                 if (changingActivityState)
     4985                // When the software keyboard is being used to enter an url, only the focus activity state is changing.
     4986                // In this case, auto focus on the page being navigated to should be disabled, unless a hardware
     4987                // keyboard is attached.
     4988                if (activityStateChanges && activityStateChanges != WebCore::ActivityState::IsFocused)
    49864989                    return YES;
    49874990
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r244239 r244559  
    409409
    410410    if (auto arguments = std::exchange(m_deferredElementDidFocusArguments, nullptr))
    411         pageClient().elementDidFocus(arguments->information, arguments->userIsInteracting, arguments->blurPreviousNode, arguments->changingActivityState, arguments->userData.get());
     411        pageClient().elementDidFocus(arguments->information, arguments->userIsInteracting, arguments->blurPreviousNode, arguments->activityStateChanges, arguments->userData.get());
    412412}
    413413
     
    928928}
    929929
    930 void WebPageProxy::elementDidFocus(const FocusedElementInformation& information, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, const UserData& userData)
     930void WebPageProxy::elementDidFocus(const FocusedElementInformation& information, bool userIsInteracting, bool blurPreviousNode, OptionSet<WebCore::ActivityState::Flag> activityStateChanges, const UserData& userData)
    931931{
    932932    m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = true;
     
    935935    if (m_editorState.isMissingPostLayoutData) {
    936936        // FIXME: We should try to eliminate m_deferredElementDidFocusArguments altogether, in favor of only deferring actions that are dependent on post-layout editor state information.
    937         m_deferredElementDidFocusArguments = std::make_unique<ElementDidFocusArguments>(ElementDidFocusArguments { information, userIsInteracting, blurPreviousNode, changingActivityState, userDataObject });
    938         return;
    939     }
    940 
    941     pageClient().elementDidFocus(information, userIsInteracting, blurPreviousNode, changingActivityState, userDataObject);
     937        m_deferredElementDidFocusArguments = std::make_unique<ElementDidFocusArguments>(ElementDidFocusArguments { information, userIsInteracting, blurPreviousNode, activityStateChanges, userDataObject });
     938        return;
     939    }
     940
     941    pageClient().elementDidFocus(information, userIsInteracting, blurPreviousNode, activityStateChanges, userDataObject);
    942942}
    943943
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r244494 r244559  
    31313131    ASSERT_WITH_MESSAGE(m_page, "setActivityState called on %" PRIu64 " but WebCore page was null", pageID());
    31323132    if (m_page) {
    3133         SetForScope<bool> currentlyChangingActivityState { m_changingActivityState, true };
     3133        SetForScope<OptionSet<ActivityState::Flag>> currentlyChangingActivityState { m_lastActivityStateChanges, changed };
    31343134        m_page->setActivityState(activityState);
    31353135    }
     
    54075407        m_formClient->willBeginInputSession(this, &element, WebFrame::fromCoreFrame(*element.document().frame()), m_userIsInteracting, userData);
    54085408
    5409         send(Messages::WebPageProxy::ElementDidFocus(information, m_userIsInteracting, m_recentlyBlurredElement, m_changingActivityState, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
     5409        send(Messages::WebPageProxy::ElementDidFocus(information, m_userIsInteracting, m_recentlyBlurredElement, m_lastActivityStateChanges, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
    54105410#elif PLATFORM(MAC)
    54115411        // FIXME: This can be unified with the iOS code above by bringing ElementDidFocus to macOS.
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r244494 r244559  
    17581758    bool m_isTouchBarUpdateSupressedForHiddenContentEditable { false };
    17591759    bool m_isNeverRichlyEditableForTouchBar { false };
    1760     bool m_changingActivityState { false };
     1760    OptionSet<WebCore::ActivityState::Flag> m_lastActivityStateChanges;
    17611761
    17621762#if ENABLE(CONTEXT_MENUS)
Note: See TracChangeset for help on using the changeset viewer.