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

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: De-duplicate using FocusController; update TestExpectations 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 25 matching lines...) Expand all
36 #include "core/html/HTMLFormElement.h" 36 #include "core/html/HTMLFormElement.h"
37 #include "core/html/HTMLImageElement.h" 37 #include "core/html/HTMLImageElement.h"
38 #include "core/html/parser/HTMLParserIdioms.h" 38 #include "core/html/parser/HTMLParserIdioms.h"
39 #include "core/loader/FrameLoadRequest.h" 39 #include "core/loader/FrameLoadRequest.h"
40 #include "core/loader/FrameLoader.h" 40 #include "core/loader/FrameLoader.h"
41 #include "core/loader/FrameLoaderClient.h" 41 #include "core/loader/FrameLoaderClient.h"
42 #include "core/loader/FrameLoaderTypes.h" 42 #include "core/loader/FrameLoaderTypes.h"
43 #include "core/loader/PingLoader.h" 43 #include "core/loader/PingLoader.h"
44 #include "core/page/Chrome.h" 44 #include "core/page/Chrome.h"
45 #include "core/page/ChromeClient.h" 45 #include "core/page/ChromeClient.h"
46 #include "core/page/FocusController.h"
47 #include "core/page/Page.h"
46 #include "core/rendering/RenderImage.h" 48 #include "core/rendering/RenderImage.h"
47 #include "platform/PlatformMouseEvent.h" 49 #include "platform/PlatformMouseEvent.h"
48 #include "platform/network/DNS.h" 50 #include "platform/network/DNS.h"
49 #include "platform/network/ResourceRequest.h" 51 #include "platform/network/ResourceRequest.h"
50 #include "platform/weborigin/KnownPorts.h" 52 #include "platform/weborigin/KnownPorts.h"
51 #include "platform/weborigin/SecurityOrigin.h" 53 #include "platform/weborigin/SecurityOrigin.h"
52 #include "platform/weborigin/SecurityPolicy.h" 54 #include "platform/weborigin/SecurityPolicy.h"
53 #include "public/platform/Platform.h" 55 #include "public/platform/Platform.h"
54 #include "public/platform/WebURL.h" 56 #include "public/platform/WebURL.h"
55 #include "public/platform/WebURLRequest.h" 57 #include "public/platform/WebURLRequest.h"
(...skipping 21 matching lines...) Expand all
77 } 79 }
78 80
79 bool HTMLAnchorElement::supportsFocus() const 81 bool HTMLAnchorElement::supportsFocus() const
80 { 82 {
81 if (hasEditableStyle()) 83 if (hasEditableStyle())
82 return HTMLElement::supportsFocus(); 84 return HTMLElement::supportsFocus();
83 // If not a link we should still be able to focus the element if it has tabI ndex. 85 // If not a link we should still be able to focus the element if it has tabI ndex.
84 return isLink() || HTMLElement::supportsFocus(); 86 return isLink() || HTMLElement::supportsFocus();
85 } 87 }
86 88
89 bool HTMLAnchorElement::shouldHaveFocusAppearance() const
90 {
91 ASSERT(focused());
92 return !document().page()->focusController().wasFocusedByMouse() || HTMLElem ent::supportsFocus();
Xianzhu 2014/08/12 03:58:01 The above code will have side-effect. For example:
Xianzhu 2014/08/12 04:01:11 s/agile/fragile/ ..
robwu 2014/08/12 14:27:49 What is "outline-style:auto" supposed to do when a
Xianzhu 2014/08/12 16:03:07 I think 'outline-style:auto' was first introduced
Xianzhu 2014/08/14 19:12:49 I no longer insist the pseudo-class method. The cu
robwu 2014/08/15 22:51:33 Great. Anything else besides that?
93 }
94
87 bool HTMLAnchorElement::isMouseFocusable() const 95 bool HTMLAnchorElement::isMouseFocusable() const
88 { 96 {
89 // Links are focusable by default, but only allow links with tabindex or con tenteditable to be mouse focusable.
pdr. 2014/08/12 02:02:22 Both here and in SVGAElement we're removing this c
robwu 2014/08/12 14:27:49 LayoutTests/fast/events/click-focus-anchor.html al
90 // https://bugs.webkit.org/show_bug.cgi?id=26856
91 if (isLink()) 97 if (isLink())
92 return HTMLElement::supportsFocus(); 98 return supportsFocus();
93 99
94 return HTMLElement::isMouseFocusable(); 100 return HTMLElement::isMouseFocusable();
95 } 101 }
96 102
97 bool HTMLAnchorElement::isKeyboardFocusable() const 103 bool HTMLAnchorElement::isKeyboardFocusable() const
98 { 104 {
99 ASSERT(document().isActive()); 105 ASSERT(document().isActive());
100 106
101 if (isFocusable() && Element::supportsFocus()) 107 if (isFocusable() && Element::supportsFocus())
102 return HTMLElement::isKeyboardFocusable(); 108 return HTMLElement::isKeyboardFocusable();
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 Vector<String> argv; 386 Vector<String> argv;
381 argv.append("a"); 387 argv.append("a");
382 argv.append(fastGetAttribute(hrefAttr)); 388 argv.append(fastGetAttribute(hrefAttr));
383 activityLogger->logEvent("blinkAddElement", argv.size(), argv.data() ); 389 activityLogger->logEvent("blinkAddElement", argv.size(), argv.data() );
384 } 390 }
385 } 391 }
386 return HTMLElement::insertedInto(insertionPoint); 392 return HTMLElement::insertedInto(insertionPoint);
387 } 393 }
388 394
389 } 395 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698