Index: Source/WebCore/html/HTMLAnchorElement.cpp |
=================================================================== |
--- Source/WebCore/html/HTMLAnchorElement.cpp (revision 91866) |
+++ Source/WebCore/html/HTMLAnchorElement.cpp (working copy) |
@@ -27,6 +27,7 @@ |
#include "Attribute.h" |
#include "EventNames.h" |
#include "Frame.h" |
+#include "FrameLoaderClient.h" |
#include "FrameLoaderTypes.h" |
#include "HTMLImageElement.h" |
#include "HTMLNames.h" |
@@ -147,10 +148,7 @@ |
} |
if (isLinkClick(event) && treatLinkAsLiveForEventType(eventType(event))) { |
- String url = stripLeadingAndTrailingHTMLSpaces(getAttribute(hrefAttr)); |
- appendServerMapMousePosition(url, event); |
- handleLinkClick(event, document(), url, getAttribute(targetAttr), hasRel(RelationNoReferrer)); |
- sendPings(document()->completeURL(url)); |
+ handleClick(event); |
return; |
} |
@@ -492,6 +490,37 @@ |
PingLoader::sendPing(document()->frame(), document()->completeURL(pingURLs[i]), destinationURL); |
} |
+void HTMLAnchorElement::handleClick(Event* event) |
+{ |
+ event->setDefaultHandled(); |
+ |
+ Frame* frame = document()->frame(); |
+ if (!frame) |
+ return; |
+ |
+ String url = stripLeadingAndTrailingHTMLSpaces(fastGetAttribute(hrefAttr)); |
+ appendServerMapMousePosition(url, event); |
+ KURL kurl = document()->completeURL(url); |
+ |
+#if ENABLE(DOWNLOAD_ATTRIBUTE) |
+ if (hasAttribute(downloadAttr)) { |
+ ResourceRequest request(kurl); |
+ |
+ if (!hasRel(RelationNoReferrer)) { |
+ String referrer = frame->loader()->outgoingReferrer(); |
+ if (!referrer.isEmpty() && !SecurityOrigin::shouldHideReferrer(kurl, referrer)) |
+ request.setHTTPReferrer(referrer); |
+ frame->loader()->addExtraFieldsToMainResourceRequest(request); |
+ } |
+ |
+ frame->loader()->client()->startDownload(request, fastGetAttribute(downloadAttr)); |
+ } else |
+#endif |
+ frame->loader()->urlSelected(kurl, target(), event, false, false, hasRel(RelationNoReferrer) ? NoReferrer : SendReferrer); |
+ |
+ sendPings(kurl); |
+} |
+ |
HTMLAnchorElement::EventType HTMLAnchorElement::eventType(Event* event) |
{ |
if (!event->isMouseEvent()) |