Changeset 247306 in webkit


Ignore:
Timestamp:
Jul 10, 2019 10:03:04 AM (5 years ago)
Author:
Antti Koivisto
Message:

Remove TouchActionData
https://bugs.webkit.org/show_bug.cgi?id=199668

Reviewed by Simon Fraser.

Source/WebCore:

TouchActionData structure has been superseded by touch-action regions in EventRegion and is unused.
Remove it and the supporting code.

No functional changes.

  • dom/Document.cpp:

(WebCore::Document::nodeWillBeRemoved):
(WebCore::Document::updateTouchActionElements): Deleted.

  • dom/Document.h:

(WebCore::Document::mayHaveElementsWithNonAutoTouchAction const):
(WebCore::Document::setMayHaveElementsWithNonAutoTouchAction):

Replace touchActionElements set with a bit that covers the only remaining clients (optimizations).
Note that touchActionElements was not deleted when emptied, it had the same "may have" behavior (which
is currently needed).

(WebCore::Document::touchActionElements const): Deleted.

  • dom/Element.cpp:

(WebCore::Element::computedTouchActions const): Deleted.

  • dom/Element.h:
  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const):

  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::touchActionDataAtPoint const): Deleted.

  • page/scrolling/ScrollingTree.h:
  • platform/EventTrackingRegions.cpp:

(WebCore::operator==):

  • platform/EventTrackingRegions.h:

(): Deleted.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::paintObject):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::calculateClipRects const):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateEventRegion):

  • style/StyleTreeResolver.cpp:

(WebCore::Style::TreeResolver::resolveElement):

Source/WebKit:

  • Shared/WebCoreArgumentCoders.cpp:

(IPC::ArgumentCoder<EventTrackingRegions>::encode):
(IPC::ArgumentCoder<EventTrackingRegions>::decode):
(IPC::ArgumentCoder<TouchActionData>::encode): Deleted.
(IPC::ArgumentCoder<TouchActionData>::decode): Deleted.

Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r247299 r247306  
     12019-07-10  Antti Koivisto  <antti@apple.com>
     2
     3        Remove TouchActionData
     4        https://bugs.webkit.org/show_bug.cgi?id=199668
     5
     6        Reviewed by Simon Fraser.
     7
     8        TouchActionData structure has been superseded by touch-action regions in EventRegion and is unused.
     9        Remove it and the supporting code.
     10
     11        No functional changes.
     12
     13        * dom/Document.cpp:
     14        (WebCore::Document::nodeWillBeRemoved):
     15        (WebCore::Document::updateTouchActionElements): Deleted.
     16        * dom/Document.h:
     17        (WebCore::Document::mayHaveElementsWithNonAutoTouchAction const):
     18        (WebCore::Document::setMayHaveElementsWithNonAutoTouchAction):
     19
     20        Replace touchActionElements set with a bit that covers the only remaining clients (optimizations).
     21        Note that touchActionElements was not deleted when emptied, it had the same "may have" behavior (which
     22        is currently needed).
     23
     24        (WebCore::Document::touchActionElements const): Deleted.
     25        * dom/Element.cpp:
     26        (WebCore::Element::computedTouchActions const): Deleted.
     27        * dom/Element.h:
     28        * page/scrolling/ScrollingCoordinator.cpp:
     29        (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const):
     30        * page/scrolling/ScrollingTree.cpp:
     31        (WebCore::ScrollingTree::touchActionDataAtPoint const): Deleted.
     32        * page/scrolling/ScrollingTree.h:
     33        * platform/EventTrackingRegions.cpp:
     34        (WebCore::operator==):
     35        * platform/EventTrackingRegions.h:
     36        (): Deleted.
     37        * rendering/RenderBlock.cpp:
     38        (WebCore::RenderBlock::paintObject):
     39        * rendering/RenderLayer.cpp:
     40        (WebCore::RenderLayer::calculateClipRects const):
     41        * rendering/RenderLayerBacking.cpp:
     42        (WebCore::RenderLayerBacking::updateEventRegion):
     43        * style/StyleTreeResolver.cpp:
     44        (WebCore::Style::TreeResolver::resolveElement):
     45
    1462019-07-10  Zalan Bujtas  <zalan@apple.com>
    247
  • trunk/Source/WebCore/dom/Document.cpp

    r247239 r247306  
    44594459    if (is<Text>(node))
    44604460        m_markers->removeMarkers(node);
    4461 
    4462 #if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
    4463     if (m_touchActionElements && is<Element>(node))
    4464         m_touchActionElements->remove(&downcast<Element>(node));
    4465 #endif
    44664461}
    44674462
     
    81918186#endif
    81928187
    8193 #if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
    8194 void Document::updateTouchActionElements(Element& element, const RenderStyle& style)
    8195 {
    8196     bool changed = false;
    8197 
    8198     if (style.touchActions() != TouchAction::Auto) {
    8199         if (!m_touchActionElements)
    8200             m_touchActionElements = std::make_unique<HashSet<RefPtr<Element>>>();
    8201         changed |= m_touchActionElements->add(&element).isNewEntry;
    8202     } else if (m_touchActionElements)
    8203         changed |= m_touchActionElements->remove(&element);
    8204 
    8205     if (!changed)
    8206         return;
    8207 
    8208     Page* page = this->page();
    8209     if (!page)
    8210         return;
    8211 
    8212     if (FrameView* frameView = view()) {
    8213         if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
    8214             scrollingCoordinator->frameViewEventTrackingRegionsChanged(*frameView);
    8215     }
    8216 }
    8217 #endif
    8218 
    82198188#if PLATFORM(IOS_FAMILY)
    82208189ContentChangeObserver& Document::contentChangeObserver()
  • trunk/Source/WebCore/dom/Document.h

    r247184 r247306  
    12341234#endif
    12351235#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
    1236     void updateTouchActionElements(Element&, const RenderStyle&);
    1237     const HashSet<RefPtr<Element>>* touchActionElements() const { return m_touchActionElements.get(); }
     1236    bool mayHaveElementsWithNonAutoTouchAction() const { return m_mayHaveElementsWithNonAutoTouchAction; }
     1237    void setMayHaveElementsWithNonAutoTouchAction() { m_mayHaveElementsWithNonAutoTouchAction = true; }
    12381238#endif
    12391239
     
    18201820#endif
    18211821#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
    1822     std::unique_ptr<HashSet<RefPtr<Element>>> m_touchActionElements;
     1822    bool m_mayHaveElementsWithNonAutoTouchAction { false };
    18231823#endif
    18241824    std::unique_ptr<EventTargetSet> m_wheelEventTargets;
  • trunk/Source/WebCore/dom/Element.cpp

    r247255 r247306  
    43274327
    43284328#if ENABLE(POINTER_EVENTS)
    4329 OptionSet<TouchAction> Element::computedTouchActions() const
    4330 {
    4331     if (auto* style = renderOrDisplayContentsStyle())
    4332         return style->effectiveTouchActions();
    4333 
    4334     return TouchAction::Auto;
    4335 }
    4336 
    43374329#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
    43384330ScrollingNodeID Element::nearestScrollingNodeIDUsingTouchOverflowScrolling() const
  • trunk/Source/WebCore/dom/Element.h

    r246490 r247306  
    7474};
    7575
    76 #if ENABLE(POINTER_EVENTS)
    77 enum class TouchAction : uint8_t;
    78 #endif
    79 
    8076class Element : public ContainerNode {
    8177    WTF_MAKE_ISO_ALLOCATED(Element);
     
    607603
    608604#if ENABLE(POINTER_EVENTS)
    609     OptionSet<TouchAction> computedTouchActions() const;
    610605#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
    611606    ScrollingNodeID nearestScrollingNodeIDUsingTouchOverflowScrolling() const;
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r246723 r247306  
    109109    if (!document)
    110110        return EventTrackingRegions();
    111     auto eventTrackingRegions = document->eventTrackingRegions();
    112 
    113 #if ENABLE(POINTER_EVENTS)
    114     if (!document->quirks().shouldDisablePointerEventsQuirk() && RuntimeEnabledFeatures::sharedFeatures().pointerEventsEnabled()) {
    115         if (auto* touchActionElements = frame.document()->touchActionElements()) {
    116             auto& touchActionData = eventTrackingRegions.touchActionData;
    117             for (const auto& element : *touchActionElements) {
    118                 ASSERT(element);
    119                 touchActionData.append({
    120                     element->computedTouchActions(),
    121                     element->nearestScrollingNodeIDUsingTouchOverflowScrolling(),
    122                     element->document().absoluteEventRegionForNode(*element).first
    123                 });
    124             }
    125         }
    126     }
    127 #endif
    128 
    129     return eventTrackingRegions;
     111    return document->eventTrackingRegions();
    130112#else
    131113    auto* frameView = frame.view();
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r246962 r247306  
    492492}
    493493
    494 #if ENABLE(POINTER_EVENTS)
    495 Optional<TouchActionData> ScrollingTree::touchActionDataAtPoint(IntPoint p) const
    496 {
    497     // FIXME: This does not handle the case where there are multiple regions matching this point.
    498     for (auto& touchActionData : m_treeState.eventTrackingRegions.touchActionData) {
    499         if (touchActionData.region.contains(p))
    500             return touchActionData;
    501     }
    502 
    503     return { };
    504 }
    505 #endif
    506 
    507494} // namespace WebCore
    508495
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.h

    r246962 r247306  
    3131#include "Region.h"
    3232#include "ScrollingCoordinator.h"
    33 #include "TouchAction.h"
    3433#include "WheelEventTestTrigger.h"
    3534#include <wtf/HashMap.h>
     
    104103
    105104    WEBCORE_EXPORT TrackingType eventTrackingTypeForPoint(const AtomString& eventName, IntPoint);
    106 #if ENABLE(POINTER_EVENTS)
    107     WEBCORE_EXPORT Optional<TouchActionData> touchActionDataAtPoint(IntPoint) const;
    108 #endif
    109105
    110106#if PLATFORM(MAC)
  • trunk/Source/WebCore/platform/EventTrackingRegions.cpp

    r240579 r247306  
    7474{
    7575    return a.asynchronousDispatchRegion == b.asynchronousDispatchRegion
    76 #if ENABLE(POINTER_EVENTS)
    77         && a.touchActionData == b.touchActionData
    78 #endif
    7976        && a.eventSpecificSynchronousDispatchRegions == b.eventSpecificSynchronousDispatchRegions;
    8077}
    8178
    82 #if ENABLE(POINTER_EVENTS)
    83 bool operator==(const TouchActionData& a, const TouchActionData& b)
    84 {
    85     return a.touchActions == b.touchActions
    86         && a.scrollingNodeID == b.scrollingNodeID
    87         && a.region == b.region;
    88 }
    89 #endif
    90 
    9179} // namespace WebCore
  • trunk/Source/WebCore/platform/EventTrackingRegions.h

    r240579 r247306  
    3131#include <wtf/text/WTFString.h>
    3232
    33 #if ENABLE(POINTER_EVENTS)
    34 #include "CSSPrimitiveValueMappings.h"
    35 #include "ScrollingCoordinatorTypes.h"
    36 #include "TouchAction.h"
    37 #endif
    38 
    3933namespace WebCore {
    4034
     
    4539};
    4640
    47 #if ENABLE(POINTER_EVENTS)
    48 typedef uint64_t ScrollingNodeID;
    49 struct TouchActionData {
    50     OptionSet<TouchAction> touchActions { TouchAction::Auto };
    51     ScrollingNodeID scrollingNodeID { 0 };
    52     Region region;
    53 };
    54 
    55 bool operator==(const TouchActionData&, const TouchActionData&);
    56 inline bool operator!=(const TouchActionData& a, const TouchActionData& b) { return !(a == b); }
    57 #endif
    58 
    5941struct EventTrackingRegions {
    6042    // Region for which events can be dispatched without blocking scrolling.
     
    6446    // The key is the Event Name with an active handler.
    6547    HashMap<String, Region> eventSpecificSynchronousDispatchRegions;
    66 
    67 #if ENABLE(POINTER_EVENTS)
    68     Vector<TouchActionData> touchActionData;
    69 #endif
    7048
    7149    bool isEmpty() const;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r246490 r247306  
    12531253        bool needsTraverseDescendants = hasVisualOverflow() || !paintInfo.eventRegionContext->contains(enclosingIntRect(borderRect));
    12541254#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
    1255         needsTraverseDescendants = needsTraverseDescendants || document().touchActionElements();
     1255        needsTraverseDescendants = needsTraverseDescendants || document().mayHaveElementsWithNonAutoTouchAction();
    12561256#endif
    12571257        if (!needsTraverseDescendants)
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r247255 r247306  
    68246824#if ENABLE(POINTER_EVENTS)
    68256825        // UI side touch-action resolution.
    6826         if (renderer().document().touchActionElements())
     6826        if (renderer().document().mayHaveElementsWithNonAutoTouchAction())
    68276827            return true;
    68286828#endif
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r247187 r247306  
    15351535    bool hasTouchActionElements = false;
    15361536#if ENABLE(POINTER_EVENTS)
    1537     hasTouchActionElements = !!renderer().document().touchActionElements();
     1537    hasTouchActionElements = renderer().document().mayHaveElementsWithNonAutoTouchAction();
    15381538#endif
    15391539    if (m_owningLayer.isRenderViewLayer() && !hasTouchActionElements)
  • trunk/Source/WebCore/style/StyleTreeResolver.cpp

    r244240 r247306  
    240240
    241241#if ENABLE(POINTER_EVENTS) && PLATFORM(IOS_FAMILY)
    242     if (!m_document.quirks().shouldDisablePointerEventsQuirk() && RuntimeEnabledFeatures::sharedFeatures().pointerEventsEnabled())
    243         m_document.updateTouchActionElements(element, *update.style.get());
     242    // FIXME: Track this exactly.
     243    if (update.style->touchActions() != TouchAction::Auto && !m_document.quirks().shouldDisablePointerEventsQuirk() && RuntimeEnabledFeatures::sharedFeatures().pointerEventsEnabled())
     244        m_document.setMayHaveElementsWithNonAutoTouchAction();
    244245#endif
    245246
  • trunk/Source/WebKit/ChangeLog

    r247294 r247306  
     12019-07-10  Antti Koivisto  <antti@apple.com>
     2
     3        Remove TouchActionData
     4        https://bugs.webkit.org/show_bug.cgi?id=199668
     5
     6        Reviewed by Simon Fraser.
     7
     8        * Shared/WebCoreArgumentCoders.cpp:
     9        (IPC::ArgumentCoder<EventTrackingRegions>::encode):
     10        (IPC::ArgumentCoder<EventTrackingRegions>::decode):
     11        (IPC::ArgumentCoder<TouchActionData>::encode): Deleted.
     12        (IPC::ArgumentCoder<TouchActionData>::decode): Deleted.
     13
    1142019-07-09  Michael Catanzaro  <mcatanzaro@igalia.com>
    215
  • trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp

    r246725 r247306  
    331331}
    332332
    333 #if ENABLE(POINTER_EVENTS)
    334 void ArgumentCoder<TouchActionData>::encode(Encoder& encoder, const TouchActionData& touchActionData)
    335 {
    336     encoder << touchActionData.touchActions << touchActionData.scrollingNodeID << touchActionData.region;
    337 }
    338 
    339 Optional<TouchActionData> ArgumentCoder<TouchActionData>::decode(Decoder& decoder)
    340 {
    341     Optional<OptionSet<TouchAction>> touchActions;
    342     decoder >> touchActions;
    343     if (!touchActions)
    344         return WTF::nullopt;
    345 
    346     Optional<ScrollingNodeID> scrollingNodeID;
    347     decoder >> scrollingNodeID;
    348     if (!scrollingNodeID)
    349         return WTF::nullopt;
    350 
    351     Optional<Region> region;
    352     decoder >> region;
    353     if (!region)
    354         return WTF::nullopt;
    355 
    356     return {{ WTFMove(*touchActions), WTFMove(*scrollingNodeID), WTFMove(*region) }};
    357 }
    358 #endif
    359 
    360333void ArgumentCoder<EventTrackingRegions>::encode(Encoder& encoder, const EventTrackingRegions& eventTrackingRegions)
    361334{
    362335    encoder << eventTrackingRegions.asynchronousDispatchRegion;
    363336    encoder << eventTrackingRegions.eventSpecificSynchronousDispatchRegions;
    364 #if ENABLE(POINTER_EVENTS)
    365     encoder << eventTrackingRegions.touchActionData;
    366 #endif
    367337}
    368338
     
    376346    if (!decoder.decode(eventSpecificSynchronousDispatchRegions))
    377347        return false;
    378 #if ENABLE(POINTER_EVENTS)
    379     Vector<TouchActionData> touchActionData;
    380     if (!decoder.decode(touchActionData))
    381         return false;
    382 #endif
    383348    eventTrackingRegions.asynchronousDispatchRegion = WTFMove(*asynchronousDispatchRegion);
    384349    eventTrackingRegions.eventSpecificSynchronousDispatchRegions = WTFMove(eventSpecificSynchronousDispatchRegions);
    385 #if ENABLE(POINTER_EVENTS)
    386     eventTrackingRegions.touchActionData = WTFMove(touchActionData);
    387 #endif
    388350    return true;
    389351}
Note: See TracChangeset for help on using the changeset viewer.