| 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 14 matching lines...) Expand all Loading... |
| 25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
| 26 * | 26 * |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "core/html/HTMLInputElement.h" | 30 #include "core/html/HTMLInputElement.h" |
| 31 | 31 |
| 32 #include "CSSPropertyNames.h" | 32 #include "CSSPropertyNames.h" |
| 33 #include "CSSValueKeywords.h" | 33 #include "CSSValueKeywords.h" |
| 34 #include "HTMLNames.h" | 34 #include "HTMLNames.h" |
| 35 #include "RuntimeEnabledFeatures.h" |
| 35 #include "bindings/v8/ScriptEventListener.h" | 36 #include "bindings/v8/ScriptEventListener.h" |
| 36 #include "core/accessibility/AXObjectCache.h" | 37 #include "core/accessibility/AXObjectCache.h" |
| 37 #include "core/css/resolver/StyleResolver.h" | 38 #include "core/css/resolver/StyleResolver.h" |
| 38 #include "core/dom/BeforeTextInsertedEvent.h" | 39 #include "core/dom/BeforeTextInsertedEvent.h" |
| 39 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
| 40 #include "core/dom/EventNames.h" | 41 #include "core/dom/EventNames.h" |
| 41 #include "core/dom/ExceptionCode.h" | 42 #include "core/dom/ExceptionCode.h" |
| 42 #include "core/dom/IdTargetObserver.h" | 43 #include "core/dom/IdTargetObserver.h" |
| 43 #include "core/dom/KeyboardEvent.h" | 44 #include "core/dom/KeyboardEvent.h" |
| 44 #include "core/dom/MouseEvent.h" | 45 #include "core/dom/MouseEvent.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 #include "core/html/HTMLCollection.h" | 56 #include "core/html/HTMLCollection.h" |
| 56 #include "core/html/HTMLDataListElement.h" | 57 #include "core/html/HTMLDataListElement.h" |
| 57 #include "core/html/HTMLFormElement.h" | 58 #include "core/html/HTMLFormElement.h" |
| 58 #include "core/html/HTMLImageLoader.h" | 59 #include "core/html/HTMLImageLoader.h" |
| 59 #include "core/html/HTMLOptionElement.h" | 60 #include "core/html/HTMLOptionElement.h" |
| 60 #include "core/html/InputType.h" | 61 #include "core/html/InputType.h" |
| 61 #include "core/html/SearchInputType.h" | 62 #include "core/html/SearchInputType.h" |
| 62 #include "core/html/parser/HTMLParserIdioms.h" | 63 #include "core/html/parser/HTMLParserIdioms.h" |
| 63 #include "core/page/Frame.h" | 64 #include "core/page/Frame.h" |
| 64 #include "core/page/FrameView.h" | 65 #include "core/page/FrameView.h" |
| 65 #include "RuntimeEnabledFeatures.h" | |
| 66 #include "core/page/UseCounter.h" | 66 #include "core/page/UseCounter.h" |
| 67 #include "core/platform/DateTimeChooser.h" | 67 #include "core/platform/DateTimeChooser.h" |
| 68 #include "core/platform/Language.h" | 68 #include "core/platform/Language.h" |
| 69 #include "core/platform/LocalizedStrings.h" | 69 #include "core/platform/LocalizedStrings.h" |
| 70 #include "core/platform/PlatformMouseEvent.h" | 70 #include "core/platform/PlatformMouseEvent.h" |
| 71 #include "core/platform/text/PlatformLocale.h" | 71 #include "core/platform/text/PlatformLocale.h" |
| 72 #include "core/rendering/RenderTextControlSingleLine.h" | 72 #include "core/rendering/RenderTextControlSingleLine.h" |
| 73 #include "core/rendering/RenderTheme.h" | 73 #include "core/rendering/RenderTheme.h" |
| 74 #include <wtf/MathExtras.h> | 74 #include <wtf/MathExtras.h> |
| 75 #include <wtf/StdLibExtras.h> | 75 #include <wtf/StdLibExtras.h> |
| 76 | 76 |
| 77 #if ENABLE(INPUT_TYPE_COLOR) | 77 #if ENABLE(INPUT_TYPE_COLOR) |
| 78 #include "core/html/ColorInputType.h" | 78 #include "core/html/ColorInputType.h" |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 #if ENABLE(INPUT_SPEECH) | |
| 82 #include "RuntimeEnabledFeatures.h" | |
| 83 #endif | |
| 84 | |
| 85 using namespace std; | 81 using namespace std; |
| 86 | 82 |
| 87 namespace WebCore { | 83 namespace WebCore { |
| 88 | 84 |
| 89 using namespace HTMLNames; | 85 using namespace HTMLNames; |
| 90 | 86 |
| 91 #if ENABLE(DATALIST_ELEMENT) | |
| 92 class ListAttributeTargetObserver : IdTargetObserver { | 87 class ListAttributeTargetObserver : IdTargetObserver { |
| 93 WTF_MAKE_FAST_ALLOCATED; | 88 WTF_MAKE_FAST_ALLOCATED; |
| 94 public: | 89 public: |
| 95 static PassOwnPtr<ListAttributeTargetObserver> create(const AtomicString& id
, HTMLInputElement*); | 90 static PassOwnPtr<ListAttributeTargetObserver> create(const AtomicString& id
, HTMLInputElement*); |
| 96 virtual void idTargetChanged() OVERRIDE; | 91 virtual void idTargetChanged() OVERRIDE; |
| 97 | 92 |
| 98 private: | 93 private: |
| 99 ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); | 94 ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); |
| 100 | 95 |
| 101 HTMLInputElement* m_element; | 96 HTMLInputElement* m_element; |
| 102 }; | 97 }; |
| 103 #endif | |
| 104 | 98 |
| 105 // FIXME: According to HTML4, the length attribute's value can be arbitrarily | 99 // FIXME: According to HTML4, the length attribute's value can be arbitrarily |
| 106 // large. However, due to https://bugs.webkit.org/show_bug.cgi?id=14536 things | 100 // large. However, due to https://bugs.webkit.org/show_bug.cgi?id=14536 things |
| 107 // get rather sluggish when a text field has a larger number of characters than | 101 // get rather sluggish when a text field has a larger number of characters than |
| 108 // this, even when just clicking in the text field. | 102 // this, even when just clicking in the text field. |
| 109 const int HTMLInputElement::maximumLength = 524288; | 103 const int HTMLInputElement::maximumLength = 524288; |
| 110 const int defaultSize = 20; | 104 const int defaultSize = 20; |
| 111 const int maxSavedResults = 256; | 105 const int maxSavedResults = 256; |
| 112 | 106 |
| 113 HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* docum
ent, HTMLFormElement* form, bool createdByParser) | 107 HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* docum
ent, HTMLFormElement* form, bool createdByParser) |
| 114 : HTMLTextFormControlElement(tagName, document, form) | 108 : HTMLTextFormControlElement(tagName, document, form) |
| 115 , m_size(defaultSize) | 109 , m_size(defaultSize) |
| 116 , m_maxLength(maximumLength) | 110 , m_maxLength(maximumLength) |
| 117 , m_maxResults(-1) | 111 , m_maxResults(-1) |
| 118 , m_isChecked(false) | 112 , m_isChecked(false) |
| 119 , m_reflectsCheckedAttribute(true) | 113 , m_reflectsCheckedAttribute(true) |
| 120 , m_isIndeterminate(false) | 114 , m_isIndeterminate(false) |
| 121 , m_hasType(false) | 115 , m_hasType(false) |
| 122 , m_isActivatedSubmit(false) | 116 , m_isActivatedSubmit(false) |
| 123 , m_autocomplete(Uninitialized) | 117 , m_autocomplete(Uninitialized) |
| 124 , m_isAutofilled(false) | 118 , m_isAutofilled(false) |
| 125 #if ENABLE(DATALIST_ELEMENT) | |
| 126 , m_hasNonEmptyList(false) | 119 , m_hasNonEmptyList(false) |
| 127 #endif | |
| 128 , m_stateRestored(false) | 120 , m_stateRestored(false) |
| 129 , m_parsingInProgress(createdByParser) | 121 , m_parsingInProgress(createdByParser) |
| 130 , m_valueAttributeWasUpdatedAfterParsing(false) | 122 , m_valueAttributeWasUpdatedAfterParsing(false) |
| 131 , m_wasModifiedByUser(false) | 123 , m_wasModifiedByUser(false) |
| 132 , m_canReceiveDroppedFiles(false) | 124 , m_canReceiveDroppedFiles(false) |
| 133 , m_hasTouchEventHandler(false) | 125 , m_hasTouchEventHandler(false) |
| 134 , m_inputType(InputType::createText(this)) | 126 , m_inputType(InputType::createText(this)) |
| 135 { | 127 { |
| 136 ASSERT(hasTagName(inputTag) || hasTagName(isindexTag)); | 128 ASSERT(hasTagName(inputTag) || hasTagName(isindexTag)); |
| 137 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 129 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 bool HTMLInputElement::getAllowedValueStep(Decimal* step) const | 330 bool HTMLInputElement::getAllowedValueStep(Decimal* step) const |
| 339 { | 331 { |
| 340 return m_inputType->getAllowedValueStep(step); | 332 return m_inputType->getAllowedValueStep(step); |
| 341 } | 333 } |
| 342 | 334 |
| 343 StepRange HTMLInputElement::createStepRange(AnyStepHandling anyStepHandling) con
st | 335 StepRange HTMLInputElement::createStepRange(AnyStepHandling anyStepHandling) con
st |
| 344 { | 336 { |
| 345 return m_inputType->createStepRange(anyStepHandling); | 337 return m_inputType->createStepRange(anyStepHandling); |
| 346 } | 338 } |
| 347 | 339 |
| 348 #if ENABLE(DATALIST_ELEMENT) | |
| 349 Decimal HTMLInputElement::findClosestTickMarkValue(const Decimal& value) | 340 Decimal HTMLInputElement::findClosestTickMarkValue(const Decimal& value) |
| 350 { | 341 { |
| 351 return m_inputType->findClosestTickMarkValue(value); | 342 return m_inputType->findClosestTickMarkValue(value); |
| 352 } | 343 } |
| 353 #endif | |
| 354 | 344 |
| 355 void HTMLInputElement::stepUp(int n, ExceptionCode& ec) | 345 void HTMLInputElement::stepUp(int n, ExceptionCode& ec) |
| 356 { | 346 { |
| 357 m_inputType->stepUp(n, ec); | 347 m_inputType->stepUp(n, ec); |
| 358 } | 348 } |
| 359 | 349 |
| 360 void HTMLInputElement::stepDown(int n, ExceptionCode& ec) | 350 void HTMLInputElement::stepDown(int n, ExceptionCode& ec) |
| 361 { | 351 { |
| 362 m_inputType->stepUp(-n, ec); | 352 m_inputType->stepUp(-n, ec); |
| 363 } | 353 } |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 UseCounter::count(document(), UseCounter::PatternAttribute); | 683 UseCounter::count(document(), UseCounter::PatternAttribute); |
| 694 } else if (name == precisionAttr) { | 684 } else if (name == precisionAttr) { |
| 695 setNeedsValidityCheck(); | 685 setNeedsValidityCheck(); |
| 696 UseCounter::count(document(), UseCounter::PrecisionAttribute); | 686 UseCounter::count(document(), UseCounter::PrecisionAttribute); |
| 697 } else if (name == disabledAttr) { | 687 } else if (name == disabledAttr) { |
| 698 HTMLTextFormControlElement::parseAttribute(name, value); | 688 HTMLTextFormControlElement::parseAttribute(name, value); |
| 699 m_inputType->disabledAttributeChanged(); | 689 m_inputType->disabledAttributeChanged(); |
| 700 } else if (name == readonlyAttr) { | 690 } else if (name == readonlyAttr) { |
| 701 HTMLTextFormControlElement::parseAttribute(name, value); | 691 HTMLTextFormControlElement::parseAttribute(name, value); |
| 702 m_inputType->readonlyAttributeChanged(); | 692 m_inputType->readonlyAttributeChanged(); |
| 703 } | 693 } else if (name == listAttr) { |
| 704 #if ENABLE(DATALIST_ELEMENT) | |
| 705 else if (name == listAttr) { | |
| 706 m_hasNonEmptyList = !value.isEmpty(); | 694 m_hasNonEmptyList = !value.isEmpty(); |
| 707 if (m_hasNonEmptyList) { | 695 if (m_hasNonEmptyList) { |
| 708 resetListAttributeTargetObserver(); | 696 resetListAttributeTargetObserver(); |
| 709 listAttributeTargetChanged(); | 697 listAttributeTargetChanged(); |
| 710 } | 698 } |
| 711 UseCounter::count(document(), UseCounter::ListAttribute); | 699 UseCounter::count(document(), UseCounter::ListAttribute); |
| 712 } | 700 } |
| 713 #endif | |
| 714 #if ENABLE(INPUT_SPEECH) | 701 #if ENABLE(INPUT_SPEECH) |
| 715 else if (name == webkitspeechAttr) { | 702 else if (name == webkitspeechAttr) { |
| 716 if (renderer()) { | 703 if (renderer()) { |
| 717 // This renderer and its children have quite different layouts and s
tyles depending on | 704 // This renderer and its children have quite different layouts and s
tyles depending on |
| 718 // whether the speech button is visible or not. So we reset the whol
e thing and recreate | 705 // whether the speech button is visible or not. So we reset the whol
e thing and recreate |
| 719 // to get the right styles and layout. | 706 // to get the right styles and layout. |
| 720 detach(); | 707 detach(); |
| 721 m_inputType->destroyShadowSubtree(); | 708 m_inputType->destroyShadowSubtree(); |
| 722 m_inputType->createShadowSubtree(); | 709 m_inputType->createShadowSubtree(); |
| 723 if (!attached()) | 710 if (!attached()) |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 { | 1405 { |
| 1419 HTMLTextFormControlElement::didChangeForm(); | 1406 HTMLTextFormControlElement::didChangeForm(); |
| 1420 addToRadioButtonGroup(); | 1407 addToRadioButtonGroup(); |
| 1421 } | 1408 } |
| 1422 | 1409 |
| 1423 Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode*
insertionPoint) | 1410 Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode*
insertionPoint) |
| 1424 { | 1411 { |
| 1425 HTMLTextFormControlElement::insertedInto(insertionPoint); | 1412 HTMLTextFormControlElement::insertedInto(insertionPoint); |
| 1426 if (insertionPoint->inDocument() && !form()) | 1413 if (insertionPoint->inDocument() && !form()) |
| 1427 addToRadioButtonGroup(); | 1414 addToRadioButtonGroup(); |
| 1428 #if ENABLE(DATALIST_ELEMENT) | |
| 1429 resetListAttributeTargetObserver(); | 1415 resetListAttributeTargetObserver(); |
| 1430 #endif | |
| 1431 return InsertionDone; | 1416 return InsertionDone; |
| 1432 } | 1417 } |
| 1433 | 1418 |
| 1434 void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) | 1419 void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) |
| 1435 { | 1420 { |
| 1436 if (insertionPoint->inDocument() && !form()) | 1421 if (insertionPoint->inDocument() && !form()) |
| 1437 removeFromRadioButtonGroup(); | 1422 removeFromRadioButtonGroup(); |
| 1438 HTMLTextFormControlElement::removedFrom(insertionPoint); | 1423 HTMLTextFormControlElement::removedFrom(insertionPoint); |
| 1439 ASSERT(!inDocument()); | 1424 ASSERT(!inDocument()); |
| 1440 #if ENABLE(DATALIST_ELEMENT) | |
| 1441 resetListAttributeTargetObserver(); | 1425 resetListAttributeTargetObserver(); |
| 1442 #endif | |
| 1443 } | 1426 } |
| 1444 | 1427 |
| 1445 void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) | 1428 void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) |
| 1446 { | 1429 { |
| 1447 if (hasImageLoader()) | 1430 if (hasImageLoader()) |
| 1448 imageLoader()->elementDidMoveToNewDocument(); | 1431 imageLoader()->elementDidMoveToNewDocument(); |
| 1449 | 1432 |
| 1450 if (oldDocument) { | 1433 if (oldDocument) { |
| 1451 if (isRadioButton()) | 1434 if (isRadioButton()) |
| 1452 oldDocument->formController()->checkedRadioButtons().removeButton(th
is); | 1435 oldDocument->formController()->checkedRadioButtons().removeButton(th
is); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1482 | 1465 |
| 1483 #if ENABLE(INPUT_TYPE_COLOR) | 1466 #if ENABLE(INPUT_TYPE_COLOR) |
| 1484 void HTMLInputElement::selectColorInColorChooser(const Color& color) | 1467 void HTMLInputElement::selectColorInColorChooser(const Color& color) |
| 1485 { | 1468 { |
| 1486 if (!m_inputType->isColorControl()) | 1469 if (!m_inputType->isColorControl()) |
| 1487 return; | 1470 return; |
| 1488 static_cast<ColorInputType*>(m_inputType.get())->didChooseColor(color); | 1471 static_cast<ColorInputType*>(m_inputType.get())->didChooseColor(color); |
| 1489 } | 1472 } |
| 1490 #endif | 1473 #endif |
| 1491 | 1474 |
| 1492 #if ENABLE(DATALIST_ELEMENT) | |
| 1493 HTMLElement* HTMLInputElement::list() const | 1475 HTMLElement* HTMLInputElement::list() const |
| 1494 { | 1476 { |
| 1495 return dataList(); | 1477 return dataList(); |
| 1496 } | 1478 } |
| 1497 | 1479 |
| 1498 HTMLDataListElement* HTMLInputElement::dataList() const | 1480 HTMLDataListElement* HTMLInputElement::dataList() const |
| 1499 { | 1481 { |
| 1500 if (!m_hasNonEmptyList) | 1482 if (!m_hasNonEmptyList) |
| 1501 return 0; | 1483 return 0; |
| 1502 | 1484 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1517 if (inDocument()) | 1499 if (inDocument()) |
| 1518 m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fast
GetAttribute(listAttr), this); | 1500 m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fast
GetAttribute(listAttr), this); |
| 1519 else | 1501 else |
| 1520 m_listAttributeTargetObserver = nullptr; | 1502 m_listAttributeTargetObserver = nullptr; |
| 1521 } | 1503 } |
| 1522 | 1504 |
| 1523 void HTMLInputElement::listAttributeTargetChanged() | 1505 void HTMLInputElement::listAttributeTargetChanged() |
| 1524 { | 1506 { |
| 1525 m_inputType->listAttributeTargetChanged(); | 1507 m_inputType->listAttributeTargetChanged(); |
| 1526 } | 1508 } |
| 1527 #endif // ENABLE(DATALIST_ELEMENT) | |
| 1528 | 1509 |
| 1529 bool HTMLInputElement::isSteppable() const | 1510 bool HTMLInputElement::isSteppable() const |
| 1530 { | 1511 { |
| 1531 return m_inputType->isSteppable(); | 1512 return m_inputType->isSteppable(); |
| 1532 } | 1513 } |
| 1533 | 1514 |
| 1534 #if ENABLE(INPUT_SPEECH) | 1515 #if ENABLE(INPUT_SPEECH) |
| 1535 | 1516 |
| 1536 bool HTMLInputElement::isSpeechEnabled() const | 1517 bool HTMLInputElement::isSpeechEnabled() const |
| 1537 { | 1518 { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1780 void HTMLInputElement::setHeight(unsigned height) | 1761 void HTMLInputElement::setHeight(unsigned height) |
| 1781 { | 1762 { |
| 1782 setAttribute(heightAttr, String::number(height)); | 1763 setAttribute(heightAttr, String::number(height)); |
| 1783 } | 1764 } |
| 1784 | 1765 |
| 1785 void HTMLInputElement::setWidth(unsigned width) | 1766 void HTMLInputElement::setWidth(unsigned width) |
| 1786 { | 1767 { |
| 1787 setAttribute(widthAttr, String::number(width)); | 1768 setAttribute(widthAttr, String::number(width)); |
| 1788 } | 1769 } |
| 1789 | 1770 |
| 1790 #if ENABLE(DATALIST_ELEMENT) | |
| 1791 PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(cons
t AtomicString& id, HTMLInputElement* element) | 1771 PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(cons
t AtomicString& id, HTMLInputElement* element) |
| 1792 { | 1772 { |
| 1793 return adoptPtr(new ListAttributeTargetObserver(id, element)); | 1773 return adoptPtr(new ListAttributeTargetObserver(id, element)); |
| 1794 } | 1774 } |
| 1795 | 1775 |
| 1796 ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id,
HTMLInputElement* element) | 1776 ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id,
HTMLInputElement* element) |
| 1797 : IdTargetObserver(element->treeScope()->idTargetObserverRegistry(), id) | 1777 : IdTargetObserver(element->treeScope()->idTargetObserverRegistry(), id) |
| 1798 , m_element(element) | 1778 , m_element(element) |
| 1799 { | 1779 { |
| 1800 } | 1780 } |
| 1801 | 1781 |
| 1802 void ListAttributeTargetObserver::idTargetChanged() | 1782 void ListAttributeTargetObserver::idTargetChanged() |
| 1803 { | 1783 { |
| 1804 m_element->listAttributeTargetChanged(); | 1784 m_element->listAttributeTargetChanged(); |
| 1805 } | 1785 } |
| 1806 #endif | |
| 1807 | 1786 |
| 1808 void HTMLInputElement::setRangeText(const String& replacement, ExceptionCode& ec
) | 1787 void HTMLInputElement::setRangeText(const String& replacement, ExceptionCode& ec
) |
| 1809 { | 1788 { |
| 1810 if (!m_inputType->supportsSelectionAPI()) { | 1789 if (!m_inputType->supportsSelectionAPI()) { |
| 1811 ec = INVALID_STATE_ERR; | 1790 ec = INVALID_STATE_ERR; |
| 1812 return; | 1791 return; |
| 1813 } | 1792 } |
| 1814 | 1793 |
| 1815 HTMLTextFormControlElement::setRangeText(replacement, ec); | 1794 HTMLTextFormControlElement::setRangeText(replacement, ec); |
| 1816 } | 1795 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1846 parameters.step = stepRange.step().toDouble(); | 1825 parameters.step = stepRange.step().toDouble(); |
| 1847 parameters.stepBase = stepRange.stepBase().toDouble(); | 1826 parameters.stepBase = stepRange.stepBase().toDouble(); |
| 1848 } else { | 1827 } else { |
| 1849 parameters.step = 1.0; | 1828 parameters.step = 1.0; |
| 1850 parameters.stepBase = 0; | 1829 parameters.stepBase = 0; |
| 1851 } | 1830 } |
| 1852 | 1831 |
| 1853 parameters.anchorRectInRootView = document()->view()->contentsToRootView(pix
elSnappedBoundingBox()); | 1832 parameters.anchorRectInRootView = document()->view()->contentsToRootView(pix
elSnappedBoundingBox()); |
| 1854 parameters.currentValue = value(); | 1833 parameters.currentValue = value(); |
| 1855 parameters.isAnchorElementRTL = computedStyle()->direction() == RTL; | 1834 parameters.isAnchorElementRTL = computedStyle()->direction() == RTL; |
| 1856 #if ENABLE(DATALIST_ELEMENT) | 1835 if (RuntimeEnabledFeatures::dataListElementEnabled()) { |
| 1857 if (HTMLDataListElement* dataList = this->dataList()) { | 1836 if (HTMLDataListElement* dataList = this->dataList()) { |
| 1858 RefPtr<HTMLCollection> options = dataList->options(); | 1837 RefPtr<HTMLCollection> options = dataList->options(); |
| 1859 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(opt
ions->item(i)); ++i) { | 1838 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement
(options->item(i)); ++i) { |
| 1860 if (!isValidValue(option->value())) | 1839 if (!isValidValue(option->value())) |
| 1861 continue; | 1840 continue; |
| 1862 parameters.suggestionValues.append(sanitizeValue(option->value())); | 1841 parameters.suggestionValues.append(sanitizeValue(option->value()
)); |
| 1863 parameters.localizedSuggestionValues.append(localizeValue(option->va
lue())); | 1842 parameters.localizedSuggestionValues.append(localizeValue(option
->value())); |
| 1864 parameters.suggestionLabels.append(option->value() == option->label(
) ? String() : option->label()); | 1843 parameters.suggestionLabels.append(option->value() == option->la
bel() ? String() : option->label()); |
| 1844 } |
| 1865 } | 1845 } |
| 1866 } | 1846 } |
| 1867 #endif | |
| 1868 return true; | 1847 return true; |
| 1869 } | 1848 } |
| 1870 | 1849 |
| 1871 void HTMLInputElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
st | 1850 void HTMLInputElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
st |
| 1872 { | 1851 { |
| 1873 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 1852 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
| 1874 HTMLTextFormControlElement::reportMemoryUsage(memoryObjectInfo); | 1853 HTMLTextFormControlElement::reportMemoryUsage(memoryObjectInfo); |
| 1875 info.addMember(m_name, "name"); | 1854 info.addMember(m_name, "name"); |
| 1876 info.addMember(m_valueIfDirty, "valueIfDirty"); | 1855 info.addMember(m_valueIfDirty, "valueIfDirty"); |
| 1877 info.addMember(m_suggestedValue, "suggestedValue"); | 1856 info.addMember(m_suggestedValue, "suggestedValue"); |
| 1878 info.addMember(m_inputType, "inputType"); | 1857 info.addMember(m_inputType, "inputType"); |
| 1879 #if ENABLE(DATALIST_ELEMENT) | |
| 1880 info.addMember(m_listAttributeTargetObserver, "listAttributeTargetObserver")
; | 1858 info.addMember(m_listAttributeTargetObserver, "listAttributeTargetObserver")
; |
| 1881 #endif | |
| 1882 } | 1859 } |
| 1883 | 1860 |
| 1884 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 1861 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
| 1885 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() | 1862 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() |
| 1886 { | 1863 { |
| 1887 return m_inputType->customStyleForRenderer(document()->styleResolver()->styl
eForElement(this)); | 1864 return m_inputType->customStyleForRenderer(document()->styleResolver()->styl
eForElement(this)); |
| 1888 } | 1865 } |
| 1889 #endif | 1866 #endif |
| 1890 | 1867 |
| 1891 } // namespace | 1868 } // namespace |
| OLD | NEW |