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 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 } |
|
tkent
2013/05/22 00:40:38
should be "} else if (..."
| |
| 704 #if ENABLE(DATALIST_ELEMENT) | |
| 705 else if (name == listAttr) { | 694 else if (name == listAttr) { |
| 706 m_hasNonEmptyList = !value.isEmpty(); | 695 m_hasNonEmptyList = !value.isEmpty(); |
| 707 if (m_hasNonEmptyList) { | 696 if (m_hasNonEmptyList) { |
| 708 resetListAttributeTargetObserver(); | 697 resetListAttributeTargetObserver(); |
| 709 listAttributeTargetChanged(); | 698 listAttributeTargetChanged(); |
| 710 } | 699 } |
| 711 UseCounter::count(document(), UseCounter::ListAttribute); | 700 UseCounter::count(document(), UseCounter::ListAttribute); |
| 712 } | 701 } |
| 713 #endif | |
| 714 #if ENABLE(INPUT_SPEECH) | 702 #if ENABLE(INPUT_SPEECH) |
| 715 else if (name == webkitspeechAttr) { | 703 else if (name == webkitspeechAttr) { |
| 716 if (renderer()) { | 704 if (renderer()) { |
| 717 // This renderer and its children have quite different layouts and s tyles depending on | 705 // 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 | 706 // 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. | 707 // to get the right styles and layout. |
| 720 detach(); | 708 detach(); |
| 721 m_inputType->destroyShadowSubtree(); | 709 m_inputType->destroyShadowSubtree(); |
| 722 m_inputType->createShadowSubtree(); | 710 m_inputType->createShadowSubtree(); |
| 723 if (!attached()) | 711 if (!attached()) |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1418 { | 1406 { |
| 1419 HTMLTextFormControlElement::didChangeForm(); | 1407 HTMLTextFormControlElement::didChangeForm(); |
| 1420 addToRadioButtonGroup(); | 1408 addToRadioButtonGroup(); |
| 1421 } | 1409 } |
| 1422 | 1410 |
| 1423 Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode* insertionPoint) | 1411 Node::InsertionNotificationRequest HTMLInputElement::insertedInto(ContainerNode* insertionPoint) |
| 1424 { | 1412 { |
| 1425 HTMLTextFormControlElement::insertedInto(insertionPoint); | 1413 HTMLTextFormControlElement::insertedInto(insertionPoint); |
| 1426 if (insertionPoint->inDocument() && !form()) | 1414 if (insertionPoint->inDocument() && !form()) |
| 1427 addToRadioButtonGroup(); | 1415 addToRadioButtonGroup(); |
| 1428 #if ENABLE(DATALIST_ELEMENT) | |
| 1429 resetListAttributeTargetObserver(); | 1416 resetListAttributeTargetObserver(); |
| 1430 #endif | |
| 1431 return InsertionDone; | 1417 return InsertionDone; |
| 1432 } | 1418 } |
| 1433 | 1419 |
| 1434 void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) | 1420 void HTMLInputElement::removedFrom(ContainerNode* insertionPoint) |
| 1435 { | 1421 { |
| 1436 if (insertionPoint->inDocument() && !form()) | 1422 if (insertionPoint->inDocument() && !form()) |
| 1437 removeFromRadioButtonGroup(); | 1423 removeFromRadioButtonGroup(); |
| 1438 HTMLTextFormControlElement::removedFrom(insertionPoint); | 1424 HTMLTextFormControlElement::removedFrom(insertionPoint); |
| 1439 ASSERT(!inDocument()); | 1425 ASSERT(!inDocument()); |
| 1440 #if ENABLE(DATALIST_ELEMENT) | |
| 1441 resetListAttributeTargetObserver(); | 1426 resetListAttributeTargetObserver(); |
| 1442 #endif | |
| 1443 } | 1427 } |
| 1444 | 1428 |
| 1445 void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) | 1429 void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) |
| 1446 { | 1430 { |
| 1447 if (hasImageLoader()) | 1431 if (hasImageLoader()) |
| 1448 imageLoader()->elementDidMoveToNewDocument(); | 1432 imageLoader()->elementDidMoveToNewDocument(); |
| 1449 | 1433 |
| 1450 if (oldDocument) { | 1434 if (oldDocument) { |
| 1451 if (isRadioButton()) | 1435 if (isRadioButton()) |
| 1452 oldDocument->formController()->checkedRadioButtons().removeButton(th is); | 1436 oldDocument->formController()->checkedRadioButtons().removeButton(th is); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1482 | 1466 |
| 1483 #if ENABLE(INPUT_TYPE_COLOR) | 1467 #if ENABLE(INPUT_TYPE_COLOR) |
| 1484 void HTMLInputElement::selectColorInColorChooser(const Color& color) | 1468 void HTMLInputElement::selectColorInColorChooser(const Color& color) |
| 1485 { | 1469 { |
| 1486 if (!m_inputType->isColorControl()) | 1470 if (!m_inputType->isColorControl()) |
| 1487 return; | 1471 return; |
| 1488 static_cast<ColorInputType*>(m_inputType.get())->didChooseColor(color); | 1472 static_cast<ColorInputType*>(m_inputType.get())->didChooseColor(color); |
| 1489 } | 1473 } |
| 1490 #endif | 1474 #endif |
| 1491 | 1475 |
| 1492 #if ENABLE(DATALIST_ELEMENT) | |
| 1493 HTMLElement* HTMLInputElement::list() const | 1476 HTMLElement* HTMLInputElement::list() const |
| 1494 { | 1477 { |
| 1495 return dataList(); | 1478 return dataList(); |
| 1496 } | 1479 } |
| 1497 | 1480 |
| 1498 HTMLDataListElement* HTMLInputElement::dataList() const | 1481 HTMLDataListElement* HTMLInputElement::dataList() const |
| 1499 { | 1482 { |
| 1500 if (!m_hasNonEmptyList) | 1483 if (!m_hasNonEmptyList) |
| 1501 return 0; | 1484 return 0; |
| 1502 | 1485 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1517 if (inDocument()) | 1500 if (inDocument()) |
| 1518 m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fast GetAttribute(listAttr), this); | 1501 m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fast GetAttribute(listAttr), this); |
| 1519 else | 1502 else |
| 1520 m_listAttributeTargetObserver = nullptr; | 1503 m_listAttributeTargetObserver = nullptr; |
| 1521 } | 1504 } |
| 1522 | 1505 |
| 1523 void HTMLInputElement::listAttributeTargetChanged() | 1506 void HTMLInputElement::listAttributeTargetChanged() |
| 1524 { | 1507 { |
| 1525 m_inputType->listAttributeTargetChanged(); | 1508 m_inputType->listAttributeTargetChanged(); |
| 1526 } | 1509 } |
| 1527 #endif // ENABLE(DATALIST_ELEMENT) | |
| 1528 | 1510 |
| 1529 bool HTMLInputElement::isSteppable() const | 1511 bool HTMLInputElement::isSteppable() const |
| 1530 { | 1512 { |
| 1531 return m_inputType->isSteppable(); | 1513 return m_inputType->isSteppable(); |
| 1532 } | 1514 } |
| 1533 | 1515 |
| 1534 #if ENABLE(INPUT_SPEECH) | 1516 #if ENABLE(INPUT_SPEECH) |
| 1535 | 1517 |
| 1536 bool HTMLInputElement::isSpeechEnabled() const | 1518 bool HTMLInputElement::isSpeechEnabled() const |
| 1537 { | 1519 { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1780 void HTMLInputElement::setHeight(unsigned height) | 1762 void HTMLInputElement::setHeight(unsigned height) |
| 1781 { | 1763 { |
| 1782 setAttribute(heightAttr, String::number(height)); | 1764 setAttribute(heightAttr, String::number(height)); |
| 1783 } | 1765 } |
| 1784 | 1766 |
| 1785 void HTMLInputElement::setWidth(unsigned width) | 1767 void HTMLInputElement::setWidth(unsigned width) |
| 1786 { | 1768 { |
| 1787 setAttribute(widthAttr, String::number(width)); | 1769 setAttribute(widthAttr, String::number(width)); |
| 1788 } | 1770 } |
| 1789 | 1771 |
| 1790 #if ENABLE(DATALIST_ELEMENT) | |
| 1791 PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(cons t AtomicString& id, HTMLInputElement* element) | 1772 PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(cons t AtomicString& id, HTMLInputElement* element) |
| 1792 { | 1773 { |
| 1793 return adoptPtr(new ListAttributeTargetObserver(id, element)); | 1774 return adoptPtr(new ListAttributeTargetObserver(id, element)); |
| 1794 } | 1775 } |
| 1795 | 1776 |
| 1796 ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement* element) | 1777 ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement* element) |
| 1797 : IdTargetObserver(element->treeScope()->idTargetObserverRegistry(), id) | 1778 : IdTargetObserver(element->treeScope()->idTargetObserverRegistry(), id) |
| 1798 , m_element(element) | 1779 , m_element(element) |
| 1799 { | 1780 { |
| 1800 } | 1781 } |
| 1801 | 1782 |
| 1802 void ListAttributeTargetObserver::idTargetChanged() | 1783 void ListAttributeTargetObserver::idTargetChanged() |
| 1803 { | 1784 { |
| 1804 m_element->listAttributeTargetChanged(); | 1785 m_element->listAttributeTargetChanged(); |
| 1805 } | 1786 } |
| 1806 #endif | |
| 1807 | 1787 |
| 1808 void HTMLInputElement::setRangeText(const String& replacement, ExceptionCode& ec ) | 1788 void HTMLInputElement::setRangeText(const String& replacement, ExceptionCode& ec ) |
| 1809 { | 1789 { |
| 1810 if (!m_inputType->supportsSelectionAPI()) { | 1790 if (!m_inputType->supportsSelectionAPI()) { |
| 1811 ec = INVALID_STATE_ERR; | 1791 ec = INVALID_STATE_ERR; |
| 1812 return; | 1792 return; |
| 1813 } | 1793 } |
| 1814 | 1794 |
| 1815 HTMLTextFormControlElement::setRangeText(replacement, ec); | 1795 HTMLTextFormControlElement::setRangeText(replacement, ec); |
| 1816 } | 1796 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1846 parameters.step = stepRange.step().toDouble(); | 1826 parameters.step = stepRange.step().toDouble(); |
| 1847 parameters.stepBase = stepRange.stepBase().toDouble(); | 1827 parameters.stepBase = stepRange.stepBase().toDouble(); |
| 1848 } else { | 1828 } else { |
| 1849 parameters.step = 1.0; | 1829 parameters.step = 1.0; |
| 1850 parameters.stepBase = 0; | 1830 parameters.stepBase = 0; |
| 1851 } | 1831 } |
| 1852 | 1832 |
| 1853 parameters.anchorRectInRootView = document()->view()->contentsToRootView(pix elSnappedBoundingBox()); | 1833 parameters.anchorRectInRootView = document()->view()->contentsToRootView(pix elSnappedBoundingBox()); |
| 1854 parameters.currentValue = value(); | 1834 parameters.currentValue = value(); |
| 1855 parameters.isAnchorElementRTL = computedStyle()->direction() == RTL; | 1835 parameters.isAnchorElementRTL = computedStyle()->direction() == RTL; |
| 1856 #if ENABLE(DATALIST_ELEMENT) | 1836 if (RuntimeEnabledFeatures::dataListElementEnabled()) { |
| 1857 if (HTMLDataListElement* dataList = this->dataList()) { | 1837 if (HTMLDataListElement* dataList = this->dataList()) { |
| 1858 RefPtr<HTMLCollection> options = dataList->options(); | 1838 RefPtr<HTMLCollection> options = dataList->options(); |
| 1859 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(opt ions->item(i)); ++i) { | 1839 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement (options->item(i)); ++i) { |
| 1860 if (!isValidValue(option->value())) | 1840 if (!isValidValue(option->value())) |
| 1861 continue; | 1841 continue; |
| 1862 parameters.suggestionValues.append(sanitizeValue(option->value())); | 1842 parameters.suggestionValues.append(sanitizeValue(option->value() )); |
| 1863 parameters.localizedSuggestionValues.append(localizeValue(option->va lue())); | 1843 parameters.localizedSuggestionValues.append(localizeValue(option ->value())); |
| 1864 parameters.suggestionLabels.append(option->value() == option->label( ) ? String() : option->label()); | 1844 parameters.suggestionLabels.append(option->value() == option->la bel() ? String() : option->label()); |
| 1845 } | |
| 1865 } | 1846 } |
| 1866 } | 1847 } |
| 1867 #endif | |
| 1868 return true; | 1848 return true; |
| 1869 } | 1849 } |
| 1870 | 1850 |
| 1871 void HTMLInputElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con st | 1851 void HTMLInputElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con st |
| 1872 { | 1852 { |
| 1873 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 1853 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
| 1874 HTMLTextFormControlElement::reportMemoryUsage(memoryObjectInfo); | 1854 HTMLTextFormControlElement::reportMemoryUsage(memoryObjectInfo); |
| 1875 info.addMember(m_name, "name"); | 1855 info.addMember(m_name, "name"); |
| 1876 info.addMember(m_valueIfDirty, "valueIfDirty"); | 1856 info.addMember(m_valueIfDirty, "valueIfDirty"); |
| 1877 info.addMember(m_suggestedValue, "suggestedValue"); | 1857 info.addMember(m_suggestedValue, "suggestedValue"); |
| 1878 info.addMember(m_inputType, "inputType"); | 1858 info.addMember(m_inputType, "inputType"); |
| 1879 #if ENABLE(DATALIST_ELEMENT) | |
| 1880 info.addMember(m_listAttributeTargetObserver, "listAttributeTargetObserver") ; | 1859 info.addMember(m_listAttributeTargetObserver, "listAttributeTargetObserver") ; |
| 1881 #endif | |
| 1882 } | 1860 } |
| 1883 | 1861 |
| 1884 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 1862 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
| 1885 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() | 1863 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() |
| 1886 { | 1864 { |
| 1887 return m_inputType->customStyleForRenderer(document()->styleResolver()->styl eForElement(this)); | 1865 return m_inputType->customStyleForRenderer(document()->styleResolver()->styl eForElement(this)); |
| 1888 } | 1866 } |
| 1889 #endif | 1867 #endif |
| 1890 | 1868 |
| 1891 } // namespace | 1869 } // namespace |
| OLD | NEW |