Changeset 247568 in webkit
- Timestamp:
- Jul 18, 2019 11:57:35 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247566 r247568 1 2019-07-18 Antoine Quint <graouts@apple.com> 2 3 REGRESSION: Panning on an Amazon product image scrolls the page on iPadOS 4 https://bugs.webkit.org/show_bug.cgi?id=199905 5 <rdar://problem/49124529> 6 7 Reviewed by Dean Jackson. 8 9 Amazon product pages include images that the user can touch and pan to show zoomed details in a side image. This 10 currently works on iPadOS thanks to the dispatch of simulated "mousemove" events on the product image, but the site 11 doesn't call preventDefault() when handling those events as it wasn't necessary for macOS. 12 13 We add a new quirk that will indicate that a given element is such a product image. 14 15 * page/Quirks.cpp: 16 (WebCore::Quirks::isAmazon const): 17 (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const): 18 (WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const): 19 (WebCore::Quirks::simulatedMouseEventTypeForTarget const): 20 * page/Quirks.h: 21 1 22 2019-07-18 Youenn Fablet <youenn@apple.com> 2 23 -
trunk/Source/WebCore/page/Quirks.cpp
r247530 r247568 228 228 229 229 #if ENABLE(TOUCH_EVENTS) 230 bool Quirks::isAmazon() const 231 { 232 auto& url = m_document->topDocument().url(); 233 auto host = url.host(); 234 return equalLettersIgnoringASCIICase(host, "amazon.com") || host.endsWithIgnoringASCIICase(".amazon.com"); 235 } 236 230 237 bool Quirks::shouldDispatchSimulatedMouseEvents() const 231 238 { … … 237 244 return false; 238 245 239 auto& url = m_document->topDocument().url(); 240 auto host = url.host(); 241 242 if (equalLettersIgnoringASCIICase(host, "amazon.com") || host.endsWithIgnoringASCIICase(".amazon.com")) 243 return true; 246 if (isAmazon()) 247 return true; 248 249 auto& url = m_document->topDocument().url(); 250 auto host = url.host(); 251 244 252 if (equalLettersIgnoringASCIICase(host, "wix.com") || host.endsWithIgnoringASCIICase(".wix.com")) 245 253 return true; … … 265 273 if (host.endsWithIgnoringASCIICase(".naver.com")) 266 274 return !equalLettersIgnoringASCIICase(host, "tv.naver.com"); 275 return false; 276 } 277 278 bool Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented(EventTarget* target) const 279 { 280 if (!needsQuirks() || !shouldDispatchSimulatedMouseEvents()) 281 return false; 282 283 if (isAmazon() && is<Element>(target)) { 284 // When panning on an Amazon product image, we're either touching on the #magnifierLens element 285 // or its previous sibling. 286 auto* element = downcast<Element>(target); 287 if (element->getIdAttribute() == "magnifierLens") 288 return true; 289 if (auto* sibling = element->nextElementSibling()) 290 return sibling->getIdAttribute() == "magnifierLens"; 291 } 292 267 293 return false; 268 294 } … … 286 312 287 313 return Event::IsCancelable::Yes; 288 } 314 } 289 315 #endif 290 316 -
trunk/Source/WebCore/page/Quirks.h
r247530 r247568 51 51 #if ENABLE(TOUCH_EVENTS) 52 52 bool shouldDispatchSimulatedMouseEvents() const; 53 bool shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented(EventTarget*) const; 53 54 Optional<Event::IsCancelable> simulatedMouseEventTypeForTarget(EventTarget*) const; 54 55 #endif … … 71 72 bool needsQuirks() const; 72 73 74 #if ENABLE(TOUCH_EVENTS) 75 bool isAmazon() const; 76 #endif 77 73 78 WeakPtr<Document> m_document; 74 79
Note: See TracChangeset
for help on using the changeset viewer.