Changeset 267003 in webkit
- Timestamp:
- Sep 13, 2020 1:32:24 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r267002 r267003 1 2020-09-13 Aditya Keerthi <akeerthi@apple.com> 2 3 Consolidate BaseDateAndTimeInputType and BaseChooserOnlyDateAndTimeInputType 4 https://bugs.webkit.org/show_bug.cgi?id=216414 5 6 Reviewed by Devin Rousso. 7 8 BaseChooserOnlyDateAndTimeInputType is the only derived class of 9 BaseDateAndTimeInputType. Furthermore, with the introduction of editable 10 components, "ChooserOnly" no longer makes sense as a name for the 11 derived class. Consequently, all logic in BaseChooserOnlyDateAndTimeInputType 12 was moved into BaseDateAndTimeInputType, and the derived classes of the 13 "ChooserOnly" type now inherit BaseDateAndTimeInputType. 14 15 Also changed some methods from override to final, and made some protected 16 methods private, where possible. 17 18 No new tests, as there is no change in behavior. 19 20 * Sources.txt: 21 * WebCore.xcodeproj/project.pbxproj: 22 * html/BaseChooserOnlyDateAndTimeInputType.cpp: Removed. 23 * html/BaseChooserOnlyDateAndTimeInputType.h: Removed. 24 * html/BaseDateAndTimeInputType.cpp: 25 (WebCore::BaseDateAndTimeInputType::DateTimeFormatValidator::visitField): 26 (WebCore::BaseDateAndTimeInputType::DateTimeFormatValidator::validateFormat): 27 (WebCore::BaseDateAndTimeInputType::~BaseDateAndTimeInputType): 28 (WebCore::BaseDateAndTimeInputType::isMouseFocusable const): 29 (WebCore::BaseDateAndTimeInputType::shouldHaveSecondField const): 30 (WebCore::BaseDateAndTimeInputType::shouldHaveMillisecondField const): 31 (WebCore::BaseDateAndTimeInputType::setValue): 32 (WebCore::BaseDateAndTimeInputType::handleDOMActivateEvent): 33 (WebCore::BaseDateAndTimeInputType::createShadowSubtree): 34 (WebCore::BaseDateAndTimeInputType::destroyShadowSubtree): 35 (WebCore::BaseDateAndTimeInputType::updateInnerTextValue): 36 (WebCore::BaseDateAndTimeInputType::hasCustomFocusLogic const): 37 (WebCore::BaseDateAndTimeInputType::attributeChanged): 38 (WebCore::BaseDateAndTimeInputType::elementDidBlur): 39 (WebCore::BaseDateAndTimeInputType::detach): 40 (WebCore::BaseDateAndTimeInputType::isPresentingAttachedView const): 41 (WebCore::BaseDateAndTimeInputType::handleKeydownEvent): 42 (WebCore::BaseDateAndTimeInputType::handleKeypressEvent): 43 (WebCore::BaseDateAndTimeInputType::handleKeyupEvent): 44 (WebCore::BaseDateAndTimeInputType::handleFocusEvent): 45 (WebCore::BaseDateAndTimeInputType::accessKeyAction): 46 (WebCore::BaseDateAndTimeInputType::didBlurFromControl): 47 (WebCore::BaseDateAndTimeInputType::didChangeValueFromControl): 48 (WebCore::BaseDateAndTimeInputType::isEditControlOwnerDisabled const): 49 (WebCore::BaseDateAndTimeInputType::isEditControlOwnerReadOnly const): 50 (WebCore::BaseDateAndTimeInputType::localeIdentifier const): 51 (WebCore::BaseDateAndTimeInputType::didChooseValue): 52 (WebCore::BaseDateAndTimeInputType::didEndChooser): 53 (WebCore::BaseDateAndTimeInputType::closeDateTimeChooser): 54 * html/BaseDateAndTimeInputType.h: 55 * html/DateInputType.cpp: 56 (WebCore::DateInputType::DateInputType): 57 * html/DateInputType.h: 58 * html/DateTimeLocalInputType.cpp: 59 * html/DateTimeLocalInputType.h: 60 * html/MonthInputType.h: 61 * html/TimeInputType.cpp: 62 (WebCore::TimeInputType::TimeInputType): 63 * html/TimeInputType.h: 64 * html/WeekInputType.h: 65 1 66 2020-09-13 Simon Fraser <simon.fraser@apple.com> 2 67 -
trunk/Source/WebCore/Sources.txt
r266976 r267003 1066 1066 html/BaseButtonInputType.cpp 1067 1067 html/BaseCheckableInputType.cpp 1068 html/BaseChooserOnlyDateAndTimeInputType.cpp1069 1068 html/BaseClickableWithKeyInputType.cpp 1070 1069 html/BaseDateAndTimeInputType.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r266977 r267003 5190 5190 F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5191 5191 F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */; }; 5192 F5E0C65C1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F5E0C65A1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h */; };5193 5192 F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F916C48C0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h */; }; 5194 5193 F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; }; … … 16243 16242 F5C041E10FFCA96D00839D4A /* JSHTMLDataListElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDataListElement.cpp; sourceTree = "<group>"; }; 16244 16243 F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLDataListElement.h; sourceTree = "<group>"; }; 16245 F5E0C6591643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseChooserOnlyDateAndTimeInputType.cpp; sourceTree = "<group>"; };16246 F5E0C65A1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseChooserOnlyDateAndTimeInputType.h; sourceTree = "<group>"; };16247 16244 F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLSelectElement.cpp; sourceTree = "<group>"; }; 16248 16245 F8216299029F4FB501000131 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; … … 22672 22669 379E61C7126CA5C300B63E8D /* BaseCheckableInputType.cpp */, 22673 22670 379E61C8126CA5C300B63E8D /* BaseCheckableInputType.h */, 22674 F5E0C6591643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.cpp */,22675 F5E0C65A1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h */,22676 22671 C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */, 22677 22672 C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */, … … 30454 30449 379E61CA126CA5C400B63E8D /* BaseButtonInputType.h in Headers */, 30455 30450 379E61CC126CA5C400B63E8D /* BaseCheckableInputType.h in Headers */, 30456 F5E0C65C1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h in Headers */,30457 30451 C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */, 30458 30452 F59C96001255B23F000623C0 /* BaseDateAndTimeInputType.h in Headers */, -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp
r266396 r267003 35 35 #if ENABLE(DATE_AND_TIME_INPUT_TYPES) 36 36 37 #include "BaseClickableWithKeyInputType.h" 38 #include "Chrome.h" 37 39 #include "DateComponents.h" 40 #include "DateTimeChooserParameters.h" 38 41 #include "Decimal.h" 42 #include "FocusController.h" 43 #include "HTMLDivElement.h" 39 44 #include "HTMLInputElement.h" 40 45 #include "HTMLNames.h" 41 46 #include "KeyboardEvent.h" 47 #include "Page.h" 42 48 #include "PlatformLocale.h" 49 #include "Settings.h" 50 #include "ShadowRoot.h" 51 #include "StepRange.h" 52 #include "Text.h" 53 #include "UserGestureIndicator.h" 43 54 #include <limits> 44 55 #include <wtf/DateMath.h> … … 53 64 static const int msecPerSecond = 1000; 54 65 66 void BaseDateAndTimeInputType::DateTimeFormatValidator::visitField(DateTimeFormat::FieldType fieldType, int) 67 { 68 switch (fieldType) { 69 case DateTimeFormat::FieldTypeYear: 70 m_results.add(DateTimeFormatValidationResults::HasYear); 71 break; 72 73 case DateTimeFormat::FieldTypeMonth: 74 case DateTimeFormat::FieldTypeMonthStandAlone: 75 m_results.add(DateTimeFormatValidationResults::HasMonth); 76 break; 77 78 case DateTimeFormat::FieldTypeWeekOfYear: 79 m_results.add(DateTimeFormatValidationResults::HasWeek); 80 break; 81 82 case DateTimeFormat::FieldTypeDayOfMonth: 83 m_results.add(DateTimeFormatValidationResults::HasDay); 84 break; 85 86 case DateTimeFormat::FieldTypePeriod: 87 m_results.add(DateTimeFormatValidationResults::HasMeridiem); 88 break; 89 90 case DateTimeFormat::FieldTypeHour11: 91 case DateTimeFormat::FieldTypeHour12: 92 m_results.add(DateTimeFormatValidationResults::HasHour); 93 break; 94 95 case DateTimeFormat::FieldTypeHour23: 96 case DateTimeFormat::FieldTypeHour24: 97 m_results.add(DateTimeFormatValidationResults::HasHour); 98 m_results.add(DateTimeFormatValidationResults::HasMeridiem); 99 break; 100 101 case DateTimeFormat::FieldTypeMinute: 102 m_results.add(DateTimeFormatValidationResults::HasMinute); 103 break; 104 105 case DateTimeFormat::FieldTypeSecond: 106 m_results.add(DateTimeFormatValidationResults::HasSecond); 107 break; 108 109 default: 110 break; 111 } 112 } 113 114 bool BaseDateAndTimeInputType::DateTimeFormatValidator::validateFormat(const String& format, const BaseDateAndTimeInputType& inputType) 115 { 116 if (!DateTimeFormat::parse(format, *this)) 117 return false; 118 return inputType.isValidFormat(m_results); 119 } 120 121 BaseDateAndTimeInputType::~BaseDateAndTimeInputType() 122 { 123 closeDateTimeChooser(); 124 } 125 55 126 double BaseDateAndTimeInputType::valueAsDate() const 56 127 { … … 100 171 { 101 172 return true; 102 }103 104 void BaseDateAndTimeInputType::attributeChanged(const QualifiedName& name)105 {106 if (name == maxAttr || name == minAttr) {107 if (auto* element = this->element())108 element->invalidateStyleForSubtree();109 }110 InputType::attributeChanged(name);111 173 } 112 174 … … 191 253 } 192 254 255 bool BaseDateAndTimeInputType::isMouseFocusable() const 256 { 257 ASSERT(element()); 258 return element()->isTextFormControlFocusable(); 259 } 260 261 bool BaseDateAndTimeInputType::shouldHaveSecondField(const DateComponents& date) const 262 { 263 if (date.second()) 264 return true; 265 266 auto stepRange = createStepRange(AnyStepHandling::Default); 267 return !stepRange.minimum().remainder(msecPerMinute).isZero() 268 || !stepRange.step().remainder(msecPerMinute).isZero(); 269 } 270 271 bool BaseDateAndTimeInputType::shouldHaveMillisecondField(const DateComponents& date) const 272 { 273 if (date.millisecond()) 274 return true; 275 276 auto stepRange = createStepRange(AnyStepHandling::Default); 277 return !stepRange.minimum().remainder(msecPerSecond).isZero() 278 || !stepRange.step().remainder(msecPerSecond).isZero(); 279 } 280 281 void BaseDateAndTimeInputType::setValue(const String& value, bool valueChanged, TextFieldEventBehavior eventBehavior) 282 { 283 InputType::setValue(value, valueChanged, eventBehavior); 284 if (valueChanged) 285 updateInnerTextValue(); 286 } 287 288 void BaseDateAndTimeInputType::handleDOMActivateEvent(Event&) 289 { 290 ASSERT(element()); 291 if (element()->isDisabledOrReadOnly() || !element()->renderer() || !UserGestureIndicator::processingUserGesture()) 292 return; 293 294 if (m_dateTimeChooser) 295 return; 296 if (!element()->document().page()) 297 return; 298 299 DateTimeChooserParameters parameters; 300 if (!element()->setupDateTimeChooserParameters(parameters)) 301 return; 302 303 if (auto chrome = this->chrome()) { 304 m_dateTimeChooser = chrome->createDateTimeChooser(*this); 305 if (m_dateTimeChooser) 306 m_dateTimeChooser->showChooser(parameters); 307 } 308 } 309 310 void BaseDateAndTimeInputType::createShadowSubtree() 311 { 312 ASSERT(element()); 313 314 auto& element = *this->element(); 315 auto& document = element.document(); 316 317 if (document.settings().dateTimeInputsEditableComponentsEnabled()) { 318 m_dateTimeEditElement = DateTimeEditElement::create(document, *this); 319 element.userAgentShadowRoot()->appendChild(*m_dateTimeEditElement); 320 } else { 321 static MainThreadNeverDestroyed<const AtomString> valueContainerPseudo("-webkit-date-and-time-value", AtomString::ConstructFromLiteral); 322 auto valueContainer = HTMLDivElement::create(document); 323 valueContainer->setPseudo(valueContainerPseudo); 324 element.userAgentShadowRoot()->appendChild(valueContainer); 325 } 326 updateInnerTextValue(); 327 } 328 329 void BaseDateAndTimeInputType::destroyShadowSubtree() 330 { 331 InputType::destroyShadowSubtree(); 332 m_dateTimeEditElement = nullptr; 333 } 334 335 void BaseDateAndTimeInputType::updateInnerTextValue() 336 { 337 ASSERT(element()); 338 if (!m_dateTimeEditElement) { 339 auto node = element()->userAgentShadowRoot()->firstChild(); 340 if (!is<HTMLElement>(node)) 341 return; 342 auto displayValue = visibleValue(); 343 if (displayValue.isEmpty()) { 344 // Need to put something to keep text baseline. 345 displayValue = " "_s; 346 } 347 downcast<HTMLElement>(*node).setInnerText(displayValue); 348 return; 349 } 350 351 DateTimeEditElement::LayoutParameters layoutParameters(element()->locale()); 352 353 auto date = parseToDateComponents(element()->value()); 354 if (date) 355 setupLayoutParameters(layoutParameters, *date); 356 else { 357 if (auto dateForLayout = setMillisecondToDateComponents(createStepRange(AnyStepHandling::Default).minimum().toDouble())) 358 setupLayoutParameters(layoutParameters, *dateForLayout); 359 else 360 setupLayoutParameters(layoutParameters, DateComponents()); 361 } 362 363 if (!DateTimeFormatValidator().validateFormat(layoutParameters.dateTimeFormat, *this)) 364 layoutParameters.dateTimeFormat = layoutParameters.fallbackDateTimeFormat; 365 366 if (date) 367 m_dateTimeEditElement->setValueAsDate(layoutParameters, *date); 368 else 369 m_dateTimeEditElement->setEmptyValue(layoutParameters); 370 } 371 372 bool BaseDateAndTimeInputType::hasCustomFocusLogic() const 373 { 374 if (m_dateTimeEditElement) 375 return false; 376 return InputType::hasCustomFocusLogic(); 377 } 378 379 void BaseDateAndTimeInputType::attributeChanged(const QualifiedName& name) 380 { 381 if (name == maxAttr || name == minAttr) { 382 if (auto* element = this->element()) 383 element->invalidateStyleForSubtree(); 384 } else if (name == valueAttr) { 385 if (auto* element = this->element()) { 386 if (!element->hasDirtyValue()) 387 updateInnerTextValue(); 388 } 389 } else if (name == stepAttr && m_dateTimeEditElement) 390 updateInnerTextValue(); 391 392 InputType::attributeChanged(name); 393 } 394 395 void BaseDateAndTimeInputType::elementDidBlur() 396 { 397 closeDateTimeChooser(); 398 } 399 400 void BaseDateAndTimeInputType::detach() 401 { 402 closeDateTimeChooser(); 403 } 404 405 bool BaseDateAndTimeInputType::isPresentingAttachedView() const 406 { 407 return !!m_dateTimeChooser; 408 } 409 410 auto BaseDateAndTimeInputType::handleKeydownEvent(KeyboardEvent& event) -> ShouldCallBaseEventHandler 411 { 412 ASSERT(element()); 413 return BaseClickableWithKeyInputType::handleKeydownEvent(*element(), event); 414 } 415 416 void BaseDateAndTimeInputType::handleKeypressEvent(KeyboardEvent& event) 417 { 418 ASSERT(element()); 419 BaseClickableWithKeyInputType::handleKeypressEvent(*element(), event); 420 } 421 422 void BaseDateAndTimeInputType::handleKeyupEvent(KeyboardEvent& event) 423 { 424 BaseClickableWithKeyInputType::handleKeyupEvent(*this, event); 425 } 426 427 void BaseDateAndTimeInputType::handleFocusEvent(Node* oldFocusedNode, FocusDirection direction) 428 { 429 if (!m_dateTimeEditElement) { 430 InputType::handleFocusEvent(oldFocusedNode, direction); 431 return; 432 } 433 434 // If the element contains editable components, the element itself should not 435 // be focused. Instead, one of it's children should receive focus. 436 437 if (direction == FocusDirectionBackward) { 438 // If the element received focus when going backwards, advance the focus one more time 439 // so that this element no longer has focus. In this case, one of the children should 440 // not be focused as the element is losing focus entirely. 441 if (auto* page = element()->document().page()) 442 page->focusController().advanceFocus(direction, 0); 443 } else { 444 // If the element received focus in any other direction, transfer focus to the first focusable child. 445 m_dateTimeEditElement->focusByOwner(); 446 } 447 } 448 449 bool BaseDateAndTimeInputType::accessKeyAction(bool sendMouseEvents) 450 { 451 InputType::accessKeyAction(sendMouseEvents); 452 ASSERT(element()); 453 return BaseClickableWithKeyInputType::accessKeyAction(*element(), sendMouseEvents); 454 } 455 456 void BaseDateAndTimeInputType::didBlurFromControl() 457 { 458 closeDateTimeChooser(); 459 } 460 461 void BaseDateAndTimeInputType::didChangeValueFromControl() 462 { 463 String value = sanitizeValue(m_dateTimeEditElement->value()); 464 InputType::setValue(value, value != element()->value(), DispatchInputAndChangeEvent); 465 466 DateTimeChooserParameters parameters; 467 if (!element()->setupDateTimeChooserParameters(parameters)) 468 return; 469 470 if (m_dateTimeChooser) 471 m_dateTimeChooser->showChooser(parameters); 472 } 473 474 bool BaseDateAndTimeInputType::isEditControlOwnerDisabled() const 475 { 476 ASSERT(element()); 477 return element()->isDisabledFormControl(); 478 } 479 480 bool BaseDateAndTimeInputType::isEditControlOwnerReadOnly() const 481 { 482 ASSERT(element()); 483 return element()->isReadOnly(); 484 } 485 486 AtomString BaseDateAndTimeInputType::localeIdentifier() const 487 { 488 ASSERT(element()); 489 return element()->computeInheritedLanguage(); 490 } 491 492 void BaseDateAndTimeInputType::didChooseValue(StringView value) 493 { 494 ASSERT(element()); 495 element()->setValue(value.toString(), DispatchInputAndChangeEvent); 496 } 497 498 void BaseDateAndTimeInputType::didEndChooser() 499 { 500 m_dateTimeChooser = nullptr; 501 } 502 503 void BaseDateAndTimeInputType::closeDateTimeChooser() 504 { 505 if (m_dateTimeChooser) 506 m_dateTimeChooser->endChooser(); 507 } 508 193 509 } // namespace WebCore 194 510 #endif -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.h
r266779 r267003 34 34 #if ENABLE(DATE_AND_TIME_INPUT_TYPES) 35 35 36 #include "DateTimeChooser.h" 37 #include "DateTimeChooserClient.h" 38 #include "DateTimeEditElement.h" 39 #include "DateTimeFormat.h" 36 40 #include "InputType.h" 41 #include <wtf/OptionSet.h> 37 42 38 43 namespace WebCore { … … 41 46 42 47 // A super class of date, datetime, datetime-local, month, time, and week types. 43 class BaseDateAndTimeInputType : public InputType {48 class BaseDateAndTimeInputType : public InputType, private DateTimeChooserClient, private DateTimeEditElement::EditControlOwner { 44 49 protected: 50 enum class DateTimeFormatValidationResults : uint8_t { 51 HasYear = 1 << 0, 52 HasMonth = 1 << 1, 53 HasWeek = 1 << 2, 54 HasDay = 1 << 3, 55 HasHour = 1 << 4, 56 HasMinute = 1 << 5, 57 HasSecond = 1 << 6, 58 HasMeridiem = 1 << 7, 59 }; 60 45 61 BaseDateAndTimeInputType(HTMLInputElement& element) : InputType(element) { } 62 ~BaseDateAndTimeInputType(); 46 63 47 64 Decimal parseToNumber(const String&, const Decimal&) const override; 48 String sanitizeValue(const String&) const override;49 65 String serialize(const Decimal&) const override; 50 66 String serializeWithComponents(const DateComponents&) const; 51 String visibleValue() const override; 52 void attributeChanged(const QualifiedName&) override; 53 bool isKeyboardFocusable(KeyboardEvent*) const override; 67 68 bool shouldHaveSecondField(const DateComponents&) const; 69 bool shouldHaveMillisecondField(const DateComponents&) const; 70 71 private: 72 class DateTimeFormatValidator final : public DateTimeFormat::TokenHandler { 73 public: 74 DateTimeFormatValidator() { } 75 76 void visitField(DateTimeFormat::FieldType, int); 77 void visitLiteral(const String&) { } 78 79 bool validateFormat(const String& format, const BaseDateAndTimeInputType&); 80 81 private: 82 OptionSet<DateTimeFormatValidationResults> m_results; 83 }; 54 84 55 85 virtual Optional<DateComponents> parseToDateComponents(const StringView&) const = 0; 56 86 virtual Optional<DateComponents> setMillisecondToDateComponents(double) const = 0; 87 virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const = 0; 88 virtual bool isValidFormat(OptionSet<DateTimeFormatValidationResults>) const = 0; 89 virtual String serializeWithMilliseconds(double) const; 57 90 58 private: 91 // InputType functions: 92 String visibleValue() const final; 93 String sanitizeValue(const String&) const final; 94 void setValue(const String&, bool valueChanged, TextFieldEventBehavior) final; 59 95 double valueAsDate() const override; 60 96 ExceptionOr<void> setValueAsDate(double) const override; 61 double valueAsDouble() const override;62 ExceptionOr<void> setValueAsDecimal(const Decimal&, TextFieldEventBehavior) const override;63 bool typeMismatchFor(const String&) const override;64 bool typeMismatch() const override;65 bool valueMissing(const String&) const override;97 double valueAsDouble() const final; 98 ExceptionOr<void> setValueAsDecimal(const Decimal&, TextFieldEventBehavior) const final; 99 bool typeMismatchFor(const String&) const final; 100 bool typeMismatch() const final; 101 bool valueMissing(const String&) const final; 66 102 Decimal defaultValueForStepUp() const override; 67 bool isSteppable() const override; 68 virtual String serializeWithMilliseconds(double) const; 69 String localizeValue(const String&) const override; 70 bool supportsReadOnly() const override; 71 bool shouldRespectListAttribute() override; 103 bool isSteppable() const final; 104 String localizeValue(const String&) const final; 105 bool supportsReadOnly() const final; 106 bool shouldRespectListAttribute() final; 107 bool isKeyboardFocusable(KeyboardEvent*) const final; 108 bool isMouseFocusable() const final; 109 110 void handleDOMActivateEvent(Event&) override; 111 void createShadowSubtree() final; 112 void destroyShadowSubtree() final; 113 void updateInnerTextValue() final; 114 bool hasCustomFocusLogic() const final; 115 void attributeChanged(const QualifiedName&) final; 116 bool isPresentingAttachedView() const final; 117 void elementDidBlur() final; 118 void detach() final; 119 120 ShouldCallBaseEventHandler handleKeydownEvent(KeyboardEvent&) override; 121 void handleKeypressEvent(KeyboardEvent&) override; 122 void handleKeyupEvent(KeyboardEvent&) override; 123 void handleFocusEvent(Node* oldFocusedNode, FocusDirection) final; 124 bool accessKeyAction(bool sendMouseEvents) override; 125 126 // DateTimeEditElement::EditControlOwner functions: 127 void didBlurFromControl() final; 128 void didChangeValueFromControl() final; 129 bool isEditControlOwnerDisabled() const final; 130 bool isEditControlOwnerReadOnly() const final; 131 AtomString localeIdentifier() const final; 132 133 // DateTimeChooserClient functions: 134 void didChooseValue(StringView) final; 135 void didEndChooser() final; 136 137 void closeDateTimeChooser(); 138 139 std::unique_ptr<DateTimeChooser> m_dateTimeChooser; 140 RefPtr<DateTimeEditElement> m_dateTimeEditElement; 72 141 }; 73 142 -
trunk/Source/WebCore/html/DateInputType.cpp
r266779 r267003 51 51 52 52 DateInputType::DateInputType(HTMLInputElement& element) 53 : Base ChooserOnlyDateAndTimeInputType(element)53 : BaseDateAndTimeInputType(element) 54 54 { 55 55 } -
trunk/Source/WebCore/html/DateInputType.h
r266779 r267003 33 33 #if ENABLE(INPUT_TYPE_DATE) 34 34 35 #include "Base ChooserOnlyDateAndTimeInputType.h"35 #include "BaseDateAndTimeInputType.h" 36 36 37 37 namespace WebCore { 38 38 39 class DateInputType final : public Base ChooserOnlyDateAndTimeInputType {39 class DateInputType final : public BaseDateAndTimeInputType { 40 40 public: 41 41 explicit DateInputType(HTMLInputElement&); -
trunk/Source/WebCore/html/DateTimeLocalInputType.cpp
r266830 r267003 35 35 36 36 #include "DateComponents.h" 37 #include "DateTimeFieldsState.h" 37 38 #include "Decimal.h" 38 39 #include "HTMLInputElement.h" 39 40 #include "HTMLNames.h" 40 41 #include "InputTypeNames.h" 42 #include "PlatformLocale.h" 41 43 #include "StepRange.h" 42 44 -
trunk/Source/WebCore/html/DateTimeLocalInputType.h
r266779 r267003 33 33 #if ENABLE(INPUT_TYPE_DATETIMELOCAL) 34 34 35 #include "Base ChooserOnlyDateAndTimeInputType.h"35 #include "BaseDateAndTimeInputType.h" 36 36 37 37 namespace WebCore { 38 38 39 class DateTimeLocalInputType final : public Base ChooserOnlyDateAndTimeInputType {39 class DateTimeLocalInputType final : public BaseDateAndTimeInputType { 40 40 public: 41 explicit DateTimeLocalInputType(HTMLInputElement& element) : BaseChooserOnlyDateAndTimeInputType(element) { } 41 explicit DateTimeLocalInputType(HTMLInputElement& element) 42 : BaseDateAndTimeInputType(element) 43 { 44 } 42 45 43 46 private: -
trunk/Source/WebCore/html/MonthInputType.h
r266779 r267003 33 33 #if ENABLE(INPUT_TYPE_MONTH) 34 34 35 #include "Base ChooserOnlyDateAndTimeInputType.h"35 #include "BaseDateAndTimeInputType.h" 36 36 37 37 namespace WebCore { 38 38 39 class MonthInputType final : public Base ChooserOnlyDateAndTimeInputType {39 class MonthInputType final : public BaseDateAndTimeInputType { 40 40 public: 41 explicit MonthInputType(HTMLInputElement& element) : BaseChooserOnlyDateAndTimeInputType(element) { } 41 explicit MonthInputType(HTMLInputElement& element) 42 : BaseDateAndTimeInputType(element) 43 { 44 } 42 45 43 46 private: -
trunk/Source/WebCore/html/TimeInputType.cpp
r266830 r267003 54 54 55 55 TimeInputType::TimeInputType(HTMLInputElement& element) 56 : Base ChooserOnlyDateAndTimeInputType(element)56 : BaseDateAndTimeInputType(element) 57 57 { 58 58 } -
trunk/Source/WebCore/html/TimeInputType.h
r266779 r267003 33 33 #if ENABLE(INPUT_TYPE_TIME) 34 34 35 #include "Base ChooserOnlyDateAndTimeInputType.h"35 #include "BaseDateAndTimeInputType.h" 36 36 37 37 namespace WebCore { 38 38 39 class TimeInputType final : public Base ChooserOnlyDateAndTimeInputType {39 class TimeInputType final : public BaseDateAndTimeInputType { 40 40 public: 41 41 explicit TimeInputType(HTMLInputElement&); -
trunk/Source/WebCore/html/WeekInputType.h
r266779 r267003 33 33 #if ENABLE(INPUT_TYPE_WEEK) 34 34 35 #include "Base ChooserOnlyDateAndTimeInputType.h"35 #include "BaseDateAndTimeInputType.h" 36 36 37 37 namespace WebCore { 38 38 39 class WeekInputType final : public Base ChooserOnlyDateAndTimeInputType {39 class WeekInputType final : public BaseDateAndTimeInputType { 40 40 public: 41 explicit WeekInputType(HTMLInputElement& element) : BaseChooserOnlyDateAndTimeInputType(element) { } 41 explicit WeekInputType(HTMLInputElement& element) 42 : BaseDateAndTimeInputType(element) 43 { 44 } 42 45 43 46 private:
Note: See TracChangeset
for help on using the changeset viewer.