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

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

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new instances Created 4 years, 4 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
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 private: 57 private:
58 explicit NavigationHintSender(HTMLAnchorElement*); 58 explicit NavigationHintSender(HTMLAnchorElement*);
59 bool shouldSendNavigationHint() const; 59 bool shouldSendNavigationHint() const;
60 void maybeSendNavigationHint(WebNavigationHintType); 60 void maybeSendNavigationHint(WebNavigationHintType);
61 61
62 Member<HTMLAnchorElement> m_anchorElement; 62 Member<HTMLAnchorElement> m_anchorElement;
63 }; 63 };
64 64
65 void HTMLAnchorElement::NavigationHintSender::handleEvent(Event* event) 65 void HTMLAnchorElement::NavigationHintSender::handleEvent(Event* event)
66 { 66 {
67 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) 67 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == static_cast<short>(WebPointerProperties::Button: :Left))
68 maybeSendNavigationHint(WebNavigationHintType::LinkMouseDown); 68 maybeSendNavigationHint(WebNavigationHintType::LinkMouseDown);
69 else if (event->type() == EventTypeNames::gesturetapunconfirmed) 69 else if (event->type() == EventTypeNames::gesturetapunconfirmed)
70 maybeSendNavigationHint(WebNavigationHintType::LinkTapUnconfirmed); 70 maybeSendNavigationHint(WebNavigationHintType::LinkTapUnconfirmed);
71 else if (event->type() == EventTypeNames::gestureshowpress) 71 else if (event->type() == EventTypeNames::gestureshowpress)
72 maybeSendNavigationHint(WebNavigationHintType::LinkTapDown); 72 maybeSendNavigationHint(WebNavigationHintType::LinkTapDown);
73 } 73 }
74 74
75 DEFINE_TRACE(HTMLAnchorElement::NavigationHintSender) 75 DEFINE_TRACE(HTMLAnchorElement::NavigationHintSender)
76 { 76 {
77 visitor->trace(m_anchorElement); 77 visitor->trace(m_anchorElement);
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 448 }
449 449
450 bool isEnterKeyKeydownEvent(Event* event) 450 bool isEnterKeyKeydownEvent(Event* event)
451 { 451 {
452 return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->key() == "Enter" && !toKeyboardEvent(event)->repeat() ; 452 return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->key() == "Enter" && !toKeyboardEvent(event)->repeat() ;
453 } 453 }
454 454
455 bool isLinkClick(Event* event) 455 bool isLinkClick(Event* event)
456 { 456 {
457 // Allow detail <= 1 so that synthetic clicks work. They may have detail == 0. 457 // Allow detail <= 1 so that synthetic clicks work. They may have detail == 0.
458 return (event->type() == EventTypeNames::click || event->type() == EventType Names::auxclick) && (!event->isMouseEvent() || (toMouseEvent(event)->button() != RightButton && toMouseEvent(event)->detail() <= 1)); 458 return (event->type() == EventTypeNames::click || event->type() == EventType Names::auxclick) && (!event->isMouseEvent() || (toMouseEvent(event)->button() != static_cast<short>(WebPointerProperties::Button::Right) && toMouseEvent(event)- >detail() <= 1));
459 } 459 }
460 460
461 bool HTMLAnchorElement::willRespondToMouseClickEvents() 461 bool HTMLAnchorElement::willRespondToMouseClickEvents()
462 { 462 {
463 return isLink() || HTMLElement::willRespondToMouseClickEvents(); 463 return isLink() || HTMLElement::willRespondToMouseClickEvents();
464 } 464 }
465 465
466 bool HTMLAnchorElement::isInteractiveContent() const 466 bool HTMLAnchorElement::isInteractiveContent() const
467 { 467 {
468 return isLink(); 468 return isLink();
469 } 469 }
470 470
471 Node::InsertionNotificationRequest HTMLAnchorElement::insertedInto(ContainerNode * insertionPoint) 471 Node::InsertionNotificationRequest HTMLAnchorElement::insertedInto(ContainerNode * insertionPoint)
472 { 472 {
473 InsertionNotificationRequest request = HTMLElement::insertedInto(insertionPo int); 473 InsertionNotificationRequest request = HTMLElement::insertedInto(insertionPo int);
474 logAddElementIfIsolatedWorldAndInDocument("a", hrefAttr); 474 logAddElementIfIsolatedWorldAndInDocument("a", hrefAttr);
475 return request; 475 return request;
476 } 476 }
477 477
478 HTMLAnchorElement::NavigationHintSender* HTMLAnchorElement::ensureNavigationHint Sender() 478 HTMLAnchorElement::NavigationHintSender* HTMLAnchorElement::ensureNavigationHint Sender()
479 { 479 {
480 if (!m_navigationHintSender) 480 if (!m_navigationHintSender)
481 m_navigationHintSender = NavigationHintSender::create(this); 481 m_navigationHintSender = NavigationHintSender::create(this);
482 return m_navigationHintSender; 482 return m_navigationHintSender;
483 } 483 }
484 484
485 } // namespace blink 485 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698