| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 StepRange HTMLInputElement::createStepRange(AnyStepHandling anyStepHandling) con
st | 291 StepRange HTMLInputElement::createStepRange(AnyStepHandling anyStepHandling) con
st |
| 292 { | 292 { |
| 293 return m_inputType->createStepRange(anyStepHandling); | 293 return m_inputType->createStepRange(anyStepHandling); |
| 294 } | 294 } |
| 295 | 295 |
| 296 Decimal HTMLInputElement::findClosestTickMarkValue(const Decimal& value) | 296 Decimal HTMLInputElement::findClosestTickMarkValue(const Decimal& value) |
| 297 { | 297 { |
| 298 return m_inputType->findClosestTickMarkValue(value); | 298 return m_inputType->findClosestTickMarkValue(value); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void HTMLInputElement::stepUp(int n, ExceptionState& es) | 301 void HTMLInputElement::stepUp(int n, ExceptionState& exceptionState) |
| 302 { | 302 { |
| 303 m_inputType->stepUp(n, es); | 303 m_inputType->stepUp(n, exceptionState); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void HTMLInputElement::stepDown(int n, ExceptionState& es) | 306 void HTMLInputElement::stepDown(int n, ExceptionState& exceptionState) |
| 307 { | 307 { |
| 308 m_inputType->stepUp(-n, es); | 308 m_inputType->stepUp(-n, exceptionState); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void HTMLInputElement::blur() | 311 void HTMLInputElement::blur() |
| 312 { | 312 { |
| 313 m_inputTypeView->blur(); | 313 m_inputTypeView->blur(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void HTMLInputElement::defaultBlur() | 316 void HTMLInputElement::defaultBlur() |
| 317 { | 317 { |
| 318 HTMLTextFormControlElement::blur(); | 318 HTMLTextFormControlElement::blur(); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 if (!isTextField()) | 508 if (!isTextField()) |
| 509 return false; | 509 return false; |
| 510 return HTMLTextFormControlElement::canStartSelection(); | 510 return HTMLTextFormControlElement::canStartSelection(); |
| 511 } | 511 } |
| 512 | 512 |
| 513 bool HTMLInputElement::canHaveSelection() const | 513 bool HTMLInputElement::canHaveSelection() const |
| 514 { | 514 { |
| 515 return isTextField(); | 515 return isTextField(); |
| 516 } | 516 } |
| 517 | 517 |
| 518 int HTMLInputElement::selectionStartForBinding(ExceptionState& es) const | 518 int HTMLInputElement::selectionStartForBinding(ExceptionState& exceptionState) c
onst |
| 519 { | 519 { |
| 520 if (!canHaveSelection()) { | 520 if (!canHaveSelection()) { |
| 521 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 521 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 522 return 0; | 522 return 0; |
| 523 } | 523 } |
| 524 return HTMLTextFormControlElement::selectionStart(); | 524 return HTMLTextFormControlElement::selectionStart(); |
| 525 } | 525 } |
| 526 | 526 |
| 527 int HTMLInputElement::selectionEndForBinding(ExceptionState& es) const | 527 int HTMLInputElement::selectionEndForBinding(ExceptionState& exceptionState) con
st |
| 528 { | 528 { |
| 529 if (!canHaveSelection()) { | 529 if (!canHaveSelection()) { |
| 530 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 530 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 531 return 0; | 531 return 0; |
| 532 } | 532 } |
| 533 return HTMLTextFormControlElement::selectionEnd(); | 533 return HTMLTextFormControlElement::selectionEnd(); |
| 534 } | 534 } |
| 535 | 535 |
| 536 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& es) const | 536 String HTMLInputElement::selectionDirectionForBinding(ExceptionState& exceptionS
tate) const |
| 537 { | 537 { |
| 538 if (!canHaveSelection()) { | 538 if (!canHaveSelection()) { |
| 539 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 539 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 540 return String(); | 540 return String(); |
| 541 } | 541 } |
| 542 return HTMLTextFormControlElement::selectionDirection(); | 542 return HTMLTextFormControlElement::selectionDirection(); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& es
) | 545 void HTMLInputElement::setSelectionStartForBinding(int start, ExceptionState& ex
ceptionState) |
| 546 { | 546 { |
| 547 if (!canHaveSelection()) { | 547 if (!canHaveSelection()) { |
| 548 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 548 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 549 return; | 549 return; |
| 550 } | 550 } |
| 551 HTMLTextFormControlElement::setSelectionStart(start); | 551 HTMLTextFormControlElement::setSelectionStart(start); |
| 552 } | 552 } |
| 553 | 553 |
| 554 void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& es) | 554 void HTMLInputElement::setSelectionEndForBinding(int end, ExceptionState& except
ionState) |
| 555 { | 555 { |
| 556 if (!canHaveSelection()) { | 556 if (!canHaveSelection()) { |
| 557 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 557 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 558 return; | 558 return; |
| 559 } | 559 } |
| 560 HTMLTextFormControlElement::setSelectionEnd(end); | 560 HTMLTextFormControlElement::setSelectionEnd(end); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void HTMLInputElement::setSelectionDirectionForBinding(const String& direction,
ExceptionState& es) | 563 void HTMLInputElement::setSelectionDirectionForBinding(const String& direction,
ExceptionState& exceptionState) |
| 564 { | 564 { |
| 565 if (!canHaveSelection()) { | 565 if (!canHaveSelection()) { |
| 566 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 566 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 567 return; | 567 return; |
| 568 } | 568 } |
| 569 HTMLTextFormControlElement::setSelectionDirection(direction); | 569 HTMLTextFormControlElement::setSelectionDirection(direction); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, Exception
State& es) | 572 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, Exception
State& exceptionState) |
| 573 { | 573 { |
| 574 if (!canHaveSelection()) { | 574 if (!canHaveSelection()) { |
| 575 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 575 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 576 return; | 576 return; |
| 577 } | 577 } |
| 578 HTMLTextFormControlElement::setSelectionRange(start, end); | 578 HTMLTextFormControlElement::setSelectionRange(start, end); |
| 579 } | 579 } |
| 580 | 580 |
| 581 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const Str
ing& direction, ExceptionState& es) | 581 void HTMLInputElement::setSelectionRangeForBinding(int start, int end, const Str
ing& direction, ExceptionState& exceptionState) |
| 582 { | 582 { |
| 583 if (!canHaveSelection()) { | 583 if (!canHaveSelection()) { |
| 584 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 584 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 585 return; | 585 return; |
| 586 } | 586 } |
| 587 HTMLTextFormControlElement::setSelectionRange(start, end, direction); | 587 HTMLTextFormControlElement::setSelectionRange(start, end, direction); |
| 588 } | 588 } |
| 589 | 589 |
| 590 void HTMLInputElement::accessKeyAction(bool sendMouseEvents) | 590 void HTMLInputElement::accessKeyAction(bool sendMouseEvents) |
| 591 { | 591 { |
| 592 m_inputType->accessKeyAction(sendMouseEvents); | 592 m_inputType->accessKeyAction(sendMouseEvents); |
| 593 } | 593 } |
| 594 | 594 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 | 987 |
| 988 unsigned max = value.length(); | 988 unsigned max = value.length(); |
| 989 if (focused()) | 989 if (focused()) |
| 990 setSelectionRange(max, max); | 990 setSelectionRange(max, max); |
| 991 else | 991 else |
| 992 cacheSelectionInResponseToSetValue(max); | 992 cacheSelectionInResponseToSetValue(max); |
| 993 | 993 |
| 994 dispatchInputEvent(); | 994 dispatchInputEvent(); |
| 995 } | 995 } |
| 996 | 996 |
| 997 void HTMLInputElement::setValue(const String& value, ExceptionState& es, TextFie
ldEventBehavior eventBehavior) | 997 void HTMLInputElement::setValue(const String& value, ExceptionState& exceptionSt
ate, TextFieldEventBehavior eventBehavior) |
| 998 { | 998 { |
| 999 if (isFileUpload() && !value.isEmpty()) { | 999 if (isFileUpload() && !value.isEmpty()) { |
| 1000 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 1000 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 1001 return; | 1001 return; |
| 1002 } | 1002 } |
| 1003 setValue(value, eventBehavior); | 1003 setValue(value, eventBehavior); |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) | 1006 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) |
| 1007 { | 1007 { |
| 1008 if (!m_inputType->canSetValue(value)) | 1008 if (!m_inputType->canSetValue(value)) |
| 1009 return; | 1009 return; |
| 1010 | 1010 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1033 m_valueIfDirty = sanitizedValue; | 1033 m_valueIfDirty = sanitizedValue; |
| 1034 m_wasModifiedByUser = eventBehavior != DispatchNoEvent; | 1034 m_wasModifiedByUser = eventBehavior != DispatchNoEvent; |
| 1035 setNeedsValidityCheck(); | 1035 setNeedsValidityCheck(); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 double HTMLInputElement::valueAsDate() const | 1038 double HTMLInputElement::valueAsDate() const |
| 1039 { | 1039 { |
| 1040 return m_inputType->valueAsDate(); | 1040 return m_inputType->valueAsDate(); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 void HTMLInputElement::setValueAsDate(double value, ExceptionState& es) | 1043 void HTMLInputElement::setValueAsDate(double value, ExceptionState& exceptionSta
te) |
| 1044 { | 1044 { |
| 1045 m_inputType->setValueAsDate(value, es); | 1045 m_inputType->setValueAsDate(value, exceptionState); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 double HTMLInputElement::valueAsNumber() const | 1048 double HTMLInputElement::valueAsNumber() const |
| 1049 { | 1049 { |
| 1050 return m_inputType->valueAsDouble(); | 1050 return m_inputType->valueAsDouble(); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 void HTMLInputElement::setValueAsNumber(double newValue, ExceptionState& es, Tex
tFieldEventBehavior eventBehavior) | 1053 void HTMLInputElement::setValueAsNumber(double newValue, ExceptionState& excepti
onState, TextFieldEventBehavior eventBehavior) |
| 1054 { | 1054 { |
| 1055 if (!std::isfinite(newValue)) { | 1055 if (!std::isfinite(newValue)) { |
| 1056 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 1056 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 1057 return; | 1057 return; |
| 1058 } | 1058 } |
| 1059 m_inputType->setValueAsDouble(newValue, eventBehavior, es); | 1059 m_inputType->setValueAsDouble(newValue, eventBehavior, exceptionState); |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 void HTMLInputElement::setValueFromRenderer(const String& value) | 1062 void HTMLInputElement::setValueFromRenderer(const String& value) |
| 1063 { | 1063 { |
| 1064 // File upload controls will never use this. | 1064 // File upload controls will never use this. |
| 1065 ASSERT(!isFileUpload()); | 1065 ASSERT(!isFileUpload()); |
| 1066 | 1066 |
| 1067 m_suggestedValue = String(); | 1067 m_suggestedValue = String(); |
| 1068 | 1068 |
| 1069 // Renderer and our event handler are responsible for sanitizing values. | 1069 // Renderer and our event handler are responsible for sanitizing values. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 String HTMLInputElement::alt() const | 1278 String HTMLInputElement::alt() const |
| 1279 { | 1279 { |
| 1280 return fastGetAttribute(altAttr); | 1280 return fastGetAttribute(altAttr); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 int HTMLInputElement::maxLength() const | 1283 int HTMLInputElement::maxLength() const |
| 1284 { | 1284 { |
| 1285 return m_maxLength; | 1285 return m_maxLength; |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& es) | 1288 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& exceptionStat
e) |
| 1289 { | 1289 { |
| 1290 if (maxLength < 0) | 1290 if (maxLength < 0) |
| 1291 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1291 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1292 else | 1292 else |
| 1293 setAttribute(maxlengthAttr, String::number(maxLength)); | 1293 setAttribute(maxlengthAttr, String::number(maxLength)); |
| 1294 } | 1294 } |
| 1295 | 1295 |
| 1296 bool HTMLInputElement::multiple() const | 1296 bool HTMLInputElement::multiple() const |
| 1297 { | 1297 { |
| 1298 return fastHasAttribute(multipleAttr); | 1298 return fastHasAttribute(multipleAttr); |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 void HTMLInputElement::setSize(unsigned size) | 1301 void HTMLInputElement::setSize(unsigned size) |
| 1302 { | 1302 { |
| 1303 setAttribute(sizeAttr, String::number(size)); | 1303 setAttribute(sizeAttr, String::number(size)); |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 void HTMLInputElement::setSize(unsigned size, ExceptionState& es) | 1306 void HTMLInputElement::setSize(unsigned size, ExceptionState& exceptionState) |
| 1307 { | 1307 { |
| 1308 if (!size) | 1308 if (!size) |
| 1309 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1309 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1310 else | 1310 else |
| 1311 setSize(size); | 1311 setSize(size); |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 KURL HTMLInputElement::src() const | 1314 KURL HTMLInputElement::src() const |
| 1315 { | 1315 { |
| 1316 return document().completeURL(fastGetAttribute(srcAttr)); | 1316 return document().completeURL(fastGetAttribute(srcAttr)); |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 FileList* HTMLInputElement::files() | 1319 FileList* HTMLInputElement::files() |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 : IdTargetObserver(element->treeScope().idTargetObserverRegistry(), id) | 1779 : IdTargetObserver(element->treeScope().idTargetObserverRegistry(), id) |
| 1780 , m_element(element) | 1780 , m_element(element) |
| 1781 { | 1781 { |
| 1782 } | 1782 } |
| 1783 | 1783 |
| 1784 void ListAttributeTargetObserver::idTargetChanged() | 1784 void ListAttributeTargetObserver::idTargetChanged() |
| 1785 { | 1785 { |
| 1786 m_element->listAttributeTargetChanged(); | 1786 m_element->listAttributeTargetChanged(); |
| 1787 } | 1787 } |
| 1788 | 1788 |
| 1789 void HTMLInputElement::setRangeText(const String& replacement, ExceptionState& e
s) | 1789 void HTMLInputElement::setRangeText(const String& replacement, ExceptionState& e
xceptionState) |
| 1790 { | 1790 { |
| 1791 if (!m_inputType->supportsSelectionAPI()) { | 1791 if (!m_inputType->supportsSelectionAPI()) { |
| 1792 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 1792 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 1793 return; | 1793 return; |
| 1794 } | 1794 } |
| 1795 | 1795 |
| 1796 HTMLTextFormControlElement::setRangeText(replacement, es); | 1796 HTMLTextFormControlElement::setRangeText(replacement, exceptionState); |
| 1797 } | 1797 } |
| 1798 | 1798 |
| 1799 void HTMLInputElement::setRangeText(const String& replacement, unsigned start, u
nsigned end, const String& selectionMode, ExceptionState& es) | 1799 void HTMLInputElement::setRangeText(const String& replacement, unsigned start, u
nsigned end, const String& selectionMode, ExceptionState& exceptionState) |
| 1800 { | 1800 { |
| 1801 if (!m_inputType->supportsSelectionAPI()) { | 1801 if (!m_inputType->supportsSelectionAPI()) { |
| 1802 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 1802 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 1803 return; | 1803 return; |
| 1804 } | 1804 } |
| 1805 | 1805 |
| 1806 HTMLTextFormControlElement::setRangeText(replacement, start, end, selectionM
ode, es); | 1806 HTMLTextFormControlElement::setRangeText(replacement, start, end, selectionM
ode, exceptionState); |
| 1807 } | 1807 } |
| 1808 | 1808 |
| 1809 bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
parameters) | 1809 bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
parameters) |
| 1810 { | 1810 { |
| 1811 if (!document().view()) | 1811 if (!document().view()) |
| 1812 return false; | 1812 return false; |
| 1813 | 1813 |
| 1814 parameters.type = type(); | 1814 parameters.type = type(); |
| 1815 parameters.minimum = minimum(); | 1815 parameters.minimum = minimum(); |
| 1816 parameters.maximum = maximum(); | 1816 parameters.maximum = maximum(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 } | 1860 } |
| 1861 | 1861 |
| 1862 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 1862 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
| 1863 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() | 1863 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() |
| 1864 { | 1864 { |
| 1865 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); | 1865 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); |
| 1866 } | 1866 } |
| 1867 #endif | 1867 #endif |
| 1868 | 1868 |
| 1869 } // namespace | 1869 } // namespace |
| OLD | NEW |