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

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

Issue 2272913002: Add UseCounter to count InvalidStateError by input.selectionStart, selectionEnd, and selectionDirec… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 bool HTMLInputElement::canStartSelection() const 520 bool HTMLInputElement::canStartSelection() const
521 { 521 {
522 if (!isTextField()) 522 if (!isTextField())
523 return false; 523 return false;
524 return HTMLTextFormControlElement::canStartSelection(); 524 return HTMLTextFormControlElement::canStartSelection();
525 } 525 }
526 526
527 int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c onst 527 int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c onst
528 { 528 {
529 if (!m_inputType->supportsSelectionAPI()) { 529 if (!m_inputType->supportsSelectionAPI()) {
530 UseCounter::count(document(), UseCounter::InputSelectionGettersThrow);
530 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); 531 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
531 return 0; 532 return 0;
532 } 533 }
533 return HTMLTextFormControlElement::selectionStart(); 534 return HTMLTextFormControlElement::selectionStart();
534 } 535 }
535 536
536 int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con st 537 int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con st
537 { 538 {
538 if (!m_inputType->supportsSelectionAPI()) { 539 if (!m_inputType->supportsSelectionAPI()) {
540 UseCounter::count(document(), UseCounter::InputSelectionGettersThrow);
539 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); 541 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
540 return 0; 542 return 0;
541 } 543 }
542 return HTMLTextFormControlElement::selectionEnd(); 544 return HTMLTextFormControlElement::selectionEnd();
543 } 545 }
544 546
545 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS tate) const 547 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS tate) const
546 { 548 {
547 if (!m_inputType->supportsSelectionAPI()) { 549 if (!m_inputType->supportsSelectionAPI()) {
550 UseCounter::count(document(), UseCounter::InputSelectionGettersThrow);
548 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); 551 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
549 return String(); 552 return String();
550 } 553 }
551 return HTMLTextFormControlElement::selectionDirection(); 554 return HTMLTextFormControlElement::selectionDirection();
552 } 555 }
553 556
554 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& ex ceptionState) 557 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& ex ceptionState)
555 { 558 {
556 if (!m_inputType->supportsSelectionAPI()) { 559 if (!m_inputType->supportsSelectionAPI()) {
557 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); 560 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection.");
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 { 1912 {
1910 return m_inputTypeView->hasFallbackContent(); 1913 return m_inputTypeView->hasFallbackContent();
1911 } 1914 }
1912 1915
1913 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) 1916 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths)
1914 { 1917 {
1915 return m_inputType->setFilesFromPaths(paths); 1918 return m_inputType->setFilesFromPaths(paths);
1916 } 1919 }
1917 1920
1918 } // namespace blink 1921 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698