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

Side by Side Diff: Source/core/dom/Element.cpp

Issue 455223002: Make anchors mouse-focusable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move m_wasFocusedByMouse into subclasses. Created 6 years, 3 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 | « Source/core/dom/Element.h ('k') | Source/core/html/HTMLAnchorElement.h » ('j') | 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) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 bool Element::isKeyboardFocusable() const 2157 bool Element::isKeyboardFocusable() const
2158 { 2158 {
2159 return isFocusable() && tabIndex() >= 0; 2159 return isFocusable() && tabIndex() >= 0;
2160 } 2160 }
2161 2161
2162 bool Element::isMouseFocusable() const 2162 bool Element::isMouseFocusable() const
2163 { 2163 {
2164 return isFocusable(); 2164 return isFocusable();
2165 } 2165 }
2166 2166
2167 void Element::dispatchFocusEvent(Element* oldFocusedElement, FocusType) 2167 void Element::willCallDefaultEventHandler(const Event& event)
2168 { 2168 {
2169 if (!wasFocusedByMouse())
2170 return;
2171 if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown)
2172 return;
2173 setWasFocusedByMouse(false);
2174 if (renderer())
2175 renderer()->setShouldDoFullPaintInvalidation(true);
2176 }
2177
2178 void Element::dispatchFocusEvent(Element* oldFocusedElement, FocusType type)
2179 {
2180 if (type != FocusTypePage)
2181 setWasFocusedByMouse(type == FocusTypeMouse);
2182
2169 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::fo cus, false, false, document().domWindow(), 0, oldFocusedElement); 2183 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::fo cus, false, false, document().domWindow(), 0, oldFocusedElement);
2170 EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(even t.release())); 2184 EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(even t.release()));
2171 } 2185 }
2172 2186
2173 void Element::dispatchBlurEvent(Element* newFocusedElement) 2187 void Element::dispatchBlurEvent(Element* newFocusedElement)
2174 { 2188 {
2175 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::bl ur, false, false, document().domWindow(), 0, newFocusedElement); 2189 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::bl ur, false, false, document().domWindow(), 0, newFocusedElement);
2176 EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event .release())); 2190 EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event .release()));
2177 } 2191 }
2178 2192
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 { 3262 {
3249 #if ENABLE(OILPAN) 3263 #if ENABLE(OILPAN)
3250 if (hasRareData()) 3264 if (hasRareData())
3251 visitor->trace(elementRareData()); 3265 visitor->trace(elementRareData());
3252 visitor->trace(m_elementData); 3266 visitor->trace(m_elementData);
3253 #endif 3267 #endif
3254 ContainerNode::trace(visitor); 3268 ContainerNode::trace(visitor);
3255 } 3269 }
3256 3270
3257 } // namespace blink 3271 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/html/HTMLAnchorElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698