Skip to content

Commit

Permalink
Rename RenderStyle effectivePointerEvents() to usedPointerEvents() & …
Browse files Browse the repository at this point in the history
…effectiveTouchActions() to usedTouchActions()

https://bugs.webkit.org/show_bug.cgi?id=270743

Reviewed by Tim Nguyen.

This aligns them with terminology used in CSS standards.

* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::interactionRegionForRenderedRegion):
* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegion::unite):
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):
* Source/WebCore/rendering/RenderElementInlines.h:
(WebCore::RenderElement::visibleToHitTesting const):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStyleChanged):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::conservativelyCollectChangedAnimatableProperties const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::usedPointerEvents const):
(WebCore::RenderStyle::usedTouchActions const):
(WebCore::RenderStyle::effectivePointerEvents const): Deleted.
(WebCore::RenderStyle::effectiveTouchActions const): Deleted.
* Source/WebCore/rendering/style/RenderStyleSetters.h:
(WebCore::RenderStyle::setUsedTouchActions):
(WebCore::RenderStyle::setEffectiveTouchActions): Deleted.
* Source/WebCore/rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* Source/WebCore/rendering/style/StyleRareInheritedData.h:
* Source/WebCore/rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::checkIntersection):
(WebCore::RenderSVGModelObject::checkEnclosure):
* Source/WebCore/rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::nodeAtPoint):
* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::nodeAtFloatPoint):
* Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::nodeAtPoint):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.cpp:
(WebCore::LegacyRenderSVGImage::nodeAtFloatPoint):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGModelObject.cpp:
(WebCore::LegacyRenderSVGModelObject::checkIntersection):
(WebCore::LegacyRenderSVGModelObject::checkEnclosure):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp:
(WebCore::LegacyRenderSVGShape::nodeAtFloatPoint):
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::computeUsedTouchActions):
(WebCore::Style::Adjuster::adjust const):
(WebCore::Style::computeEffectiveTouchActions): Deleted.

Canonical link: https://commits.webkit.org/275881@main
  • Loading branch information
annevk committed Mar 9, 2024
1 parent 88fcdec commit 0e54094
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Source/WebCore/page/InteractionRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ std::optional<InteractionRegion> interactionRegionForRenderedRegion(RenderObject
return std::nullopt;
auto& renderer = *matchedElement->renderer();

if (renderer.style().effectivePointerEvents() == PointerEvents::None)
if (renderer.style().usedPointerEvents() == PointerEvents::None)
return std::nullopt;

bool isOriginalMatch = matchedElement == originalElement;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/EventRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,13 @@ EventRegion::EventRegion(Region&& region

void EventRegion::unite(const Region& region, const RenderStyle& style, bool overrideUserModifyIsEditable)
{
if (style.effectivePointerEvents() == PointerEvents::None)
if (style.usedPointerEvents() == PointerEvents::None)
return;

m_region.unite(region);

#if ENABLE(TOUCH_ACTION_REGIONS)
uniteTouchActions(region, style.effectiveTouchActions());
uniteTouchActions(region, style.usedTouchActions());
#endif

#if ENABLE(WHEEL_EVENT_REGIONS)
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/RenderElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,10 +881,10 @@ void RenderElement::styleWillChange(StyleDifference diff, const RenderStyle& new
}

auto needsInvalidateEventRegion = [&] {
if (m_style.effectivePointerEvents() != newStyle.effectivePointerEvents())
if (m_style.usedPointerEvents() != newStyle.usedPointerEvents())
return true;
#if ENABLE(TOUCH_ACTION_REGIONS)
if (m_style.effectiveTouchActions() != newStyle.effectiveTouchActions())
if (m_style.usedTouchActions() != newStyle.usedTouchActions())
return true;
#endif
if (m_style.eventListenerRegionTypes() != newStyle.eventListenerRegionTypes())
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderElementInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ inline bool RenderElement::visibleToHitTesting(const std::optional<HitTestReques
{
return style().visibility() == Visibility::Visible
&& !isSkippedContent()
&& ((request && request->ignoreCSSPointerEventsProperty()) || style().effectivePointerEvents() != PointerEvents::None);
&& ((request && request->ignoreCSSPointerEventsProperty()) || style().usedPointerEvents() != PointerEvents::None);
}

inline int adjustForAbsoluteZoom(int value, const RenderElement& renderer)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderLayerCompositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,7 @@ void RenderLayerCompositor::layerStyleChanged(StyleDifference diff, RenderLayer&

if (diff >= StyleDifference::RecompositeLayer) {
if (layer.isComposited()) {
bool hitTestingStateChanged = oldStyle && (oldStyle->effectivePointerEvents() != newStyle.effectivePointerEvents());
bool hitTestingStateChanged = oldStyle && (oldStyle->usedPointerEvents() != newStyle.usedPointerEvents());
if (is<RenderWidget>(layer.renderer()) || hitTestingStateChanged) {
// For RenderWidgets this is necessary to get iframe layers hooked up in response to scheduleInvalidateStyleAndLayerComposition().
layer.setNeedsCompositingConfigurationUpdate();
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/style/RenderStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@ void RenderStyle::conservativelyCollectChangedAnimatableProperties(const RenderS
// textSizeAdjust
// userSelect
// isInSubtreeWithBlendMode
// effectiveTouchActions
// usedTouchActions
// eventListenerRegionTypes
// effectiveInert
// effectiveContentVisibility
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/rendering/style/RenderStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ class RenderStyle {
inline LineAlign lineAlign() const;

PointerEvents pointerEvents() const { return static_cast<PointerEvents>(m_inheritedFlags.pointerEvents); }
inline PointerEvents effectivePointerEvents() const;
inline PointerEvents usedPointerEvents() const;

inline const Vector<Ref<ScrollTimeline>>& scrollTimelines() const;
inline const Vector<ScrollAxis>& scrollTimelineAxes() const;
Expand Down Expand Up @@ -994,7 +994,7 @@ class RenderStyle {

inline OptionSet<TouchAction> touchActions() const;
// 'touch-action' behavior depends on values in ancestors. We use an additional inherited property to implement that.
inline OptionSet<TouchAction> effectiveTouchActions() const;
inline OptionSet<TouchAction> usedTouchActions() const;
inline OptionSet<EventListenerRegionType> eventListenerRegionTypes() const;

inline bool effectiveInert() const;
Expand Down Expand Up @@ -1544,7 +1544,7 @@ class RenderStyle {
inline void setInitialLetter(const IntSize&);

inline void setTouchActions(OptionSet<TouchAction>);
inline void setEffectiveTouchActions(OptionSet<TouchAction>);
inline void setUsedTouchActions(OptionSet<TouchAction>);
inline void setEventListenerRegionTypes(OptionSet<EventListenerRegionType>);

inline void setEffectiveInert(bool);
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/style/RenderStyleInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ inline CursorList* RenderStyle::cursors() const { return m_rareInheritedData->cu
inline StyleAppearance RenderStyle::usedAppearance() const { return static_cast<StyleAppearance>(m_nonInheritedData->miscData->usedAppearance); }
inline OptionSet<Containment> RenderStyle::effectiveContainment() const { return m_nonInheritedData->rareData->effectiveContainment(); }
inline bool RenderStyle::effectiveInert() const { return m_rareInheritedData->effectiveInert; }
inline PointerEvents RenderStyle::effectivePointerEvents() const { return effectiveInert() ? PointerEvents::None : pointerEvents(); }
inline PointerEvents RenderStyle::usedPointerEvents() const { return effectiveInert() ? PointerEvents::None : pointerEvents(); }
inline CSSPropertyID RenderStyle::effectiveStrokeColorProperty() const { return hasExplicitlySetStrokeColor() ? CSSPropertyStrokeColor : CSSPropertyWebkitTextStrokeColor; }
inline OptionSet<TouchAction> RenderStyle::effectiveTouchActions() const { return m_rareInheritedData->effectiveTouchActions; }
inline OptionSet<TouchAction> RenderStyle::usedTouchActions() const { return m_rareInheritedData->usedTouchActions; }
inline UserModify RenderStyle::usedUserModify() const { return effectiveInert() ? UserModify::ReadOnly : userModify(); }
inline float RenderStyle::effectiveZoom() const { return m_rareInheritedData->effectiveZoom; }
inline OptionSet<EventListenerRegionType> RenderStyle::eventListenerRegionTypes() const { return m_rareInheritedData->eventListenerRegionTypes; }
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/style/RenderStyleSetters.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ inline void RenderStyle::setContainerType(ContainerType type) { SET_NESTED(m_non
inline void RenderStyle::setContentVisibility(ContentVisibility value) { SET_NESTED(m_nonInheritedData, rareData, contentVisibility, static_cast<unsigned>(value)); }
inline void RenderStyle::setUsedAppearance(StyleAppearance a) { SET_NESTED(m_nonInheritedData, miscData, usedAppearance, static_cast<unsigned>(a)); }
inline void RenderStyle::setEffectiveInert(bool effectiveInert) { SET(m_rareInheritedData, effectiveInert, effectiveInert); }
inline void RenderStyle::setEffectiveTouchActions(OptionSet<TouchAction> touchActions) { SET(m_rareInheritedData, effectiveTouchActions, touchActions); }
inline void RenderStyle::setUsedTouchActions(OptionSet<TouchAction> touchActions) { SET(m_rareInheritedData, usedTouchActions, touchActions); }
inline void RenderStyle::setEventListenerRegionTypes(OptionSet<EventListenerRegionType> eventListenerTypes) { SET(m_rareInheritedData, eventListenerRegionTypes, eventListenerTypes); }
inline void RenderStyle::setFilter(const FilterOperations& ops) { SET_DOUBLY_NESTED(m_nonInheritedData, miscData, filter, operations, ops); }
inline void RenderStyle::setFlexBasis(Length&& length) { SET_DOUBLY_NESTED(m_nonInheritedData, miscData, flexibleBox, flexBasis, WTFMove(length)); }
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ StyleRareInheritedData::StyleRareInheritedData()
, effectiveInert(false)
, isInSubtreeWithBlendMode(false)
, effectiveContentVisibility(static_cast<unsigned>(ContentVisibility::Visible))
, effectiveTouchActions(RenderStyle::initialTouchActions())
, usedTouchActions(RenderStyle::initialTouchActions())
, strokeWidth(RenderStyle::initialStrokeWidth())
, strokeColor(RenderStyle::initialStrokeColor())
#if ENABLE(DARK_MODE_CSS)
Expand Down Expand Up @@ -229,7 +229,7 @@ inline StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedDa
, effectiveInert(o.effectiveInert)
, isInSubtreeWithBlendMode(o.isInSubtreeWithBlendMode)
, effectiveContentVisibility(o.effectiveContentVisibility)
, effectiveTouchActions(o.effectiveTouchActions)
, usedTouchActions(o.usedTouchActions)
, eventListenerRegionTypes(o.eventListenerRegionTypes)
, strokeWidth(o.strokeWidth)
, strokeColor(o.strokeColor)
Expand Down Expand Up @@ -349,7 +349,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
&& hasVisitedLinkAutoCaretColor == o.hasVisitedLinkAutoCaretColor
&& hasAutoAccentColor == o.hasAutoAccentColor
&& isInSubtreeWithBlendMode == o.isInSubtreeWithBlendMode
&& effectiveTouchActions == o.effectiveTouchActions
&& usedTouchActions == o.usedTouchActions
&& eventListenerRegionTypes == o.eventListenerRegionTypes
&& effectiveInert == o.effectiveInert
&& effectiveContentVisibility == o.effectiveContentVisibility
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/style/StyleRareInheritedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class StyleRareInheritedData : public RefCounted<StyleRareInheritedData> {

unsigned effectiveContentVisibility : 2; // ContentVisibility

OptionSet<TouchAction> effectiveTouchActions;
OptionSet<TouchAction> usedTouchActions;
OptionSet<EventListenerRegionType> eventListenerRegionTypes;

Length strokeWidth;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static bool isGraphicsElement(const RenderElement& renderer)

bool RenderSVGModelObject::checkIntersection(RenderElement* renderer, const FloatRect& rect)
{
if (!renderer || renderer->style().effectivePointerEvents() == PointerEvents::None)
if (!renderer || renderer->style().usedPointerEvents() == PointerEvents::None)
return false;
if (!isGraphicsElement(*renderer))
return false;
Expand All @@ -233,7 +233,7 @@ bool RenderSVGModelObject::checkIntersection(RenderElement* renderer, const Floa

bool RenderSVGModelObject::checkEnclosure(RenderElement* renderer, const FloatRect& rect)
{
if (!renderer || renderer->style().effectivePointerEvents() == PointerEvents::None)
if (!renderer || renderer->style().usedPointerEvents() == PointerEvents::None)
return false;
if (!isGraphicsElement(*renderer))
return false;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/svg/RenderSVGShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ bool RenderSVGShape::nodeAtPoint(const HitTestRequest& request, HitTestResult& r
if (!pointInSVGClippingArea(localPoint))
return false;

PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGPath, request, style().effectivePointerEvents());
PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGPath, request, style().usedPointerEvents());
bool isVisible = (style().visibility() == Visibility::Visible);
if (isVisible || !hitRules.requireVisible) {
const SVGRenderStyle& svgStyle = style().svgStyle();
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/svg/RenderSVGText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul
#if ENABLE(LAYER_BASED_SVG_ENGINE)
ASSERT(!document().settings().layerBasedSVGEngineEnabled());
#endif
PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGText, request, style().effectivePointerEvents());
PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGText, request, style().usedPointerEvents());
bool isVisible = (style().visibility() == Visibility::Visible);
if (isVisible || !hitRules.requireVisible) {
if ((hitRules.canHitStroke && (style().svgStyle().hasStroke() || !hitRules.requireStroke))
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ bool SVGInlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult&
// FIXME: integrate with LegacyInlineTextBox::nodeAtPoint better.
ASSERT(!isLineBreak());

PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGText, request, renderer().style().effectivePointerEvents());
PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGText, request, renderer().style().usedPointerEvents());
bool isVisible = renderer().style().visibility() == Visibility::Visible;
if (isVisible || !hitRules.requireVisible) {
if ((hitRules.canHitStroke && (renderer().style().svgStyle().hasStroke() || !hitRules.requireStroke))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ bool LegacyRenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTe
if (hitTestAction != HitTestForeground)
return false;

PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGImage, request, style().effectivePointerEvents());
PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGImage, request, style().usedPointerEvents());
bool isVisible = (style().visibility() == Visibility::Visible);
if (isVisible || !hitRules.requireVisible) {
static NeverDestroyed<SVGVisitedRendererTracking::VisitedSet> s_visitedSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void LegacyRenderSVGModelObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads

bool LegacyRenderSVGModelObject::checkIntersection(RenderElement* renderer, const FloatRect& rect)
{
if (!renderer || renderer->style().effectivePointerEvents() == PointerEvents::None)
if (!renderer || renderer->style().usedPointerEvents() == PointerEvents::None)
return false;
if (!isGraphicsElement(*renderer))
return false;
Expand All @@ -208,7 +208,7 @@ bool LegacyRenderSVGModelObject::checkIntersection(RenderElement* renderer, cons

bool LegacyRenderSVGModelObject::checkEnclosure(RenderElement* renderer, const FloatRect& rect)
{
if (!renderer || renderer->style().effectivePointerEvents() == PointerEvents::None)
if (!renderer || renderer->style().usedPointerEvents() == PointerEvents::None)
return false;
if (!isGraphicsElement(*renderer))
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ bool LegacyRenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTe

SVGVisitedRendererTracking::Scope recursionScope(recursionTracking, *this);

PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGPath, request, style().effectivePointerEvents());
PointerEventsHitRules hitRules(PointerEventsHitRules::HitTestingTargetType::SVGPath, request, style().usedPointerEvents());
bool isVisible = (style().visibility() == Visibility::Visible);
if (isVisible || !hitRules.requireVisible) {
const SVGRenderStyle& svgStyle = style().svgStyle();
Expand Down
16 changes: 8 additions & 8 deletions Source/WebCore/style/StyleAdjuster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static bool isScrollableOverflow(Overflow overflow)
return overflow == Overflow::Scroll || overflow == Overflow::Auto;
}

static OptionSet<TouchAction> computeEffectiveTouchActions(const RenderStyle& style, OptionSet<TouchAction> effectiveTouchActions)
static OptionSet<TouchAction> computeUsedTouchActions(const RenderStyle& style, OptionSet<TouchAction> usedTouchActions)
{
// https://w3c.github.io/pointerevents/#determining-supported-touch-behavior
// "A touch behavior is supported if it conforms to the touch-action property of each element between
Expand All @@ -275,22 +275,22 @@ static OptionSet<TouchAction> computeEffectiveTouchActions(const RenderStyle& st

bool hasDefaultTouchBehavior = isScrollableOverflow(style.overflowX()) || isScrollableOverflow(style.overflowY());
if (hasDefaultTouchBehavior)
effectiveTouchActions = RenderStyle::initialTouchActions();
usedTouchActions = RenderStyle::initialTouchActions();

auto touchActions = style.touchActions();
if (touchActions == RenderStyle::initialTouchActions())
return effectiveTouchActions;
return usedTouchActions;

if (effectiveTouchActions.contains(TouchAction::None))
if (usedTouchActions.contains(TouchAction::None))
return { TouchAction::None };

if (effectiveTouchActions.containsAny({ TouchAction::Auto, TouchAction::Manipulation }))
if (usedTouchActions.containsAny({ TouchAction::Auto, TouchAction::Manipulation }))
return touchActions;

if (touchActions.containsAny({ TouchAction::Auto, TouchAction::Manipulation }))
return effectiveTouchActions;
return usedTouchActions;

auto sharedTouchActions = effectiveTouchActions & touchActions;
auto sharedTouchActions = usedTouchActions & touchActions;
if (sharedTouchActions.isEmpty())
return { TouchAction::None };

Expand Down Expand Up @@ -713,7 +713,7 @@ void Adjuster::adjust(RenderStyle& style, const RenderStyle* userAgentAppearance
if (m_parentBoxStyle.justifyItems().positionType() == ItemPositionType::Legacy && style.justifyItems().position() == ItemPosition::Legacy)
style.setJustifyItems(m_parentBoxStyle.justifyItems());

style.setEffectiveTouchActions(computeEffectiveTouchActions(style, m_parentStyle.effectiveTouchActions()));
style.setUsedTouchActions(computeUsedTouchActions(style, m_parentStyle.usedTouchActions()));

// Counterparts in Element::addToTopLayer/removeFromTopLayer & SharingResolver::canShareStyleWithElement need to match!
auto hasInertAttribute = [] (const Element* element) -> bool {
Expand Down

0 comments on commit 0e54094

Please sign in to comment.