Bug 7156

Summary: TinyMCE: Links are actually activated in editable area, not editable.
Product: WebKit Reporter: Moxiecode Systems <spam>
Component: HTML EditingAssignee: Timothy Hatcher <timothy>
Status: RESOLVED FIXED    
Severity: Major CC: timothy
Priority: P3 Keywords: EasyFix, HasReduction
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
URL: http://tinymce.moxiecode.com
Bug Depends on: 8817    
Bug Blocks: 6627    
Attachments:
Description Flags
Testcase
none
Patch with simple fix darin: review+

Description Moxiecode Systems 2006-02-09 06:33:02 PST
Expected Results: 
Text that is a link should be marked at as a link but not activated in any way inside an editable area (also includes events).

What I got: The link is opened inside the iframe editor!

Steps to reproduce:

1) Go to http://tinymce.moxiecode.com/example.php?example=true
2) Click on the link inside the editable area.
Comment 1 Aldo Hoeben 2006-02-10 04:43:19 PST
See http://hoeben.net/files/webkit/repro7156.html for a simple repro document.

Clicking the anchor opens the specified uri. This makes it tricky to select the link in order to manipulte it (eg removing the link, changing the linked url).

Anchors should be disabled in designmode.
Comment 2 Joost de Valk (AlthA) 2006-02-14 04:13:50 PST
Created attachment 6482 [details]
Testcase

Added Aldo's testcase to the bug itself.
Comment 3 Justin Haygood 2006-02-28 21:07:30 PST
(

(In reply to comment #1)
> See http://hoeben.net/files/webkit/repro7156.html for a simple repro document.
> 
> Clicking the anchor opens the specified uri. This makes it tricky to select the
> link in order to manipulte it (eg removing the link, changing the linked url).
> 
> Anchors should be disabled in designmode.
>

To match Firefox & Internet Explorer's behavior, you should be able to navigate to the link by pressing ctrl-clicking (or the Mac equivalent) it.

Comment 4 Dave Hyatt 2006-02-28 21:37:18 PST
This is very easy to fix if someone wants to take a shot at it.  You just have to patch the defaultEventHandler for the anchorelement and check to see if the link is editable.  If so, do the right thing.

You should be able to just check the links user-modify style, assuming the concept of making a whole WebView editable has been fixed to properly adjust all the style property values for elements.  (It probably hasn't though.)
Comment 5 Timothy Hatcher 2006-05-11 20:10:51 PDT
Created attachment 8257 [details]
Patch with simple fix

        Links in editable areas will not activate or perform a navigation
        change (on par with WinIE and Firefox.) To visit the link
        you can shift-click. Manual test added.

        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::adjustRenderStyle):
        * html/html_inlineimpl.cpp:
        (WebCore::HTMLAnchorElement::defaultEventHandler):
        (WebCore::HTMLAnchorElement::setActive):
        * html/html_inlineimpl.h:
        * manual-tests/contenteditable-link.html: Added.
        * page/FrameView.cpp:
        (WebCore::selectCursor):

A more complex fix to allow editing of the href is being talked about, but this lets us behave like IE and Firefox.
Comment 6 Darin Adler 2006-05-11 21:27:24 PDT
Comment on attachment 8257 [details]
Patch with simple fix

I understand all of this except for the HTMLAnchorElement::setActive part. Why doesn't it need a check for the shift key?

r=me, in any case
Comment 7 Timothy Hatcher 2006-05-11 21:33:09 PDT
Is there a way to change the current event in setActive? If so I agree, checking for the shift key there would be correct.
Comment 8 Timothy Hatcher 2006-05-11 21:41:12 PDT
That should read: Is there a way to check the current event...
Comment 9 Timothy Hatcher 2006-05-12 19:40:35 PDT
Landed in r14346.
Comment 10 Ted Rust 2006-06-07 13:32:00 PDT
Not sure if this is what was meant by

>A more complex fix to allow editing of the href is being talked about, 
>but this lets us behave like IE and Firefox. 

but, it does not appear that it is possible to select a portion of a link now.  Is the click event being "eaten" by the new code?  You can start a selection from outside the link and continue into it, but you cannot start a selection *in* the link itself.
Comment 11 Timothy Hatcher 2006-06-07 13:46:55 PDT
In the test case attached to this bug that is not the case. The TinyMCE example page seems to have a event listener that they do not allow to propagate, preventing the click (this is mentioned in bug 8817).