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

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

Issue 562653002: Do not reset mouse focus flag on keydown at anchor elements (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add regression test (click-focus-keydown-no-ring) 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 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 bool Element::isKeyboardFocusable() const 2128 bool Element::isKeyboardFocusable() const
2129 { 2129 {
2130 return isFocusable() && tabIndex() >= 0; 2130 return isFocusable() && tabIndex() >= 0;
2131 } 2131 }
2132 2132
2133 bool Element::isMouseFocusable() const 2133 bool Element::isMouseFocusable() const
2134 { 2134 {
2135 return isFocusable(); 2135 return isFocusable();
2136 } 2136 }
2137 2137
2138 void Element::willCallDefaultEventHandler(const Event& event)
2139 {
2140 if (!wasFocusedByMouse())
2141 return;
2142 if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown)
2143 return;
2144 setWasFocusedByMouse(false);
2145 if (renderer())
2146 renderer()->setShouldDoFullPaintInvalidation(true);
2147 }
2148
2149 void Element::dispatchFocusEvent(Element* oldFocusedElement, FocusType type) 2138 void Element::dispatchFocusEvent(Element* oldFocusedElement, FocusType type)
2150 { 2139 {
2151 if (type != FocusTypePage)
2152 setWasFocusedByMouse(type == FocusTypeMouse);
2153
2154 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::fo cus, false, false, document().domWindow(), 0, oldFocusedElement); 2140 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::fo cus, false, false, document().domWindow(), 0, oldFocusedElement);
2155 EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(even t.release())); 2141 EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(even t.release()));
2156 } 2142 }
2157 2143
2158 void Element::dispatchBlurEvent(Element* newFocusedElement) 2144 void Element::dispatchBlurEvent(Element* newFocusedElement)
2159 { 2145 {
2160 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::bl ur, false, false, document().domWindow(), 0, newFocusedElement); 2146 RefPtrWillBeRawPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::bl ur, false, false, document().domWindow(), 0, newFocusedElement);
2161 EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event .release())); 2147 EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event .release()));
2162 } 2148 }
2163 2149
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 return v8::Handle<v8::Object>(); 3253 return v8::Handle<v8::Object>();
3268 3254
3269 wrapper->SetPrototype(binding->prototype()); 3255 wrapper->SetPrototype(binding->prototype());
3270 3256
3271 wrapperType->refObject(toScriptWrappableBase()); 3257 wrapperType->refObject(toScriptWrappableBase());
3272 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp er, isolate); 3258 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp er, isolate);
3273 return wrapper; 3259 return wrapper;
3274 } 3260 }
3275 3261
3276 } // namespace blink 3262 } // 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