Changeset 255827 in webkit
- Timestamp:
- Feb 5, 2020 10:22:02 AM (4 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r255819 r255827 1 2020-02-05 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [macCatalyst] IBeam cursor doesn't show up when hovering over text form controls prior to editing 4 https://bugs.webkit.org/show_bug.cgi?id=207268 5 <rdar://problem/59188152> 6 7 Reviewed by Tim Horton. 8 9 On macCatalyst, when hovering over textareas and input fields that have not been edited yet, the cursor fails to 10 change to an IBeam and instead falls back to the default style. Even though `EventHandler::selectCursor()` 11 returns `IBeam`, we end up not actually using an IBeam because the position information's `lineCaretExtent` is 12 an empty rect, which means the caret height is 0 and, more importantly, the line rect will not contain the 13 request point. 14 15 The line rect is empty in text fields that have not been edited yet because the form control's inner plaintext 16 contenteditable div (embedded in the shadow root) does not contain any child renderers with a non-zero height. 17 Even if it did, however, the element may still be much taller than the combined height of the inner div's 18 children, so the line rect may still not contain the position information request point (this is most easily 19 noticeable when focusing a textarea, typing a few letters, and then moving the cursor to near the bottom of the 20 textarea element). 21 22 To fix this, add a fallback path for the scenario where we want to show an IBeam, but fail to find line rects 23 that contain the request point. Instead, we still show an IBeam, but simply fake the lineCaretExtent to be an 24 element-wide rect that is the height of the caret, and is also vertically centered about the request point. 25 26 * WebProcess/WebPage/ios/WebPageIOS.mm: 27 (WebKit::populateCaretContext): 28 1 29 2020-02-05 Commit Queue <commit-queue@webkit.org> 2 30 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r255786 r255827 2818 2818 info.caretHeight = info.lineCaretExtent.height(); 2819 2819 2820 bool lineContainsRequestPoint = info.lineCaretExtent.contains(request.point); 2820 2821 // Force an I-beam cursor if the page didn't request a hand, and we're inside the bounds of the line. 2821 if ( info.lineCaretExtent.contains(request.point)&& info.cursor->type() != Cursor::Hand && canForceCaretForPosition(position))2822 if (lineContainsRequestPoint && info.cursor->type() != Cursor::Hand && canForceCaretForPosition(position)) 2822 2823 info.cursor = Cursor::fromType(Cursor::IBeam); 2824 2825 if (!lineContainsRequestPoint && info.cursor->type() == Cursor::IBeam) { 2826 auto approximateLineRectInContentCoordinates = renderer->absoluteBoundingBoxRect(); 2827 approximateLineRectInContentCoordinates.setHeight(position.absoluteCaretBounds().height()); 2828 info.lineCaretExtent = view->contentsToRootView(approximateLineRectInContentCoordinates); 2829 info.lineCaretExtent.setY(request.point.y() - info.lineCaretExtent.height() / 2); 2830 info.caretHeight = info.lineCaretExtent.height(); 2831 } 2823 2832 } 2824 2833
Note: See TracChangeset
for help on using the changeset viewer.