| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Simon Hausmann <hausmann@kde.org> | 4 * (C) 2000 Simon Hausmann <hausmann@kde.org> |
| 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 if (wasLink && treeScope().adjustedFocusedElement() == this) { | 268 if (wasLink && treeScope().adjustedFocusedElement() == this) { |
| 269 // We might want to call blur(), but it's dangerous to dispatch | 269 // We might want to call blur(), but it's dangerous to dispatch |
| 270 // events here. | 270 // events here. |
| 271 document().setNeedsFocusedElementCheck(); | 271 document().setNeedsFocusedElementCheck(); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 if (isLink()) { | 274 if (isLink()) { |
| 275 String parsedURL = stripLeadingAndTrailingHTMLSpaces(value); | 275 String parsedURL = stripLeadingAndTrailingHTMLSpaces(value); |
| 276 if (document().isDNSPrefetchEnabled()) { | 276 if (document().isDNSPrefetchEnabled()) { |
| 277 if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "http
s") || parsedURL.startsWith("//")) | 277 if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "http
s") || parsedURL.startsWith("//")) |
| 278 prefetchDNS(document().completeURL(parsedURL).host()); | 278 prefetchDNS(treeScope().completeURL(parsedURL).host()); |
| 279 } | 279 } |
| 280 | 280 |
| 281 if (wasLink) | 281 if (wasLink) |
| 282 prefetchEventHandler()->didChangeHREF(); | 282 prefetchEventHandler()->didChangeHREF(); |
| 283 } | 283 } |
| 284 invalidateCachedVisitedLinkHash(); | 284 invalidateCachedVisitedLinkHash(); |
| 285 } else if (name == nameAttr || name == titleAttr) { | 285 } else if (name == nameAttr || name == titleAttr) { |
| 286 // Do nothing. | 286 // Do nothing. |
| 287 } else if (name == relAttr) | 287 } else if (name == relAttr) |
| 288 setRel(value); | 288 setRel(value); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 314 const AtomicString& value = getAttribute(draggableAttr); | 314 const AtomicString& value = getAttribute(draggableAttr); |
| 315 if (equalIgnoringCase(value, "true")) | 315 if (equalIgnoringCase(value, "true")) |
| 316 return true; | 316 return true; |
| 317 if (equalIgnoringCase(value, "false")) | 317 if (equalIgnoringCase(value, "false")) |
| 318 return false; | 318 return false; |
| 319 return hasAttribute(hrefAttr); | 319 return hasAttribute(hrefAttr); |
| 320 } | 320 } |
| 321 | 321 |
| 322 KURL HTMLAnchorElement::href() const | 322 KURL HTMLAnchorElement::href() const |
| 323 { | 323 { |
| 324 return document().completeURL(stripLeadingAndTrailingHTMLSpaces(getAttribute
(hrefAttr))); | 324 return treeScope().completeURL(stripLeadingAndTrailingHTMLSpaces(getAttribut
e(hrefAttr))); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void HTMLAnchorElement::setHref(const AtomicString& value) | 327 void HTMLAnchorElement::setHref(const AtomicString& value) |
| 328 { | 328 { |
| 329 setAttribute(hrefAttr, value); | 329 setAttribute(hrefAttr, value); |
| 330 } | 330 } |
| 331 | 331 |
| 332 KURL HTMLAnchorElement::url() const | 332 KURL HTMLAnchorElement::url() const |
| 333 { | 333 { |
| 334 return href(); | 334 return href(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return isLink() && treatLinkAsLiveForEventType(m_wasShiftKeyDownOnMouseDown
? MouseEventWithShiftKey : MouseEventWithoutShiftKey); | 390 return isLink() && treatLinkAsLiveForEventType(m_wasShiftKeyDownOnMouseDown
? MouseEventWithShiftKey : MouseEventWithoutShiftKey); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void HTMLAnchorElement::sendPings(const KURL& destinationURL) | 393 void HTMLAnchorElement::sendPings(const KURL& destinationURL) |
| 394 { | 394 { |
| 395 if (!hasAttribute(pingAttr) || !document().settings() || !document().setting
s()->hyperlinkAuditingEnabled()) | 395 if (!hasAttribute(pingAttr) || !document().settings() || !document().setting
s()->hyperlinkAuditingEnabled()) |
| 396 return; | 396 return; |
| 397 | 397 |
| 398 SpaceSplitString pingURLs(getAttribute(pingAttr), false); | 398 SpaceSplitString pingURLs(getAttribute(pingAttr), false); |
| 399 for (unsigned i = 0; i < pingURLs.size(); i++) | 399 for (unsigned i = 0; i < pingURLs.size(); i++) |
| 400 PingLoader::sendPing(document().frame(), document().completeURL(pingURLs
[i]), destinationURL); | 400 PingLoader::sendPing(document().frame(), treeScope().completeURL(pingURL
s[i]), destinationURL); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void HTMLAnchorElement::handleClick(Event* event) | 403 void HTMLAnchorElement::handleClick(Event* event) |
| 404 { | 404 { |
| 405 event->setDefaultHandled(); | 405 event->setDefaultHandled(); |
| 406 | 406 |
| 407 Frame* frame = document().frame(); | 407 Frame* frame = document().frame(); |
| 408 if (!frame) | 408 if (!frame) |
| 409 return; | 409 return; |
| 410 | 410 |
| 411 StringBuilder url; | 411 StringBuilder url; |
| 412 url.append(stripLeadingAndTrailingHTMLSpaces(fastGetAttribute(hrefAttr))); | 412 url.append(stripLeadingAndTrailingHTMLSpaces(fastGetAttribute(hrefAttr))); |
| 413 appendServerMapMousePosition(url, event); | 413 appendServerMapMousePosition(url, event); |
| 414 KURL completedURL = document().completeURL(url.toString()); | 414 KURL completedURL = treeScope().completeURL(url.toString()); |
| 415 | 415 |
| 416 // Schedule the ping before the frame load. Prerender in Chrome may kill the
renderer as soon as the navigation is | 416 // Schedule the ping before the frame load. Prerender in Chrome may kill the
renderer as soon as the navigation is |
| 417 // sent out. | 417 // sent out. |
| 418 sendPings(completedURL); | 418 sendPings(completedURL); |
| 419 | 419 |
| 420 ResourceRequest request(completedURL); | 420 ResourceRequest request(completedURL); |
| 421 if (prefetchEventHandler()->hasIssuedPreconnect()) | 421 if (prefetchEventHandler()->hasIssuedPreconnect()) |
| 422 frame->loader().client()->dispatchWillRequestAfterPreconnect(request); | 422 frame->loader().client()->dispatchWillRequestAfterPreconnect(request); |
| 423 if (hasAttribute(downloadAttr)) { | 423 if (hasAttribute(downloadAttr)) { |
| 424 if (!hasRel(RelationNoReferrer)) { | 424 if (!hasRel(RelationNoReferrer)) { |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 preconnectToURL(url, motivation); | 689 preconnectToURL(url, motivation); |
| 690 m_hasIssuedPreconnect = true; | 690 m_hasIssuedPreconnect = true; |
| 691 } | 691 } |
| 692 | 692 |
| 693 bool HTMLAnchorElement::isInteractiveContent() const | 693 bool HTMLAnchorElement::isInteractiveContent() const |
| 694 { | 694 { |
| 695 return true; | 695 return true; |
| 696 } | 696 } |
| 697 | 697 |
| 698 } | 698 } |
| OLD | NEW |