| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 523 } |
| 524 | 524 |
| 525 bool HTMLInputElement::canHaveSelection() const | 525 bool HTMLInputElement::canHaveSelection() const |
| 526 { | 526 { |
| 527 return isTextField(); | 527 return isTextField(); |
| 528 } | 528 } |
| 529 | 529 |
| 530 int HTMLInputElement::selectionStartForBinding(ExceptionState& es) const | 530 int HTMLInputElement::selectionStartForBinding(ExceptionState& es) const |
| 531 { | 531 { |
| 532 if (!canHaveSelection()) { | 532 if (!canHaveSelection()) { |
| 533 es.throwDOMException(InvalidStateError); | 533 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 534 return 0; | 534 return 0; |
| 535 } | 535 } |
| 536 return HTMLTextFormControlElement::selectionStart(); | 536 return HTMLTextFormControlElement::selectionStart(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 int HTMLInputElement::selectionEndForBinding(ExceptionState& es) const | 539 int HTMLInputElement::selectionEndForBinding(ExceptionState& es) const |
| 540 { | 540 { |
| 541 if (!canHaveSelection()) { | 541 if (!canHaveSelection()) { |
| 542 es.throwDOMException(InvalidStateError); | 542 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 543 return 0; | 543 return 0; |
| 544 } | 544 } |
| 545 return HTMLTextFormControlElement::selectionEnd(); | 545 return HTMLTextFormControlElement::selectionEnd(); |
| 546 } | 546 } |
| 547 | 547 |
| 548 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& es) const | 548 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& es) const |
| 549 { | 549 { |
| 550 if (!canHaveSelection()) { | 550 if (!canHaveSelection()) { |
| 551 es.throwDOMException(InvalidStateError); | 551 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 552 return String(); | 552 return String(); |
| 553 } | 553 } |
| 554 return HTMLTextFormControlElement::selectionDirection(); | 554 return HTMLTextFormControlElement::selectionDirection(); |
| 555 } | 555 } |
| 556 | 556 |
| 557 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& es
) | 557 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& es
) |
| 558 { | 558 { |
| 559 if (!canHaveSelection()) { | 559 if (!canHaveSelection()) { |
| 560 es.throwDOMException(InvalidStateError); | 560 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 561 return; | 561 return; |
| 562 } | 562 } |
| 563 HTMLTextFormControlElement::setSelectionStart(start); | 563 HTMLTextFormControlElement::setSelectionStart(start); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& es) | 566 void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& es) |
| 567 { | 567 { |
| 568 if (!canHaveSelection()) { | 568 if (!canHaveSelection()) { |
| 569 es.throwDOMException(InvalidStateError); | 569 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 570 return; | 570 return; |
| 571 } | 571 } |
| 572 HTMLTextFormControlElement::setSelectionEnd(end); | 572 HTMLTextFormControlElement::setSelectionEnd(end); |
| 573 } | 573 } |
| 574 | 574 |
| 575 void HTMLInputElement::setSelectionDirectionForBinding(const String& direction,
ExceptionState& es) | 575 void HTMLInputElement::setSelectionDirectionForBinding(const String& direction,
ExceptionState& es) |
| 576 { | 576 { |
| 577 if (!canHaveSelection()) { | 577 if (!canHaveSelection()) { |
| 578 es.throwDOMException(InvalidStateError); | 578 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 579 return; | 579 return; |
| 580 } | 580 } |
| 581 HTMLTextFormControlElement::setSelectionDirection(direction); | 581 HTMLTextFormControlElement::setSelectionDirection(direction); |
| 582 } | 582 } |
| 583 | 583 |
| 584 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, Exception
State& es) | 584 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, Exception
State& es) |
| 585 { | 585 { |
| 586 if (!canHaveSelection()) { | 586 if (!canHaveSelection()) { |
| 587 es.throwDOMException(InvalidStateError); | 587 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 588 return; | 588 return; |
| 589 } | 589 } |
| 590 HTMLTextFormControlElement::setSelectionRange(start, end); | 590 HTMLTextFormControlElement::setSelectionRange(start, end); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const Str
ing& direction, ExceptionState& es) | 593 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const Str
ing& direction, ExceptionState& es) |
| 594 { | 594 { |
| 595 if (!canHaveSelection()) { | 595 if (!canHaveSelection()) { |
| 596 es.throwDOMException(InvalidStateError); | 596 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 597 return; | 597 return; |
| 598 } | 598 } |
| 599 HTMLTextFormControlElement::setSelectionRange(start, end, direction); | 599 HTMLTextFormControlElement::setSelectionRange(start, end, direction); |
| 600 } | 600 } |
| 601 | 601 |
| 602 void HTMLInputElement::accessKeyAction(bool sendMouseEvents) | 602 void HTMLInputElement::accessKeyAction(bool sendMouseEvents) |
| 603 { | 603 { |
| 604 m_inputType->accessKeyAction(sendMouseEvents); | 604 m_inputType->accessKeyAction(sendMouseEvents); |
| 605 } | 605 } |
| 606 | 606 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 setSelectionRange(max, max); | 998 setSelectionRange(max, max); |
| 999 else | 999 else |
| 1000 cacheSelectionInResponseToSetValue(max); | 1000 cacheSelectionInResponseToSetValue(max); |
| 1001 | 1001 |
| 1002 dispatchInputEvent(); | 1002 dispatchInputEvent(); |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 void HTMLInputElement::setValue(const String& value, ExceptionState& es, TextFie
ldEventBehavior eventBehavior) | 1005 void HTMLInputElement::setValue(const String& value, ExceptionState& es, TextFie
ldEventBehavior eventBehavior) |
| 1006 { | 1006 { |
| 1007 if (isFileUpload() && !value.isEmpty()) { | 1007 if (isFileUpload() && !value.isEmpty()) { |
| 1008 es.throwDOMException(InvalidStateError); | 1008 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 1009 return; | 1009 return; |
| 1010 } | 1010 } |
| 1011 setValue(value, eventBehavior); | 1011 setValue(value, eventBehavior); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) | 1014 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) |
| 1015 { | 1015 { |
| 1016 if (!m_inputType->canSetValue(value)) | 1016 if (!m_inputType->canSetValue(value)) |
| 1017 return; | 1017 return; |
| 1018 | 1018 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 double HTMLInputElement::valueAsNumber() const | 1056 double HTMLInputElement::valueAsNumber() const |
| 1057 { | 1057 { |
| 1058 return m_inputType->valueAsDouble(); | 1058 return m_inputType->valueAsDouble(); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 void HTMLInputElement::setValueAsNumber(double newValue, ExceptionState& es, Tex
tFieldEventBehavior eventBehavior) | 1061 void HTMLInputElement::setValueAsNumber(double newValue, ExceptionState& es, Tex
tFieldEventBehavior eventBehavior) |
| 1062 { | 1062 { |
| 1063 if (!std::isfinite(newValue)) { | 1063 if (!std::isfinite(newValue)) { |
| 1064 es.throwDOMException(NotSupportedError); | 1064 es.throwUninformativeAndGenericDOMException(NotSupportedError); |
| 1065 return; | 1065 return; |
| 1066 } | 1066 } |
| 1067 m_inputType->setValueAsDouble(newValue, eventBehavior, es); | 1067 m_inputType->setValueAsDouble(newValue, eventBehavior, es); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 void HTMLInputElement::setValueFromRenderer(const String& value) | 1070 void HTMLInputElement::setValueFromRenderer(const String& value) |
| 1071 { | 1071 { |
| 1072 // File upload controls will never use this. | 1072 // File upload controls will never use this. |
| 1073 ASSERT(!isFileUpload()); | 1073 ASSERT(!isFileUpload()); |
| 1074 | 1074 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 int HTMLInputElement::maxLength() const | 1291 int HTMLInputElement::maxLength() const |
| 1292 { | 1292 { |
| 1293 return m_maxLength; | 1293 return m_maxLength; |
| 1294 } | 1294 } |
| 1295 | 1295 |
| 1296 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& es) | 1296 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& es) |
| 1297 { | 1297 { |
| 1298 if (maxLength < 0) | 1298 if (maxLength < 0) |
| 1299 es.throwDOMException(IndexSizeError); | 1299 es.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1300 else | 1300 else |
| 1301 setAttribute(maxlengthAttr, String::number(maxLength)); | 1301 setAttribute(maxlengthAttr, String::number(maxLength)); |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 bool HTMLInputElement::multiple() const | 1304 bool HTMLInputElement::multiple() const |
| 1305 { | 1305 { |
| 1306 return fastHasAttribute(multipleAttr); | 1306 return fastHasAttribute(multipleAttr); |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 void HTMLInputElement::setSize(unsigned size) | 1309 void HTMLInputElement::setSize(unsigned size) |
| 1310 { | 1310 { |
| 1311 setAttribute(sizeAttr, String::number(size)); | 1311 setAttribute(sizeAttr, String::number(size)); |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 void HTMLInputElement::setSize(unsigned size, ExceptionState& es) | 1314 void HTMLInputElement::setSize(unsigned size, ExceptionState& es) |
| 1315 { | 1315 { |
| 1316 if (!size) | 1316 if (!size) |
| 1317 es.throwDOMException(IndexSizeError); | 1317 es.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1318 else | 1318 else |
| 1319 setSize(size); | 1319 setSize(size); |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 KURL HTMLInputElement::src() const | 1322 KURL HTMLInputElement::src() const |
| 1323 { | 1323 { |
| 1324 return document().completeURL(fastGetAttribute(srcAttr)); | 1324 return document().completeURL(fastGetAttribute(srcAttr)); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 void HTMLInputElement::setAutofilled(bool autofilled) | 1327 void HTMLInputElement::setAutofilled(bool autofilled) |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 } | 1801 } |
| 1802 | 1802 |
| 1803 void ListAttributeTargetObserver::idTargetChanged() | 1803 void ListAttributeTargetObserver::idTargetChanged() |
| 1804 { | 1804 { |
| 1805 m_element->listAttributeTargetChanged(); | 1805 m_element->listAttributeTargetChanged(); |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 void HTMLInputElement::setRangeText(const String& replacement, ExceptionState& e
s) | 1808 void HTMLInputElement::setRangeText(const String& replacement, ExceptionState& e
s) |
| 1809 { | 1809 { |
| 1810 if (!m_inputType->supportsSelectionAPI()) { | 1810 if (!m_inputType->supportsSelectionAPI()) { |
| 1811 es.throwDOMException(InvalidStateError); | 1811 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 1812 return; | 1812 return; |
| 1813 } | 1813 } |
| 1814 | 1814 |
| 1815 HTMLTextFormControlElement::setRangeText(replacement, es); | 1815 HTMLTextFormControlElement::setRangeText(replacement, es); |
| 1816 } | 1816 } |
| 1817 | 1817 |
| 1818 void HTMLInputElement::setRangeText(const String& replacement, unsigned start, u
nsigned end, const String& selectionMode, ExceptionState& es) | 1818 void HTMLInputElement::setRangeText(const String& replacement, unsigned start, u
nsigned end, const String& selectionMode, ExceptionState& es) |
| 1819 { | 1819 { |
| 1820 if (!m_inputType->supportsSelectionAPI()) { | 1820 if (!m_inputType->supportsSelectionAPI()) { |
| 1821 es.throwDOMException(InvalidStateError); | 1821 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 1822 return; | 1822 return; |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 HTMLTextFormControlElement::setRangeText(replacement, start, end, selectionM
ode, es); | 1825 HTMLTextFormControlElement::setRangeText(replacement, start, end, selectionM
ode, es); |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
parameters) | 1828 bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
parameters) |
| 1829 { | 1829 { |
| 1830 if (!document().view()) | 1830 if (!document().view()) |
| 1831 return false; | 1831 return false; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 } | 1874 } |
| 1875 | 1875 |
| 1876 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 1876 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
| 1877 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() | 1877 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() |
| 1878 { | 1878 { |
| 1879 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); | 1879 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); |
| 1880 } | 1880 } |
| 1881 #endif | 1881 #endif |
| 1882 | 1882 |
| 1883 } // namespace | 1883 } // namespace |
| OLD | NEW |