Changeset 243893 in webkit


Ignore:
Timestamp:
Apr 4, 2019 1:28:46 PM (5 years ago)
Author:
Antti Koivisto
Message:

Compute accurate regions for touch-action
https://bugs.webkit.org/show_bug.cgi?id=196536
<rdar://problem/49516022>

Reviewed by Simon Fraser.

Source/WebCore:

Tests: pointerevents/ios/touch-action-region-basic.html

pointerevents/ios/touch-action-region-layers.html
pointerevents/ios/touch-action-region-pan-x-y.html

  • Use style system to compute effective touch-action without additional tree walks.
  • Compute touch-action region in a fake paint, at the same time with the event region.

This patch doesn't yet use the computed region for anything except test output.

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • css/StyleResolver.cpp:

(WebCore::computeEffectiveTouchActions):
(WebCore::StyleResolver::adjustRenderStyle):

Update RenderStyle::effectiveTouchAction.

  • dom/Element.cpp:

(WebCore::Element::computedTouchActions const):

Just get it from the style.

  • platform/graphics/GraphicsLayer.cpp:

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

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::touchActionRegion const):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::setTouchActionRegion):

  • platform/graphics/ca/GraphicsLayerCA.h:
  • rendering/PaintInfo.h:
  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::paintObject):

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::collectEventRegionForFragments):

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

(WebCore::RenderLayerBacking::updateConfiguration):

Need to do this for the top compositing layer too.

(WebCore::RenderLayerBacking::updateEventRegion):

Compute touch-action region too.
As a basic optimization avoid doing any extra work if there are no elements with non-default touch-action property.

  • rendering/TouchActionRegion.cpp: Added.

(WebCore::toIndex):
(WebCore::toTouchAction):
(WebCore::toString):
(WebCore::TouchActionRegion::unite):
(WebCore::TouchActionRegion::actionsForPoint const):
(WebCore::TouchActionRegion::translate):
(WebCore::operator<<):

  • rendering/TouchActionRegion.h: Added.

Class for collecting and maintaining touch-action region.

(WebCore::TouchActionRegion::isEmpty const):
(WebCore::TouchActionRegion::operator== const):

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::effectiveTouchActions const):
(WebCore::RenderStyle::setEffectiveTouchActions):

Implement as inherited property for efficiency (touch-action itself is non-inherited).

  • rendering/style/StyleRareInheritedData.cpp:

(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):

  • rendering/style/StyleRareInheritedData.h:

LayoutTests:

  • pointerevents/ios/touch-action-region-basic-expected.txt: Added.
  • pointerevents/ios/touch-action-region-basic.html: Added.
  • pointerevents/ios/touch-action-region-layers-expected.txt: Added.
  • pointerevents/ios/touch-action-region-layers.html: Added.
  • pointerevents/ios/touch-action-region-pan-x-y-expected.txt: Added.
  • pointerevents/ios/touch-action-region-pan-x-y.html: Added.
Location:
trunk
Files:
8 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243883 r243893  
     12019-04-04  Antti Koivisto  <antti@apple.com>
     2
     3        Compute accurate regions for touch-action
     4        https://bugs.webkit.org/show_bug.cgi?id=196536
     5        <rdar://problem/49516022>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * pointerevents/ios/touch-action-region-basic-expected.txt: Added.
     10        * pointerevents/ios/touch-action-region-basic.html: Added.
     11        * pointerevents/ios/touch-action-region-layers-expected.txt: Added.
     12        * pointerevents/ios/touch-action-region-layers.html: Added.
     13        * pointerevents/ios/touch-action-region-pan-x-y-expected.txt: Added.
     14        * pointerevents/ios/touch-action-region-pan-x-y.html: Added.
     15
    1162019-04-04  Manuel Rego Casasnovas  <rego@igalia.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r243890 r243893  
     12019-04-04  Antti Koivisto  <antti@apple.com>
     2
     3        Compute accurate regions for touch-action
     4        https://bugs.webkit.org/show_bug.cgi?id=196536
     5        <rdar://problem/49516022>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Tests: pointerevents/ios/touch-action-region-basic.html
     10               pointerevents/ios/touch-action-region-layers.html
     11               pointerevents/ios/touch-action-region-pan-x-y.html
     12
     13        - Use style system to compute effective touch-action without additional tree walks.
     14        - Compute touch-action region in a fake paint, at the same time with the event region.
     15
     16        This patch doesn't yet use the computed region for anything except test output.
     17
     18        * Sources.txt:
     19        * WebCore.xcodeproj/project.pbxproj:
     20        * css/StyleResolver.cpp:
     21        (WebCore::computeEffectiveTouchActions):
     22        (WebCore::StyleResolver::adjustRenderStyle):
     23
     24        Update RenderStyle::effectiveTouchAction.
     25
     26        * dom/Element.cpp:
     27        (WebCore::Element::computedTouchActions const):
     28
     29        Just get it from the style.
     30
     31        * platform/graphics/GraphicsLayer.cpp:
     32        (WebCore::GraphicsLayer::setEventRegion):
     33        (WebCore::GraphicsLayer::setTouchActionRegion):
     34        (WebCore::GraphicsLayer::dumpProperties const):
     35        * platform/graphics/GraphicsLayer.h:
     36        (WebCore::GraphicsLayer::touchActionRegion const):
     37        * platform/graphics/ca/GraphicsLayerCA.cpp:
     38        (WebCore::GraphicsLayerCA::setTouchActionRegion):
     39        * platform/graphics/ca/GraphicsLayerCA.h:
     40        * rendering/PaintInfo.h:
     41        * rendering/RenderBlock.cpp:
     42        (WebCore::RenderBlock::paintObject):
     43        * rendering/RenderLayer.cpp:
     44        (WebCore::RenderLayer::collectEventRegionForFragments):
     45        * rendering/RenderLayer.h:
     46        * rendering/RenderLayerBacking.cpp:
     47        (WebCore::RenderLayerBacking::updateConfiguration):
     48
     49        Need to do this for the top compositing layer too.
     50
     51        (WebCore::RenderLayerBacking::updateEventRegion):
     52
     53        Compute touch-action region too.
     54        As a basic optimization avoid doing any extra work if there are no elements with non-default touch-action property.
     55
     56        * rendering/TouchActionRegion.cpp: Added.
     57        (WebCore::toIndex):
     58        (WebCore::toTouchAction):
     59        (WebCore::toString):
     60        (WebCore::TouchActionRegion::unite):
     61        (WebCore::TouchActionRegion::actionsForPoint const):
     62        (WebCore::TouchActionRegion::translate):
     63        (WebCore::operator<<):
     64        * rendering/TouchActionRegion.h: Added.
     65
     66        Class for collecting and maintaining touch-action region.
     67
     68        (WebCore::TouchActionRegion::isEmpty const):
     69        (WebCore::TouchActionRegion::operator== const):
     70        * rendering/style/RenderStyle.h:
     71        (WebCore::RenderStyle::effectiveTouchActions const):
     72        (WebCore::RenderStyle::setEffectiveTouchActions):
     73
     74        Implement as inherited property for efficiency (touch-action itself is non-inherited).
     75
     76        * rendering/style/StyleRareInheritedData.cpp:
     77        (WebCore::StyleRareInheritedData::StyleRareInheritedData):
     78        (WebCore::StyleRareInheritedData::operator== const):
     79        * rendering/style/StyleRareInheritedData.h:
     80
    1812019-04-04  Yusuke Suzuki  <ysuzuki@apple.com>
    282
  • trunk/Source/WebCore/Sources.txt

    r243887 r243893  
    20692069rendering/TextPaintStyle.cpp
    20702070rendering/TextPainter.cpp
     2071rendering/TouchActionRegion.cpp
    20712072rendering/TrailingFloatsRootInlineBox.cpp
    20722073
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r243890 r243893  
    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, ); }; };
    48254826                E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1517D1BB950009FB31 /* ElementIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
    48264827                E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1488414885                E4A814DD1C7338D100BF85AC /* IdChangeInvalidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdChangeInvalidation.cpp; sourceTree = "<group>"; };
    1488514886                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>"; };
    1488614889                E4AE7C1517D1BB950009FB31 /* ElementIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementIterator.h; sourceTree = "<group>"; };
    1488714890                E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementAncestorIterator.h; sourceTree = "<group>"; };
     
    2705527058                                E4C91A0F1802343900A17F6D /* TextPaintStyle.cpp */,
    2705627059                                E4C91A0D1802343100A17F6D /* TextPaintStyle.h */,
     27060                                E4A8D20C22538FC700A8463C /* TouchActionRegion.cpp */,
     27061                                E4A8D20F22538FD100A8463C /* TouchActionRegion.h */,
    2705727062                                1100FC6E1FDB3C4D00DD961B /* TrailingFloatsRootInlineBox.cpp */,
    2705827063                                37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */,
     
    2949629501                                FDA15EAE12B03EE1003A583A /* JSAudioListener.h in Headers */,
    2949729502                                FDA15EB012B03EE1003A583A /* JSAudioNode.h in Headers */,
     29503                                E4A8D21022538FD200A8463C /* TouchActionRegion.h in Headers */,
    2949829504                                FDA15EB412B03EE1003A583A /* JSAudioParam.h in Headers */,
    2949929505                                FDA15EB612B03EE1003A583A /* JSAudioProcessingEvent.h in Headers */,
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r243275 r243893  
    746746}
    747747
    748 #if ENABLE(OVERFLOW_SCROLLING_TOUCH)
     748#if ENABLE(OVERFLOW_SCROLLING_TOUCH) || ENABLE(POINTER_EVENTS)
    749749static bool isScrollableOverflow(Overflow overflow)
    750750{
     
    843843}
    844844
     845#if ENABLE(POINTER_EVENTS)
     846static OptionSet<TouchAction> computeEffectiveTouchActions(const RenderStyle& style, OptionSet<TouchAction> effectiveTouchActions)
     847{
     848    // https://w3c.github.io/pointerevents/#determining-supported-touch-behavior
     849    // "A touch behavior is supported if it conforms to the touch-action property of each element between
     850    // the hit tested element and its nearest ancestor with the default touch behavior (including both the
     851    // hit tested element and the element with the default touch behavior)."
     852
     853    bool hasDefaultTouchBehavior = isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY());
     854    if (hasDefaultTouchBehavior)
     855        effectiveTouchActions = RenderStyle::initialTouchActions();
     856
     857    auto touchActions = style.touchActions();
     858    if (touchActions == RenderStyle::initialTouchActions())
     859        return effectiveTouchActions;
     860
     861    if (effectiveTouchActions.contains(TouchAction::None))
     862        return { TouchAction::None };
     863
     864    if (effectiveTouchActions.contains(TouchAction::Auto) || effectiveTouchActions.contains(TouchAction::Manipulation))
     865        return touchActions;
     866
     867    auto sharedTouchActions = effectiveTouchActions & touchActions;
     868    if (sharedTouchActions.isEmpty())
     869        return { TouchAction::None };
     870
     871    return sharedTouchActions;
     872}
     873#endif
     874
    845875void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const Element* element)
    846876{
     
    10881118    if (parentBoxStyle->justifyItems().positionType() == ItemPositionType::Legacy && style.justifyItems().position() == ItemPosition::Legacy)
    10891119        style.setJustifyItems(parentBoxStyle->justifyItems());
     1120
     1121#if ENABLE(POINTER_EVENTS)
     1122    style.setEffectiveTouchActions(computeEffectiveTouchActions(style, parentStyle.effectiveTouchActions()));
     1123#endif
    10901124}
    10911125
  • trunk/Source/WebCore/dom/Element.cpp

    r243830 r243893  
    42204220OptionSet<TouchAction> Element::computedTouchActions() const
    42214221{
    4222     OptionSet<TouchAction> computedTouchActions = TouchAction::Auto;
    4223     for (auto* element = this; element; element = parentCrossingFrameBoundaries(element)) {
    4224         auto* renderer = element->renderer();
    4225         if (!renderer)
    4226             continue;
    4227 
    4228         auto touchActions = renderer->style().touchActions();
    4229 
    4230         // Once we've encountered touch-action: none, we know that this will be the computed value.
    4231         if (touchActions == TouchAction::None)
    4232             return touchActions;
    4233 
    4234         // If the computed touch-action so far was "auto", we can just use the current element's touch-action.
    4235         if (computedTouchActions == TouchAction::Auto) {
    4236             computedTouchActions = touchActions;
    4237             continue;
    4238         }
    4239 
    4240         // If the current element has touch-action: auto or the same touch-action as the computed touch-action,
    4241         // we need to keep going up the ancestry chain.
    4242         if (touchActions == TouchAction::Auto || touchActions == computedTouchActions)
    4243             continue;
    4244 
    4245         // Now, the element's touch-action and the computed touch-action are different and are neither "auto" nor "none".
    4246         if (computedTouchActions == TouchAction::Manipulation) {
    4247             // If the computed touch-action is "manipulation", we can take the current element's touch-action as the newly
    4248             // computed touch-action.
    4249             computedTouchActions = touchActions;
    4250         } else if (touchActions == TouchAction::Manipulation) {
    4251             // Otherwise, we have a restricted computed touch-action so far. If the current element's touch-action is "manipulation"
    4252             // then we can just keep going and leave the computed touch-action untouched.
    4253             continue;
    4254         }
    4255 
    4256         // In any other case, we have competing restrictive touch-action values that can only yield "none".
    4257         return TouchAction::None;
    4258     }
    4259     return computedTouchActions;
     4222    if (auto* style = renderOrDisplayContentsStyle())
     4223        return style->effectiveTouchActions();
     4224
     4225    return TouchAction::Auto;
    42604226}
    42614227
  • trunk/Source/WebCore/platform/TouchAction.h

    r243648 r243893  
    2828#if ENABLE(POINTER_EVENTS)
    2929
     30#include <wtf/text/TextStream.h>
     31
    3032namespace WebCore {
    3133
     
    3941};
    4042
     43TextStream& operator<<(TextStream&, TouchAction);
     44
    4145}
    4246
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r243674 r243893  
    414414void GraphicsLayer::setEventRegion(Region&& eventRegion)
    415415{
    416     m_eventRegion = eventRegion;
    417 }
     416    m_eventRegion = WTFMove(eventRegion);
     417}
     418
     419#if ENABLE(POINTER_EVENTS)
     420void GraphicsLayer::setTouchActionRegion(TouchActionRegion&& touchActionRegion)
     421{
     422    m_touchActionRegion = WTFMove(touchActionRegion);
     423}
     424#endif
    418425
    419426void GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants()
     
    927934    }
    928935
    929     if (behavior & LayerTreeAsTextIncludeEventRegion && !m_eventRegion.isEmpty())
    930         ts << indent << "(event region" << m_eventRegion << ")\n";
     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
     943    }
    931944
    932945    if (behavior & LayerTreeAsTextIncludePaintingPhases && paintingPhase()) {
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r243134 r243893  
    3838#include "Region.h"
    3939#include "ScrollableArea.h"
     40#include "TouchActionRegion.h"
    4041#include "TransformOperations.h"
    4142#include "WindRule.h"
     
    456457    const Region& eventRegion() const { return m_eventRegion; }
    457458    virtual void setEventRegion(Region&&);
    458 
     459#if ENABLE(POINTER_EVENTS)
     460    const TouchActionRegion& touchActionRegion() const { return m_touchActionRegion; }
     461    virtual void setTouchActionRegion(TouchActionRegion&&);
     462#endif
    459463    // Transitions are identified by a special animation name that cannot clash with a keyframe identifier.
    460464    static String animationNameForTransition(AnimatedPropertyID);
     
    732736
    733737    Region m_eventRegion;
    734 
     738#if ENABLE(POINTER_EVENTS)
     739    TouchActionRegion m_touchActionRegion;
     740#endif
    735741#if USE(CA)
    736742    WindRule m_shapeLayerWindRule { WindRule::NonZero };
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r243007 r243893  
    994994}
    995995
     996#if ENABLE(POINTER_EVENTS)
     997void 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
     1006
    9961007bool GraphicsLayerCA::shouldRepaintOnSizeChange() const
    9971008{
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r243007 r243893  
    126126
    127127    WEBCORE_EXPORT void setEventRegion(Region&&) override;
    128 
     128#if ENABLE(POINTER_EVENTS)
     129    WEBCORE_EXPORT void setTouchActionRegion(TouchActionRegion&&) override;
     130#endif
    129131    WEBCORE_EXPORT void suspendAnimations(MonotonicTime) override;
    130132    WEBCORE_EXPORT void resumeAnimations() override;
  • trunk/Source/WebCore/rendering/PaintInfo.h

    r242794 r243893  
    4545class RenderObject;
    4646
     47#if ENABLE(POINTER_EVENTS)
     48class TouchActionRegion;
     49#endif
     50   
    4751typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap;
    4852
     
    132136    const RenderLayer* m_enclosingSelfPaintingLayer { nullptr };
    133137    Region* eventRegion { nullptr }; // For PaintPhase::EventRegion.
    134 
     138#if ENABLE(POINTER_EVENTS)
     139    TouchActionRegion* touchActionRegion { nullptr };
     140#endif
    135141private:
    136142    GraphicsContext* m_context;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r243694 r243893  
    7171#include "ShadowRoot.h"
    7272#include "ShapeOutsideInfo.h"
     73#include "TouchActionRegion.h"
    7374#include "TransformState.h"
    7475#include <wtf/IsoMallocInlines.h>
     
    12471248            auto borderRegion = approximateAsRegion(style().getRoundedBorderFor(borderRect));
    12481249            paintInfo.eventRegion->unite(borderRegion);
     1250#if ENABLE(POINTER_EVENTS)
     1251            if (paintInfo.touchActionRegion)
     1252                paintInfo.touchActionRegion->unite(borderRegion, style().effectiveTouchActions());
     1253#endif
    12491254        }
    12501255
    12511256        // No need to check descendants if we don't have overflow and the area is already covered.
    1252         if (!hasVisualOverflow() && paintInfo.eventRegion->contains(enclosingIntRect(borderRect)))
     1257        bool needsTraverseDescendants = hasVisualOverflow() || !paintInfo.eventRegion->contains(enclosingIntRect(borderRect));
     1258#if ENABLE(POINTER_EVENTS)
     1259        needsTraverseDescendants = needsTraverseDescendants || paintInfo.touchActionRegion;
     1260#endif
     1261        if (!needsTraverseDescendants)
    12531262            return;
    12541263    }
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r243709 r243893  
    48714871        PaintInfo paintInfo(context, fragment.foregroundRect.rect(), PaintPhase::EventRegion, { });
    48724872        paintInfo.eventRegion = localPaintingInfo.eventRegion;
     4873#if ENABLE(POINTER_EVENTS)
     4874        paintInfo.touchActionRegion = localPaintingInfo.touchActionRegion;
     4875#endif
    48734876        renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelOffset));
    48744877    }
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r243709 r243893  
    8181class TransformationMatrix;
    8282
     83#if ENABLE(POINTER_EVENTS)
     84class TouchActionRegion;
     85#endif
     86
    8387enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForBorderRadius };
    8488enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf };
     
    915919        bool clipToDirtyRect { true };
    916920        Region* eventRegion { nullptr };
     921#if ENABLE(POINTER_EVENTS)
     922        TouchActionRegion* touchActionRegion { nullptr };
     923#endif
    917924    };
    918925
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r243151 r243893  
    766766        bool didUpdateContentsRect = false;
    767767        updateDirectlyCompositedBoxDecorations(contentsInfo, didUpdateContentsRect);
    768 
    769         updateEventRegion();
    770768    } else
    771769        updateRootLayerConfiguration();
     770
     771    updateEventRegion();
    772772   
    773773    // Requires layout.
     
    14401440        return;
    14411441
     1442    bool hasTouchActionElements = false;
     1443#if ENABLE(POINTER_EVENTS)
     1444    hasTouchActionElements = !!renderer().document().touchActionElements();
     1445#endif
     1446    if (m_owningLayer.isRenderViewLayer() && !hasTouchActionElements)
     1447        return;
     1448
    14421449    GraphicsContext nullContext(nullptr);
    14431450    RenderLayer::LayerPaintingInfo paintingInfo(&m_owningLayer, compositedBounds(), { }, LayoutSize());
     
    14461453    paintingInfo.eventRegion = &eventRegion;
    14471454
     1455#if ENABLE(POINTER_EVENTS)
     1456    TouchActionRegion touchActionRegion;
     1457    if (hasTouchActionElements)
     1458        paintingInfo.touchActionRegion = &touchActionRegion;
     1459#endif
     1460
    14481461    auto paintFlags = RenderLayer::paintLayerPaintingCompositingAllPhasesFlags() | RenderLayer::PaintLayerCollectingEventRegion;
    14491462    m_owningLayer.paintLayerContents(nullContext, paintingInfo, paintFlags);
    14501463
    1451     eventRegion.translate(roundedIntSize(contentOffsetInCompositingLayer()));
    1452 
     1464    auto contentOffset = roundedIntSize(contentOffsetInCompositingLayer());
     1465    eventRegion.translate(contentOffset);
    14531466    m_graphicsLayer->setEventRegion(WTFMove(eventRegion));
     1467
     1468#if ENABLE(POINTER_EVENTS)
     1469    touchActionRegion.translate(contentOffset);
     1470    m_graphicsLayer->setTouchActionRegion(WTFMove(touchActionRegion));
     1471#endif
    14541472#endif
    14551473}
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r243841 r243893  
    707707#if ENABLE(POINTER_EVENTS)
    708708    OptionSet<TouchAction> touchActions() const { return OptionSet<TouchAction>::fromRaw(m_rareNonInheritedData->touchActions); }
     709    // 'touch-action' behavior depends on values in ancestors. We use an additional inherited property to implement that.
     710    OptionSet<TouchAction> effectiveTouchActions() const { return OptionSet<TouchAction>::fromRaw(m_rareInheritedData->effectiveTouchActions); }
    709711#endif
    710712
     
    12261228#if ENABLE(POINTER_EVENTS)
    12271229    void setTouchActions(OptionSet<TouchAction> touchActions) { SET_VAR(m_rareNonInheritedData, touchActions, touchActions.toRaw()); }
     1230    void setEffectiveTouchActions(OptionSet<TouchAction> touchActions) { SET_VAR(m_rareInheritedData, effectiveTouchActions, touchActions.toRaw()); }
    12281231#endif
    12291232
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp

    r243819 r243893  
    138138    , hasSetStrokeWidth(false)
    139139    , hasSetStrokeColor(false)
     140#if ENABLE(POINTER_EVENTS)
     141    , effectiveTouchActions(static_cast<unsigned>(RenderStyle::initialTouchActions()))
     142#endif
    140143    , strokeWidth(RenderStyle::initialStrokeWidth())
    141144    , strokeColor(RenderStyle::initialStrokeColor())
     
    233236    , hasSetStrokeWidth(o.hasSetStrokeWidth)
    234237    , hasSetStrokeColor(o.hasSetStrokeColor)
     238#if ENABLE(POINTER_EVENTS)
     239    , effectiveTouchActions(o.effectiveTouchActions)
     240#endif
    235241    , strokeWidth(o.strokeWidth)
    236242    , strokeColor(o.strokeColor)
     
    355361        && hasSetStrokeWidth == o.hasSetStrokeWidth
    356362        && hasSetStrokeColor == o.hasSetStrokeColor
     363#if ENABLE(POINTER_EVENTS)
     364        && effectiveTouchActions == o.effectiveTouchActions
     365#endif
    357366        && strokeWidth == o.strokeWidth
    358367        && strokeColor == o.strokeColor
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h

    r243819 r243893  
    153153    unsigned hasSetStrokeWidth : 1;
    154154    unsigned hasSetStrokeColor : 1;
     155
     156#if ENABLE(POINTER_EVENTS)
     157    unsigned effectiveTouchActions : 6; // OptionSet<TouchAction>
     158#endif
     159
    155160    Length strokeWidth;
    156161    Color strokeColor;
Note: See TracChangeset for help on using the changeset viewer.