The paste event fires twice for Mac webkit. In the attached url, paste something into the textarea.
<rdar://problem/8094611>
Created attachment 65295 [details] Patch
Comment on attachment 65295 [details] Patch r=me
Landed in r65912.
> 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 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.