Changeset 244588 in webkit


Ignore:
Timestamp:
Apr 24, 2019 8:38:23 AM (5 years ago)
Author:
Alan Bujtas
Message:

[ContentChangeObserver] Do not use the global _WKContentChange in WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=196286
<rdar://problem/49364417>

Reviewed by Simon Fraser.

By reporting WKContentIndeterminateChange in sendMouseMoveEvent enables us to remove the global _WKContentChange state.
Using _WKContentChange is fine as long as only the observed frame reports content change during the synthetic click event.
In case of multiple frames, we should really consult the local state instead.
Unfortunately sendMouseMoveEvent has no access to the observed Document object so we can't really identify the observed content change.
WKContentIndeterminateChange triggers asynchronous decision making at the callsite and in the callback we have access
to the active Document/ContentChangeObverver object and can report the correct state.
This is inline with current WebKit(WK2) behaviour.

Manually tested with a WebKitLegacy test app.

  • SourcesCocoa.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • page/ios/ContentChangeObserver.h:

(WebCore::ContentChangeObserver::setHasNoChangeState):
(WebCore::ContentChangeObserver::setHasIndeterminateState):
(WebCore::ContentChangeObserver::setHasVisibleChangeState):
(WebCore::ContentChangeObserver::setObservedContentState): Deleted.

  • page/ios/EventHandlerIOS.mm:

(WebCore::EventHandler::mouseMoved):

  • platform/ios/wak/WAKWindow.mm:

(-[WAKWindow sendMouseMoveEvent:contentChange:]):

  • platform/ios/wak/WKContentObservation.cpp: Removed.
  • platform/ios/wak/WKContentObservation.h:
Location:
trunk/Source/WebCore
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r244587 r244588  
     12019-04-24  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Do not use the global _WKContentChange in WebKitLegacy
     4        https://bugs.webkit.org/show_bug.cgi?id=196286
     5        <rdar://problem/49364417>
     6
     7        Reviewed by Simon Fraser.
     8
     9        By reporting WKContentIndeterminateChange in sendMouseMoveEvent enables us to remove the global _WKContentChange state.
     10        Using _WKContentChange is fine as long as only the observed frame reports content change during the synthetic click event.
     11        In case of multiple frames, we should really consult the local state instead.
     12        Unfortunately sendMouseMoveEvent has no access to the observed Document object so we can't really identify the observed content change.
     13        WKContentIndeterminateChange triggers asynchronous decision making at the callsite and in the callback we have access
     14        to the active Document/ContentChangeObverver object and can report the correct state.
     15        This is inline with current WebKit(WK2) behaviour.
     16
     17        Manually tested with a WebKitLegacy test app.
     18
     19        * SourcesCocoa.txt:
     20        * WebCore.xcodeproj/project.pbxproj:
     21        * page/ios/ContentChangeObserver.h:
     22        (WebCore::ContentChangeObserver::setHasNoChangeState):
     23        (WebCore::ContentChangeObserver::setHasIndeterminateState):
     24        (WebCore::ContentChangeObserver::setHasVisibleChangeState):
     25        (WebCore::ContentChangeObserver::setObservedContentState): Deleted.
     26        * page/ios/EventHandlerIOS.mm:
     27        (WebCore::EventHandler::mouseMoved):
     28        * platform/ios/wak/WAKWindow.mm:
     29        (-[WAKWindow sendMouseMoveEvent:contentChange:]):
     30        * platform/ios/wak/WKContentObservation.cpp: Removed.
     31        * platform/ios/wak/WKContentObservation.h:
     32
    1332019-04-24  Philippe Normand  <pnormand@igalia.com>
    234
  • trunk/Source/WebCore/SourcesCocoa.txt

    r244439 r244588  
    418418platform/ios/wak/WebCoreThreadRun.cpp
    419419platform/ios/wak/WebCoreThreadSystemInterface.cpp
    420 platform/ios/wak/WKContentObservation.cpp
    421420platform/ios/wak/WKGraphics.mm
    422421platform/ios/wak/WKView.mm
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r244582 r244588  
    1107811078                A14832A0187F508700DA63A6 /* WebCoreThreadSystemInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreThreadSystemInterface.cpp; sourceTree = "<group>"; };
    1107911079                A14832A1187F508700DA63A6 /* WebCoreThreadSystemInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreThreadSystemInterface.h; sourceTree = "<group>"; };
    11080                 A14832A2187F508700DA63A6 /* WKContentObservation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContentObservation.cpp; sourceTree = "<group>"; };
    1108111080                A14832A3187F508700DA63A6 /* WKContentObservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentObservation.h; sourceTree = "<group>"; };
    1108211081                A14832A4187F508700DA63A6 /* WKGraphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKGraphics.h; sourceTree = "<group>"; };
     
    2206822067                                A14832A0187F508700DA63A6 /* WebCoreThreadSystemInterface.cpp */,
    2206922068                                A14832A1187F508700DA63A6 /* WebCoreThreadSystemInterface.h */,
    22070                                 A14832A2187F508700DA63A6 /* WKContentObservation.cpp */,
    2207122069                                A14832A3187F508700DA63A6 /* WKContentObservation.h */,
    2207222070                                A14832A4187F508700DA63A6 /* WKGraphics.h */,
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.h

    r244182 r244588  
    155155    void reset();
    156156
    157     void setHasNoChangeState() { setObservedContentState(WKContentNoChange); }
    158     void setHasIndeterminateState() { setObservedContentState(WKContentIndeterminateChange); }
    159     void setHasVisibleChangeState() { setObservedContentState(WKContentVisibilityChange); }
     157    void setHasNoChangeState() { m_observedContentState = WKContentNoChange; }
     158    void setHasIndeterminateState() { m_observedContentState = WKContentIndeterminateChange; }
     159    void setHasVisibleChangeState() { m_observedContentState = WKContentVisibilityChange; }
    160160
    161161    bool hasVisibleChangeState() const { return observedContentChange() == WKContentVisibilityChange; }
     
    171171
    172172    void completeDurationBasedContentObservation();
    173     void setObservedContentState(WKContentChange);
    174173
    175174    void renderTreeUpdateDidStart();
     
    218217};
    219218
    220 inline void ContentChangeObserver::setObservedContentState(WKContentChange observedContentChange)
    221 {
    222     m_observedContentState = observedContentChange;
    223     WKSetObservedContentChange(observedContentChange);
    224 }
    225 
    226219inline bool ContentChangeObserver::isObservingContentChanges() const
    227220{
  • trunk/Source/WebCore/page/ios/EventHandlerIOS.mm

    r243043 r244588  
    488488    // Reject a mouse moved if the button is down - screws up tracking during autoscroll
    489489    // These happen because WebKit sometimes has to fake up moved events.
    490     if (!m_frame.view() || m_mousePressed || m_sendingEventToSubview)
     490    if (!m_frame.document() || !m_frame.view() || m_mousePressed || m_sendingEventToSubview)
    491491        return;
    492492
     
    501501        // Run style recalc to be able to capture content changes as the result of the mouse move event.
    502502        document.updateStyleIfNeeded();
     503        callOnMainThread([protectedFrame = makeRef(m_frame)] {
     504            if (auto* document = protectedFrame->document())
     505                document->page()->chrome().client().observedContentChange(*document->frame());
     506        });
    503507    }
    504508
  • trunk/Source/WebCore/platform/ios/wak/WAKWindow.mm

    r240355 r244588  
    362362        [self sendEvent:anEvent];
    363363
    364         if (aContentChange)
    365             *aContentChange = WKObservedContentChange();
     364        if (aContentChange) {
     365            // We always make the decision asynchronously. See EventHandler::mouseMoved.
     366            *aContentChange = WKContentIndeterminateChange;
     367        }
    366368    });
    367369}
  • trunk/Source/WebCore/platform/ios/wak/WKContentObservation.h

    r242190 r244588  
    4040}   WKContentChange;
    4141
    42 WEBCORE_EXPORT WKContentChange WKObservedContentChange(void);
    43 WEBCORE_EXPORT void WKSetObservedContentChange(WKContentChange);
    44 
    4542#ifdef __cplusplus
    4643}
Note: See TracChangeset for help on using the changeset viewer.