Changeset 251761 in webkit
- Timestamp:
- Oct 29, 2019 7:48:45 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251750 r251761 1 2019-10-29 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 REGRESSION (r251693): [iOS] Unable to change selection after focusing an element with keyboard attached 4 https://bugs.webkit.org/show_bug.cgi?id=203582 5 6 Reviewed by Tim Horton. 7 8 Add a new layout test to cover this scenario. 9 10 * editing/selection/ios/set-selection-by-tapping-after-changing-focused-element-bounds-expected.txt: Added. 11 * editing/selection/ios/set-selection-by-tapping-after-changing-focused-element-bounds.html: Added. 12 1 13 2019-10-29 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r251750 r251761 1 2019-10-29 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 REGRESSION (r251693): [iOS] Unable to change selection after focusing an element with keyboard attached 4 https://bugs.webkit.org/show_bug.cgi?id=203582 5 6 Reviewed by Tim Horton. 7 8 Introduces a new helper method to check whether two ElementContexts refer to the same element. Importantly, this 9 ignores any information on ElementContext that is not either the element, document, or page identifier (for now, 10 this only includes the element's bounding rect, which may change over time). 11 12 Test: editing/selection/ios/set-selection-by-tapping-after-changing-focused-element-bounds.html 13 14 * dom/ElementContext.h: 15 (WebCore::ElementContext::isSameElement const): 16 (WebCore::operator==): 17 1 18 2019-10-29 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/Source/WebCore/dom/ElementContext.h
r251388 r251761 42 42 ~ElementContext() = default; 43 43 44 bool isSameElement(const ElementContext& other) const 45 { 46 return webPageIdentifier == other.webPageIdentifier && documentIdentifier == other.documentIdentifier && elementIdentifier == other.elementIdentifier; 47 } 48 44 49 template<class Encoder> void encode(Encoder&) const; 45 50 template<class Decoder> static Optional<ElementContext> decode(Decoder&); … … 48 53 inline bool operator==(const ElementContext& a, const ElementContext& b) 49 54 { 50 return a.boundingRect == b.boundingRect 51 && a.webPageIdentifier == b.webPageIdentifier 52 && a.documentIdentifier == b.documentIdentifier 53 && a.elementIdentifier == b.elementIdentifier; 55 return a.boundingRect == b.boundingRect && a.isSameElement(b); 54 56 } 55 57 -
trunk/Source/WebKit/ChangeLog
r251737 r251761 1 2019-10-29 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 REGRESSION (r251693): [iOS] Unable to change selection in a focused element if the element's bounds change 4 https://bugs.webkit.org/show_bug.cgi?id=203582 5 6 Reviewed by Tim Horton. 7 8 The refactoring in r251693 broke the ability to change selection in an editable area by tapping in iOS Safari, 9 in the case where the editable element's bounds change after focus. This is because the aforementioned change 10 now compares position informations' element context against the focused element information's element context to 11 check whether or not the position information request was inside the focused element. However, if the bounds of 12 the focused element change in between the position information request and when the element is initially 13 focused, the `operator==` comparison will fail, causing us to prevent text selection. 14 15 To fix this, only check whether or not the two element contexts refer to the same element in the DOM by 16 comparing page, document and element identifiers, but not the element's bounding rect. 17 18 * UIProcess/ios/WKContentViewInteraction.mm: 19 (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]): 20 (-[WKContentView gestureRecognizerShouldBegin:]): 21 (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]): 22 1 23 2019-10-07 Jer Noble <jer.noble@apple.com> 2 24 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r251720 r251761 1697 1697 return; 1698 1698 1699 if (hasFocusedElement(_focusedElementInformation) && _positionInformation.elementContext == _focusedElementInformation.elementContext)1699 if (hasFocusedElement(_focusedElementInformation) && _positionInformation.elementContext && _positionInformation.elementContext->isSameElement(_focusedElementInformation.elementContext)) 1700 1700 return; 1701 1701 … … 2269 2269 if (![self ensurePositionInformationIsUpToDate:WebKit::InteractionInformationRequest(WebCore::roundedIntPoint(point))]) 2270 2270 return NO; 2271 if (_positionInformation.elementContext == _focusedElementInformation.elementContext)2271 if (_positionInformation.elementContext && _positionInformation.elementContext->isSameElement(_focusedElementInformation.elementContext)) 2272 2272 return NO; 2273 2273 } … … 2315 2315 if (hasFocusedElement(_focusedElementInformation)) { 2316 2316 // Prevent the gesture if it is the same node. 2317 if (_positionInformation.elementContext == _focusedElementInformation.elementContext)2317 if (_positionInformation.elementContext && _positionInformation.elementContext->isSameElement(_focusedElementInformation.elementContext)) 2318 2318 return NO; 2319 2319 } else { … … 2450 2450 // If we're currently focusing an editable element, only allow the selection to move within that focused element. 2451 2451 if (self.isFocusingElement) 2452 return _positionInformation.elementContext == _focusedElementInformation.elementContext;2452 return _positionInformation.elementContext && _positionInformation.elementContext->isSameElement(_focusedElementInformation.elementContext); 2453 2453 2454 2454 // If we're selecting something, don't activate highlight.
Note: See TracChangeset
for help on using the changeset viewer.