diff options
Diffstat (limited to 'WebCore/wml')
-rw-r--r-- | WebCore/wml/WMLAElement.cpp | 35 | ||||
-rw-r--r-- | WebCore/wml/WMLElement.cpp | 10 | ||||
-rw-r--r-- | WebCore/wml/WMLImageLoader.cpp | 4 | ||||
-rw-r--r-- | WebCore/wml/WMLInputElement.cpp | 2 |
4 files changed, 15 insertions, 36 deletions
diff --git a/WebCore/wml/WMLAElement.cpp b/WebCore/wml/WMLAElement.cpp index 4d1bf95..c60db5e 100644 --- a/WebCore/wml/WMLAElement.cpp +++ b/WebCore/wml/WMLAElement.cpp @@ -4,7 +4,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann <hausmann@kde.org> - * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. * (C) 2006 Graham Dennis (graham.dennis@gmail.com) * * This library is free software; you can redistribute it and/or @@ -35,6 +35,7 @@ #include "EventNames.h" #include "Frame.h" #include "FrameLoader.h" +#include "HTMLAnchorElement.h" #include "HTMLNames.h" #include "KeyboardEvent.h" #include "MouseEvent.h" @@ -119,37 +120,17 @@ bool WMLAElement::isKeyboardFocusable(KeyboardEvent* event) const void WMLAElement::defaultEventHandler(Event* event) { - if (isLink() && (event->type() == eventNames().clickEvent || (event->type() == eventNames().keydownEvent && focused()))) { - MouseEvent* e = 0; - if (event->type() == eventNames().clickEvent && event->isMouseEvent()) - e = static_cast<MouseEvent*>(event); - - KeyboardEvent* k = 0; - if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) - k = static_cast<KeyboardEvent*>(event); - - if (e && e->button() == RightButton) { - WMLElement::defaultEventHandler(event); - return; - } - - if (k) { - if (k->keyIdentifier() != "Enter") { - WMLElement::defaultEventHandler(event); - return; - } - + if (isLink()) { + if (focused() && isEnterKeyKeydownEvent(event)) { event->setDefaultHandled(); dispatchSimulatedClick(event); return; } - - if (!event->defaultPrevented() && document()->frame()) { - KURL url = document()->completeURL(deprecatedParseURL(getAttribute(HTMLNames::hrefAttr))); - document()->frame()->loader()->urlSelected(url, target(), event, false, false, true, SendReferrer); - } - event->setDefaultHandled(); + if (isLinkClick(event)) { + handleLinkClick(event, document(), deprecatedParseURL(getAttribute(HTMLNames::hrefAttr)), target(), event); + return; + } } WMLElement::defaultEventHandler(event); diff --git a/WebCore/wml/WMLElement.cpp b/WebCore/wml/WMLElement.cpp index 4d18e94..5c8a94c 100644 --- a/WebCore/wml/WMLElement.cpp +++ b/WebCore/wml/WMLElement.cpp @@ -72,12 +72,10 @@ void WMLElement::parseMappedAttribute(Attribute* attr) addCSSProperty(attr, CSSPropertyTextAlign, attr->value()); } else if (attr->name() == HTMLNames::tabindexAttr) { String indexstring = attr->value(); - if (indexstring.length()) { - bool parsedOK; - int tabindex = indexstring.toIntStrict(&parsedOK); - if (parsedOK) - // Clamp tabindex to the range of 'short' to match Firefox's behavior. - setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); + int tabindex = 0; + if (parseHTMLInteger(tabindex)) { + // Clamp tabindex to the range of 'short' to match Firefox's behavior. + setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); } } } diff --git a/WebCore/wml/WMLImageLoader.cpp b/WebCore/wml/WMLImageLoader.cpp index 3c40215..1f1054f 100644 --- a/WebCore/wml/WMLImageLoader.cpp +++ b/WebCore/wml/WMLImageLoader.cpp @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * This library is free software; you can redistribute it and/or @@ -49,7 +49,7 @@ void WMLImageLoader::dispatchLoadEvent() String WMLImageLoader::sourceURI(const AtomicString& attr) const { - return deprecatedParseURL(KURL(element()->baseURI(), attr).string()); + return KURL(element()->baseURI(), deprecatedParseURL(attr)); } void WMLImageLoader::notifyFinished(CachedResource* image) diff --git a/WebCore/wml/WMLInputElement.cpp b/WebCore/wml/WMLInputElement.cpp index 639658f..2165bd4 100644 --- a/WebCore/wml/WMLInputElement.cpp +++ b/WebCore/wml/WMLInputElement.cpp @@ -274,7 +274,7 @@ void WMLInputElement::defaultEventHandler(Event* evt) } if (evt->type() == eventNames().keydownEvent && evt->isKeyboardEvent() && focused() && document()->frame() - && document()->frame()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt))) { + && document()->frame()->editor()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt))) { evt->setDefaultHandled(); return; } |