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

Changeset 243962 in webkit


Ignore:
Timestamp:
Apr 6, 2019, 9:48:58 AM (7 years ago)
Author:
Antti Koivisto
Message:

Combine event and touch action regions into a single class
https://bugs.webkit.org/show_bug.cgi?id=196644
<rdar://problem/49643614>

Reviewed by Darin Adler.

Source/WebCore:

This patch replaces the existing TouchActionRegion class with the more general EventRegion class.
It collects both the overall event region and the touch action regions. This avoids duplication
and simplifies the code.

The patch also adds serialization support for EventRegion, so touch-action regions gets passed
to the UI process too.

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::setEventRegion):
(WebCore::GraphicsLayer::dumpProperties const):
(WebCore::GraphicsLayer::setTouchActionRegion): Deleted.

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::eventRegion const):
(WebCore::GraphicsLayer::touchActionRegion const): Deleted.

  • platform/graphics/Region.cpp:

(WebCore::operator<<):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::setEventRegion):
(WebCore::GraphicsLayerCA::setTouchActionRegion): Deleted.

  • platform/graphics/ca/GraphicsLayerCA.h:
  • platform/graphics/ca/PlatformCALayer.h:
  • platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
  • rendering/EventRegion.cpp: Copied from Source/WebCore/rendering/TouchActionRegion.cpp.

(WebCore::EventRegion::operator== const):
(WebCore::EventRegion::unite):
(WebCore::EventRegion::translate):
(WebCore::EventRegion::uniteTouchActions):
(WebCore::EventRegion::touchActionsForPoint const):
(WebCore::operator<<):
(WebCore::TouchActionRegion::unite): Deleted.
(WebCore::TouchActionRegion::actionsForPoint const): Deleted.
(WebCore::TouchActionRegion::translate): Deleted.

  • rendering/EventRegion.h: Copied from Source/WebCore/rendering/TouchActionRegion.h.

(WebCore::EventRegion::isEmpty const):
(WebCore::EventRegion::contains const):
(WebCore::EventRegion::hasTouchActions const):
(WebCore::EventRegion::encode const):
(WebCore::EventRegion::decode):
(WebCore::TouchActionRegion::isEmpty const): Deleted.
(WebCore::TouchActionRegion::operator== const): Deleted.

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::paint):

  • rendering/PaintInfo.h:
  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::paintObject):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::collectEventRegionForFragments):

  • rendering/RenderLayer.h:
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateEventRegion):

  • rendering/RenderLayerModelObject.cpp:
  • rendering/SimpleLineLayoutFunctions.cpp:

(WebCore::SimpleLineLayout::paintFlow):

  • rendering/TouchActionRegion.cpp: Removed.
  • rendering/TouchActionRegion.h: Removed.

Source/WebKit:

  • Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
  • Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:

(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):

  • UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:

(WebKit::RemoteLayerTreeNode::eventRegion const):

  • UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:

(WebKit::RemoteLayerTreeNode::setEventRegion):

  • WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:

(WebKit::PlatformCALayerRemote::setEventRegion):

  • WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:

LayoutTests:

  • pointerevents/ios/touch-action-region-basic-expected.txt:
  • pointerevents/ios/touch-action-region-layers-expected.txt:
  • pointerevents/ios/touch-action-region-pan-x-y-expected.txt:
Location:
trunk
Files:
1 added
1 deleted
30 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243961 r243962  
     12019-04-06  Antti Koivisto  <antti@apple.com>
     2
     3        Combine event and touch action regions into a single class
     4        https://bugs.webkit.org/show_bug.cgi?id=196644
     5        <rdar://problem/49643614>
     6
     7        Reviewed by Darin Adler.
     8
     9        * pointerevents/ios/touch-action-region-basic-expected.txt:
     10        * pointerevents/ios/touch-action-region-layers-expected.txt:
     11        * pointerevents/ios/touch-action-region-pan-x-y-expected.txt:
     12
    1132019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
    214
  • trunk/LayoutTests/pointerevents/ios/touch-action-region-basic-expected.txt

    r243893 r243962  
    1010      (event region
    1111        (rect (0,0) width=800 height=621)
    12       )
    13       (touch-action region
    14         (none       
    15           (rect (8,8) width=100 height=100)
    16           (rect (8,208) width=200 height=25)
    17           (rect (8,233) width=100 height=75)
    18           (rect (8,408) width=100 height=50)
    19           (rect (8,458) width=50 height=50)
     12        (touch-action
     13          (none         
     14            (rect (8,8) width=100 height=100)
     15            (rect (8,208) width=200 height=25)
     16            (rect (8,233) width=100 height=75)
     17            (rect (8,408) width=100 height=50)
     18            (rect (8,458) width=50 height=50)
     19          )
    2020        )
    2121      )
  • trunk/LayoutTests/pointerevents/ios/touch-action-region-layers-expected.txt

    r243893 r243962  
    1818          (event region
    1919            (rect (0,0) width=100 height=100)
    20           )
    21           (touch-action region
    22             (none           
    23               (rect (0,0) width=100 height=100)
     20            (touch-action
     21              (none             
     22                (rect (0,0) width=100 height=100)
     23              )
    2424            )
    2525          )
     
    3232            (rect (0,0) width=200 height=25)
    3333            (rect (0,25) width=100 height=75)
    34           )
    35           (touch-action region
    36             (none           
    37               (rect (0,0) width=200 height=25)
    38               (rect (0,25) width=100 height=75)
     34            (touch-action
     35              (none             
     36                (rect (0,0) width=200 height=25)
     37                (rect (0,25) width=100 height=75)
     38              )
    3939            )
    4040          )
     
    4646          (event region
    4747            (rect (0,0) width=100 height=100)
    48           )
    49           (touch-action region
    50             (none           
    51               (rect (0,0) width=100 height=100)
     48            (touch-action
     49              (none             
     50                (rect (0,0) width=100 height=100)
     51              )
    5252            )
    5353          )
     
    7070            (rect (0,50) width=150 height=50)
    7171            (rect (50,100) width=100 height=50)
    72           )
    73           (touch-action region
    74             (none           
    75               (rect (0,0) width=100 height=50)
    76               (rect (0,50) width=150 height=50)
    77               (rect (50,100) width=100 height=50)
     72            (touch-action
     73              (none             
     74                (rect (0,0) width=100 height=50)
     75                (rect (0,50) width=150 height=50)
     76                (rect (50,100) width=100 height=50)
     77              )
    7878            )
    7979          )
     
    8989              (event region
    9090                (rect (0,0) width=100 height=100)
    91               )
    92               (touch-action region
    93                 (none               
    94                   (rect (0,0) width=100 height=100)
     91                (touch-action
     92                  (none                 
     93                    (rect (0,0) width=100 height=100)
     94                  )
    9595                )
    9696              )
  • trunk/LayoutTests/pointerevents/ios/touch-action-region-pan-x-y-expected.txt

    r243893 r243962  
    1010      (event region
    1111        (rect (0,0) width=800 height=1021)
    12       )
    13       (touch-action region
    14         (none       
    15           (rect (8,808) width=100 height=100)
    16         )
    17         (pan-x       
    18           (rect (8,8) width=100 height=100)
    19           (rect (8,208) width=200 height=25)
    20           (rect (8,233) width=100 height=75)
    21           (rect (108,408) width=100 height=25)
    22           (rect (8,608) width=200 height=25)
    23           (rect (8,633) width=100 height=75)
    24           (rect (108,808) width=100 height=25)
    25         )
    26         (pan-y       
    27           (rect (8,408) width=200 height=25)
    28           (rect (8,433) width=100 height=75)
     12        (touch-action
     13          (none         
     14            (rect (8,808) width=100 height=100)
     15          )
     16          (pan-x         
     17            (rect (8,8) width=100 height=100)
     18            (rect (8,208) width=200 height=25)
     19            (rect (8,233) width=100 height=75)
     20            (rect (108,408) width=100 height=25)
     21            (rect (8,608) width=200 height=25)
     22            (rect (8,633) width=100 height=75)
     23            (rect (108,808) width=100 height=25)
     24          )
     25          (pan-y         
     26            (rect (8,408) width=200 height=25)
     27            (rect (8,433) width=100 height=75)
     28          )
    2929        )
    3030      )
  • trunk/Source/WebCore/ChangeLog

    r243961 r243962  
     12019-04-06  Antti Koivisto  <antti@apple.com>
     2
     3        Combine event and touch action regions into a single class
     4        https://bugs.webkit.org/show_bug.cgi?id=196644
     5        <rdar://problem/49643614>
     6
     7        Reviewed by Darin Adler.
     8
     9        This patch replaces the existing TouchActionRegion class with the more general EventRegion class.
     10        It collects both the overall event region and the touch action regions. This avoids duplication
     11        and simplifies the code.
     12
     13        The patch also adds serialization support for EventRegion, so touch-action regions gets passed
     14        to the UI process too.
     15
     16        * Sources.txt:
     17        * WebCore.xcodeproj/project.pbxproj:
     18        * platform/graphics/GraphicsLayer.cpp:
     19        (WebCore::GraphicsLayer::setEventRegion):
     20        (WebCore::GraphicsLayer::dumpProperties const):
     21        (WebCore::GraphicsLayer::setTouchActionRegion): Deleted.
     22        * platform/graphics/GraphicsLayer.h:
     23        (WebCore::GraphicsLayer::eventRegion const):
     24        (WebCore::GraphicsLayer::touchActionRegion const): Deleted.
     25        * platform/graphics/Region.cpp:
     26        (WebCore::operator<<):
     27        * platform/graphics/ca/GraphicsLayerCA.cpp:
     28        (WebCore::GraphicsLayerCA::setEventRegion):
     29        (WebCore::GraphicsLayerCA::setTouchActionRegion): Deleted.
     30        * platform/graphics/ca/GraphicsLayerCA.h:
     31        * platform/graphics/ca/PlatformCALayer.h:
     32        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
     33        * rendering/EventRegion.cpp: Copied from Source/WebCore/rendering/TouchActionRegion.cpp.
     34        (WebCore::EventRegion::operator== const):
     35        (WebCore::EventRegion::unite):
     36        (WebCore::EventRegion::translate):
     37        (WebCore::EventRegion::uniteTouchActions):
     38        (WebCore::EventRegion::touchActionsForPoint const):
     39        (WebCore::operator<<):
     40        (WebCore::TouchActionRegion::unite): Deleted.
     41        (WebCore::TouchActionRegion::actionsForPoint const): Deleted.
     42        (WebCore::TouchActionRegion::translate): Deleted.
     43        * rendering/EventRegion.h: Copied from Source/WebCore/rendering/TouchActionRegion.h.
     44        (WebCore::EventRegion::isEmpty const):
     45        (WebCore::EventRegion::contains const):
     46        (WebCore::EventRegion::hasTouchActions const):
     47        (WebCore::EventRegion::encode const):
     48        (WebCore::EventRegion::decode):
     49        (WebCore::TouchActionRegion::isEmpty const): Deleted.
     50        (WebCore::TouchActionRegion::operator== const): Deleted.
     51        * rendering/InlineTextBox.cpp:
     52        (WebCore::InlineTextBox::paint):
     53        * rendering/PaintInfo.h:
     54        * rendering/RenderBlock.cpp:
     55        (WebCore::RenderBlock::paintObject):
     56        * rendering/RenderLayer.cpp:
     57        (WebCore::RenderLayer::collectEventRegionForFragments):
     58        * rendering/RenderLayer.h:
     59        * rendering/RenderLayerBacking.cpp:
     60        (WebCore::RenderLayerBacking::updateEventRegion):
     61        * rendering/RenderLayerModelObject.cpp:
     62        * rendering/SimpleLineLayoutFunctions.cpp:
     63        (WebCore::SimpleLineLayout::paintFlow):
     64        * rendering/TouchActionRegion.cpp: Removed.
     65        * rendering/TouchActionRegion.h: Removed.
     66
    1672019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
    268
  • trunk/Source/WebCore/Sources.txt

    r243893 r243962  
    19511951rendering/CounterNode.cpp
    19521952rendering/EllipsisBox.cpp
     1953rendering/EventRegion.cpp
    19531954rendering/FlexibleBoxAlgorithm.cpp
    19541955rendering/FixedTableLayout.cpp
     
    20692070rendering/TextPaintStyle.cpp
    20702071rendering/TextPainter.cpp
    2071 rendering/TouchActionRegion.cpp
    20722072rendering/TrailingFloatsRootInlineBox.cpp
    20732073
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r243893 r243962  
    48234823                E4A814DA1C70E10D00BF85AC /* AttributeChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814D91C70E10D00BF85AC /* AttributeChangeInvalidation.h */; };
    48244824                E4A814E01C7338EB00BF85AC /* IdChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814DF1C7338EB00BF85AC /* IdChangeInvalidation.h */; };
    4825                 E4A8D21022538FD200A8463C /* TouchActionRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A8D20F22538FD100A8463C /* TouchActionRegion.h */; settings = {ATTRIBUTES = (Private, ); }; };
     4825                E4A8D21622578DB700A8463C /* EventRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A8D21422578DA000A8463C /* EventRegion.h */; settings = {ATTRIBUTES = (Private, ); }; };
    48264826                E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1517D1BB950009FB31 /* ElementIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
    48274827                E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1488514885                E4A814DD1C7338D100BF85AC /* IdChangeInvalidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdChangeInvalidation.cpp; sourceTree = "<group>"; };
    1488614886                E4A814DF1C7338EB00BF85AC /* IdChangeInvalidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdChangeInvalidation.h; sourceTree = "<group>"; };
    14887                 E4A8D20C22538FC700A8463C /* TouchActionRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TouchActionRegion.cpp; sourceTree = "<group>"; };
    14888                 E4A8D20F22538FD100A8463C /* TouchActionRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchActionRegion.h; sourceTree = "<group>"; };
     14887                E4A8D21422578DA000A8463C /* EventRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventRegion.h; sourceTree = "<group>"; };
     14888                E4A8D21522578DA000A8463C /* EventRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventRegion.cpp; sourceTree = "<group>"; };
    1488914889                E4AE7C1517D1BB950009FB31 /* ElementIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementIterator.h; sourceTree = "<group>"; };
    1489014890                E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementAncestorIterator.h; sourceTree = "<group>"; };
     
    2680226802                                A8CFF6CA0A1561CD000A4234 /* EllipsisBox.cpp */,
    2680326803                                A8CFF6BD0A156118000A4234 /* EllipsisBox.h */,
     26804                                E4A8D21522578DA000A8463C /* EventRegion.cpp */,
     26805                                E4A8D21422578DA000A8463C /* EventRegion.h */,
    2680426806                                A8CFF0480A154F09000A4234 /* FixedTableLayout.cpp */,
    2680526807                                A8CFF04A0A154F09000A4234 /* FixedTableLayout.h */,
     
    2705827060                                E4C91A0F1802343900A17F6D /* TextPaintStyle.cpp */,
    2705927061                                E4C91A0D1802343100A17F6D /* TextPaintStyle.h */,
    27060                                 E4A8D20C22538FC700A8463C /* TouchActionRegion.cpp */,
    27061                                 E4A8D20F22538FD100A8463C /* TouchActionRegion.h */,
    2706227062                                1100FC6E1FDB3C4D00DD961B /* TrailingFloatsRootInlineBox.cpp */,
    2706327063                                37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */,
     
    2950129501                                FDA15EAE12B03EE1003A583A /* JSAudioListener.h in Headers */,
    2950229502                                FDA15EB012B03EE1003A583A /* JSAudioNode.h in Headers */,
    29503                                 E4A8D21022538FD200A8463C /* TouchActionRegion.h in Headers */,
    2950429503                                FDA15EB412B03EE1003A583A /* JSAudioParam.h in Headers */,
    2950529504                                FDA15EB612B03EE1003A583A /* JSAudioProcessingEvent.h in Headers */,
     
    2978729786                                1AE2AE5C0A1D26F200B42B25 /* JSHTMLMenuElement.h in Headers */,
    2978829787                                A80E7A180A19C3D6007FB8C5 /* JSHTMLMetaElement.h in Headers */,
     29788                                E4A8D21622578DB700A8463C /* EventRegion.h in Headers */,
    2978929789                                A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */,
    2979029790                                1AE2AB2A0A1CE63B00B42B25 /* JSHTMLModElement.h in Headers */,
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r243893 r243962  
    412412}
    413413
    414 void GraphicsLayer::setEventRegion(Region&& eventRegion)
     414void GraphicsLayer::setEventRegion(EventRegion&& eventRegion)
    415415{
    416416    m_eventRegion = WTFMove(eventRegion);
    417417}
    418 
    419 #if ENABLE(POINTER_EVENTS)
    420 void GraphicsLayer::setTouchActionRegion(TouchActionRegion&& touchActionRegion)
    421 {
    422     m_touchActionRegion = WTFMove(touchActionRegion);
    423 }
    424 #endif
    425418
    426419void GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants()
     
    934927    }
    935928
    936     if (behavior & LayerTreeAsTextIncludeEventRegion) {
    937         if (!m_eventRegion.isEmpty())
    938             ts << indent << "(event region" << m_eventRegion << ")\n";
    939 #if ENABLE(POINTER_EVENTS)
    940         if (!m_touchActionRegion.isEmpty())
    941             ts << indent << "(touch-action region" << m_touchActionRegion << ")\n";
    942 #endif
     929    if (behavior & LayerTreeAsTextIncludeEventRegion && !m_eventRegion.isEmpty()) {
     930        ts << indent << "(event region" << m_eventRegion;
     931        ts << indent << ")\n";
    943932    }
    944933
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r243893 r243962  
    2828#include "Animation.h"
    2929#include "Color.h"
     30#include "EventRegion.h"
    3031#include "FilterOperations.h"
    3132#include "FloatPoint.h"
     
    3839#include "Region.h"
    3940#include "ScrollableArea.h"
    40 #include "TouchActionRegion.h"
    4141#include "TransformOperations.h"
    4242#include "WindRule.h"
     
    455455    virtual void setShapeLayerWindRule(WindRule);
    456456
    457     const Region& eventRegion() const { return m_eventRegion; }
    458     virtual void setEventRegion(Region&&);
    459 #if ENABLE(POINTER_EVENTS)
    460     const TouchActionRegion& touchActionRegion() const { return m_touchActionRegion; }
    461     virtual void setTouchActionRegion(TouchActionRegion&&);
    462 #endif
     457    const EventRegion& eventRegion() const { return m_eventRegion; }
     458    virtual void setEventRegion(EventRegion&&);
     459
    463460    // Transitions are identified by a special animation name that cannot clash with a keyframe identifier.
    464461    static String animationNameForTransition(AnimatedPropertyID);
     
    735732    Optional<FloatRect> m_animationExtent;
    736733
    737     Region m_eventRegion;
    738 #if ENABLE(POINTER_EVENTS)
    739     TouchActionRegion m_touchActionRegion;
    740 #endif
     734    EventRegion m_eventRegion;
    741735#if USE(CA)
    742736    WindRule m_shapeLayerWindRule { WindRule::NonZero };
  • trunk/Source/WebCore/platform/graphics/Region.cpp

    r243675 r243962  
    660660            ts << indent << "(rect " << rect << ")\n";
    661661    }
    662     ts << indent;
    663662
    664663    return ts;
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r243893 r243962  
    985985}
    986986
    987 void GraphicsLayerCA::setEventRegion(Region&& eventRegion)
     987void GraphicsLayerCA::setEventRegion(EventRegion&& eventRegion)
    988988{
    989989    if (eventRegion == m_eventRegion)
     
    993993    noteLayerPropertyChanged(EventRegionChanged, m_isCommittingChanges ? DontScheduleFlush : ScheduleFlush);
    994994}
    995 
    996 #if ENABLE(POINTER_EVENTS)
    997 void GraphicsLayerCA::setTouchActionRegion(TouchActionRegion&& touchActionRegion)
    998 {
    999     if (touchActionRegion == m_touchActionRegion)
    1000         return;
    1001 
    1002     GraphicsLayer::setTouchActionRegion(WTFMove(touchActionRegion));
    1003     // FIXME: Invalidate and pass to platform layer.
    1004 }
    1005 #endif
    1006995
    1007996bool GraphicsLayerCA::shouldRepaintOnSizeChange() const
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r243893 r243962  
    125125    WEBCORE_EXPORT void setShapeLayerWindRule(WindRule) override;
    126126
    127     WEBCORE_EXPORT void setEventRegion(Region&&) override;
    128 #if ENABLE(POINTER_EVENTS)
    129     WEBCORE_EXPORT void setTouchActionRegion(TouchActionRegion&&) override;
    130 #endif
     127    WEBCORE_EXPORT void setEventRegion(EventRegion&&) override;
     128
    131129    WEBCORE_EXPORT void suspendAnimations(MonotonicTime) override;
    132130    WEBCORE_EXPORT void resumeAnimations() override;
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h

    r243007 r243962  
    235235    virtual void setShapeWindRule(WindRule) = 0;
    236236
    237     virtual void setEventRegion(const Region&) = 0;
     237    virtual void setEventRegion(const EventRegion&) = 0;
    238238   
    239239    virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h

    r243007 r243962  
    169169    void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
    170170
    171     void setEventRegion(const Region&) override { }
     171    void setEventRegion(const EventRegion&) override { }
    172172
    173173    GraphicsLayer::EmbeddedViewID embeddedViewID() const override;
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h

    r243007 r243962  
    158158    void updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance) override { m_customAppearance = customAppearance; }
    159159
    160     void setEventRegion(const Region&) override { }
     160    void setEventRegion(const EventRegion&) override { }
    161161
    162162    GraphicsLayer::EmbeddedViewID embeddedViewID() const override;
  • trunk/Source/WebCore/rendering/EventRegion.cpp

    r243961 r243962  
    2525
    2626#include "config.h"
    27 #include "TouchActionRegion.h"
     27#include "EventRegion.h"
     28
     29#include "RenderStyle.h"
     30
     31namespace WebCore {
     32
     33EventRegion::EventRegion() = default;
     34
     35bool EventRegion::operator==(const EventRegion& other) const
     36{
     37#if ENABLE(POINTER_EVENTS)
     38    if (m_touchActionRegions != other.m_touchActionRegions)
     39        return false;
     40#endif
     41    return m_region == other.m_region;
     42}
     43
     44void EventRegion::unite(const Region& region, const RenderStyle& style)
     45{
     46    m_region.unite(region);
    2847
    2948#if ENABLE(POINTER_EVENTS)
     49    uniteTouchActions(region, style.effectiveTouchActions());
     50#else
     51    UNUSED_PARAM(style);
     52#endif
     53}
    3054
    31 namespace WebCore {
     55void EventRegion::translate(const IntSize& offset)
     56{
     57    m_region.translate(offset);
     58
     59#if ENABLE(POINTER_EVENTS)
     60    for (auto& touchActionRegion : m_touchActionRegions)
     61        touchActionRegion.translate(offset);
     62#endif
     63}
     64
     65#if ENABLE(POINTER_EVENTS)
    3266
    3367constexpr unsigned toIndex(TouchAction touchAction)
     
    71105}
    72106
    73 TouchActionRegion::TouchActionRegion() = default;
    74 
    75 void TouchActionRegion::unite(const Region& touchRegion, OptionSet<TouchAction> touchActions)
     107void EventRegion::uniteTouchActions(const Region& touchRegion, OptionSet<TouchAction> touchActions)
    76108{
    77109    for (auto touchAction : touchActions) {
     
    79111            break;
    80112        auto index = toIndex(touchAction);
    81         if (m_regions.size() < index + 1)
    82             m_regions.grow(index + 1);
     113        if (m_touchActionRegions.size() < index + 1)
     114            m_touchActionRegions.grow(index + 1);
    83115    }
    84116
    85     for (unsigned i = 0; i < m_regions.size(); ++i) {
     117    for (unsigned i = 0; i < m_touchActionRegions.size(); ++i) {
    86118        auto regionTouchAction = toTouchAction(i);
    87119        if (touchActions.contains(regionTouchAction))
    88             m_regions[i].unite(touchRegion);
     120            m_touchActionRegions[i].unite(touchRegion);
    89121        else
    90             m_regions[i].subtract(touchRegion);
     122            m_touchActionRegions[i].subtract(touchRegion);
    91123    }
    92124}
    93125
    94 OptionSet<TouchAction> TouchActionRegion::actionsForPoint(const IntPoint& point) const
     126OptionSet<TouchAction> EventRegion::touchActionsForPoint(const IntPoint& point) const
    95127{
    96128    OptionSet<TouchAction> actions;
    97129
    98     for (unsigned i = 0; i < m_regions.size(); ++i) {
    99         if (m_regions[i].contains(point)) {
     130    for (unsigned i = 0; i < m_touchActionRegions.size(); ++i) {
     131        if (m_touchActionRegions[i].contains(point)) {
    100132            auto action = toTouchAction(i);
    101133            actions.add(action);
     
    106138
    107139    return actions;
    108 }
    109 
    110 void TouchActionRegion::translate(const IntSize& offset)
    111 {
    112     for (auto& region : m_regions)
    113         region.translate(offset);
    114140}
    115141
     
    134160}
    135161
    136 TextStream& operator<<(TextStream& ts, const TouchActionRegion& touchActionRegion)
     162#endif
     163
     164TextStream& operator<<(TextStream& ts, const EventRegion& eventRegion)
    137165{
    138     ts << "\n";
    139     {
    140         for (unsigned i = 0; i < touchActionRegion.m_regions.size(); ++i) {
    141             if (touchActionRegion.m_regions[i].isEmpty())
     166    ts << eventRegion.m_region;
     167
     168#if ENABLE(POINTER_EVENTS)
     169    if (!eventRegion.m_touchActionRegions.isEmpty()) {
     170        TextStream::IndentScope indentScope(ts);
     171        ts << indent << "(touch-action\n";
     172        for (unsigned i = 0; i < eventRegion.m_touchActionRegions.size(); ++i) {
     173            if (eventRegion.m_touchActionRegions[i].isEmpty())
    142174                continue;
    143175            TextStream::IndentScope indentScope(ts);
    144176            ts << indent << "(" << toTouchAction(i);
    145             ts << indent << touchActionRegion.m_regions[i] << ")\n";
     177            ts << indent << eventRegion.m_touchActionRegions[i];
     178            ts << indent << ")\n";
    146179        }
     180        ts << indent << ")\n";
    147181    }
    148     ts << indent;
     182#endif
    149183
    150184    return ts;
     
    152186
    153187}
    154 
    155 #endif
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r243488 r243962  
    3030#include "Editor.h"
    3131#include "EllipsisBox.h"
     32#include "EventRegion.h"
    3233#include "Frame.h"
    3334#include "GraphicsContext.h"
     
    505506    if (paintInfo.phase == PaintPhase::EventRegion) {
    506507        if (visibleToHitTesting())
    507             paintInfo.eventRegion->unite(enclosingIntRect(boxRect));
     508            paintInfo.eventRegion->unite(enclosingIntRect(boxRect), renderer().style());
    508509        return;
    509510    }
  • trunk/Source/WebCore/rendering/PaintInfo.h

    r243893 r243962  
    3838namespace WebCore {
    3939
     40class EventRegion;
    4041class OverlapTestRequestClient;
    41 class Region;
    4242class RenderInline;
    4343class RenderLayer;
     
    4545class RenderObject;
    4646
    47 #if ENABLE(POINTER_EVENTS)
    48 class TouchActionRegion;
    49 #endif
    50    
    5147typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap;
    5248
     
    135131    bool requireSecurityOriginAccessForWidgets { false };
    136132    const RenderLayer* m_enclosingSelfPaintingLayer { nullptr };
    137     Region* eventRegion { nullptr }; // For PaintPhase::EventRegion.
    138 #if ENABLE(POINTER_EVENTS)
    139     TouchActionRegion* touchActionRegion { nullptr };
    140 #endif
     133    EventRegion* eventRegion { nullptr }; // For PaintPhase::EventRegion.
    141134private:
    142135    GraphicsContext* m_context;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r243893 r243962  
    2929#include "Editor.h"
    3030#include "Element.h"
     31#include "EventRegion.h"
    3132#include "FloatQuad.h"
    3233#include "Frame.h"
     
    7172#include "ShadowRoot.h"
    7273#include "ShapeOutsideInfo.h"
    73 #include "TouchActionRegion.h"
    7474#include "TransformState.h"
    7575#include <wtf/IsoMallocInlines.h>
     
    12471247        if (visibleToHitTesting()) {
    12481248            auto borderRegion = approximateAsRegion(style().getRoundedBorderFor(borderRect));
    1249             paintInfo.eventRegion->unite(borderRegion);
    1250 #if ENABLE(POINTER_EVENTS)
    1251             if (paintInfo.touchActionRegion)
    1252                 paintInfo.touchActionRegion->unite(borderRegion, style().effectiveTouchActions());
    1253 #endif
     1249            paintInfo.eventRegion->unite(borderRegion, style());
    12541250        }
    12551251
    12561252        // No need to check descendants if we don't have overflow and the area is already covered.
    12571253        bool needsTraverseDescendants = hasVisualOverflow() || !paintInfo.eventRegion->contains(enclosingIntRect(borderRect));
    1258 #if ENABLE(POINTER_EVENTS)
    1259         needsTraverseDescendants = needsTraverseDescendants || paintInfo.touchActionRegion;
     1254#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
     1255        needsTraverseDescendants = needsTraverseDescendants || document().touchActionElements();
    12601256#endif
    12611257        if (!needsTraverseDescendants)
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r243926 r243962  
    48924892        PaintInfo paintInfo(context, fragment.foregroundRect.rect(), PaintPhase::EventRegion, { });
    48934893        paintInfo.eventRegion = localPaintingInfo.eventRegion;
    4894 #if ENABLE(POINTER_EVENTS)
    4895         paintInfo.touchActionRegion = localPaintingInfo.touchActionRegion;
    4896 #endif
    48974894        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
    48984895    }
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r243926 r243962  
    6464class ClipRects;
    6565class ClipRectsCache;
     66class EventRegion;
    6667class HitTestRequest;
    6768class HitTestResult;
     
    8081class Scrollbar;
    8182class TransformationMatrix;
    82 
    83 #if ENABLE(POINTER_EVENTS)
    84 class TouchActionRegion;
    85 #endif
    8683
    8784enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForBorderRadius };
     
    917914        bool requireSecurityOriginAccessForWidgets;
    918915        bool clipToDirtyRect { true };
    919         Region* eventRegion { nullptr };
    920 #if ENABLE(POINTER_EVENTS)
    921         TouchActionRegion* touchActionRegion { nullptr };
    922 #endif
     916        EventRegion* eventRegion { nullptr };
    923917    };
    924918
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r243919 r243962  
    3535#include "Chrome.h"
    3636#include "DocumentTimeline.h"
     37#include "EventRegion.h"
    3738#include "Frame.h"
    3839#include "FrameView.h"
     
    5253#include "PluginViewBase.h"
    5354#include "ProgressTracker.h"
    54 #include "Region.h"
    5555#include "RenderFragmentContainer.h"
    5656#include "RenderFragmentedFlow.h"
     
    14501450    RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, compositedBounds(), { }, LayoutSize());
    14511451
    1452     Region eventRegion;
     1452    EventRegion eventRegion;
    14531453    paintingInfo.eventRegion = &eventRegion;
    1454 
    1455 #if ENABLE(POINTER_EVENTS)
    1456     TouchActionRegion touchActionRegion;
    1457     if (hasTouchActionElements)
    1458         paintingInfo.touchActionRegion = &touchActionRegion;
    1459 #endif
    14601454
    14611455    auto paintFlags = RenderLayer::paintLayerPaintingCompositingAllPhasesFlags() | RenderLayer::PaintLayerCollectingEventRegion;
     
    14661460    m_graphicsLayer->setEventRegion(WTFMove(eventRegion));
    14671461
    1468 #if ENABLE(POINTER_EVENTS)
    1469     touchActionRegion.translate(contentOffset);
    1470     m_graphicsLayer->setTouchActionRegion(WTFMove(touchActionRegion));
    1471 #endif
    14721462#endif
    14731463}
  • trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp

    r243151 r243962  
    2727
    2828#include "RenderLayer.h"
     29#include "RenderLayerBacking.h"
    2930#include "RenderLayerCompositor.h"
    3031#include "RenderView.h"
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp

    r243660 r243962  
    2929#include "BidiRun.h"
    3030#include "BidiRunList.h"
     31#include "EventRegion.h"
    3132#include "FontCache.h"
    3233#include "Frame.h"
     
    8485        for (auto run : layout.runResolver().rangeForRect(paintRect)) {
    8586            FloatRect visualOverflowRect = computeOverflow(flow, run.rect());
    86             paintInfo.eventRegion->unite(enclosingIntRect(visualOverflowRect));
     87            paintInfo.eventRegion->unite(enclosingIntRect(visualOverflowRect), flow.style());
    8788        }
    8889        return;
  • trunk/Source/WebKit/ChangeLog

    r243961 r243962  
     12019-04-06  Antti Koivisto  <antti@apple.com>
     2
     3        Combine event and touch action regions into a single class
     4        https://bugs.webkit.org/show_bug.cgi?id=196644
     5        <rdar://problem/49643614>
     6
     7        Reviewed by Darin Adler.
     8
     9        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
     10        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
     11        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
     12        * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
     13        (WebKit::RemoteLayerTreeNode::eventRegion const):
     14        * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
     15        (WebKit::RemoteLayerTreeNode::setEventRegion):
     16        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
     17        (WebKit::PlatformCALayerRemote::setEventRegion):
     18        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
     19
    1202019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
    221
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h

    r243460 r243962  
    171171        bool contentsHidden;
    172172        bool userInteractionEnabled;
    173         WebCore::Region eventRegion;
     173        WebCore::EventRegion eventRegion;
    174174    };
    175175
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm

    r243460 r243962  
    3232#import "WebCoreArgumentCoders.h"
    3333#import <QuartzCore/QuartzCore.h>
     34#import <WebCore/EventRegion.h>
    3435#import <WebCore/LengthFunctions.h>
    35 #import <WebCore/Region.h>
    3636#import <WebCore/TimingFunction.h>
    3737#import <wtf/text/CString.h>
     
    509509
    510510    if (result.changedProperties & EventRegionChanged) {
    511         Optional<WebCore::Region> eventRegion;
     511        Optional<WebCore::EventRegion> eventRegion;
    512512        decoder >> eventRegion;
    513513        if (!eventRegion)
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h

    r243380 r243962  
    5757    WebCore::GraphicsLayer::PlatformLayerID layerID() const { return m_layerID; }
    5858
    59     const WebCore::Region& eventRegion() const { return m_eventRegion; }
    60     void setEventRegion(const WebCore::Region&);
     59    const WebCore::EventRegion& eventRegion() const { return m_eventRegion; }
     60    void setEventRegion(const WebCore::EventRegion&);
    6161
    6262    // If empty the layer is scrolled normally by an ancestor scroller.
     
    8282#endif
    8383
    84     WebCore::Region m_eventRegion;
     84    WebCore::EventRegion m_eventRegion;
    8585
    8686    Vector<WebCore::GraphicsLayer::PlatformLayerID> m_relatedScrollContainerIDs;
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm

    r243380 r243962  
    8888}
    8989
    90 void RemoteLayerTreeNode::setEventRegion(const WebCore::Region& eventRegion)
     90void RemoteLayerTreeNode::setEventRegion(const WebCore::EventRegion& eventRegion)
    9191{
    9292    m_eventRegion = eventRegion;
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp

    r243007 r243962  
    3333#import "RemoteLayerTreePropertyApplier.h"
    3434#import <WebCore/AnimationUtilities.h>
     35#import <WebCore/EventRegion.h>
    3536#import <WebCore/GraphicsContext.h>
    3637#import <WebCore/GraphicsLayerCA.h>
     
    872873}
    873874
    874 void PlatformCALayerRemote::setEventRegion(const WebCore::Region& eventRegion)
     875void PlatformCALayerRemote::setEventRegion(const WebCore::EventRegion& eventRegion)
    875876{
    876877    if (m_properties.eventRegion == eventRegion)
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h

    r243007 r243962  
    175175    void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) override;
    176176
    177     void setEventRegion(const WebCore::Region&) override;
     177    void setEventRegion(const WebCore::EventRegion&) override;
    178178
    179179    WebCore::GraphicsLayer::EmbeddedViewID embeddedViewID() const override;
Note: See TracChangeset for help on using the changeset viewer.