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

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

Issue 455223002: Make anchors mouse-focusable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move m_wasFocusedByMouse to elementData().m_shouldHideFocusRingOnMouseFocus Created 6 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 bool HTMLAnchorElement::supportsFocus() const 79 bool HTMLAnchorElement::supportsFocus() const
80 { 80 {
81 if (hasEditableStyle()) 81 if (hasEditableStyle())
82 return HTMLElement::supportsFocus(); 82 return HTMLElement::supportsFocus();
83 // If not a link we should still be able to focus the element if it has tabI ndex. 83 // If not a link we should still be able to focus the element if it has tabI ndex.
84 return isLink() || HTMLElement::supportsFocus(); 84 return isLink() || HTMLElement::supportsFocus();
85 } 85 }
86 86
87 bool HTMLAnchorElement::shouldShowFocusRingOnMouseFocus() const
88 {
89 return HTMLElement::supportsFocus();
90 }
91
87 bool HTMLAnchorElement::isMouseFocusable() const 92 bool HTMLAnchorElement::isMouseFocusable() const
88 { 93 {
89 // Links are focusable by default, but only allow links with tabindex or con tenteditable to be mouse focusable.
90 // https://bugs.webkit.org/show_bug.cgi?id=26856
91 if (isLink()) 94 if (isLink())
92 return HTMLElement::supportsFocus(); 95 return supportsFocus();
93 96
94 return HTMLElement::isMouseFocusable(); 97 return HTMLElement::isMouseFocusable();
95 } 98 }
96 99
97 bool HTMLAnchorElement::isKeyboardFocusable() const 100 bool HTMLAnchorElement::isKeyboardFocusable() const
98 { 101 {
99 ASSERT(document().isActive()); 102 ASSERT(document().isActive());
100 103
101 if (isFocusable() && Element::supportsFocus()) 104 if (isFocusable() && Element::supportsFocus())
102 return HTMLElement::isKeyboardFocusable(); 105 return HTMLElement::isKeyboardFocusable();
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 Vector<String> argv; 383 Vector<String> argv;
381 argv.append("a"); 384 argv.append("a");
382 argv.append(fastGetAttribute(hrefAttr)); 385 argv.append(fastGetAttribute(hrefAttr));
383 activityLogger->logEvent("blinkAddElement", argv.size(), argv.data() ); 386 activityLogger->logEvent("blinkAddElement", argv.size(), argv.data() );
384 } 387 }
385 } 388 }
386 return HTMLElement::insertedInto(insertionPoint); 389 return HTMLElement::insertedInto(insertionPoint);
387 } 390 }
388 391
389 } 392 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698