Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: WebCore/wml/WMLAElement.cpp

Issue 3366025: Merge 67246 - 2010-09-109 Peter Kasting <pkasting@google.com>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « WebCore/svg/SVGAElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 2 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
3 * 3 *
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * (C) 2000 Simon Hausmann <hausmann@kde.org> 6 * (C) 2000 Simon Hausmann <hausmann@kde.org>
7 * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
8 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 8 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public 11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either 12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version. 13 * version 2 of the License, or (at your option) any later version.
14 * 14 *
15 * This library is distributed in the hope that it will be useful, 15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
(...skipping 10 matching lines...) Expand all
28 28
29 #if ENABLE(WML) 29 #if ENABLE(WML)
30 #include "WMLAElement.h" 30 #include "WMLAElement.h"
31 31
32 #include "Attribute.h" 32 #include "Attribute.h"
33 #include "Event.h" 33 #include "Event.h"
34 #include "EventHandler.h" 34 #include "EventHandler.h"
35 #include "EventNames.h" 35 #include "EventNames.h"
36 #include "Frame.h" 36 #include "Frame.h"
37 #include "FrameLoader.h" 37 #include "FrameLoader.h"
38 #include "HTMLAnchorElement.h"
38 #include "HTMLNames.h" 39 #include "HTMLNames.h"
39 #include "KeyboardEvent.h" 40 #include "KeyboardEvent.h"
40 #include "MouseEvent.h" 41 #include "MouseEvent.h"
41 #include "RenderBox.h" 42 #include "RenderBox.h"
42 #include "ResourceHandle.h" 43 #include "ResourceHandle.h"
43 #include "WMLNames.h" 44 #include "WMLNames.h"
44 45
45 namespace WebCore { 46 namespace WebCore {
46 47
47 using namespace WMLNames; 48 using namespace WMLNames;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 size_t n = rects.size(); 113 size_t n = rects.size();
113 for (size_t i = 0; i < n; ++i) 114 for (size_t i = 0; i < n; ++i)
114 if (!rects[i].isEmpty()) 115 if (!rects[i].isEmpty())
115 return true; 116 return true;
116 117
117 return false; 118 return false;
118 } 119 }
119 120
120 void WMLAElement::defaultEventHandler(Event* event) 121 void WMLAElement::defaultEventHandler(Event* event)
121 { 122 {
122 if (isLink() && (event->type() == eventNames().clickEvent || (event->type() == eventNames().keydownEvent && focused()))) { 123 if (isLink()) {
123 MouseEvent* e = 0; 124 if (focused() && isEnterKeyKeydownEvent(event)) {
124 if (event->type() == eventNames().clickEvent && event->isMouseEvent())
125 e = static_cast<MouseEvent*>(event);
126
127 KeyboardEvent* k = 0;
128 if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent ())
129 k = static_cast<KeyboardEvent*>(event);
130
131 if (e && e->button() == RightButton) {
132 WMLElement::defaultEventHandler(event);
133 return;
134 }
135
136 if (k) {
137 if (k->keyIdentifier() != "Enter") {
138 WMLElement::defaultEventHandler(event);
139 return;
140 }
141
142 event->setDefaultHandled(); 125 event->setDefaultHandled();
143 dispatchSimulatedClick(event); 126 dispatchSimulatedClick(event);
144 return; 127 return;
145 } 128 }
146 129
147 if (!event->defaultPrevented() && document()->frame()) { 130 if (isLinkClick(event)) {
148 KURL url = document()->completeURL(deprecatedParseURL(getAttribute(H TMLNames::hrefAttr))); 131 handleLinkClick(document(), deprecatedParseURL(getAttribute(HTMLName s::hrefAttr)), target(), event);
149 document()->frame()->loader()->urlSelected(url, target(), event, fal se, false, true, SendReferrer); 132 return;
150 } 133 }
151
152 event->setDefaultHandled();
153 } 134 }
154 135
155 WMLElement::defaultEventHandler(event); 136 WMLElement::defaultEventHandler(event);
156 } 137 }
157 138
158 void WMLAElement::accessKeyAction(bool sendToAnyElement) 139 void WMLAElement::accessKeyAction(bool sendToAnyElement)
159 { 140 {
160 // send the mouse button events if the caller specified sendToAnyElement 141 // send the mouse button events if the caller specified sendToAnyElement
161 dispatchSimulatedClick(0, sendToAnyElement); 142 dispatchSimulatedClick(0, sendToAnyElement);
162 } 143 }
163 144
164 bool WMLAElement::isURLAttribute(Attribute *attr) const 145 bool WMLAElement::isURLAttribute(Attribute *attr) const
165 { 146 {
166 return attr->name() == HTMLNames::hrefAttr; 147 return attr->name() == HTMLNames::hrefAttr;
167 } 148 }
168 149
169 String WMLAElement::target() const 150 String WMLAElement::target() const
170 { 151 {
171 return getAttribute(HTMLNames::targetAttr); 152 return getAttribute(HTMLNames::targetAttr);
172 } 153 }
173 154
174 } 155 }
175 156
176 #endif 157 #endif
OLDNEW
« no previous file with comments | « WebCore/svg/SVGAElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698