Changeset 14346 in webkit


Ignore:
Timestamp:
May 12, 2006 7:44:53 PM (18 years ago)
Author:
thatcher
Message:

Reviewed by Darin.

http://bugzilla.opendarwin.org/show_bug.cgi?id=7156
Bug 7156: TinyMCE: Links are actually activated in editable area, not editable.


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/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::defaultEventHandler): (WebCore::HTMLAnchorElement::setActive):
  • html/HTMLAnchorElement.h:
  • manual-tests/contenteditable-link.html: Added.
  • page/FrameView.cpp: (WebCore::selectCursor):
Location:
trunk/WebCore
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r14345 r14346  
     12006-05-12  Timothy Hatcher  <timothy@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        http://bugzilla.opendarwin.org/show_bug.cgi?id=7156
     6        Bug 7156: TinyMCE: Links are actually activated in editable area, not editable.
     7       
     8        Links in editable areas will not activate or perform a navigation
     9        change (on par with WinIE and Firefox.) To visit the link
     10        you can shift-click. Manual test added.
     11
     12        * css/cssstyleselector.cpp:
     13        (WebCore::CSSStyleSelector::adjustRenderStyle):
     14        * html/HTMLAnchorElement.cpp:
     15        (WebCore::HTMLAnchorElement::defaultEventHandler):
     16        (WebCore::HTMLAnchorElement::setActive):
     17        * html/HTMLAnchorElement.h:
     18        * manual-tests/contenteditable-link.html: Added.
     19        * page/FrameView.cpp:
     20        (WebCore::selectCursor):
     21
    1222006-05-12  Eric Seidel  <eseidel@apple.com>
    223
     
    10891110        * WebCore: Removed an extra WebCore subtree that somehow got checked in.
    10901111
    1091 >>>>>>> .r14297
    109211122006-05-10  David Carson <dacarson@gmail.com>
    10931113
  • trunk/WebCore/css/cssstyleselector.cpp

    r14278 r14346  
    999999         style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW))
    10001000        style->setOverflow(OVISIBLE);
     1001
     1002    // Links should be user selectable when content editable
     1003    if (e && e->isLink() && (style->userModify() == READ_WRITE || style->userModify() == READ_WRITE_PLAINTEXT_ONLY))
     1004        style->setUserSelect(SELECT_AUTO);
    10011005
    10021006    // Cull out any useless layers and also repeat patterns into additional layers.
  • trunk/WebCore/html/HTMLAnchorElement.cpp

    r14345 r14346  
    105105    // Don't make this KEYUP_EVENT again, it makes khtml follow links it shouldn't,
    106106    // when pressing Enter in the combo.
    107     if ((evt->type() == clickEvent || (evt->type() == keydownEvent && m_focused)) && m_isLink) {
     107    if (m_isLink && (evt->type() == clickEvent || (evt->type() == keydownEvent && m_focused))) {
    108108        MouseEvent* e = 0;
    109109        if (evt->type() == clickEvent)
     
    114114            k = static_cast<KeyboardEvent*>(evt);
    115115
    116         DeprecatedString utarget;
    117         DeprecatedString url;
    118 
    119116        if (e && e->button() == 2) {
     117            HTMLElement::defaultEventHandler(evt);
     118            return;
     119        }
     120
     121        if (e && !e->shiftKey() && isContentEditable()) {
    120122            HTMLElement::defaultEventHandler(evt);
    121123            return;
     
    134136        }
    135137
    136         url = parseURL(getAttribute(hrefAttr)).deprecatedString();
    137 
    138         utarget = getAttribute(targetAttr).deprecatedString();
     138        DeprecatedString url = WebCore::parseURL(getAttribute(hrefAttr)).deprecatedString();
     139        String utarget = getAttribute(targetAttr);
    139140
    140141        if (e && e->button() == 1)
     
    144145            HTMLImageElement* img = static_cast<HTMLImageElement*>(evt->target());
    145146            if (img && img->isServerMap()) {
    146                 RenderImage *r = static_cast<RenderImage*>(img->renderer());
     147                RenderImage* r = static_cast<RenderImage*>(img->renderer());
    147148                if(r && e) {
    148149                    int absx, absy;
     
    160161            }
    161162        }
    162         if (!evt->defaultPrevented()) {
    163             if (document()->frame())
    164                 document()->frame()->urlSelected(url, utarget);
    165         }
     163
     164        if (!evt->defaultPrevented() && document()->frame())
     165            document()->frame()->urlSelected(url, utarget);
     166
    166167        evt->setDefaultHandled();
    167168    }
     169
    168170    HTMLElement::defaultEventHandler(evt);
    169171}
    170172
     173void HTMLAnchorElement::setActive(bool down, bool pause)
     174{
     175    if (isContentEditable())
     176        return;
     177    ContainerNode::setActive(down, pause);
     178}
    171179
    172180void HTMLAnchorElement::parseMappedAttribute(MappedAttribute *attr)
  • trunk/WebCore/html/HTMLAnchorElement.h

    r14345 r14346  
    4646    virtual void parseMappedAttribute(MappedAttribute*);
    4747    virtual void defaultEventHandler(Event*);
     48    virtual void setActive(bool active = true, bool pause = false);
    4849    virtual void accessKeyAction(bool fullAction);
    4950    virtual bool isURLAttribute(Attribute*) const;
  • trunk/WebCore/page/FrameView.cpp

    r14345 r14346  
    555555
    556556    switch (style ? style->cursor() : CURSOR_AUTO) {
    557         case CURSOR_AUTO:
    558             if (event.isOverLink() || isSubmitImage(node))
     557        case CURSOR_AUTO: {
     558            bool editable = (node && node->isContentEditable());
     559            if ((event.isOverLink() || isSubmitImage(node)) && (!editable || event.event().shiftKey()))
    559560                return handCursor();
    560             if ((node && node->isContentEditable()) || (renderer && renderer->isText() && renderer->canSelect()))
     561            if (editable || (renderer && renderer->isText() && renderer->canSelect()))
    561562                return iBeamCursor();
    562563            return pointerCursor();
     564        }
    563565        case CURSOR_CROSS:
    564566            return crossCursor();
Note: See TracChangeset for help on using the changeset viewer.