Bug 134084

Summary: iOS WebKit2: selection handles become too large when zooming a page.
Product: WebKit Reporter: Enrica Casucci <enrica>
Component: WebKit2Assignee: Enrica Casucci <enrica>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, commit-queue
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: Unspecified   
Attachments:
Description Flags
Patch benjamin: review+

Description Enrica Casucci 2014-06-19 17:46:29 PDT
This happens only in WebKit2, since the WKContentView is now zoomed and all the selection views are child views of the document view.

<rdar://problem/16799164>
Comment 1 Enrica Casucci 2014-06-19 17:51:52 PDT
Created attachment 233398 [details]
Patch
Comment 2 WebKit Commit Bot 2014-06-19 17:53:34 PDT
Attachment 233398 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:1719:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:1720:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 2 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Benjamin Poulain 2014-06-20 14:23:39 PDT
Comment on attachment 233398 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=233398&action=review

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:201
> +    CGFloat inverseScale = 1 / [[self layer] transform].m11;
> +    [_inverseScaleRootView setTransform:CGAffineTransformMakeScale(inverseScale, inverseScale)];

Can you just call [self _updateUnscaledView]?

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:291
> +        hitView = [hitView hitTest:[hitView convertPoint:point fromView:self] withEvent:event];

I would not reuse "hitView" but use a different UIView* local variable for clarity.

maybe:
for (UIView *subView ...) {
    if (UIView *hitView...)

> Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm:1695
>  - (UITextRange *)selectedTextRange

I would store inverseScale in a local variable.

I think this deserve a comment with a little explanation of how the UI works regarding the caret width/height.
Comment 4 Ahmad Saleem 2022-10-25 13:33:29 PDT
Landed - https://github.com/WebKit/WebKit/commit/81101735c10d2c44bbcd0d5684177d7fc473310d

and didn't backed out. Marking this bug as "RESOLVED FIXED". Thanks!