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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14346
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-05-12 Timothy Hatcher <timothy@apple.com>
+
+ 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):
+
2006-05-12 Eric Seidel <eseidel@apple.com>
Reviewed by timo.
* WebCore: Removed an extra WebCore subtree that somehow got checked in.
->>>>>>> .r14297
2006-05-10 David Carson <dacarson@gmail.com>
- Fix for bug 8833. Removed inline keyword from functions declared
style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW))
style->setOverflow(OVISIBLE);
+ // Links should be user selectable when content editable
+ if (e && e->isLink() && (style->userModify() == READ_WRITE || style->userModify() == READ_WRITE_PLAINTEXT_ONLY))
+ style->setUserSelect(SELECT_AUTO);
+
// Cull out any useless layers and also repeat patterns into additional layers.
style->adjustBackgroundLayers();
// React on clicks and on keypresses.
// Don't make this KEYUP_EVENT again, it makes khtml follow links it shouldn't,
// when pressing Enter in the combo.
- if ((evt->type() == clickEvent || (evt->type() == keydownEvent && m_focused)) && m_isLink) {
+ if (m_isLink && (evt->type() == clickEvent || (evt->type() == keydownEvent && m_focused))) {
MouseEvent* e = 0;
if (evt->type() == clickEvent)
e = static_cast<MouseEvent*>(evt);
if (evt->type() == keydownEvent)
k = static_cast<KeyboardEvent*>(evt);
- DeprecatedString utarget;
- DeprecatedString url;
-
if (e && e->button() == 2) {
HTMLElement::defaultEventHandler(evt);
return;
}
+ if (e && !e->shiftKey() && isContentEditable()) {
+ HTMLElement::defaultEventHandler(evt);
+ return;
+ }
+
if (k) {
if (k->keyIdentifier() != "Enter") {
HTMLElement::defaultEventHandler(evt);
}
}
- url = parseURL(getAttribute(hrefAttr)).deprecatedString();
-
- utarget = getAttribute(targetAttr).deprecatedString();
+ DeprecatedString url = WebCore::parseURL(getAttribute(hrefAttr)).deprecatedString();
+ String utarget = getAttribute(targetAttr);
if (e && e->button() == 1)
utarget = "_blank";
if (evt->target()->hasTagName(imgTag)) {
HTMLImageElement* img = static_cast<HTMLImageElement*>(evt->target());
if (img && img->isServerMap()) {
- RenderImage *r = static_cast<RenderImage*>(img->renderer());
+ RenderImage* r = static_cast<RenderImage*>(img->renderer());
if(r && e) {
int absx, absy;
r->absolutePosition(absx, absy);
}
}
}
- if (!evt->defaultPrevented()) {
- if (document()->frame())
- document()->frame()->urlSelected(url, utarget);
- }
+
+ if (!evt->defaultPrevented() && document()->frame())
+ document()->frame()->urlSelected(url, utarget);
+
evt->setDefaultHandled();
}
+
HTMLElement::defaultEventHandler(evt);
}
+void HTMLAnchorElement::setActive(bool down, bool pause)
+{
+ if (isContentEditable())
+ return;
+ ContainerNode::setActive(down, pause);
+}
void HTMLAnchorElement::parseMappedAttribute(MappedAttribute *attr)
{
virtual bool isFocusable() const;
virtual void parseMappedAttribute(MappedAttribute*);
virtual void defaultEventHandler(Event*);
+ virtual void setActive(bool active = true, bool pause = false);
virtual void accessKeyAction(bool fullAction);
virtual bool isURLAttribute(Attribute*) const;
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+<TITLE> Webkit bugzilla repro movie: #7156 </TITLE>
+<META NAME="Author" CONTENT="Aldo Hoeben">
+<style type="text/css">
+#editable {
+ width: 40em;
+ height: 10em;
+ border: 1px solid black;
+}
+</STYLE>
+</HEAD>
+
+<BODY>
+<P>Repro movie for bug <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7156">#7156</a></P>
+
+<div id="editable" contentEditable="true">
+ <p>Test content</p>
+ <p><a href="about:blank">Test link</a></p>
+</div>
+
+</BODY>
+</HTML>
return style->cursorImage()->image();
switch (style ? style->cursor() : CURSOR_AUTO) {
- case CURSOR_AUTO:
- if (event.isOverLink() || isSubmitImage(node))
+ case CURSOR_AUTO: {
+ bool editable = (node && node->isContentEditable());
+ if ((event.isOverLink() || isSubmitImage(node)) && (!editable || event.event().shiftKey()))
return handCursor();
- if ((node && node->isContentEditable()) || (renderer && renderer->isText() && renderer->canSelect()))
+ if (editable || (renderer && renderer->isText() && renderer->canSelect()))
return iBeamCursor();
return pointerCursor();
+ }
case CURSOR_CROSS:
return crossCursor();
case CURSOR_POINTER: