Bug 9575
Summary: | replaceSelectionWithMarkupString merges blockquotes | ||
---|---|---|---|
Product: | WebKit | Reporter: | Graham Dennis <Graham.Dennis> |
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | ahmad.saleem792, ap, bfulgham, dwood, ian, justin.garcia, rniwa |
Priority: | P2 | ||
Version: | 420+ | ||
Hardware: | Mac | ||
OS: | OS X 10.4 |
Graham Dennis
I'm not sure if this is in fact a bug but... If you call [webView replaceSelectionWithMarkupString:] with a string like:
<blockquote>Text</blockquote>
One would expect a blockquote tag to be inserted (unless you happen to be Mail.app...). However the blockquote tag isn't inserted because shouldMergeStart() returns true (the last condition returns true).
I'm happy to fix this if it is in fact a bug.... so is it?
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Justin Garcia
The fact that we force the first bit of content being inserted onto the same line as the content before the selection being pasted into is not a bug. To get that behavior we must strip blocks surrounding the first paragraph of the incoming fragment. We could strip blocks surrounding the content before the selection being pasted into but that could produce bad visual results: you'd paste something into a bordered block and the border would go away.
It would be nice if there was a way to override this behavior though. To work around this, you could put an interchange newline at the beginning of the markup when the selection being pasted into doesn't start at the start of a paragraph
<br class="Apple-interchange-newline">
<blockquote>Text</blockquote>
...
You'll also want an interchange newline at the end of the fragment if the selection being pasted into doesn't end at the end of a paragraph.
Graham Dennis
Your suggestion with interchange <br>'s gives me:
<div> Text before caret </div>
<blockquote> Quote </blockquote>
<div> Text after caret </div>
Whereas ideally I would like:
<div> Text before caret <blockquote> Quote </blockquote> Text after caret </div>
In most cases they should be visually identical, but is there a way to do this without creating a document fragment and directly inserting that?
Ahmad Saleem
We still have references to replaceSelectionWithMarkupString in:
Source/WebKitLegacy/win/WebView.h
Source/WebKitLegacy/win/WebView.cpp
Only references are in WebkitLegacy or WK1, is it something we are planning to fix or valid these days or we can mark this as "RESOLVED WONTFIX" etc., appreciate if someone else can comment here. Thanks!
Ryosuke Niwa
We're no longer making improvements to WebKitLegacy API at this point.
Alexey Proskuryakov
What Ryosuke said.
However, not sure if your search was exhaustive, we have it outside Windows directories too (still WK1 only).
$ grep -r replaceSelectionWithMarkupString Source/
Source//WebKitLegacy/win/WebView.h: HRESULT STDMETHODCALLTYPE replaceSelectionWithMarkupString(_In_ BSTR) override;
Source//WebKitLegacy/win/WebView.cpp:HRESULT WebView::replaceSelectionWithMarkupString(_In_ BSTR /*markupString*/)
Source//WebKitLegacy/win/Interfaces/IWebView.idl: - (void)replaceSelectionWithMarkupString:(NSString *)markupString;
Source//WebKitLegacy/win/Interfaces/IWebView.idl: HRESULT replaceSelectionWithMarkupString([in] BSTR markupString);
Source//WebKitLegacy/mac/WebView/WebView.mm:- (void)replaceSelectionWithMarkupString:(NSString *)markupString
Source//WebKitLegacy/mac/WebView/WebView.mm: [[self _selectedOrMainFrame] _replaceSelectionWithMarkupString:markupString baseURLString:nil selectReplacement:YES smartReplace:NO];
Source//WebKitLegacy/mac/WebView/WebView.h:- (void)replaceSelectionWithMarkupString:(NSString *)markupString;
Source//WebKitLegacy/mac/WebView/WebFramePrivate.h:- (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
Source//WebKitLegacy/mac/WebView/WebFrame.mm:- (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace