Bug 44535 - Paste event fires twice for mac WebKit
Summary: Paste event fires twice for mac WebKit
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
URL: data:text/html,<textarea onpaste="ale...
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2010-08-24 10:38 PDT by Sam Weinig
Modified: 2010-08-24 11:01 PDT (History)
1 user (show)

See Also:


Attachments
Patch (8.48 KB, patch)
2010-08-24 10:45 PDT, Sam Weinig
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2010-08-24 10:38:03 PDT
The paste event fires twice for Mac webkit.

In the attached url, paste something into the textarea.
Comment 1 Sam Weinig 2010-08-24 10:40:50 PDT
<rdar://problem/8094611>
Comment 2 Sam Weinig 2010-08-24 10:45:57 PDT
Created attachment 65295 [details]
Patch
Comment 3 Oliver Hunt 2010-08-24 10:57:13 PDT
Comment on attachment 65295 [details]
Patch

r=me
Comment 4 Sam Weinig 2010-08-24 10:59:36 PDT
Landed in r65912.
Comment 5 Simon Fraser (smfr) 2010-08-24 10:59:47 PDT
> Index: WebCore/ChangeLog
> ===================================================================

> +        The mac implementation of paste in WebKit was accidentally calling 
> +        Editor::tryDHTMLPaste twice, once in -[WebHTMLView paste:] and once
> +        in Editor::pasteAsPlainText (which is called -[WebHTMLView paste:]).

called _by_ ?

> Index: WebCore/WebCore.exp.in
> ===================================================================
> --- WebCore/WebCore.exp.in	(revision 65898)
> +++ WebCore/WebCore.exp.in	(working copy)
> @@ -361,6 +361,7 @@ __ZN7WebCore15VisiblePositionC1ERKNS_8Po
>  __ZN7WebCore15reportExceptionEPN3JSC9ExecStateENS0_7JSValueE
>  __ZN7WebCore15visitedLinkHashEPKtj
>  __ZN7WebCore16AbstractDatabase14setIsAvailableEb
> +__ZN7WebCore16DeviceMotionData6createEbdbdbdbdbdbdbd
>  __ZN7WebCore16FontFallbackList15releaseFontDataEv
>  __ZN7WebCore16FontPlatformDataC1EP6NSFontbb
>  __ZN7WebCore16FontPlatformDataD1Ev
> @@ -401,7 +402,6 @@ __ZN7WebCore16isEndOfParagraphERKNS_15Vi
>  __ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERNS0_9WeakGCMapIPN3WTF10StringImplEPNS0_8JSStringEEES6_
>  __ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE
>  __ZN7WebCore17DOMImplementation14isTextMIMETypeERKN3WTF6StringE
> -__ZN7WebCore16DeviceMotionData6createEbdbdbdbdbdbdbd
>  __ZN7WebCore17DeviceOrientation6createEbdbdbd
>  __ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv
>  __ZN7WebCore17HistoryController26saveDocumentAndScrollStateEv
> @@ -461,12 +461,12 @@ __ZN7WebCore22externalRepresentationEPNS
>  __ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbbbbNS_10EditActionE
>  __ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
>  __ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv
> +__ZN7WebCore24DocumentMarkerController13removeMarkersENS_14DocumentMarker10MarkerTypeE
> +__ZN7WebCore24DocumentMarkerController23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
>  __ZN7WebCore24contextMenuItemTagItalicEv
>  __ZN7WebCore24contextMenuItemTagStylesEv
>  __ZN7WebCore24createFragmentFromMarkupEPNS_8DocumentERKN3WTF6StringES5_NS_27FragmentScriptingPermissionE
>  __ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE
> -__ZN7WebCore24DocumentMarkerController13removeMarkersENS_14DocumentMarker10MarkerTypeE
> -__ZN7WebCore24DocumentMarkerController23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
>  __ZN7WebCore24notifyHistoryItemChangedE
>  __ZN7WebCore24rangeCompliantEquivalentERKNS_8PositionE
>  __ZN7WebCore25HistoryPropertyListWriter11releaseDataEv
> @@ -627,6 +627,7 @@ __ZN7WebCore6Editor29canDecreaseSelectio
>  __ZN7WebCore6Editor29canIncreaseSelectionListLevelEv
>  __ZN7WebCore6Editor30applyParagraphStyleToSelectionEPNS_19CSSStyleDeclarationENS_10EditActionE
>  __ZN7WebCore6Editor30deleteSelectionWithSmartDeleteEb
> +__ZN7WebCore6Editor30pasteAsPlainTextBypassingDHTMLEv
>  __ZN7WebCore6Editor32guessesForUngrammaticalSelectionEv
>  __ZN7WebCore6Editor33increaseSelectionListLevelOrderedEv
>  __ZN7WebCore6Editor35increaseSelectionListLevelUnorderedEv

Why all the unrelated changes?

> Index: WebCore/editing/Editor.h
> ===================================================================
> --- WebCore/editing/Editor.h	(revision 65898)
> +++ WebCore/editing/Editor.h	(working copy)
> @@ -299,6 +299,9 @@ public:
>      void pasteAsFragment(PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle);
>      void pasteAsPlainText(const String&, bool smartReplace);
>  
> +    // This is only necessary while paste is primarily implemented in WebKit for the mac platform.
> +    void pasteAsPlainTextBypassingDHTML();

I don't really understand the comment. It might be better as "This is only used on Mac, where ....."

Rest looks fine, but I am not an expert.
Comment 6 Darin Adler 2010-08-24 11:01:02 PDT
Comment on attachment 65295 [details]
Patch

> +    // This is only necessary while paste is primarily implemented in WebKit for the mac platform.
> +    void pasteAsPlainTextBypassingDHTML();

Should say Mac, not mac. Comment is a bit confusing. I think you mean this function is only used by Mac WebKit, and can probably be eliminated once we refactor the Mac pasting code.