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

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

Issue 16194013: Mouse press should focus on any types of form controls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 bool HTMLInputElement::hasCustomFocusLogic() const 364 bool HTMLInputElement::hasCustomFocusLogic() const
365 { 365 {
366 return m_inputType->hasCustomFocusLogic(); 366 return m_inputType->hasCustomFocusLogic();
367 } 367 }
368 368
369 bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const 369 bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const
370 { 370 {
371 return m_inputType->isKeyboardFocusable(event); 371 return m_inputType->isKeyboardFocusable(event);
372 } 372 }
373 373
374 bool HTMLInputElement::isMouseFocusable() const 374 bool HTMLInputElement::shouldShowFocusRingOnMouseFocus() const
375 { 375 {
376 return m_inputType->isMouseFocusable(); 376 return m_inputType->shouldShowFocusRingOnMouseFocus();
377 } 377 }
378 378
379 bool HTMLInputElement::isTextFormControlKeyboardFocusable(KeyboardEvent* event) const 379 bool HTMLInputElement::isTextFormControlKeyboardFocusable(KeyboardEvent* event) const
380 { 380 {
381 return HTMLTextFormControlElement::isKeyboardFocusable(event); 381 return HTMLTextFormControlElement::isKeyboardFocusable(event);
382 } 382 }
383 383
384 bool HTMLInputElement::isTextFormControlMouseFocusable() const
385 {
386 return HTMLTextFormControlElement::isMouseFocusable();
387 }
388
389 void HTMLInputElement::updateFocusAppearance(bool restorePreviousSelection) 384 void HTMLInputElement::updateFocusAppearance(bool restorePreviousSelection)
390 { 385 {
391 if (isTextField()) { 386 if (isTextField()) {
392 if (!restorePreviousSelection || !hasCachedSelection()) 387 if (!restorePreviousSelection || !hasCachedSelection())
393 select(); 388 select();
394 else 389 else
395 restoreCachedSelection(); 390 restoreCachedSelection();
396 if (document()->frame()) 391 if (document()->frame())
397 document()->frame()->selection()->revealSelection(); 392 document()->frame()->selection()->revealSelection();
398 } else 393 } else
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 return; 1155 return;
1161 } 1156 }
1162 1157
1163 if (evt->isTouchEvent()) { 1158 if (evt->isTouchEvent()) {
1164 m_inputType->handleTouchEvent(static_cast<TouchEvent*>(evt)); 1159 m_inputType->handleTouchEvent(static_cast<TouchEvent*>(evt));
1165 if (evt->defaultHandled()) 1160 if (evt->defaultHandled())
1166 return; 1161 return;
1167 } 1162 }
1168 1163
1169 if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) { 1164 if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) {
1165 willHandleKeyDownEvent();
1170 m_inputType->handleKeydownEvent(static_cast<KeyboardEvent*>(evt)); 1166 m_inputType->handleKeydownEvent(static_cast<KeyboardEvent*>(evt));
1171 if (evt->defaultHandled()) 1167 if (evt->defaultHandled())
1172 return; 1168 return;
1173 } 1169 }
1174 1170
1175 // Call the base event handler before any of our own event handling for almo st all events in text fields. 1171 // Call the base event handler before any of our own event handling for almo st all events in text fields.
1176 // Makes editing keyboard handling take precedence over the keydown and keyp ress handling in this function. 1172 // Makes editing keyboard handling take precedence over the keydown and keyp ress handling in this function.
1177 bool callBaseClassEarly = isTextField() && (evt->type() == eventNames().keyd ownEvent || evt->type() == eventNames().keypressEvent); 1173 bool callBaseClassEarly = isTextField() && (evt->type() == eventNames().keyd ownEvent || evt->type() == eventNames().keypressEvent);
1178 if (callBaseClassEarly) { 1174 if (callBaseClassEarly) {
1179 HTMLTextFormControlElement::defaultEventHandler(evt); 1175 HTMLTextFormControlElement::defaultEventHandler(evt);
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 } 1926 }
1931 1927
1932 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1928 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1933 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1929 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1934 { 1930 {
1935 return m_inputType->customStyleForRenderer(originalStyleForRenderer()); 1931 return m_inputType->customStyleForRenderer(originalStyleForRenderer());
1936 } 1932 }
1937 #endif 1933 #endif
1938 1934
1939 } // namespace 1935 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698