Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 return HTMLTextFormControlElement::canStartSelection(); | 514 return HTMLTextFormControlElement::canStartSelection(); |
| 515 } | 515 } |
| 516 | 516 |
| 517 bool HTMLInputElement::canHaveSelection() const | 517 bool HTMLInputElement::canHaveSelection() const |
| 518 { | 518 { |
| 519 return isTextField(); | 519 return isTextField(); |
| 520 } | 520 } |
| 521 | 521 |
| 522 int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c onst | 522 int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c onst |
| 523 { | 523 { |
| 524 if (!canHaveSelection()) { | 524 if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
|
tkent
2013/12/13 00:07:29
We can just replace canHaveSelection() with m_inpu
Habib Virji
2013/12/13 12:05:04
Done.
| |
| 525 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); | 525 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
| 526 return 0; | 526 return 0; |
| 527 } | 527 } |
| 528 | |
|
tkent
2013/12/13 00:07:29
We don't need to add this blank line.
Habib Virji
2013/12/13 12:05:04
Done.
| |
| 528 return HTMLTextFormControlElement::selectionStart(); | 529 return HTMLTextFormControlElement::selectionStart(); |
| 529 } | 530 } |
| 530 | 531 |
| 531 int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con st | 532 int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con st |
| 532 { | 533 { |
| 533 if (!canHaveSelection()) { | 534 if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
| 534 exceptionState.throwDOMException(InvalidStateError, "The input element' s type ('" + m_inputType->formControlType() + "') does not support selection."); | 535 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
| 535 return 0; | 536 return 0; |
| 536 } | 537 } |
| 537 return HTMLTextFormControlElement::selectionEnd(); | 538 return HTMLTextFormControlElement::selectionEnd(); |
| 538 } | 539 } |
| 539 | 540 |
| 540 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS tate) const | 541 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS tate) const |
| 541 { | 542 { |
| 542 if (!canHaveSelection()) { | 543 if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
| 543 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); | 544 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
| 544 return String(); | 545 return String(); |
| 545 } | 546 } |
| 546 return HTMLTextFormControlElement::selectionDirection(); | 547 return HTMLTextFormControlElement::selectionDirection(); |
| 547 } | 548 } |
| 548 | 549 |
| 549 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& ex ceptionState) | 550 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& ex ceptionState) |
| 550 { | 551 { |
| 551 if (!canHaveSelection()) { | 552 if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
| 552 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); | 553 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
| 553 return; | 554 return; |
| 554 } | 555 } |
| 555 HTMLTextFormControlElement::setSelectionStart(start); | 556 HTMLTextFormControlElement::setSelectionStart(start); |
| 556 } | 557 } |
| 557 | 558 |
| 558 void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& except ionState) | 559 void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& except ionState) |
| 559 { | 560 { |
| 560 if (!canHaveSelection()) { | 561 if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
| 561 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); | 562 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
| 562 return; | 563 return; |
| 563 } | 564 } |
| 564 HTMLTextFormControlElement::setSelectionEnd(end); | 565 HTMLTextFormControlElement::setSelectionEnd(end); |
| 565 } | 566 } |
| 566 | 567 |
| 567 void HTMLInputElement::setSelectionDirectionForBinding(const String& direction, ExceptionState& exceptionState) | 568 void HTMLInputElement::setSelectionDirectionForBinding(const String& direction, ExceptionState& exceptionState) |
| 568 { | 569 { |
| 569 if (!canHaveSelection()) { | 570 if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
| 570 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); | 571 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
| 571 return; | 572 return; |
| 572 } | 573 } |
| 573 HTMLTextFormControlElement::setSelectionDirection(direction); | 574 HTMLTextFormControlElement::setSelectionDirection(direction); |
| 574 } | 575 } |
| 575 | 576 |
| 576 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, Exception State& exceptionState) | 577 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, Exception State& exceptionState) |
| 577 { | 578 { |
| 578 if (!canHaveSelection()) { | 579 if (!canHaveSelection() || !m_inputType->supportsSelectionAPI()) { |
| 579 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); | 580 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
| 580 return; | 581 return; |
| 581 } | 582 } |
| 582 HTMLTextFormControlElement::setSelectionRange(start, end); | 583 HTMLTextFormControlElement::setSelectionRange(start, end); |
| 583 } | 584 } |
| 584 | 585 |
| 585 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const Str ing& direction, ExceptionState& exceptionState) | 586 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const Str ing& direction, ExceptionState& exceptionState) |
| 586 { | 587 { |
| 587 if (!canHaveSelection()) { | 588 if (!canHaveSelection() && !m_inputType->supportsSelectionAPI()) { |
| 588 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); | 589 exceptionState.throwDOMException(InvalidStateError, "The input element's type ('" + m_inputType->formControlType() + "') does not support selection."); |
| 589 return; | 590 return; |
| 590 } | 591 } |
| 591 HTMLTextFormControlElement::setSelectionRange(start, end, direction); | 592 HTMLTextFormControlElement::setSelectionRange(start, end, direction); |
| 592 } | 593 } |
| 593 | 594 |
| 594 void HTMLInputElement::accessKeyAction(bool sendMouseEvents) | 595 void HTMLInputElement::accessKeyAction(bool sendMouseEvents) |
| 595 { | 596 { |
| 596 m_inputType->accessKeyAction(sendMouseEvents); | 597 m_inputType->accessKeyAction(sendMouseEvents); |
| 597 } | 598 } |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1864 } | 1865 } |
| 1865 | 1866 |
| 1866 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 1867 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
| 1867 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() | 1868 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() |
| 1868 { | 1869 { |
| 1869 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); | 1870 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); |
| 1870 } | 1871 } |
| 1871 #endif | 1872 #endif |
| 1872 | 1873 |
| 1873 } // namespace | 1874 } // namespace |
| OLD | NEW |