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

Unified Diff: third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp

Issue 2778173002: Revert of "Speculatively launch Service Workers on mouse/touch events." (Closed)
Patch Set: rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp b/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
index 72501650ad2785b75235b85042edbf74f284a742..4d8b3238e5b98a983911134748cb5d5e7cd2e3c0 100644
--- a/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
@@ -39,79 +39,11 @@
#include "core/page/Page.h"
#include "platform/network/NetworkHints.h"
#include "platform/weborigin/SecurityPolicy.h"
-#include "public/platform/WebNavigationHintType.h"
namespace blink {
using namespace HTMLNames;
-class HTMLAnchorElement::NavigationHintSender
- : public GarbageCollected<HTMLAnchorElement::NavigationHintSender> {
- public:
- static NavigationHintSender* create(HTMLAnchorElement* anchorElement) {
- return new NavigationHintSender(anchorElement);
- }
- void handleEvent(Event*);
-
- DECLARE_TRACE();
-
- private:
- explicit NavigationHintSender(HTMLAnchorElement*);
- bool shouldSendNavigationHint() const;
- void maybeSendNavigationHint(WebNavigationHintType);
-
- Member<HTMLAnchorElement> m_anchorElement;
-};
-
-void HTMLAnchorElement::NavigationHintSender::handleEvent(Event* event) {
- if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() &&
- toMouseEvent(event)->button() ==
- static_cast<short>(WebPointerProperties::Button::Left))
- maybeSendNavigationHint(WebNavigationHintType::LinkMouseDown);
- else if (event->type() == EventTypeNames::gesturetapunconfirmed)
- maybeSendNavigationHint(WebNavigationHintType::LinkTapUnconfirmed);
- else if (event->type() == EventTypeNames::gestureshowpress)
- maybeSendNavigationHint(WebNavigationHintType::LinkTapDown);
-}
-
-DEFINE_TRACE(HTMLAnchorElement::NavigationHintSender) {
- visitor->trace(m_anchorElement);
-}
-
-HTMLAnchorElement::NavigationHintSender::NavigationHintSender(
- HTMLAnchorElement* anchorElement)
- : m_anchorElement(anchorElement) {}
-
-bool HTMLAnchorElement::NavigationHintSender::shouldSendNavigationHint() const {
- const KURL& url = m_anchorElement->href();
- // Currently the navigation hint only supports HTTP and HTTPS.
- if (!url.protocolIsInHTTPFamily())
- return false;
-
- Document& document = m_anchorElement->document();
- // If the element was detached from the frame, handleClick() doesn't cause
- // the navigation.
- if (!document.frame())
- return false;
-
- // When the user clicks a link which is to the current document with a hash,
- // the network request is not fetched. So we don't send the navigation hint
- // to the browser process.
- if (url.hasFragmentIdentifier() &&
- equalIgnoringFragmentIdentifier(document.url(), url))
- return false;
-
- return true;
-}
-
-void HTMLAnchorElement::NavigationHintSender::maybeSendNavigationHint(
- WebNavigationHintType type) {
- if (!shouldSendNavigationHint())
- return;
-
- sendNavigationHint(m_anchorElement->href(), type);
-}
-
HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName,
Document& document)
: HTMLElement(tagName, document),
@@ -125,11 +57,6 @@ HTMLAnchorElement* HTMLAnchorElement::create(Document& document) {
HTMLAnchorElement::~HTMLAnchorElement() {}
-DEFINE_TRACE(HTMLAnchorElement) {
- visitor->trace(m_navigationHintSender);
- HTMLElement::trace(visitor);
-}
-
bool HTMLAnchorElement::supportsFocus() const {
if (hasEditableStyle(*this))
return HTMLElement::supportsFocus();
@@ -232,9 +159,6 @@ void HTMLAnchorElement::defaultEventHandler(Event* event) {
return;
}
- if (RuntimeEnabledFeatures::speculativeLaunchServiceWorkerEnabled())
- ensureNavigationHintSender()->handleEvent(event);
-
if (isLinkClick(event) && isLiveLink()) {
handleClick(event);
return;
@@ -481,11 +405,4 @@ Node::InsertionNotificationRequest HTMLAnchorElement::insertedInto(
return request;
}
-HTMLAnchorElement::NavigationHintSender*
-HTMLAnchorElement::ensureNavigationHintSender() {
- if (!m_navigationHintSender)
- m_navigationHintSender = NavigationHintSender::create(this);
- return m_navigationHintSender;
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698