Changeset 261239 in webkit
- Timestamp:
- May 6, 2020 11:00:33 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r261236 r261239 1 2020-05-06 Antti Koivisto <antti@apple.com> 2 3 Add basic support for generating accurate wheel event listener region 4 https://bugs.webkit.org/show_bug.cgi?id=211512 5 6 Reviewed by Simon Fraser. 7 8 * fast/scrolling/mac/wheel-event-listener-region-basic-expected.txt: Added. 9 * fast/scrolling/mac/wheel-event-listener-region-basic.html: Added. 10 1 11 2020-05-06 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r261234 r261239 1 2020-05-06 Antti Koivisto <antti@apple.com> 2 3 Add basic support for generating accurate wheel event listener region 4 https://bugs.webkit.org/show_bug.cgi?id=211512 5 6 Reviewed by Simon Fraser. 7 8 Add fake properties for wheel event listeners to RenderStyle and use them to 9 generate regions in EventRegion. There is a separate region for non-passive 10 wheel event listeners (that will require synchronous handling). 11 12 The generated regions are not used for anything in this patch. 13 Style is not yet invalided on event listener additions and removals. 14 15 Test: fast/scrolling/mac/wheel-event-listener-region-basic.html 16 17 * dom/Node.h: 18 * rendering/EventRegion.cpp: 19 (WebCore::EventRegion::unite): 20 (WebCore::EventRegion::uniteEventListeners): 21 (WebCore::EventRegion::dump const): 22 * rendering/EventRegion.h: 23 * rendering/RenderLayerBacking.cpp: 24 (WebCore::RenderLayerBacking::updateEventRegion): 25 * rendering/style/RenderStyle.h: 26 (WebCore::RenderStyle::eventListenerRegionTypes const): 27 (WebCore::RenderStyle::setEventListenerRegionTypes): 28 * rendering/style/RenderStyleConstants.h: 29 * rendering/style/StyleRareInheritedData.cpp: 30 (WebCore::StyleRareInheritedData::StyleRareInheritedData): 31 (WebCore::StyleRareInheritedData::operator== const): 32 * rendering/style/StyleRareInheritedData.h: 33 * style/StyleAdjuster.cpp: 34 (WebCore::Style::computeEventListenerRegionTypes): 35 (WebCore::Style::Adjuster::adjust const): 36 1 37 2020-05-06 Darin Adler <darin@apple.com> 2 38 -
trunk/Source/WebCore/dom/Node.h
r260753 r261239 483 483 #endif 484 484 485 using EventTarget::eventTargetData; 485 486 EventTargetData* eventTargetData() final; 486 487 EventTargetData* eventTargetDataConcurrently() final; -
trunk/Source/WebCore/rendering/EventRegion.cpp
r261065 r261239 113 113 114 114 uniteTouchActions(region, style.effectiveTouchActions()); 115 uniteEventListeners(region, style.eventListenerRegionTypes()); 115 116 116 117 #if ENABLE(EDITABLE_REGION) … … 221 222 } 222 223 224 void EventRegion::uniteEventListeners(const Region& region, OptionSet<EventListenerRegionType> eventListenerRegionTypes) 225 { 226 if (eventListenerRegionTypes.contains(EventListenerRegionType::Wheel)) 227 m_wheelEventListenerRegion.unite(region); 228 if (eventListenerRegionTypes.contains(EventListenerRegionType::NonPassiveWheel)) 229 m_nonPassiveWheelEventListenerRegion.unite(region); 230 } 231 223 232 #if ENABLE(EDITABLE_REGION) 224 233 … … 243 252 ts << indent << "(" << toTouchAction(i); 244 253 ts << indent << m_touchActionRegions[i]; 254 ts << indent << ")\n"; 255 } 256 ts << indent << ")\n"; 257 } 258 259 if (!m_wheelEventListenerRegion.isEmpty()) { 260 ts << indent << "(wheel event listener region" << m_wheelEventListenerRegion; 261 if (!m_nonPassiveWheelEventListenerRegion.isEmpty()) { 262 TextStream::IndentScope indentScope(ts); 263 ts << indent << "(non-passive" << m_nonPassiveWheelEventListenerRegion; 245 264 ts << indent << ")\n"; 246 265 } -
trunk/Source/WebCore/rendering/EventRegion.h
r261065 r261239 28 28 #include "AffineTransform.h" 29 29 #include "Region.h" 30 #include "RenderStyleConstants.h" 30 31 #include "TouchAction.h" 31 32 #include <wtf/OptionSet.h> … … 77 78 bool hasTouchActions() const { return !m_touchActionRegions.isEmpty(); } 78 79 WEBCORE_EXPORT OptionSet<TouchAction> touchActionsForPoint(const IntPoint&) const; 79 80 80 const Region* regionForTouchAction(TouchAction) const; 81 81 … … 94 94 private: 95 95 void uniteTouchActions(const Region&, OptionSet<TouchAction>); 96 void uniteEventListeners(const Region&, OptionSet<EventListenerRegionType>); 96 97 97 98 Region m_region; 98 99 Vector<Region> m_touchActionRegions; 100 Region m_wheelEventListenerRegion; 101 Region m_nonPassiveWheelEventListenerRegion; 99 102 #if ENABLE(EDITABLE_REGION) 100 103 Region m_editableRegion; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r261192 r261239 1669 1669 return true; 1670 1670 #endif 1671 #if !PLATFORM(IOS_FAMILY) 1672 if (renderer().document().wheelEventTargets()) 1673 return true; 1674 #endif 1671 1675 if (m_owningLayer.isRenderViewLayer()) 1672 1676 return false; -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r260311 r261239 692 692 int initialLetterHeight() const { return initialLetter().height(); } 693 693 694 OptionSet<TouchAction> touchActions() const { return OptionSet<TouchAction>::fromRaw(m_rareNonInheritedData->touchActions); }694 OptionSet<TouchAction> touchActions() const { return m_rareNonInheritedData->touchActions; } 695 695 // 'touch-action' behavior depends on values in ancestors. We use an additional inherited property to implement that. 696 OptionSet<TouchAction> effectiveTouchActions() const { return OptionSet<TouchAction>::fromRaw(m_rareInheritedData->effectiveTouchActions); } 696 OptionSet<TouchAction> effectiveTouchActions() const { return m_rareInheritedData->effectiveTouchActions; } 697 OptionSet<EventListenerRegionType> eventListenerRegionTypes() const { return m_rareInheritedData->eventListenerRegionTypes; } 697 698 698 699 #if ENABLE(CSS_SCROLL_SNAP) … … 1227 1228 void setInitialLetter(const IntSize& size) { SET_VAR(m_rareNonInheritedData, initialLetter, size); } 1228 1229 1229 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()); } 1230 void setTouchActions(OptionSet<TouchAction> touchActions) { SET_VAR(m_rareNonInheritedData, touchActions, touchActions); } 1231 void setEffectiveTouchActions(OptionSet<TouchAction> touchActions) { SET_VAR(m_rareInheritedData, effectiveTouchActions, touchActions); } 1232 void setEventListenerRegionTypes(OptionSet<EventListenerRegionType> eventListenerTypes) { SET_VAR(m_rareInheritedData, eventListenerRegionTypes, eventListenerTypes); } 1231 1233 1232 1234 #if ENABLE(CSS_SCROLL_SNAP) -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r253917 r261239 1179 1179 Fallback, 1180 1180 Optional 1181 }; 1182 1183 enum class EventListenerRegionType : uint8_t { 1184 Wheel = 1 << 0, 1185 NonPassiveWheel = 1 << 1, 1181 1186 }; 1182 1187 -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r260311 r261239 134 134 , hasSetStrokeWidth(false) 135 135 , hasSetStrokeColor(false) 136 , effectiveTouchActions( static_cast<unsigned>(RenderStyle::initialTouchActions()))136 , effectiveTouchActions(RenderStyle::initialTouchActions()) 137 137 , strokeWidth(RenderStyle::initialStrokeWidth()) 138 138 , strokeColor(RenderStyle::initialStrokeColor()) … … 229 229 , hasSetStrokeColor(o.hasSetStrokeColor) 230 230 , effectiveTouchActions(o.effectiveTouchActions) 231 , eventListenerRegionTypes(o.eventListenerRegionTypes) 231 232 , strokeWidth(o.strokeWidth) 232 233 , strokeColor(o.strokeColor) … … 350 351 && hasSetStrokeColor == o.hasSetStrokeColor 351 352 && effectiveTouchActions == o.effectiveTouchActions 353 && eventListenerRegionTypes == o.eventListenerRegionTypes 352 354 && strokeWidth == o.strokeWidth 353 355 && strokeColor == o.strokeColor -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r260311 r261239 31 31 #include "TextDecorationThickness.h" 32 32 #include "TextUnderlineOffset.h" 33 #include "TouchAction.h" 33 34 #include <wtf/DataRef.h> 34 35 #include <wtf/RefCounted.h> … … 155 156 unsigned hasSetStrokeColor : 1; 156 157 157 unsigned effectiveTouchActions : 6; // OptionSet<TouchAction> 158 OptionSet<TouchAction> effectiveTouchActions; 159 OptionSet<EventListenerRegionType> eventListenerRegionTypes; 158 160 159 161 Length strokeWidth; -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
r258148 r261239 82 82 , justifySelf(RenderStyle::initialSelfAlignment()) 83 83 , customProperties(StyleCustomPropertyData::create()) 84 , touchActions( static_cast<unsigned>(RenderStyle::initialTouchActions()))84 , touchActions(RenderStyle::initialTouchActions()) 85 85 , pageSizeType(PAGE_SIZE_AUTO) 86 86 , transformStyle3D(static_cast<unsigned>(RenderStyle::initialTransformStyle3D())) -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r260311 r261239 174 174 std::unique_ptr<HashSet<String>> customPaintWatchedProperties; 175 175 176 unsigned touchActions : 6; // TouchAction176 OptionSet<TouchAction> touchActions; 177 177 178 178 unsigned pageSizeType : 2; // PageSizeType -
trunk/Source/WebCore/style/StyleAdjuster.cpp
r261013 r261239 34 34 #include "CSSFontSelector.h" 35 35 #include "Element.h" 36 #include "EventNames.h" 36 37 #include "FrameView.h" 37 38 #include "HTMLDivElement.h" … … 193 194 } 194 195 196 static OptionSet<EventListenerRegionType> computeEventListenerRegionTypes(const Element& element, OptionSet<EventListenerRegionType> parentTypes) 197 { 198 #if !PLATFORM(IOS_FAMILY) 199 if (!element.hasEventListeners()) 200 return parentTypes; 201 202 auto types = parentTypes; 203 204 auto findListeners = [&](auto& eventName, auto type, auto nonPassiveType) { 205 auto* eventListenerVector = element.eventTargetData()->eventListenerMap.find(eventName); 206 if (!eventListenerVector) 207 return; 208 209 types.add(type); 210 211 auto isPassiveOnly = [&] { 212 for (auto& listener : *eventListenerVector) { 213 if (!listener->isPassive()) 214 return false; 215 } 216 return true; 217 }(); 218 219 if (!isPassiveOnly) 220 types.add(nonPassiveType); 221 }; 222 223 findListeners(eventNames().wheelEvent, EventListenerRegionType::Wheel, EventListenerRegionType::NonPassiveWheel); 224 findListeners(eventNames().mousewheelEvent, EventListenerRegionType::Wheel, EventListenerRegionType::NonPassiveWheel); 225 226 return types; 227 #else 228 UNUSED_PARAM(element); 229 UNUSED_PARAM(parentTypes); 230 return { }; 231 #endif 232 } 233 195 234 void Adjuster::adjust(RenderStyle& style, const RenderStyle* userAgentAppearanceStyle) const 196 235 { … … 437 476 438 477 style.setEffectiveTouchActions(computeEffectiveTouchActions(style, m_parentStyle.effectiveTouchActions())); 478 479 if (m_element) 480 style.setEventListenerRegionTypes(computeEventListenerRegionTypes(*m_element, m_parentStyle.eventListenerRegionTypes())); 439 481 440 482 #if ENABLE(TEXT_AUTOSIZING)
Note: See TracChangeset
for help on using the changeset viewer.