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 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 exceptionState); | 262 exceptionState); |
263 } | 263 } |
264 | 264 |
265 void TextControlElement::setRangeText(const String& replacement, | 265 void TextControlElement::setRangeText(const String& replacement, |
266 unsigned start, | 266 unsigned start, |
267 unsigned end, | 267 unsigned end, |
268 const String& selectionMode, | 268 const String& selectionMode, |
269 ExceptionState& exceptionState) { | 269 ExceptionState& exceptionState) { |
270 if (start > end) { | 270 if (start > end) { |
271 exceptionState.throwDOMException( | 271 exceptionState.throwDOMException( |
272 IndexSizeError, "The provided start value (" + String::number(start) + | 272 IndexSizeError, |
273 ") is larger than the provided end value (" + | 273 "The provided start value (" + String::number(start) + |
274 String::number(end) + ")."); | 274 ") is larger than the provided end value (" + String::number(end) + |
| 275 ")."); |
275 return; | 276 return; |
276 } | 277 } |
277 if (openShadowRoot()) | 278 if (openShadowRoot()) |
278 return; | 279 return; |
279 | 280 |
280 String text = innerEditorValue(); | 281 String text = innerEditorValue(); |
281 unsigned textLength = text.length(); | 282 unsigned textLength = text.length(); |
282 unsigned replacementLength = replacement.length(); | 283 unsigned replacementLength = replacement.length(); |
283 unsigned newSelectionStart = selectionStart(); | 284 unsigned newSelectionStart = selectionStart(); |
284 unsigned newSelectionEnd = selectionEnd(); | 285 unsigned newSelectionEnd = selectionEnd(); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 int value; | 636 int value; |
636 if (!parseHTMLInteger(fastGetAttribute(minlengthAttr), value)) | 637 if (!parseHTMLInteger(fastGetAttribute(minlengthAttr), value)) |
637 return -1; | 638 return -1; |
638 return value >= 0 ? value : -1; | 639 return value >= 0 ? value : -1; |
639 } | 640 } |
640 | 641 |
641 void TextControlElement::setMaxLength(int newValue, | 642 void TextControlElement::setMaxLength(int newValue, |
642 ExceptionState& exceptionState) { | 643 ExceptionState& exceptionState) { |
643 int min = minLength(); | 644 int min = minLength(); |
644 if (newValue < 0) { | 645 if (newValue < 0) { |
645 exceptionState.throwDOMException( | 646 exceptionState.throwDOMException(IndexSizeError, |
646 IndexSizeError, "The value provided (" + String::number(newValue) + | 647 "The value provided (" + |
647 ") is not positive or 0."); | 648 String::number(newValue) + |
| 649 ") is not positive or 0."); |
648 } else if (min >= 0 && newValue < min) { | 650 } else if (min >= 0 && newValue < min) { |
649 exceptionState.throwDOMException( | 651 exceptionState.throwDOMException( |
650 IndexSizeError, ExceptionMessages::indexExceedsMinimumBound( | 652 IndexSizeError, |
651 "maxLength", newValue, min)); | 653 ExceptionMessages::indexExceedsMinimumBound("maxLength", newValue, |
| 654 min)); |
652 } else { | 655 } else { |
653 setIntegralAttribute(maxlengthAttr, newValue); | 656 setIntegralAttribute(maxlengthAttr, newValue); |
654 } | 657 } |
655 } | 658 } |
656 | 659 |
657 void TextControlElement::setMinLength(int newValue, | 660 void TextControlElement::setMinLength(int newValue, |
658 ExceptionState& exceptionState) { | 661 ExceptionState& exceptionState) { |
659 int max = maxLength(); | 662 int max = maxLength(); |
660 if (newValue < 0) { | 663 if (newValue < 0) { |
661 exceptionState.throwDOMException( | 664 exceptionState.throwDOMException(IndexSizeError, |
662 IndexSizeError, "The value provided (" + String::number(newValue) + | 665 "The value provided (" + |
663 ") is not positive or 0."); | 666 String::number(newValue) + |
| 667 ") is not positive or 0."); |
664 } else if (max >= 0 && newValue > max) { | 668 } else if (max >= 0 && newValue > max) { |
665 exceptionState.throwDOMException( | 669 exceptionState.throwDOMException( |
666 IndexSizeError, ExceptionMessages::indexExceedsMaximumBound( | 670 IndexSizeError, |
667 "minLength", newValue, max)); | 671 ExceptionMessages::indexExceedsMaximumBound("minLength", newValue, |
| 672 max)); |
668 } else { | 673 } else { |
669 setIntegralAttribute(minlengthAttr, newValue); | 674 setIntegralAttribute(minlengthAttr, newValue); |
670 } | 675 } |
671 } | 676 } |
672 | 677 |
673 void TextControlElement::restoreCachedSelection() { | 678 void TextControlElement::restoreCachedSelection() { |
674 if (setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, | 679 if (setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, |
675 m_cachedSelectionDirection)) | 680 m_cachedSelectionDirection)) |
676 scheduleSelectEvent(); | 681 scheduleSelectEvent(); |
677 } | 682 } |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 | 902 |
898 void TextControlElement::copyNonAttributePropertiesFromElement( | 903 void TextControlElement::copyNonAttributePropertiesFromElement( |
899 const Element& source) { | 904 const Element& source) { |
900 const TextControlElement& sourceElement = | 905 const TextControlElement& sourceElement = |
901 static_cast<const TextControlElement&>(source); | 906 static_cast<const TextControlElement&>(source); |
902 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; | 907 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; |
903 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); | 908 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); |
904 } | 909 } |
905 | 910 |
906 } // namespace blink | 911 } // namespace blink |
OLD | NEW |