| 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 17 matching lines...) Expand all Loading... |
| 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 "bindings/core/v8/ExceptionMessages.h" | 32 #include "bindings/core/v8/ExceptionMessages.h" |
| 33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "bindings/core/v8/ScriptEventListener.h" | 34 #include "bindings/core/v8/ScriptEventListener.h" |
| 35 #include "bindings/core/v8/V8DOMActivityLogger.h" | 35 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 36 #include "core/CSSPropertyNames.h" | 36 #include "core/CSSPropertyNames.h" |
| 37 #include "core/HTMLNames.h" | 37 #include "core/HTMLNames.h" |
| 38 #include "core/InputTypeNames.h" |
| 38 #include "core/accessibility/AXObjectCache.h" | 39 #include "core/accessibility/AXObjectCache.h" |
| 39 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
| 40 #include "core/dom/ExceptionCode.h" | 41 #include "core/dom/ExceptionCode.h" |
| 41 #include "core/dom/IdTargetObserver.h" | 42 #include "core/dom/IdTargetObserver.h" |
| 42 #include "core/dom/shadow/ElementShadow.h" | 43 #include "core/dom/shadow/ElementShadow.h" |
| 43 #include "core/dom/shadow/InsertionPoint.h" | 44 #include "core/dom/shadow/InsertionPoint.h" |
| 44 #include "core/dom/shadow/ShadowRoot.h" | 45 #include "core/dom/shadow/ShadowRoot.h" |
| 45 #include "core/editing/FrameSelection.h" | 46 #include "core/editing/FrameSelection.h" |
| 46 #include "core/editing/SpellChecker.h" | 47 #include "core/editing/SpellChecker.h" |
| 47 #include "core/events/BeforeTextInsertedEvent.h" | 48 #include "core/events/BeforeTextInsertedEvent.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 168 } |
| 168 | 169 |
| 169 HTMLInputElement::~HTMLInputElement() | 170 HTMLInputElement::~HTMLInputElement() |
| 170 { | 171 { |
| 171 #if !ENABLE(OILPAN) | 172 #if !ENABLE(OILPAN) |
| 172 // Need to remove form association while this is still an HTMLInputElement | 173 // Need to remove form association while this is still an HTMLInputElement |
| 173 // so that virtual functions are called correctly. | 174 // so that virtual functions are called correctly. |
| 174 setForm(0); | 175 setForm(0); |
| 175 // setForm(0) may register this to a document-level radio button group. | 176 // setForm(0) may register this to a document-level radio button group. |
| 176 // We should unregister it to avoid accessing a deleted object. | 177 // We should unregister it to avoid accessing a deleted object. |
| 177 if (isRadioButton()) | 178 if (type() == InputTypeNames::radio) |
| 178 document().formController().radioButtonGroupScope().removeButton(this); | 179 document().formController().radioButtonGroupScope().removeButton(this); |
| 179 if (m_hasTouchEventHandler && document().frameHost()) | 180 if (m_hasTouchEventHandler && document().frameHost()) |
| 180 document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*th
is, EventHandlerRegistry::TouchEvent); | 181 document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*th
is, EventHandlerRegistry::TouchEvent); |
| 181 #endif | 182 #endif |
| 182 } | 183 } |
| 183 | 184 |
| 184 const AtomicString& HTMLInputElement::name() const | 185 const AtomicString& HTMLInputElement::name() const |
| 185 { | 186 { |
| 186 return m_name.isNull() ? emptyAtom : m_name; | 187 return m_name.isNull() ? emptyAtom : m_name; |
| 187 } | 188 } |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 HTMLTextFormControlElement::setSelectionRange(start, end, direction); | 587 HTMLTextFormControlElement::setSelectionRange(start, end, direction); |
| 587 } | 588 } |
| 588 | 589 |
| 589 void HTMLInputElement::accessKeyAction(bool sendMouseEvents) | 590 void HTMLInputElement::accessKeyAction(bool sendMouseEvents) |
| 590 { | 591 { |
| 591 m_inputType->accessKeyAction(sendMouseEvents); | 592 m_inputType->accessKeyAction(sendMouseEvents); |
| 592 } | 593 } |
| 593 | 594 |
| 594 bool HTMLInputElement::isPresentationAttribute(const QualifiedName& name) const | 595 bool HTMLInputElement::isPresentationAttribute(const QualifiedName& name) const |
| 595 { | 596 { |
| 596 if (name == vspaceAttr || name == hspaceAttr || name == alignAttr || name ==
widthAttr || name == heightAttr || (name == borderAttr && isImageButton())) | 597 // FIXME: Remove type check. |
| 598 if (name == vspaceAttr || name == hspaceAttr || name == alignAttr || name ==
widthAttr || name == heightAttr || (name == borderAttr && type() == InputTypeNa
mes::image)) |
| 597 return true; | 599 return true; |
| 598 return HTMLTextFormControlElement::isPresentationAttribute(name); | 600 return HTMLTextFormControlElement::isPresentationAttribute(name); |
| 599 } | 601 } |
| 600 | 602 |
| 601 void HTMLInputElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) | 603 void HTMLInputElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) |
| 602 { | 604 { |
| 603 if (name == vspaceAttr) { | 605 if (name == vspaceAttr) { |
| 604 addHTMLLengthToStyle(style, CSSPropertyMarginTop, value); | 606 addHTMLLengthToStyle(style, CSSPropertyMarginTop, value); |
| 605 addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value); | 607 addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value); |
| 606 } else if (name == hspaceAttr) { | 608 } else if (name == hspaceAttr) { |
| 607 addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value); | 609 addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value); |
| 608 addHTMLLengthToStyle(style, CSSPropertyMarginRight, value); | 610 addHTMLLengthToStyle(style, CSSPropertyMarginRight, value); |
| 609 } else if (name == alignAttr) { | 611 } else if (name == alignAttr) { |
| 610 if (m_inputType->shouldRespectAlignAttribute()) | 612 if (m_inputType->shouldRespectAlignAttribute()) |
| 611 applyAlignmentAttributeToStyle(value, style); | 613 applyAlignmentAttributeToStyle(value, style); |
| 612 } else if (name == widthAttr) { | 614 } else if (name == widthAttr) { |
| 613 if (m_inputType->shouldRespectHeightAndWidthAttributes()) | 615 if (m_inputType->shouldRespectHeightAndWidthAttributes()) |
| 614 addHTMLLengthToStyle(style, CSSPropertyWidth, value); | 616 addHTMLLengthToStyle(style, CSSPropertyWidth, value); |
| 615 } else if (name == heightAttr) { | 617 } else if (name == heightAttr) { |
| 616 if (m_inputType->shouldRespectHeightAndWidthAttributes()) | 618 if (m_inputType->shouldRespectHeightAndWidthAttributes()) |
| 617 addHTMLLengthToStyle(style, CSSPropertyHeight, value); | 619 addHTMLLengthToStyle(style, CSSPropertyHeight, value); |
| 618 } else if (name == borderAttr && isImageButton()) | 620 } else if (name == borderAttr && type() == InputTypeNames::image) // FIXME:
Remove type check. |
| 619 applyBorderAttributeToStyle(value, style); | 621 applyBorderAttributeToStyle(value, style); |
| 620 else | 622 else |
| 621 HTMLTextFormControlElement::collectStyleForPresentationAttribute(name, v
alue, style); | 623 HTMLTextFormControlElement::collectStyleForPresentationAttribute(name, v
alue, style); |
| 622 } | 624 } |
| 623 | 625 |
| 624 void HTMLInputElement::attributeWillChange(const QualifiedName& name, const Atom
icString& oldValue, const AtomicString& newValue) | 626 void HTMLInputElement::attributeWillChange(const QualifiedName& name, const Atom
icString& oldValue, const AtomicString& newValue) |
| 625 { | 627 { |
| 626 if (name == formactionAttr && inDocument()) { | 628 if (name == formactionAttr && inDocument()) { |
| 627 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivi
tyLoggerIfIsolatedWorld(); | 629 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivi
tyLoggerIfIsolatedWorld(); |
| 628 if (activityLogger) { | 630 if (activityLogger) { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 } | 992 } |
| 991 | 993 |
| 992 void HTMLInputElement::setInnerEditorValue(const String& value) | 994 void HTMLInputElement::setInnerEditorValue(const String& value) |
| 993 { | 995 { |
| 994 HTMLTextFormControlElement::setInnerEditorValue(value); | 996 HTMLTextFormControlElement::setInnerEditorValue(value); |
| 995 m_needsToUpdateViewValue = false; | 997 m_needsToUpdateViewValue = false; |
| 996 } | 998 } |
| 997 | 999 |
| 998 void HTMLInputElement::setValue(const String& value, ExceptionState& exceptionSt
ate, TextFieldEventBehavior eventBehavior) | 1000 void HTMLInputElement::setValue(const String& value, ExceptionState& exceptionSt
ate, TextFieldEventBehavior eventBehavior) |
| 999 { | 1001 { |
| 1000 if (isFileUpload() && !value.isEmpty()) { | 1002 // FIXME: Remove type check. |
| 1003 if (type() == InputTypeNames::file && !value.isEmpty()) { |
| 1001 exceptionState.throwDOMException(InvalidStateError, "This input element
accepts a filename, which may only be programmatically set to the empty string."
); | 1004 exceptionState.throwDOMException(InvalidStateError, "This input element
accepts a filename, which may only be programmatically set to the empty string."
); |
| 1002 return; | 1005 return; |
| 1003 } | 1006 } |
| 1004 setValue(value, eventBehavior); | 1007 setValue(value, eventBehavior); |
| 1005 } | 1008 } |
| 1006 | 1009 |
| 1007 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) | 1010 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) |
| 1008 { | 1011 { |
| 1009 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); | 1012 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); |
| 1010 if (!m_inputType->canSetValue(value)) | 1013 if (!m_inputType->canSetValue(value)) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 if (std::isinf(newValue)) { | 1070 if (std::isinf(newValue)) { |
| 1068 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(newVal
ue)); | 1071 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(newVal
ue)); |
| 1069 return; | 1072 return; |
| 1070 } | 1073 } |
| 1071 m_inputType->setValueAsDouble(newValue, eventBehavior, exceptionState); | 1074 m_inputType->setValueAsDouble(newValue, eventBehavior, exceptionState); |
| 1072 } | 1075 } |
| 1073 | 1076 |
| 1074 void HTMLInputElement::setValueFromRenderer(const String& value) | 1077 void HTMLInputElement::setValueFromRenderer(const String& value) |
| 1075 { | 1078 { |
| 1076 // File upload controls will never use this. | 1079 // File upload controls will never use this. |
| 1077 ASSERT(!isFileUpload()); | 1080 ASSERT(type() != InputTypeNames::file); |
| 1078 | 1081 |
| 1079 m_suggestedValue = String(); | 1082 m_suggestedValue = String(); |
| 1080 | 1083 |
| 1081 // Renderer and our event handler are responsible for sanitizing values. | 1084 // Renderer and our event handler are responsible for sanitizing values. |
| 1082 ASSERT(value == sanitizeValue(value) || sanitizeValue(value).isEmpty()); | 1085 ASSERT(value == sanitizeValue(value) || sanitizeValue(value).isEmpty()); |
| 1083 | 1086 |
| 1084 m_valueIfDirty = value; | 1087 m_valueIfDirty = value; |
| 1085 m_needsToUpdateViewValue = false; | 1088 m_needsToUpdateViewValue = false; |
| 1086 | 1089 |
| 1087 // Input event is fired by the Node::defaultEventHandler for editable contro
ls. | 1090 // Input event is fired by the Node::defaultEventHandler for editable contro
ls. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 return; | 1171 return; |
| 1169 } | 1172 } |
| 1170 | 1173 |
| 1171 if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keyup) { | 1174 if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keyup) { |
| 1172 m_inputTypeView->handleKeyupEvent(toKeyboardEvent(evt)); | 1175 m_inputTypeView->handleKeyupEvent(toKeyboardEvent(evt)); |
| 1173 if (evt->defaultHandled()) | 1176 if (evt->defaultHandled()) |
| 1174 return; | 1177 return; |
| 1175 } | 1178 } |
| 1176 | 1179 |
| 1177 if (m_inputTypeView->shouldSubmitImplicitly(evt)) { | 1180 if (m_inputTypeView->shouldSubmitImplicitly(evt)) { |
| 1178 if (isSearchField()) | 1181 // FIXME: Remove type check. |
| 1182 if (type() == InputTypeNames::search) |
| 1179 onSearch(); | 1183 onSearch(); |
| 1180 // Form submission finishes editing, just as loss of focus does. | 1184 // Form submission finishes editing, just as loss of focus does. |
| 1181 // If there was a change, send the event now. | 1185 // If there was a change, send the event now. |
| 1182 if (wasChangedSinceLastFormControlChangeEvent()) | 1186 if (wasChangedSinceLastFormControlChangeEvent()) |
| 1183 dispatchFormControlChangeEvent(); | 1187 dispatchFormControlChangeEvent(); |
| 1184 | 1188 |
| 1185 RefPtrWillBeRawPtr<HTMLFormElement> formForSubmission = m_inputTypeView-
>formForSubmission(); | 1189 RefPtrWillBeRawPtr<HTMLFormElement> formForSubmission = m_inputTypeView-
>formForSubmission(); |
| 1186 // Form may never have been present, or may have been destroyed by code
responding to the change event. | 1190 // Form may never have been present, or may have been destroyed by code
responding to the change event. |
| 1187 if (formForSubmission) | 1191 if (formForSubmission) |
| 1188 formForSubmission->submitImplicitly(evt, canTriggerImplicitSubmissio
n()); | 1192 formForSubmission->submitImplicitly(evt, canTriggerImplicitSubmissio
n()); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 return m_inputType->supportsReadOnly() && isReadOnly(); | 1402 return m_inputType->supportsReadOnly() && isReadOnly(); |
| 1399 } | 1403 } |
| 1400 | 1404 |
| 1401 bool HTMLInputElement::matchesReadWritePseudoClass() const | 1405 bool HTMLInputElement::matchesReadWritePseudoClass() const |
| 1402 { | 1406 { |
| 1403 return m_inputType->supportsReadOnly() && !isReadOnly(); | 1407 return m_inputType->supportsReadOnly() && !isReadOnly(); |
| 1404 } | 1408 } |
| 1405 | 1409 |
| 1406 void HTMLInputElement::onSearch() | 1410 void HTMLInputElement::onSearch() |
| 1407 { | 1411 { |
| 1408 ASSERT(isSearchField()); | 1412 // FIXME: Remove type check, and static_cast. |
| 1413 ASSERT(type() == InputTypeNames::search); |
| 1409 if (m_inputType) | 1414 if (m_inputType) |
| 1410 static_cast<SearchInputType*>(m_inputType.get())->stopSearchEventTimer()
; | 1415 static_cast<SearchInputType*>(m_inputType.get())->stopSearchEventTimer()
; |
| 1411 dispatchEvent(Event::createBubble(EventTypeNames::search)); | 1416 dispatchEvent(Event::createBubble(EventTypeNames::search)); |
| 1412 } | 1417 } |
| 1413 | 1418 |
| 1414 void HTMLInputElement::updateClearButtonVisibility() | 1419 void HTMLInputElement::updateClearButtonVisibility() |
| 1415 { | 1420 { |
| 1416 m_inputTypeView->updateClearButtonVisibility(); | 1421 m_inputTypeView->updateClearButtonVisibility(); |
| 1417 } | 1422 } |
| 1418 | 1423 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 HTMLTextFormControlElement::removedFrom(insertionPoint); | 1459 HTMLTextFormControlElement::removedFrom(insertionPoint); |
| 1455 ASSERT(!inDocument()); | 1460 ASSERT(!inDocument()); |
| 1456 resetListAttributeTargetObserver(); | 1461 resetListAttributeTargetObserver(); |
| 1457 } | 1462 } |
| 1458 | 1463 |
| 1459 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) | 1464 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) |
| 1460 { | 1465 { |
| 1461 if (hasImageLoader()) | 1466 if (hasImageLoader()) |
| 1462 imageLoader()->elementDidMoveToNewDocument(); | 1467 imageLoader()->elementDidMoveToNewDocument(); |
| 1463 | 1468 |
| 1464 if (isRadioButton()) | 1469 // FIXME: Remove type check. |
| 1470 if (type() == InputTypeNames::radio) |
| 1465 oldDocument.formController().radioButtonGroupScope().removeButton(this); | 1471 oldDocument.formController().radioButtonGroupScope().removeButton(this); |
| 1466 | 1472 |
| 1467 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); | 1473 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); |
| 1468 } | 1474 } |
| 1469 | 1475 |
| 1470 void HTMLInputElement::removeAllEventListeners() | 1476 void HTMLInputElement::removeAllEventListeners() |
| 1471 { | 1477 { |
| 1472 HTMLTextFormControlElement::removeAllEventListeners(); | 1478 HTMLTextFormControlElement::removeAllEventListeners(); |
| 1473 m_hasTouchEventHandler = false; | 1479 m_hasTouchEventHandler = false; |
| 1474 } | 1480 } |
| 1475 | 1481 |
| 1476 bool HTMLInputElement::recalcWillValidate() const | 1482 bool HTMLInputElement::recalcWillValidate() const |
| 1477 { | 1483 { |
| 1478 return m_inputType->supportsValidation() && HTMLTextFormControlElement::reca
lcWillValidate(); | 1484 return m_inputType->supportsValidation() && HTMLTextFormControlElement::reca
lcWillValidate(); |
| 1479 } | 1485 } |
| 1480 | 1486 |
| 1481 void HTMLInputElement::requiredAttributeChanged() | 1487 void HTMLInputElement::requiredAttributeChanged() |
| 1482 { | 1488 { |
| 1483 HTMLTextFormControlElement::requiredAttributeChanged(); | 1489 HTMLTextFormControlElement::requiredAttributeChanged(); |
| 1484 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 1490 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
| 1485 scope->requiredAttributeChanged(this); | 1491 scope->requiredAttributeChanged(this); |
| 1486 m_inputTypeView->requiredAttributeChanged(); | 1492 m_inputTypeView->requiredAttributeChanged(); |
| 1487 } | 1493 } |
| 1488 | 1494 |
| 1489 void HTMLInputElement::selectColorInColorChooser(const Color& color) | 1495 void HTMLInputElement::selectColorInColorChooser(const Color& color) |
| 1490 { | 1496 { |
| 1491 if (!m_inputType->isColorControl()) | 1497 // FIXME: Remove type check and static_cast. |
| 1498 if (type() != InputTypeNames::color) |
| 1492 return; | 1499 return; |
| 1493 static_cast<ColorInputType*>(m_inputType.get())->didChooseColor(color); | 1500 static_cast<ColorInputType*>(m_inputType.get())->didChooseColor(color); |
| 1494 } | 1501 } |
| 1495 | 1502 |
| 1496 HTMLElement* HTMLInputElement::list() const | 1503 HTMLElement* HTMLInputElement::list() const |
| 1497 { | 1504 { |
| 1498 return dataList(); | 1505 return dataList(); |
| 1499 } | 1506 } |
| 1500 | 1507 |
| 1501 HTMLDataListElement* HTMLInputElement::dataList() const | 1508 HTMLDataListElement* HTMLInputElement::dataList() const |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 bool HTMLInputElement::isSteppable() const | 1558 bool HTMLInputElement::isSteppable() const |
| 1552 { | 1559 { |
| 1553 return m_inputType->isSteppable(); | 1560 return m_inputType->isSteppable(); |
| 1554 } | 1561 } |
| 1555 | 1562 |
| 1556 bool HTMLInputElement::isTextButton() const | 1563 bool HTMLInputElement::isTextButton() const |
| 1557 { | 1564 { |
| 1558 return m_inputType->isTextButton(); | 1565 return m_inputType->isTextButton(); |
| 1559 } | 1566 } |
| 1560 | 1567 |
| 1561 bool HTMLInputElement::isRadioButton() const | |
| 1562 { | |
| 1563 return m_inputType->isRadioButton(); | |
| 1564 } | |
| 1565 | |
| 1566 bool HTMLInputElement::isSearchField() const | |
| 1567 { | |
| 1568 return m_inputType->isSearchField(); | |
| 1569 } | |
| 1570 | |
| 1571 bool HTMLInputElement::isInputTypeHidden() const | |
| 1572 { | |
| 1573 return m_inputType->isHiddenType(); | |
| 1574 } | |
| 1575 | |
| 1576 bool HTMLInputElement::isPasswordField() const | |
| 1577 { | |
| 1578 return m_inputType->isPasswordField(); | |
| 1579 } | |
| 1580 | |
| 1581 bool HTMLInputElement::isCheckbox() const | |
| 1582 { | |
| 1583 return m_inputType->isCheckbox(); | |
| 1584 } | |
| 1585 | |
| 1586 bool HTMLInputElement::isRangeControl() const | |
| 1587 { | |
| 1588 return m_inputType->isRangeControl(); | |
| 1589 } | |
| 1590 | |
| 1591 bool HTMLInputElement::isText() const | 1568 bool HTMLInputElement::isText() const |
| 1592 { | 1569 { |
| 1593 return m_inputType->isTextType(); | 1570 return m_inputType->isTextType(); |
| 1594 } | 1571 } |
| 1595 | 1572 |
| 1596 bool HTMLInputElement::isEmailField() const | |
| 1597 { | |
| 1598 return m_inputType->isEmailField(); | |
| 1599 } | |
| 1600 | |
| 1601 bool HTMLInputElement::isFileUpload() const | |
| 1602 { | |
| 1603 return m_inputType->isFileUpload(); | |
| 1604 } | |
| 1605 | |
| 1606 bool HTMLInputElement::isImageButton() const | |
| 1607 { | |
| 1608 return m_inputType->isImageButton(); | |
| 1609 } | |
| 1610 | |
| 1611 bool HTMLInputElement::isNumberField() const | |
| 1612 { | |
| 1613 return m_inputType->isNumberField(); | |
| 1614 } | |
| 1615 | |
| 1616 bool HTMLInputElement::isTelephoneField() const | |
| 1617 { | |
| 1618 return m_inputType->isTelephoneField(); | |
| 1619 } | |
| 1620 | |
| 1621 bool HTMLInputElement::isURLField() const | |
| 1622 { | |
| 1623 return m_inputType->isURLField(); | |
| 1624 } | |
| 1625 | |
| 1626 bool HTMLInputElement::isDateField() const | |
| 1627 { | |
| 1628 return m_inputType->isDateField(); | |
| 1629 } | |
| 1630 | |
| 1631 bool HTMLInputElement::isDateTimeLocalField() const | |
| 1632 { | |
| 1633 return m_inputType->isDateTimeLocalField(); | |
| 1634 } | |
| 1635 | |
| 1636 bool HTMLInputElement::isMonthField() const | |
| 1637 { | |
| 1638 return m_inputType->isMonthField(); | |
| 1639 } | |
| 1640 | |
| 1641 bool HTMLInputElement::isTimeField() const | |
| 1642 { | |
| 1643 return m_inputType->isTimeField(); | |
| 1644 } | |
| 1645 | |
| 1646 bool HTMLInputElement::isWeekField() const | |
| 1647 { | |
| 1648 return m_inputType->isWeekField(); | |
| 1649 } | |
| 1650 | |
| 1651 bool HTMLInputElement::isEnumeratable() const | 1573 bool HTMLInputElement::isEnumeratable() const |
| 1652 { | 1574 { |
| 1653 return m_inputType->isEnumeratable(); | 1575 return m_inputType->isEnumeratable(); |
| 1654 } | 1576 } |
| 1655 | 1577 |
| 1656 bool HTMLInputElement::supportLabels() const | 1578 bool HTMLInputElement::supportLabels() const |
| 1657 { | 1579 { |
| 1658 return m_inputType->isInteractiveContent(); | 1580 return m_inputType->isInteractiveContent(); |
| 1659 } | 1581 } |
| 1660 | 1582 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 return m_inputType->defaultToolTip(); | 1623 return m_inputType->defaultToolTip(); |
| 1702 } | 1624 } |
| 1703 | 1625 |
| 1704 bool HTMLInputElement::shouldAppearIndeterminate() const | 1626 bool HTMLInputElement::shouldAppearIndeterminate() const |
| 1705 { | 1627 { |
| 1706 return m_inputType->shouldAppearIndeterminate(); | 1628 return m_inputType->shouldAppearIndeterminate(); |
| 1707 } | 1629 } |
| 1708 | 1630 |
| 1709 bool HTMLInputElement::isInRequiredRadioButtonGroup() | 1631 bool HTMLInputElement::isInRequiredRadioButtonGroup() |
| 1710 { | 1632 { |
| 1711 ASSERT(isRadioButton()); | 1633 // FIXME: Remove type check. |
| 1634 ASSERT(type() == InputTypeNames::radio); |
| 1712 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 1635 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
| 1713 return scope->isInRequiredGroup(this); | 1636 return scope->isInRequiredGroup(this); |
| 1714 return false; | 1637 return false; |
| 1715 } | 1638 } |
| 1716 | 1639 |
| 1717 HTMLInputElement* HTMLInputElement::checkedRadioButtonForGroup() | 1640 HTMLInputElement* HTMLInputElement::checkedRadioButtonForGroup() |
| 1718 { | 1641 { |
| 1719 if (checked()) | 1642 if (checked()) |
| 1720 return this; | 1643 return this; |
| 1721 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 1644 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
| 1722 return scope->checkedButtonForGroup(name()); | 1645 return scope->checkedButtonForGroup(name()); |
| 1723 return 0; | 1646 return 0; |
| 1724 } | 1647 } |
| 1725 | 1648 |
| 1726 RadioButtonGroupScope* HTMLInputElement::radioButtonGroupScope() const | 1649 RadioButtonGroupScope* HTMLInputElement::radioButtonGroupScope() const |
| 1727 { | 1650 { |
| 1728 if (!isRadioButton()) | 1651 // FIXME: Remove type check. |
| 1652 if (type() != InputTypeNames::radio) |
| 1729 return 0; | 1653 return 0; |
| 1730 if (HTMLFormElement* formElement = form()) | 1654 if (HTMLFormElement* formElement = form()) |
| 1731 return &formElement->radioButtonGroupScope(); | 1655 return &formElement->radioButtonGroupScope(); |
| 1732 if (inDocument()) | 1656 if (inDocument()) |
| 1733 return &document().formController().radioButtonGroupScope(); | 1657 return &document().formController().radioButtonGroupScope(); |
| 1734 return 0; | 1658 return 0; |
| 1735 } | 1659 } |
| 1736 | 1660 |
| 1737 inline void HTMLInputElement::addToRadioButtonGroup() | 1661 inline void HTMLInputElement::addToRadioButtonGroup() |
| 1738 { | 1662 { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 { | 1817 { |
| 1894 listAttributeTargetChanged(); | 1818 listAttributeTargetChanged(); |
| 1895 } | 1819 } |
| 1896 | 1820 |
| 1897 AXObject* HTMLInputElement::popupRootAXObject() | 1821 AXObject* HTMLInputElement::popupRootAXObject() |
| 1898 { | 1822 { |
| 1899 return m_inputTypeView->popupRootAXObject(); | 1823 return m_inputTypeView->popupRootAXObject(); |
| 1900 } | 1824 } |
| 1901 | 1825 |
| 1902 } // namespace | 1826 } // namespace |
| OLD | NEW |