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

Changeset 243307 in webkit


Ignore:
Timestamp:
Mar 21, 2019, 11:49:52 AM (7 years ago)
Author:
Alan Bujtas
Message:

[ContentChangeObserver] Start tracking implicit transitions at touchStart
https://bugs.webkit.org/show_bug.cgi?id=196051
<rdar://problem/49092952>

Reviewed by Simon Fraser.

Source/WebCore:

This patch enables transition tracking on touchStart.

  1. Start observing for new transitions at touchStart
  2. Stop observing at touchEnd
  3. Check the next style recalc when the transition is finished (at onAnimationEnd we don't yet have the final computed style).
  4. Remove the tracked transition when it is canceled.

Tests: fast/events/touch/ios/content-observation/0ms-transition-on-touch-start.html

fast/events/touch/ios/content-observation/100ms-transition-on-touch-start.html
fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start.html
fast/events/touch/ios/content-observation/transition-on-touch-start-and-remove.html

  • page/ios/ContentChangeObserver.cpp:

(WebCore::ContentChangeObserver::didAddTransition):
(WebCore::ContentChangeObserver::didFinishTransition):
(WebCore::ContentChangeObserver::didRemoveTransition):
(WebCore::ContentChangeObserver::adjustObservedState):

  • page/ios/ContentChangeObserver.h:

(WebCore::ContentChangeObserver::setShouldObserveTransitions):
(WebCore::ContentChangeObserver::clearObservedTransitions):
(WebCore::ContentChangeObserver::hasObservedTransition const):
(WebCore::ContentChangeObserver::hasPendingActivity const):

LayoutTests:

  • fast/events/touch/ios/content-observation/0ms-transition-on-touch-start-expected.txt: Added.
  • fast/events/touch/ios/content-observation/0ms-transition-on-touch-start.html: Added.
  • fast/events/touch/ios/content-observation/100ms-transition-on-touch-start-expected.txt: Added.
  • fast/events/touch/ios/content-observation/100ms-transition-on-touch-start.html: Added.
  • fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-expected.txt: Added.
  • fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start.html: Added.
  • fast/events/touch/ios/content-observation/transition-on-touch-start-and-remove-expected.txt: Added.
  • fast/events/touch/ios/content-observation/transition-on-touch-start-and-remove.html: Added.
Location:
trunk
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243292 r243307  
     12019-03-21  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Start tracking implicit transitions at touchStart
     4        https://bugs.webkit.org/show_bug.cgi?id=196051
     5        <rdar://problem/49092952>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/events/touch/ios/content-observation/0ms-transition-on-touch-start-expected.txt: Added.
     10        * fast/events/touch/ios/content-observation/0ms-transition-on-touch-start.html: Added.
     11        * fast/events/touch/ios/content-observation/100ms-transition-on-touch-start-expected.txt: Added.
     12        * fast/events/touch/ios/content-observation/100ms-transition-on-touch-start.html: Added.
     13        * fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start-expected.txt: Added.
     14        * fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start.html: Added.
     15        * fast/events/touch/ios/content-observation/transition-on-touch-start-and-remove-expected.txt: Added.
     16        * fast/events/touch/ios/content-observation/transition-on-touch-start-and-remove.html: Added.
     17
    1182019-03-21  Shawn Roberts  <sroberts@apple.com>
    219
  • trunk/Source/WebCore/ChangeLog

    r243305 r243307  
     12019-03-21  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Start tracking implicit transitions at touchStart
     4        https://bugs.webkit.org/show_bug.cgi?id=196051
     5        <rdar://problem/49092952>
     6
     7        Reviewed by Simon Fraser.
     8
     9        This patch enables transition tracking on touchStart.
     10
     11        1. Start observing for new transitions at touchStart
     12        2. Stop observing at touchEnd
     13        3. Check the next style recalc when the transition is finished (at onAnimationEnd we don't yet have the final computed style).
     14        4. Remove the tracked transition when it is canceled.
     15
     16        Tests: fast/events/touch/ios/content-observation/0ms-transition-on-touch-start.html
     17               fast/events/touch/ios/content-observation/100ms-transition-on-touch-start.html
     18               fast/events/touch/ios/content-observation/10ms-delay-transition-on-touch-start.html
     19               fast/events/touch/ios/content-observation/transition-on-touch-start-and-remove.html
     20
     21        * page/ios/ContentChangeObserver.cpp:
     22        (WebCore::ContentChangeObserver::didAddTransition):
     23        (WebCore::ContentChangeObserver::didFinishTransition):
     24        (WebCore::ContentChangeObserver::didRemoveTransition):
     25        (WebCore::ContentChangeObserver::adjustObservedState):
     26        * page/ios/ContentChangeObserver.h:
     27        (WebCore::ContentChangeObserver::setShouldObserveTransitions):
     28        (WebCore::ContentChangeObserver::clearObservedTransitions):
     29        (WebCore::ContentChangeObserver::hasObservedTransition const):
     30        (WebCore::ContentChangeObserver::hasPendingActivity const):
     31
    1322019-03-21  Zalan Bujtas  <zalan@apple.com>
    233
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp

    r243305 r243307  
    142142
    143143    m_elementsWithTransition.add(&element);
    144     // FIXME: report state change.
     144    adjustObservedState(Event::AddedTransition);
    145145}
    146146
     
    152152        return;
    153153    LOG_WITH_STREAM(ContentObservation, stream << "didFinishTransition: transition finished (" << &element << ").");
    154     // FIXME: report state change.
     154
     155    adjustObservedState(Event::EndedTransition);
    155156}
    156157
     
    162163        return;
    163164    LOG_WITH_STREAM(ContentObservation, stream << "didRemoveTransition: transition got interrupted (" << &element << ").");
    164     // FIXME: report state change.
     165
     166    adjustObservedState(Event::CanceledTransition);
    165167}
    166168
     
    335337        setHasNoChangeState();
    336338        clearObservedDOMTimers();
     339        clearObservedTransitions();
    337340        setIsBetweenTouchEndAndMouseMoved(false);
    338341        ASSERT(!m_isObservingDOMTimerScheduling);
     
    350353        if (m_mouseMovedEventIsBeingDispatched) {
    351354            LOG(ContentObservation, "adjustStateAndNotifyContentChangeIfNeeded: in mouseMoved call. No need to notify the client.");
     355            return;
     356        }
     357        if (isBetweenTouchEndAndMouseMoved()) {
     358            LOG(ContentObservation, "adjustStateAndNotifyContentChangeIfNeeded: Not reached mouseMoved yet. No need to notify the client.");
    352359            return;
    353360        }
     
    366373        reset();
    367374        setShouldObserveDOMTimerScheduling(true);
     375        setShouldObserveTransitions(true);
    368376        break;
    369377    case Event::EndedTouchStartEventDispatching:
    370378        setShouldObserveDOMTimerScheduling(false);
     379        setShouldObserveTransitions(false);
    371380        setIsBetweenTouchEndAndMouseMoved(true);
    372381        break;
     
    395404    case Event::InstalledDOMTimer:
    396405    case Event::StartedFixedObservationTimeWindow:
     406    case Event::AddedTransition:
    397407        ASSERT(!hasVisibleChangeState());
    398408        setHasIndeterminateState();
    399409        break;
    400410    case Event::EndedDOMTimerExecution:
     411    case Event::EndedTransition:
    401412        setShouldObserveNextStyleRecalc(m_document.hasPendingStyleRecalc());
    402413        FALLTHROUGH;
    403414    case Event::EndedStyleRecalc:
    404415    case Event::RemovedDOMTimer:
     416    case Event::CanceledTransition:
    405417        if (!isObservationTimeWindowActive())
    406418            adjustStateAndNotifyContentChangeIfNeeded();
     
    414426        setShouldObserveNextStyleRecalc(false);
    415427        clearObservedDOMTimers();
     428        clearObservedTransitions();
    416429        break;
    417430    }
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.h

    r243305 r243307  
    121121    void setShouldObserveDOMTimerScheduling(bool observe) { m_isObservingDOMTimerScheduling = observe; }
    122122    bool isObservingDOMTimerScheduling() const { return m_isObservingDOMTimerScheduling; }
     123    void setShouldObserveTransitions(bool observe) { m_isObservingTransitions = observe; }
    123124    bool isObservingTransitions() const { return m_isObservingTransitions; }
    124125    bool isObservedPropertyForTransition(CSSPropertyID propertyId) const { return propertyId == CSSPropertyLeft; }
     
    128129    void unregisterDOMTimer(const DOMTimer& timer) { m_DOMTimerList.remove(&timer); }
    129130    void clearObservedDOMTimers() { m_DOMTimerList.clear(); }
     131    void clearObservedTransitions() { m_elementsWithTransition.clear(); }
    130132    bool containsObservedDOMTimer(const DOMTimer& timer) const { return m_DOMTimerList.contains(&timer); }
    131133
     
    145147    bool hasVisibleChangeState() const { return observedContentChange() == WKContentVisibilityChange; }
    146148    bool hasObservedDOMTimer() const { return !m_DOMTimerList.isEmpty(); }
     149    bool hasObservedTransition() const { return !m_elementsWithTransition.isEmpty(); }
    147150    bool hasDeterminateState() const;
    148151
     
    150153    bool isBetweenTouchEndAndMouseMoved() const { return m_isBetweenTouchEndAndMouseMoved; }
    151154
    152     bool hasPendingActivity() const { return hasObservedDOMTimer() || m_isWaitingForStyleRecalc || isObservationTimeWindowActive(); }
     155    bool hasPendingActivity() const { return hasObservedDOMTimer() || hasObservedTransition() || m_isWaitingForStyleRecalc || isObservationTimeWindowActive(); }
    153156    bool isObservationTimeWindowActive() const { return m_contentObservationTimer.isActive(); }
    154157
     
    167170        StartedStyleRecalc,
    168171        EndedStyleRecalc,
     172        AddedTransition,
     173        EndedTransition,
     174        CanceledTransition,
    169175        StartedFixedObservationTimeWindow,
    170176        EndedFixedObservationTimeWindow,
Note: See TracChangeset for help on using the changeset viewer.