Bug 60840

Summary: WebKit2: Smart cut&paste is broken
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: HTML EditingAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, commit-queue
Priority: P1 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed fix none

Description Alexey Proskuryakov 2011-05-14 11:30:59 PDT
Steps to reproduce:

1. Open e.g. http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea
2. Double click a word
3. Cmd+X

Expected results: the word is cut, only one space of the two that were surrounding it remains.
Actual results: both spaces remain.

All we likely need to do is to set a preference. I'm not sure, but we may not be using "Mac editing behavior" at all in WK2, losing a lot of other important features.
Comment 1 Alexey Proskuryakov 2011-05-14 11:31:26 PDT
<rdar://problem/9439927>
Comment 2 Alexey Proskuryakov 2011-05-14 12:00:58 PDT
Created attachment 93559 [details]
proposed fix

No, this doesn't affect editing behavior, only this one feature.
Comment 3 Anders Carlsson 2011-05-14 12:07:17 PDT
Comment on attachment 93559 [details]
proposed fix

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

> Source/WebKit2/UIProcess/mac/TextCheckerMac.mm:183
> +        smartInsertDeleteEnabled = ![[NSUserDefaults standardUserDefaults] objectForKey:WebSmartInsertDeleteEnabled] || [[NSUserDefaults standardUserDefaults] boolForKey:WebSmartInsertDeleteEnabled];

I don't understand the first part here. smartInsertDelete is enabled when [[NSUserDefaults standardUserDefaults] objectForKey:WebSmartInsertDeleteEnabled] returns nil?
Comment 4 Alexey Proskuryakov 2011-05-14 12:28:51 PDT
> I don't understand the first part here. smartInsertDelete is enabled when [[NSUserDefaults standardUserDefaults] objectForKey:WebSmartInsertDeleteEnabled] returns nil?

Yes. It should be enabled for users who never touched this preference in context menu. Here is what WebKit1 does in -[WebViewPrivate init]:

    smartInsertDeleteEnabled = ![[NSUserDefaults standardUserDefaults] objectForKey:WebSmartInsertDeleteEnabled]
        || [[NSUserDefaults standardUserDefaults] boolForKey:WebSmartInsertDeleteEnabled];
Comment 5 WebKit Commit Bot 2011-05-14 14:23:36 PDT
Comment on attachment 93559 [details]
proposed fix

Clearing flags on attachment: 93559

Committed r86497: <http://trac.webkit.org/changeset/86497>
Comment 6 WebKit Commit Bot 2011-05-14 14:23:41 PDT
All reviewed patches have been landed.  Closing bug.