| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2  * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 
| 3  * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> | 3  * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> | 
| 4  * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4  * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 
|  | 5  * Copyright (C) 2010 Apple Inc. All rights reserved. | 
| 5  * | 6  * | 
| 6  * This library is free software; you can redistribute it and/or | 7  * This library is free software; you can redistribute it and/or | 
| 7  * modify it under the terms of the GNU Library General Public | 8  * modify it under the terms of the GNU Library General Public | 
| 8  * License as published by the Free Software Foundation; either | 9  * License as published by the Free Software Foundation; either | 
| 9  * version 2 of the License, or (at your option) any later version. | 10  * version 2 of the License, or (at your option) any later version. | 
| 10  * | 11  * | 
| 11  * This library is distributed in the hope that it will be useful, | 12  * This library is distributed in the hope that it will be useful, | 
| 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
| 14  * Library General Public License for more details. | 15  * Library General Public License for more details. | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 26 | 27 | 
| 27 #include "Attr.h" | 28 #include "Attr.h" | 
| 28 #include "Attribute.h" | 29 #include "Attribute.h" | 
| 29 #include "CSSHelper.h" | 30 #include "CSSHelper.h" | 
| 30 #include "Document.h" | 31 #include "Document.h" | 
| 31 #include "EventHandler.h" | 32 #include "EventHandler.h" | 
| 32 #include "EventNames.h" | 33 #include "EventNames.h" | 
| 33 #include "Frame.h" | 34 #include "Frame.h" | 
| 34 #include "FrameLoader.h" | 35 #include "FrameLoader.h" | 
| 35 #include "FrameLoaderTypes.h" | 36 #include "FrameLoaderTypes.h" | 
|  | 37 #include "HTMLAnchorElement.h" | 
| 36 #include "KeyboardEvent.h" | 38 #include "KeyboardEvent.h" | 
| 37 #include "MouseEvent.h" | 39 #include "MouseEvent.h" | 
| 38 #include "PlatformMouseEvent.h" | 40 #include "PlatformMouseEvent.h" | 
| 39 #include "RenderSVGInline.h" | 41 #include "RenderSVGInline.h" | 
| 40 #include "RenderSVGTransformableContainer.h" | 42 #include "RenderSVGTransformableContainer.h" | 
| 41 #include "ResourceRequest.h" | 43 #include "ResourceRequest.h" | 
| 42 #include "SVGNames.h" | 44 #include "SVGNames.h" | 
| 43 #include "SVGSMILElement.h" | 45 #include "SVGSMILElement.h" | 
| 44 #include "XLinkNames.h" | 46 #include "XLinkNames.h" | 
| 45 | 47 | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 118 } | 120 } | 
| 119 | 121 | 
| 120 RenderObject* SVGAElement::createRenderer(RenderArena* arena, RenderStyle*) | 122 RenderObject* SVGAElement::createRenderer(RenderArena* arena, RenderStyle*) | 
| 121 { | 123 { | 
| 122     if (static_cast<SVGElement*>(parent())->isTextContent()) | 124     if (static_cast<SVGElement*>(parent())->isTextContent()) | 
| 123         return new (arena) RenderSVGInline(this); | 125         return new (arena) RenderSVGInline(this); | 
| 124 | 126 | 
| 125     return new (arena) RenderSVGTransformableContainer(this); | 127     return new (arena) RenderSVGTransformableContainer(this); | 
| 126 } | 128 } | 
| 127 | 129 | 
| 128 void SVGAElement::defaultEventHandler(Event* evt) | 130 void SVGAElement::defaultEventHandler(Event* event) | 
| 129 { | 131 { | 
| 130     if (isLink() && (evt->type() == eventNames().clickEvent || (evt->type() == e
     ventNames().keydownEvent && focused()))) { | 132     if (isLink()) { | 
| 131         MouseEvent* e = 0; | 133         if (focused() && isEnterKeyKeydownEvent(event)) { | 
| 132         if (evt->type() == eventNames().clickEvent && evt->isMouseEvent()) | 134             event->setDefaultHandled(); | 
| 133             e = static_cast<MouseEvent*>(evt); | 135             dispatchSimulatedClick(event); | 
| 134 |  | 
| 135         KeyboardEvent* k = 0; |  | 
| 136         if (evt->type() == eventNames().keydownEvent && evt->isKeyboardEvent()) |  | 
| 137             k = static_cast<KeyboardEvent*>(evt); |  | 
| 138 |  | 
| 139         if (e && e->button() == RightButton) { |  | 
| 140             SVGStyledTransformableElement::defaultEventHandler(evt); |  | 
| 141             return; | 136             return; | 
| 142         } | 137         } | 
| 143 |  | 
| 144         if (k) { |  | 
| 145             if (k->keyIdentifier() != "Enter") { |  | 
| 146                 SVGStyledTransformableElement::defaultEventHandler(evt); |  | 
| 147                 return; |  | 
| 148             } |  | 
| 149             evt->setDefaultHandled(); |  | 
| 150             dispatchSimulatedClick(evt); |  | 
| 151             return; |  | 
| 152         } |  | 
| 153 |  | 
| 154         String target = this->target(); |  | 
| 155         if (e && e->button() == MiddleButton) |  | 
| 156             target = "_blank"; |  | 
| 157         else if (target.isEmpty()) // if target is empty, default to "_self" or 
     use xlink:target if set |  | 
| 158             target = (getAttribute(XLinkNames::showAttr) == "new") ? "_blank" : 
     "_self"; |  | 
| 159 | 138 | 
| 160         if (!evt->defaultPrevented()) { | 139         if (isLinkClick(event)) { | 
| 161             String url = deprecatedParseURL(href()); | 140             String url = deprecatedParseURL(href()); | 
|  | 141 | 
| 162 #if ENABLE(SVG_ANIMATION) | 142 #if ENABLE(SVG_ANIMATION) | 
| 163             if (url.startsWith("#")) { | 143             if (url[0] == '#') { | 
| 164                 Element* targetElement = document()->getElementById(url.substrin
     g(1)); | 144                 Element* targetElement = document()->getElementById(url.substrin
     g(1)); | 
| 165                 if (SVGSMILElement::isSMILElement(targetElement)) { | 145                 if (SVGSMILElement::isSMILElement(targetElement)) { | 
| 166                     SVGSMILElement* timed = static_cast<SVGSMILElement*>(targetE
     lement); | 146                     static_cast<SVGSMILElement*>(targetElement)->beginByLinkActi
     vation(); | 
| 167                     timed->beginByLinkActivation(); | 147                     event->setDefaultHandled(); | 
| 168                     evt->setDefaultHandled(); |  | 
| 169                     SVGStyledTransformableElement::defaultEventHandler(evt); |  | 
| 170                     return; | 148                     return; | 
| 171                 } | 149                 } | 
| 172             } | 150             } | 
| 173 #endif | 151 #endif | 
| 174             if (document()->frame()) | 152 | 
| 175                 document()->frame()->loader()->urlSelected(document()->completeU
     RL(url), target, evt, false, false, true, SendReferrer); | 153             // FIXME: Why does the SVG anchor element have this special logic | 
|  | 154             // for middle click that the HTML anchor element does not have? | 
|  | 155             // Making a middle click open a link in a new window or tab is | 
|  | 156             // properly handled at the client level, not inside WebKit; this | 
|  | 157             // code should be deleted. | 
|  | 158             String target = isMiddleMouseButtonEvent(event) ? "_blank" : this->t
     arget(); | 
|  | 159 | 
|  | 160             // FIXME: It's not clear why setting target to "_self" is ever | 
|  | 161             // helpful. | 
|  | 162             if (target.isEmpty()) | 
|  | 163                 target = (getAttribute(XLinkNames::showAttr) == "new") ? "_blank
     " : "_self"; | 
|  | 164 | 
|  | 165             handleLinkClick(event, document(), url, target); | 
|  | 166             return; | 
| 176         } | 167         } | 
| 177 |  | 
| 178         evt->setDefaultHandled(); |  | 
| 179     } | 168     } | 
| 180 | 169 | 
| 181     SVGStyledTransformableElement::defaultEventHandler(evt); | 170     SVGStyledTransformableElement::defaultEventHandler(event); | 
| 182 } | 171 } | 
| 183 | 172 | 
| 184 bool SVGAElement::supportsFocus() const | 173 bool SVGAElement::supportsFocus() const | 
| 185 { | 174 { | 
| 186     if (isContentEditable()) | 175     if (isContentEditable()) | 
| 187         return SVGStyledTransformableElement::supportsFocus(); | 176         return SVGStyledTransformableElement::supportsFocus(); | 
| 188     return true; | 177     return true; | 
| 189 } | 178 } | 
| 190 | 179 | 
| 191 bool SVGAElement::isFocusable() const | 180 bool SVGAElement::isFocusable() const | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 220         return false; | 209         return false; | 
| 221     if (parent() && parent()->isSVGElement()) | 210     if (parent() && parent()->isSVGElement()) | 
| 222         return parent()->childShouldCreateRenderer(child); | 211         return parent()->childShouldCreateRenderer(child); | 
| 223 | 212 | 
| 224     return SVGElement::childShouldCreateRenderer(child); | 213     return SVGElement::childShouldCreateRenderer(child); | 
| 225 } | 214 } | 
| 226 | 215 | 
| 227 } // namespace WebCore | 216 } // namespace WebCore | 
| 228 | 217 | 
| 229 #endif // ENABLE(SVG) | 218 #endif // ENABLE(SVG) | 
| OLD | NEW | 
|---|