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

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

Issue 258063005: Blink does not respect input.selectionStart and input.selectionEnd for some cases (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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) 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 return false; 503 return false;
504 return HTMLTextFormControlElement::canStartSelection(); 504 return HTMLTextFormControlElement::canStartSelection();
505 } 505 }
506 506
507 int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c onst 507 int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c onst
508 { 508 {
509 if (!m_inputType->supportsSelectionAPI()) { 509 if (!m_inputType->supportsSelectionAPI()) {
510 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); 510 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
511 return 0; 511 return 0;
512 } 512 }
513 return HTMLTextFormControlElement::selectionStart(); 513
514 if (!isEmptyValue())
tkent 2014/04/29 23:55:44 This looks weird. If we need such check, we should
harpreet.sk 2014/04/30 14:36:27 Move the check to selectionStart()
515 return HTMLTextFormControlElement::selectionStart();
516 return 0;
514 } 517 }
515 518
516 int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con st 519 int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con st
517 { 520 {
518 if (!m_inputType->supportsSelectionAPI()) { 521 if (!m_inputType->supportsSelectionAPI()) {
519 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); 522 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
520 return 0; 523 return 0;
521 } 524 }
522 return HTMLTextFormControlElement::selectionEnd(); 525
526 if (!isEmptyValue())
527 return HTMLTextFormControlElement::selectionEnd();
528 return 0;
523 } 529 }
524 530
525 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS tate) const 531 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS tate) const
526 { 532 {
527 if (!m_inputType->supportsSelectionAPI()) { 533 if (!m_inputType->supportsSelectionAPI()) {
528 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); 534 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
529 return String(); 535 return String();
530 } 536 }
531 return HTMLTextFormControlElement::selectionDirection(); 537 return HTMLTextFormControlElement::selectionDirection();
532 } 538 }
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 } 1884 }
1879 1885
1880 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1886 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1881 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1887 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1882 { 1888 {
1883 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); 1889 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer());
1884 } 1890 }
1885 #endif 1891 #endif
1886 1892
1887 } // namespace 1893 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698