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

Side by Side Diff: Source/core/html/HTMLFormControlElement.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/html/HTMLFormControlElement.h ('k') | Source/core/svg/SVGAElement.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 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 bool HTMLFormControlElement::shouldShowFocusRingOnMouseFocus() const 333 bool HTMLFormControlElement::shouldShowFocusRingOnMouseFocus() const
334 { 334 {
335 return false; 335 return false;
336 } 336 }
337 337
338 bool HTMLFormControlElement::shouldHaveFocusAppearance() const 338 bool HTMLFormControlElement::shouldHaveFocusAppearance() const
339 { 339 {
340 return !m_wasFocusedByMouse || shouldShowFocusRingOnMouseFocus(); 340 return !m_wasFocusedByMouse || shouldShowFocusRingOnMouseFocus();
341 } 341 }
342 342
343 bool HTMLFormControlElement::wasFocusedByMouse() const 343 void HTMLFormControlElement::dispatchFocusEvent(Element* oldFocusedElement, Focu sType type)
344 { 344 {
345 return m_wasFocusedByMouse; 345 if (type != FocusTypePage)
346 m_wasFocusedByMouse = type == FocusTypeMouse;
347 HTMLElement::dispatchFocusEvent(oldFocusedElement, type);
346 } 348 }
347 349
348 void HTMLFormControlElement::setWasFocusedByMouse(bool wasFocusedByMouse) 350 void HTMLFormControlElement::willCallDefaultEventHandler(const Event& event)
349 { 351 {
350 m_wasFocusedByMouse = wasFocusedByMouse; 352 if (!m_wasFocusedByMouse)
353 return;
354 if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown)
355 return;
356 m_wasFocusedByMouse = false;
357 if (renderer())
358 renderer()->setShouldDoFullPaintInvalidation(true);
351 } 359 }
352 360
353 short HTMLFormControlElement::tabIndex() const 361 short HTMLFormControlElement::tabIndex() const
354 { 362 {
355 // Skip the supportsFocus check in HTMLElement. 363 // Skip the supportsFocus check in HTMLElement.
356 return Element::tabIndex(); 364 return Element::tabIndex();
357 } 365 }
358 366
359 bool HTMLFormControlElement::recalcWillValidate() const 367 bool HTMLFormControlElement::recalcWillValidate() const
360 { 368 {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 551
544 void HTMLFormControlElement::setFocus(bool flag) 552 void HTMLFormControlElement::setFocus(bool flag)
545 { 553 {
546 LabelableElement::setFocus(flag); 554 LabelableElement::setFocus(flag);
547 555
548 if (!flag && wasChangedSinceLastFormControlChangeEvent()) 556 if (!flag && wasChangedSinceLastFormControlChangeEvent())
549 dispatchFormControlChangeEvent(); 557 dispatchFormControlChangeEvent();
550 } 558 }
551 559
552 } // namespace Webcore 560 } // namespace Webcore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormControlElement.h ('k') | Source/core/svg/SVGAElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698