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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp

Issue 2011653003: Only allow link clicks on single click. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « third_party/WebKit/LayoutTests/fast/loader/repeat-same-document-navigation.html ('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) 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 } 367 }
368 368
369 bool isEnterKeyKeydownEvent(Event* event) 369 bool isEnterKeyKeydownEvent(Event* event)
370 { 370 {
371 return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter" && !toKeyboardEvent(event) ->repeat(); 371 return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter" && !toKeyboardEvent(event) ->repeat();
372 } 372 }
373 373
374 bool isLinkClick(Event* event) 374 bool isLinkClick(Event* event)
375 { 375 {
376 return event->type() == EventTypeNames::click && (!event->isMouseEvent() || toMouseEvent(event)->button() != RightButton); 376 // Allow detail <= 1 so that synthetic clicks work. They have detail == 0.
Rick Byers 2016/05/25 17:25:14 nit: "they may have", right? Presumably JS should
dtapuska 2016/05/25 19:25:47 Done.
377 return event->type() == EventTypeNames::click && (!event->isMouseEvent() || (toMouseEvent(event)->button() != RightButton && toMouseEvent(event)->detail() < = 1));
377 } 378 }
378 379
379 bool HTMLAnchorElement::willRespondToMouseClickEvents() 380 bool HTMLAnchorElement::willRespondToMouseClickEvents()
380 { 381 {
381 return isLink() || HTMLElement::willRespondToMouseClickEvents(); 382 return isLink() || HTMLElement::willRespondToMouseClickEvents();
382 } 383 }
383 384
384 bool HTMLAnchorElement::isInteractiveContent() const 385 bool HTMLAnchorElement::isInteractiveContent() const
385 { 386 {
386 return isLink(); 387 return isLink();
387 } 388 }
388 389
389 Node::InsertionNotificationRequest HTMLAnchorElement::insertedInto(ContainerNode * insertionPoint) 390 Node::InsertionNotificationRequest HTMLAnchorElement::insertedInto(ContainerNode * insertionPoint)
390 { 391 {
391 InsertionNotificationRequest request = HTMLElement::insertedInto(insertionPo int); 392 InsertionNotificationRequest request = HTMLElement::insertedInto(insertionPo int);
392 logAddElementIfIsolatedWorldAndInDocument("a", hrefAttr); 393 logAddElementIfIsolatedWorldAndInDocument("a", hrefAttr);
393 return request; 394 return request;
394 } 395 }
395 396
396 } // namespace blink 397 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/loader/repeat-same-document-navigation.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698