Changeset 248759 in webkit


Ignore:
Timestamp:
Aug 15, 2019 7:20:57 PM (5 years ago)
Author:
Alan Bujtas
Message:

[ContentChangeObserver] Keep track of all the visibility candidates.
https://bugs.webkit.org/show_bug.cgi?id=200777
<rdar://problem/54356331>

Reviewed by Simon Fraser.

Source/WebCore:

In order to find out whether a visible (and actionable) content change happened, we need to keep track of all the candidate elements.

Test: fast/events/touch/ios/content-observation/going-from-hidden-to-visible-and-to-hidden2.html

  • page/ios/ContentChangeObserver.cpp:

(WebCore::ContentChangeObserver::reset):
(WebCore::ContentChangeObserver::rendererWillBeDestroyed):
(WebCore::ContentChangeObserver::contentVisibilityDidChange):
(WebCore::ContentChangeObserver::shouldObserveVisibilityChangeForElement):

  • page/ios/ContentChangeObserver.h:

Source/WTF:

  • wtf/WeakHashSet.h:

LayoutTests:

  • fast/events/touch/ios/content-observation/going-from-hidden-to-visible-and-to-hidden2-expected.txt: Added.
  • fast/events/touch/ios/content-observation/going-from-hidden-to-visible-and-to-hidden2.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248756 r248759  
     12019-08-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Keep track of all the visibility candidates.
     4        https://bugs.webkit.org/show_bug.cgi?id=200777
     5        <rdar://problem/54356331>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/events/touch/ios/content-observation/going-from-hidden-to-visible-and-to-hidden2-expected.txt: Added.
     10        * fast/events/touch/ios/content-observation/going-from-hidden-to-visible-and-to-hidden2.html: Added.
     11
    1122019-08-15  Myles C. Maxfield  <mmaxfield@apple.com>
    213
  • trunk/Source/WTF/ChangeLog

    r248755 r248759  
     12019-08-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Keep track of all the visibility candidates.
     4        https://bugs.webkit.org/show_bug.cgi?id=200777
     5        <rdar://problem/54356331>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * wtf/WeakHashSet.h:
     10
    1112019-08-15  Brent Fulgham  <bfulgham@apple.com>
    212
  • trunk/Source/WTF/wtf/WeakHashSet.h

    r248546 r248759  
    113113    }
    114114
     115    void clear() { m_set.clear(); }
     116
    115117    template <typename U>
    116118    bool contains(const U& value) const
  • trunk/Source/WebCore/ChangeLog

    r248756 r248759  
     12019-08-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Keep track of all the visibility candidates.
     4        https://bugs.webkit.org/show_bug.cgi?id=200777
     5        <rdar://problem/54356331>
     6
     7        Reviewed by Simon Fraser.
     8
     9        In order to find out whether a visible (and actionable) content change happened, we need to keep track of all the candidate elements.
     10
     11        Test: fast/events/touch/ios/content-observation/going-from-hidden-to-visible-and-to-hidden2.html
     12
     13        * page/ios/ContentChangeObserver.cpp:
     14        (WebCore::ContentChangeObserver::reset):
     15        (WebCore::ContentChangeObserver::rendererWillBeDestroyed):
     16        (WebCore::ContentChangeObserver::contentVisibilityDidChange):
     17        (WebCore::ContentChangeObserver::shouldObserveVisibilityChangeForElement):
     18        * page/ios/ContentChangeObserver.h:
     19
    1202019-08-15  Myles C. Maxfield  <mmaxfield@apple.com>
    221
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp

    r248750 r248759  
    372372    m_observedDomTimerIsBeingExecuted = false;
    373373
    374     m_visibilityCandidateElement = { };
     374    m_visibilityCandidateList.clear();
    375375
    376376    m_contentObservationTimer.stop();
     
    402402        m_elementsWithDestroyedVisibleRenderer.add(&element);
    403403    // Candidate element is no longer visible.
    404     if (m_visibilityCandidateElement == &element) {
     404    if (m_visibilityCandidateList.remove(element)) {
    405405        // FIXME: We should also check for other type of visiblity changes.
    406406        ASSERT(hasVisibleChangeState());
    407         m_visibilityCandidateElement = { };
    408         setHasIndeterminateState();
     407        if (m_visibilityCandidateList.computesEmpty())
     408            setHasIndeterminateState();
    409409    }
    410410}
     
    413413{
    414414    LOG(ContentObservation, "contentVisibilityDidChange: visible content change did happen.");
    415     // FIXME: This should evolve into a list of candidate elements.
    416     m_visibilityCandidateElement = makeWeakPtr(element);
     415    m_visibilityCandidateList.add(element);
    417416    adjustObservedState(Event::ContentVisibilityChanged);
    418417}
     
    624623bool ContentChangeObserver::shouldObserveVisibilityChangeForElement(const Element& element)
    625624{
    626     return isObservingContentChanges() && !hasVisibleChangeState() && !visibleRendererWasDestroyed(element) && !element.document().quirks().shouldIgnoreContentChange(element);
     625    return isObservingContentChanges() && !visibleRendererWasDestroyed(element) && !element.document().quirks().shouldIgnoreContentChange(element);
    627626}
    628627
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.h

    r248750 r248759  
    208208    WKContentChange m_observedContentState { WKContentNoChange };
    209209    WeakPtr<Element> m_hiddenTouchTargetElement;
    210     WeakPtr<Element> m_visibilityCandidateElement;
     210    WeakHashSet<Element> m_visibilityCandidateList;
    211211    bool m_touchEventIsBeingDispatched { false };
    212212    bool m_isWaitingForStyleRecalc { false };
Note: See TracChangeset for help on using the changeset viewer.