WebKit Bugzilla
Attachment 341471 Details for
Bug 186043
: Straighten out HTMLInputElement attribute handling
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186043-20180528223551.patch (text/plain), 50.77 KB, created by
Darin Adler
on 2018-05-28 22:35:52 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-05-28 22:35:52 PDT
Size:
50.77 KB
patch
obsolete
>Subversion Revision: 232227 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6b088b9d834e3e0565973ecc1141071d89e052d3..910b1193523f4bbbf76149428c0f9d18a9cac280 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,109 @@ >+2018-05-28 Darin Adler <darin@apple.com> >+ >+ Straighten out HTMLInputElement attribute handling >+ https://bugs.webkit.org/show_bug.cgi?id=186043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * dom/RadioButtonGroups.cpp: >+ (WebCore::RadioButtonGroup::requiredStateChanged): Renamed from requiredAttributeChanged, >+ and changed to take a reference. >+ (WebCore::RadioButtonGroups::requiredStateChanged): Ditto. >+ * dom/RadioButtonGroups.h: Updated for changes above. >+ >+ * html/BaseDateAndTimeInputType.cpp: >+ (WebCore::BaseDateAndTimeInputType::attributeChanged): Replaced >+ minOrMaxAttributeChanged with this override, checking for the attribute names. >+ * html/BaseDateAndTimeInputType.h: Updated for changes above. >+ >+ * html/FileInputType.cpp: >+ (WebCore::FileInputType::disabledStateChanged): Renamed from disabledAttributeChanged. >+ (WebCore::FileInputType::attributeChanged): Replaced >+ multipleAttributeChanged with this override, checking for the attribute names. >+ * html/FileInputType.h: Updated for changes above. >+ >+ * html/HTMLFormControlElement.cpp: >+ (WebCore::HTMLFormControlElement::parseAttribute): Updated function names to say >+ "state changed" rather than "attribute changed" if they are called only when the >+ computed value is changed, not the raw attribute value. >+ (WebCore::HTMLFormControlElement::readOnlyStateChanged): Updated name. >+ (WebCore::HTMLFormControlElement::requiredStateChanged): Ditto. >+ * html/HTMLFormControlElement.h: Updated for changes above. >+ >+ * html/HTMLInputElement.cpp: >+ (WebCore::HTMLInputElement::parseAttribute): Removed the code to call lots of specific >+ attribute changed functions that have now been deleted. Also removed empty code for a >+ couple of attributes. >+ (WebCore::HTMLInputElement::disabledStateChanged): Added. Forward call to input type. >+ (WebCore::HTMLInputElement::readOnlyStateChanged): Ditto. >+ (WebCore::HTMLInputElement::requiredStateChanged): Renamed from requiredAttributeChanged. >+ * html/HTMLInputElement.h: Updated for changes above. >+ >+ * html/HTMLTextFormControlElement.cpp: >+ (WebCore::HTMLTextFormControlElement::readOnlyStateChanged): Renamed from >+ readOnlyAttributeChanged. Also fixed incorrect call to base class. This probably >+ fixed a bug: With some work could create a test case to demonstrate that. >+ * html/HTMLTextFormControlElement.h: Updated for changes above. >+ >+ * html/ImageInputType.cpp: >+ (WebCore::ImageInputType::attributeChanged): Replaced >+ altAttributeChanged and srcAttributeChanged with this override, checking for the >+ attribute names. >+ * html/ImageInputType.h: Updated for changes above. >+ >+ * html/InputType.cpp: >+ (WebCore::InputType::altAttributeChanged): Deleted. >+ (WebCore::InputType::srcAttributeChanged): Deleted. >+ (WebCore::InputType::maxResultsAttributeChanged): Deleted. >+ (WebCore::InputType::minOrMaxAttributeChanged): Deleted. >+ (WebCore::InputType::stepAttributeChanged): Deleted. >+ (WebCore::InputType::attributeChanged): Moved to header as an inline so derived >+ classes can call through to the base class with the empty function inlined. >+ (WebCore::InputType::multipleAttributeChanged): Deleted. >+ (WebCore::InputType::disabledAttributeChanged): Moved to header as an inline. >+ (WebCore::InputType::readonlyAttributeChanged): Ditto. >+ (WebCore::InputType::requiredAttributeChanged): Ditto. >+ * html/InputType.h: Updated for changes above. >+ >+ * html/NumberInputType.cpp: >+ (WebCore::NumberInputType::attributeChanged): Replaced >+ minOrMaxAttributeChanged and stepAttributeChanged with this override, checking >+ for the attribute names. >+ * html/NumberInputType.h: Updated for changes above. >+ >+ * html/RangeInputType.cpp: >+ (WebCore::RangeInputType::disabledStateChanged): Renamed from >+ disabledAttributeChanged. >+ (WebCore::RangeInputType::attributeChanged): Replaced >+ minOrMaxAttributeChanged with this override, checking for the attribute names. >+ * html/RangeInputType.h: Updated for changes above. >+ >+ * html/SearchInputType.cpp: >+ (WebCore::SearchInputType::SearchInputType): Removed unneeded initialization of >+ RefPtr data members to nullptr. >+ (WebCore::updateResultButtonPseudoType): Removed unneeded if statement; the two >+ cases above cover 0, and less than 0, so there is no need to check for greater >+ than 0 for the third case. >+ (WebCore::SearchInputType::attributeChanged): Replaced >+ maxResultsAttributeChanged with this override, checking for the attribute name. >+ * html/SearchInputType.h: Updated for changes above and marked more >+ member functions final. >+ >+ * html/TextFieldInputType.cpp: >+ (WebCore::TextFieldInputType::attributeChanged): Added a call through to the >+ base class to match the style of other overrides of this function. >+ (WebCore::TextFieldInputType::disabledStateChanged): Renamed from disabledAttributeChanged. >+ (WebCore::TextFieldInputType::readOnlyStateChanged): Renamed from readonlyAttributeChanged. >+ * html/TextFieldInputType.h: Updated for changes above. Also made attributeChanged no >+ longer be marked final since derived classes now override it. >+ >+ * html/shadow/SliderThumbElement.cpp: >+ (WebCore::SliderThumbElement::SliderThumbElement): Moved some data member initialization >+ from this constructor to the class definition. >+ (WebCore::SliderThumbElement::hostDisabledStateChanged): Renamed from disabledAttributeChanged. >+ * html/shadow/SliderThumbElement.h: Updated for changes above and marked more >+ member functions final. >+ > 2018-05-26 Zalan Bujtas <zalan@apple.com> > > [LFC] Implement margin computation >diff --git a/Source/WebCore/dom/RadioButtonGroups.cpp b/Source/WebCore/dom/RadioButtonGroups.cpp >index 778ab1a651c0cf305fe2c6ed95cb747bce604b58..b807befad303f6cf4c10c266f9658565a080f8bc 100644 >--- a/Source/WebCore/dom/RadioButtonGroups.cpp >+++ b/Source/WebCore/dom/RadioButtonGroups.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007, 2008, 2009, 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2007-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -30,13 +30,12 @@ namespace WebCore { > class RadioButtonGroup { > WTF_MAKE_FAST_ALLOCATED; > public: >- RadioButtonGroup(); > bool isEmpty() const { return m_members.isEmpty(); } > bool isRequired() const { return m_requiredCount; } > HTMLInputElement* checkedButton() const { return m_checkedButton; } > void add(HTMLInputElement*); > void updateCheckedState(HTMLInputElement*); >- void requiredAttributeChanged(HTMLInputElement*); >+ void requiredStateChanged(HTMLInputElement&); > void remove(HTMLInputElement*); > bool contains(HTMLInputElement*) const; > Vector<HTMLInputElement*> members() const; >@@ -49,16 +48,10 @@ private: > void setCheckedButton(HTMLInputElement*); > > HashSet<HTMLInputElement*> m_members; >- HTMLInputElement* m_checkedButton; >- size_t m_requiredCount; >+ HTMLInputElement* m_checkedButton { nullptr }; >+ size_t m_requiredCount { 0 }; > }; > >-RadioButtonGroup::RadioButtonGroup() >- : m_checkedButton(nullptr) >- , m_requiredCount(0) >-{ >-} >- > inline bool RadioButtonGroup::isValid() const > { > return !isRequired() || m_checkedButton; >@@ -123,12 +116,12 @@ void RadioButtonGroup::updateCheckedState(HTMLInputElement* button) > updateValidityForAllButtons(); > } > >-void RadioButtonGroup::requiredAttributeChanged(HTMLInputElement* button) >+void RadioButtonGroup::requiredStateChanged(HTMLInputElement& button) > { >- ASSERT(button->isRadioButton()); >- ASSERT(m_members.contains(button)); >+ ASSERT(button.isRadioButton()); >+ ASSERT(m_members.contains(&button)); > bool wasValid = isValid(); >- if (button->isRequired()) >+ if (button.isRequired()) > ++m_requiredCount; > else { > ASSERT(m_requiredCount); >@@ -248,17 +241,17 @@ void RadioButtonGroups::updateCheckedState(HTMLInputElement* element) > group->updateCheckedState(element); > } > >-void RadioButtonGroups::requiredAttributeChanged(HTMLInputElement* element) >+void RadioButtonGroups::requiredStateChanged(HTMLInputElement& element) > { >- ASSERT(element->isRadioButton()); >- if (element->name().isEmpty()) >+ ASSERT(element.isRadioButton()); >+ if (element.name().isEmpty()) > return; > ASSERT(m_nameToGroupMap); > if (!m_nameToGroupMap) > return; >- RadioButtonGroup* group = m_nameToGroupMap->get(element->name().impl()); >+ auto* group = m_nameToGroupMap->get(element.name().impl()); > ASSERT(group); >- group->requiredAttributeChanged(element); >+ group->requiredStateChanged(element); > } > > HTMLInputElement* RadioButtonGroups::checkedButtonForGroup(const AtomicString& name) const >diff --git a/Source/WebCore/dom/RadioButtonGroups.h b/Source/WebCore/dom/RadioButtonGroups.h >index 1e5a58d57da7685e1c018fd96afaf207ef01336a..de8a208c5a5970bc084c5a585763752a29819a14 100644 >--- a/Source/WebCore/dom/RadioButtonGroups.h >+++ b/Source/WebCore/dom/RadioButtonGroups.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007, 2008, 2009, 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2007-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -36,7 +36,7 @@ public: > ~RadioButtonGroups(); > void addButton(HTMLInputElement*); > void updateCheckedState(HTMLInputElement*); >- void requiredAttributeChanged(HTMLInputElement*); >+ void requiredStateChanged(HTMLInputElement&); > void removeButton(HTMLInputElement*); > HTMLInputElement* checkedButtonForGroup(const AtomicString& groupName) const; > bool hasCheckedButton(const HTMLInputElement*) const; >diff --git a/Source/WebCore/html/BaseDateAndTimeInputType.cpp b/Source/WebCore/html/BaseDateAndTimeInputType.cpp >index 37fc2fef0a122074bc8f355d9539290a8832a5d0..9ec9a0a12bbef81f2cab76405b613b5250c2c5c4 100644 >--- a/Source/WebCore/html/BaseDateAndTimeInputType.cpp >+++ b/Source/WebCore/html/BaseDateAndTimeInputType.cpp >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >- * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -95,9 +95,11 @@ bool BaseDateAndTimeInputType::isSteppable() const > return true; > } > >-void BaseDateAndTimeInputType::minOrMaxAttributeChanged() >+void BaseDateAndTimeInputType::attributeChanged(const QualifiedName& name) > { >- element().invalidateStyleForSubtree(); >+ if (name == maxAttr || name == minAttr) >+ element().invalidateStyleForSubtree(); >+ InputType::attributeChanged(name); > } > > Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Decimal& defaultValue) const >diff --git a/Source/WebCore/html/BaseDateAndTimeInputType.h b/Source/WebCore/html/BaseDateAndTimeInputType.h >index 834057d4d4c0dfa4dce925a4ab54eb94f0533d08..fd96c07604fd958023e2fd8245b60b94c0538782 100644 >--- a/Source/WebCore/html/BaseDateAndTimeInputType.h >+++ b/Source/WebCore/html/BaseDateAndTimeInputType.h >@@ -67,7 +67,7 @@ private: > bool typeMismatch() const override; > bool valueMissing(const String&) const override; > Decimal defaultValueForStepUp() const override; >- void minOrMaxAttributeChanged() override; >+ void attributeChanged(const QualifiedName&) override; > bool isSteppable() const override; > virtual String serializeWithMilliseconds(double) const; > String localizeValue(const String&) const override; >diff --git a/Source/WebCore/html/FileInputType.cpp b/Source/WebCore/html/FileInputType.cpp >index 3e55a05e8936651320ee9ebfc9c6a959541dd37b..a972461c7dbeb7b961d56db1348828cfdf7993ca 100644 >--- a/Source/WebCore/html/FileInputType.cpp >+++ b/Source/WebCore/html/FileInputType.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2004-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * Copyright (C) 2010 Google Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or >@@ -281,7 +281,7 @@ void FileInputType::createShadowSubtree() > element().userAgentShadowRoot()->appendChild(element().multiple() ? UploadButtonElement::createForMultiple(element().document()): UploadButtonElement::create(element().document())); > } > >-void FileInputType::disabledAttributeChanged() >+void FileInputType::disabledStateChanged() > { > ASSERT(element().shadowRoot()); > >@@ -293,16 +293,16 @@ void FileInputType::disabledAttributeChanged() > button->setBooleanAttribute(disabledAttr, element().isDisabledFormControl()); > } > >-void FileInputType::multipleAttributeChanged() >+void FileInputType::attributeChanged(const QualifiedName& name) > { >- ASSERT(element().shadowRoot()); >- >- auto root = element().userAgentShadowRoot(); >- if (!root) >- return; >- >- if (auto button = makeRefPtr(childrenOfType<UploadButtonElement>(*root).first())) >- button->setValue(element().multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel()); >+ if (name == multipleAttr) { >+ ASSERT(element().shadowRoot()); >+ if (auto root = element().userAgentShadowRoot()) { >+ if (auto button = makeRefPtr(childrenOfType<UploadButtonElement>(*root).first())) >+ button->setValue(element().multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel()); >+ } >+ } >+ BaseClickableWithKeyInputType::attributeChanged(name); > } > > void FileInputType::requestIcon(const Vector<String>& paths) >diff --git a/Source/WebCore/html/FileInputType.h b/Source/WebCore/html/FileInputType.h >index 1abbcedc25d71c73d2944aa0cfc91c7b73963d7b..c582cacf1b2e946706dc9b474ef0ee38c4dc83b6 100644 >--- a/Source/WebCore/html/FileInputType.h >+++ b/Source/WebCore/html/FileInputType.h >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >- * Copyright (C) 2011 Apple Inc. All rights reserved. >+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -76,8 +76,8 @@ private: > Icon* icon() const final; > bool isFileUpload() const final; > void createShadowSubtree() final; >- void disabledAttributeChanged() final; >- void multipleAttributeChanged() final; >+ void disabledStateChanged() final; >+ void attributeChanged(const QualifiedName&) final; > String defaultToolTip() const final; > > void filesChosen(const Vector<FileChooserFileInfo>&, const String& displayString = { }, Icon* = nullptr) final; >diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp >index 9e4c831d28c2eaa463a629be3cd98cb556a6add2..abeb3858e9975718413a4ac95d9769287428baf2 100644 >--- a/Source/WebCore/html/HTMLFormControlElement.cpp >+++ b/Source/WebCore/html/HTMLFormControlElement.cpp >@@ -2,7 +2,7 @@ > * Copyright (C) 1999 Lars Knoll (knoll@kde.org) > * (C) 1999 Antti Koivisto (koivisto@kde.org) > * (C) 2001 Dirk Mueller (mueller@kde.org) >- * Copyright (C) 2004-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * (C) 2006 Alexey Proskuryakov (ap@nypop.com) > * > * This library is free software; you can redistribute it and/or >@@ -159,12 +159,12 @@ void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato > bool wasReadOnly = m_isReadOnly; > m_isReadOnly = !value.isNull(); > if (wasReadOnly != m_isReadOnly) >- readOnlyAttributeChanged(); >+ readOnlyStateChanged(); > } else if (name == requiredAttr) { > bool wasRequired = m_isRequired; > m_isRequired = !value.isNull(); > if (wasRequired != m_isRequired) >- requiredAttributeChanged(); >+ requiredStateChanged(); > } else > HTMLElement::parseAttribute(name, value); > } >@@ -182,13 +182,13 @@ void HTMLFormControlElement::disabledStateChanged() > renderer()->theme().stateChanged(*renderer(), ControlStates::EnabledState); > } > >-void HTMLFormControlElement::readOnlyAttributeChanged() >+void HTMLFormControlElement::readOnlyStateChanged() > { > setNeedsWillValidateCheck(); > invalidateStyleForSubtree(); > } > >-void HTMLFormControlElement::requiredAttributeChanged() >+void HTMLFormControlElement::requiredStateChanged() > { > updateValidity(); > // Style recalculation is needed because style selectors may include >diff --git a/Source/WebCore/html/HTMLFormControlElement.h b/Source/WebCore/html/HTMLFormControlElement.h >index fbf225d47d21202760dc578ba111d0392ac86787..d876573a298b2d6ceb7de9151a81ca2d45c45e6c 100644 >--- a/Source/WebCore/html/HTMLFormControlElement.h >+++ b/Source/WebCore/html/HTMLFormControlElement.h >@@ -2,7 +2,7 @@ > * Copyright (C) 1999 Lars Knoll (knoll@kde.org) > * (C) 1999 Antti Koivisto (koivisto@kde.org) > * (C) 2000 Dirk Mueller (mueller@kde.org) >- * Copyright (C) 2004-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -133,8 +133,8 @@ protected: > void parseAttribute(const QualifiedName&, const AtomicString&) override; > virtual void disabledAttributeChanged(); > virtual void disabledStateChanged(); >- virtual void readOnlyAttributeChanged(); >- virtual void requiredAttributeChanged(); >+ virtual void readOnlyStateChanged(); >+ virtual void requiredStateChanged(); > void didAttachRenderers() override; > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) override; > void didFinishInsertingNode() override; >diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp >index 72c6fc7403e09d192a436f6f6ad50616a4981e79..d22073419b54f4147128a1195812b70ea7983c95 100644 >--- a/Source/WebCore/html/HTMLInputElement.cpp >+++ b/Source/WebCore/html/HTMLInputElement.cpp >@@ -749,42 +749,12 @@ void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicStr > m_size = limitToOnlyHTMLNonNegativeNumbersGreaterThanZero(value, defaultSize); > if (m_size != oldSize && renderer()) > renderer()->setNeedsLayoutAndPrefWidthsRecalc(); >- } else if (name == altAttr) >- m_inputType->altAttributeChanged(); >- else if (name == srcAttr) >- m_inputType->srcAttributeChanged(); >- else if (name == usemapAttr || name == accesskeyAttr) { >- // FIXME: ignore for the moment >- } else if (name == resultsAttr) { >+ } else if (name == resultsAttr) > m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults) : -1; >- m_inputType->maxResultsAttributeChanged(); >- } else if (name == autosaveAttr) { >+ else if (name == autosaveAttr || name == incrementalAttr) > invalidateStyleForSubtree(); >- } else if (name == incrementalAttr) { >- invalidateStyleForSubtree(); >- } else if (name == minAttr) { >- m_inputType->minOrMaxAttributeChanged(); >- updateValidity(); >- } else if (name == maxAttr) { >- m_inputType->minOrMaxAttributeChanged(); >- updateValidity(); >- } else if (name == multipleAttr) { >- m_inputType->multipleAttributeChanged(); >- updateValidity(); >- } else if (name == stepAttr) { >- m_inputType->stepAttributeChanged(); >+ else if (name == maxAttr || name == minAttr || name == multipleAttr || name == patternAttr || name == precisionAttr || name == stepAttr) > updateValidity(); >- } else if (name == patternAttr) { >- updateValidity(); >- } else if (name == precisionAttr) { >- updateValidity(); >- } else if (name == disabledAttr) { >- HTMLTextFormControlElement::parseAttribute(name, value); >- m_inputType->disabledAttributeChanged(); >- } else if (name == readonlyAttr) { >- HTMLTextFormControlElement::parseAttribute(name, value); >- m_inputType->readonlyAttributeChanged(); >- } > #if ENABLE(DATALIST_ELEMENT) > else if (name == listAttr) { > m_hasNonEmptyList = !value.isEmpty(); >@@ -800,6 +770,18 @@ void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicStr > m_inputType->attributeChanged(name); > } > >+void HTMLInputElement::disabledStateChanged() >+{ >+ HTMLTextFormControlElement::disabledStateChanged(); >+ m_inputType->disabledStateChanged(); >+} >+ >+void HTMLInputElement::readOnlyStateChanged() >+{ >+ HTMLTextFormControlElement::readOnlyStateChanged(); >+ m_inputType->readOnlyStateChanged(); >+} >+ > void HTMLInputElement::parserDidSetAttributes() > { > ASSERT(m_parsingInProgress); >@@ -1595,12 +1577,12 @@ bool HTMLInputElement::computeWillValidate() const > return m_inputType->supportsValidation() && HTMLTextFormControlElement::computeWillValidate(); > } > >-void HTMLInputElement::requiredAttributeChanged() >+void HTMLInputElement::requiredStateChanged() > { >- HTMLTextFormControlElement::requiredAttributeChanged(); >- if (RadioButtonGroups* buttons = radioButtonGroups()) >- buttons->requiredAttributeChanged(this); >- m_inputType->requiredAttributeChanged(); >+ HTMLTextFormControlElement::requiredStateChanged(); >+ if (auto* buttons = radioButtonGroups()) >+ buttons->requiredStateChanged(*this); >+ m_inputType->requiredStateChanged(); > } > > Color HTMLInputElement::valueAsColor() const >diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h >index ac1c81c7844cd3c846a6297ce3b628f02ad260c3..058bd66a0009ad983845e8fce3dedb1eb0f03979 100644 >--- a/Source/WebCore/html/HTMLInputElement.h >+++ b/Source/WebCore/html/HTMLInputElement.h >@@ -2,7 +2,7 @@ > * Copyright (C) 1999 Lars Knoll (knoll@kde.org) > * (C) 1999 Antti Koivisto (koivisto@kde.org) > * (C) 2000 Dirk Mueller (mueller@kde.org) >- * Copyright (C) 2004-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * Copyright (C) 2012 Samsung Electronics. All rights reserved. > * > * This library is free software; you can redistribute it and/or >@@ -428,13 +428,15 @@ private: > bool isOptionalFormControl() const final { return !isRequiredFormControl(); } > bool isRequiredFormControl() const final; > bool computeWillValidate() const final; >- void requiredAttributeChanged() final; >+ void requiredStateChanged() final; > > void initializeInputType(); > void updateType(); > void runPostTypeUpdateTasks(); >- >+ > void subtreeHasChanged() final; >+ void disabledStateChanged() final; >+ void readOnlyStateChanged() final; > > #if ENABLE(DATALIST_ELEMENT) > void resetListAttributeTargetObserver(); >diff --git a/Source/WebCore/html/HTMLTextFormControlElement.cpp b/Source/WebCore/html/HTMLTextFormControlElement.cpp >index 983bea0ecb7e242b8f44f3902d6d47d236bffec9..5c9b0497e98f8470e693983921446c9459e1ccd3 100644 >--- a/Source/WebCore/html/HTMLTextFormControlElement.cpp >+++ b/Source/WebCore/html/HTMLTextFormControlElement.cpp >@@ -2,7 +2,7 @@ > * Copyright (C) 1999 Lars Knoll (knoll@kde.org) > * (C) 1999 Antti Koivisto (koivisto@kde.org) > * (C) 2001 Dirk Mueller (mueller@kde.org) >- * Copyright (C) 2004-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * (C) 2006 Alexey Proskuryakov (ap@nypop.com) > * > * This library is free software; you can redistribute it and/or >@@ -508,9 +508,9 @@ void HTMLTextFormControlElement::disabledStateChanged() > updateInnerTextElementEditability(); > } > >-void HTMLTextFormControlElement::readOnlyAttributeChanged() >+void HTMLTextFormControlElement::readOnlyStateChanged() > { >- HTMLFormControlElementWithState::disabledAttributeChanged(); >+ HTMLFormControlElementWithState::readOnlyStateChanged(); > updateInnerTextElementEditability(); > } > >diff --git a/Source/WebCore/html/HTMLTextFormControlElement.h b/Source/WebCore/html/HTMLTextFormControlElement.h >index 7e8303ca7ec85168e07bec8707764387bb3adac8..1c391b3c1486fd6f079d23d7d5ee96b0e4ed1fb0 100644 >--- a/Source/WebCore/html/HTMLTextFormControlElement.h >+++ b/Source/WebCore/html/HTMLTextFormControlElement.h >@@ -2,7 +2,7 @@ > * Copyright (C) 1999 Lars Knoll (knoll@kde.org) > * (C) 1999 Antti Koivisto (koivisto@kde.org) > * (C) 2000 Dirk Mueller (mueller@kde.org) >- * Copyright (C) 2004-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or >@@ -106,7 +106,7 @@ protected: > void parseAttribute(const QualifiedName&, const AtomicString&) override; > > void disabledStateChanged() override; >- void readOnlyAttributeChanged() override; >+ void readOnlyStateChanged() override; > virtual bool isInnerTextElementEditable() const; > void updateInnerTextElementEditability(); > >diff --git a/Source/WebCore/html/ImageInputType.cpp b/Source/WebCore/html/ImageInputType.cpp >index fc4c0dbd2df564b9956f1615e484d67f6f88a3e2..6b5be49f818d2e7cd79f1b39dbc1cf2312e07e48 100644 >--- a/Source/WebCore/html/ImageInputType.cpp >+++ b/Source/WebCore/html/ImageInputType.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2004-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved. > * Copyright (C) 2010 Google Inc. All rights reserved. > * Copyright (C) 2012 Samsung Electronics. All rights reserved. > * >@@ -117,22 +117,18 @@ RenderPtr<RenderElement> ImageInputType::createInputRenderer(RenderStyle&& style > return createRenderer<RenderImage>(element(), WTFMove(style)); > } > >-void ImageInputType::altAttributeChanged() >+void ImageInputType::attributeChanged(const QualifiedName& name) > { >- if (!is<RenderImage>(element().renderer())) >- return; >- >- auto* renderer = downcast<RenderImage>(element().renderer()); >- if (!renderer) >- return; >- renderer->updateAltText(); >-} >- >-void ImageInputType::srcAttributeChanged() >-{ >- if (!element().renderer()) >- return; >- element().ensureImageLoader().updateFromElementIgnoringPreviousError(); >+ if (name == altAttr) { >+ auto* renderer = element().renderer(); >+ if (is<RenderImage>(renderer)) >+ downcast<RenderImage>(*renderer).updateAltText(); >+ } else if (name == srcAttr) { >+ auto& element = this->element(); >+ if (element.renderer()) >+ element.ensureImageLoader().updateFromElementIgnoringPreviousError(); >+ } >+ BaseButtonInputType::attributeChanged(name); > } > > void ImageInputType::attach() >diff --git a/Source/WebCore/html/ImageInputType.h b/Source/WebCore/html/ImageInputType.h >index c7e0e8487f34ba22683998c3b975b5c2ccfa0d12..0e31dcf849dfe63af0339d712f3736e7831bd6a6 100644 >--- a/Source/WebCore/html/ImageInputType.h >+++ b/Source/WebCore/html/ImageInputType.h >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >- * Copyright (C) 2011 Apple Inc. All rights reserved. >+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved. > * Copyright (C) 2012 Samsung Electronics. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without >@@ -42,22 +42,21 @@ public: > explicit ImageInputType(HTMLInputElement&); > > private: >- const AtomicString& formControlType() const override; >- bool isFormDataAppendable() const override; >- bool appendFormData(DOMFormData&, bool) const override; >- bool supportsValidation() const override; >- RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) override; >- void handleDOMActivateEvent(Event&) override; >- void altAttributeChanged() override; >- void srcAttributeChanged() override; >- void attach() override; >- bool shouldRespectAlignAttribute() override; >- bool canBeSuccessfulSubmitButton() override; >- bool isImageButton() const override; >- bool isEnumeratable() override; >- bool shouldRespectHeightAndWidthAttributes() override; >- unsigned height() const override; >- unsigned width() const override; >+ const AtomicString& formControlType() const final; >+ bool isFormDataAppendable() const final; >+ bool appendFormData(DOMFormData&, bool) const final; >+ bool supportsValidation() const final; >+ RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) final; >+ void handleDOMActivateEvent(Event&) final; >+ void attributeChanged(const QualifiedName&) final; >+ void attach() final; >+ bool shouldRespectAlignAttribute() final; >+ bool canBeSuccessfulSubmitButton() final; >+ bool isImageButton() const final; >+ bool isEnumeratable() final; >+ bool shouldRespectHeightAndWidthAttributes() final; >+ unsigned height() const final; >+ unsigned width() const final; > > IntPoint m_clickLocation; // Valid only during HTMLFormElement::prepareForSubmission(). > }; >diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp >index 8bec3a6f400974aadc4beab349be06f8d4cb7a57..4853666f94dcccdd4295dc4c8aeaad2b1e709426 100644 >--- a/Source/WebCore/html/InputType.cpp >+++ b/Source/WebCore/html/InputType.cpp >@@ -595,31 +595,11 @@ void InputType::detach() > { > } > >-void InputType::altAttributeChanged() >-{ >-} >- >-void InputType::srcAttributeChanged() >-{ >-} >- >-void InputType::maxResultsAttributeChanged() >-{ >-} >- > bool InputType::shouldRespectAlignAttribute() > { > return false; > } > >-void InputType::minOrMaxAttributeChanged() >-{ >-} >- >-void InputType::stepAttributeChanged() >-{ >-} >- > bool InputType::canBeSuccessfulSubmitButton() > { > return false; >@@ -896,26 +876,6 @@ void InputType::updatePlaceholderText() > { > } > >-void InputType::attributeChanged(const QualifiedName&) >-{ >-} >- >-void InputType::multipleAttributeChanged() >-{ >-} >- >-void InputType::disabledAttributeChanged() >-{ >-} >- >-void InputType::readonlyAttributeChanged() >-{ >-} >- >-void InputType::requiredAttributeChanged() >-{ >-} >- > void InputType::capsLockStateMayHaveChanged() > { > } >diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h >index d0b86b58a035bbc01546ba3c4712fa40661413b0..f6c9af100accd533569259300f61cf7c269e3848 100644 >--- a/Source/WebCore/html/InputType.h >+++ b/Source/WebCore/html/InputType.h >@@ -234,11 +234,6 @@ public: > virtual void addSearchResult(); > virtual void attach(); > virtual void detach(); >- virtual void minOrMaxAttributeChanged(); >- virtual void stepAttributeChanged(); >- virtual void altAttributeChanged(); >- virtual void srcAttributeChanged(); >- virtual void maxResultsAttributeChanged(); > virtual bool shouldRespectAlignAttribute(); > virtual FileList* files(); > virtual void setFiles(RefPtr<FileList>&&); >@@ -257,11 +252,10 @@ public: > virtual bool supportsReadOnly() const; > virtual void updateInnerTextValue(); > virtual void updatePlaceholderText(); >- virtual void attributeChanged(const QualifiedName&); >- virtual void multipleAttributeChanged(); >- virtual void disabledAttributeChanged(); >- virtual void readonlyAttributeChanged(); >- virtual void requiredAttributeChanged(); >+ virtual void attributeChanged(const QualifiedName&) { } >+ virtual void disabledStateChanged() { } >+ virtual void readOnlyStateChanged() { } >+ virtual void requiredStateChanged() { } > virtual void capsLockStateMayHaveChanged(); > virtual void updateAutoFillButton(); > virtual String defaultToolTip() const; >diff --git a/Source/WebCore/html/NumberInputType.cpp b/Source/WebCore/html/NumberInputType.cpp >index 87ec08b7eb472a5143d4971e962c711c39b4c8f8..7bfce3fe132dbadeef9a68687293582f7e6670ce 100644 >--- a/Source/WebCore/html/NumberInputType.cpp >+++ b/Source/WebCore/html/NumberInputType.cpp >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >- * Copyright (C) 2011, 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -280,21 +280,18 @@ bool NumberInputType::isNumberField() const > return true; > } > >-void NumberInputType::minOrMaxAttributeChanged() >+void NumberInputType::attributeChanged(const QualifiedName& name) > { >- InputType::minOrMaxAttributeChanged(); >- HTMLInputElement& element = this->element(); >- element.invalidateStyleForSubtree(); >- if (RenderObject* renderer = element.renderer()) >+ if (name == maxAttr || name == minAttr) { >+ auto& element = this->element(); >+ element.invalidateStyleForSubtree(); >+ if (auto* renderer = element.renderer()) >+ renderer->setNeedsLayoutAndPrefWidthsRecalc(); >+ } else if (name == stepAttr) { >+ if (auto* renderer = element().renderer()) > renderer->setNeedsLayoutAndPrefWidthsRecalc(); >-} >- >-void NumberInputType::stepAttributeChanged() >-{ >- InputType::stepAttributeChanged(); >- >- if (element().renderer()) >- element().renderer()->setNeedsLayoutAndPrefWidthsRecalc(); >+ } >+ TextFieldInputType::attributeChanged(name); > } > > } // namespace WebCore >diff --git a/Source/WebCore/html/NumberInputType.h b/Source/WebCore/html/NumberInputType.h >index e375c7f5585dd26084456488c9bec73dde401fb7..689f529750718eaa1b9ccf1f991c6fc62d3598ef 100644 >--- a/Source/WebCore/html/NumberInputType.h >+++ b/Source/WebCore/html/NumberInputType.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -61,8 +62,7 @@ private: > String badInputText() const final; > bool supportsPlaceholder() const final; > bool isNumberField() const final; >- void minOrMaxAttributeChanged() final; >- void stepAttributeChanged() final; >+ void attributeChanged(const QualifiedName&) final; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp >index 7c5b8192107c73780fdb297a5e4c47dd642b05c5..cc1444136d485965034542eeff2a038dd0d555fc 100644 >--- a/Source/WebCore/html/RangeInputType.cpp >+++ b/Source/WebCore/html/RangeInputType.cpp >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >- * Copyright (C) 2011 Apple Inc. All rights reserved. >+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -186,9 +186,9 @@ bool RangeInputType::hasTouchEventHandler() const > #endif > #endif // ENABLE(TOUCH_EVENTS) > >-void RangeInputType::disabledAttributeChanged() >+void RangeInputType::disabledStateChanged() > { >- typedSliderThumbElement().disabledAttributeChanged(); >+ typedSliderThumbElement().hostDisabledStateChanged(); > } > > void RangeInputType::handleKeydownEvent(KeyboardEvent& event) >@@ -317,15 +317,18 @@ void RangeInputType::accessKeyAction(bool sendMouseEvents) > element().dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents); > } > >-void RangeInputType::minOrMaxAttributeChanged() >+void RangeInputType::attributeChanged(const QualifiedName& name) > { >- InputType::minOrMaxAttributeChanged(); >- >- // Sanitize the value. >- if (element().hasDirtyValue()) >- element().setValue(element().value()); >- >- typedSliderThumbElement().setPositionFromValue(); >+ // FIXME: Don't we need to do this work for precisionAttr too? >+ if (name == maxAttr || name == minAttr) { >+ // Sanitize the value. >+ auto& element = this->element(); >+ if (element.hasDirtyValue()) >+ element.setValue(element.value()); >+ >+ typedSliderThumbElement().setPositionFromValue(); >+ } >+ InputType::attributeChanged(name); > } > > void RangeInputType::setValue(const String& value, bool valueChanged, TextFieldEventBehavior eventBehavior) >diff --git a/Source/WebCore/html/RangeInputType.h b/Source/WebCore/html/RangeInputType.h >index c839f1356950e9407509b5b0fada4dc83d076cbb..998465fbd3c845a2e6333ee42b020a1c07702ed1 100644 >--- a/Source/WebCore/html/RangeInputType.h >+++ b/Source/WebCore/html/RangeInputType.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -58,7 +59,7 @@ private: > Decimal parseToNumber(const String&, const Decimal&) const final; > String serialize(const Decimal&) const final; > void accessKeyAction(bool sendMouseEvents) final; >- void minOrMaxAttributeChanged() final; >+ void attributeChanged(const QualifiedName&) final; > void setValue(const String&, bool valueChanged, TextFieldEventBehavior) final; > String fallbackValue() const final; > String sanitizeValue(const String& proposedValue) const final; >@@ -81,7 +82,7 @@ private: > void handleTouchEvent(TouchEvent&) final; > #endif > >- void disabledAttributeChanged() final; >+ void disabledStateChanged() final; > > #if ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS) && ENABLE(TOUCH_SLIDER) > bool hasTouchEventHandler() const final; >diff --git a/Source/WebCore/html/SearchInputType.cpp b/Source/WebCore/html/SearchInputType.cpp >index dd22ab01e5237d1b4ad12479964f6efafb74b9e1..c9fd22864eb7097d2b3b269cf48dc7b7846d51c6 100644 >--- a/Source/WebCore/html/SearchInputType.cpp >+++ b/Source/WebCore/html/SearchInputType.cpp >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >- * Copyright (C) 2014 Apple Inc. All rights reserved. >+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -46,14 +46,10 @@ using namespace HTMLNames; > > SearchInputType::SearchInputType(HTMLInputElement& element) > : BaseTextInputType(element) >- , m_resultsButton(nullptr) >- , m_cancelButton(nullptr) > , m_searchEventTimer(*this, &SearchInputType::searchEventTimerFired) > { > } > >-SearchInputType::~SearchInputType() = default; >- > void SearchInputType::addSearchResult() > { > #if !PLATFORM(IOS) >@@ -71,14 +67,17 @@ static void updateResultButtonPseudoType(SearchFieldResultsButtonElement& result > resultButton.setPseudo(AtomicString("-webkit-search-results-decoration", AtomicString::ConstructFromLiteral)); > else if (maxResults < 0) > resultButton.setPseudo(AtomicString("-webkit-search-decoration", AtomicString::ConstructFromLiteral)); >- else if (maxResults > 0) >+ else > resultButton.setPseudo(AtomicString("-webkit-search-results-button", AtomicString::ConstructFromLiteral)); > } > >-void SearchInputType::maxResultsAttributeChanged() >+void SearchInputType::attributeChanged(const QualifiedName& name) > { >- if (m_resultsButton) >- updateResultButtonPseudoType(*m_resultsButton, element().maxResults()); >+ if (name == resultsAttr) { >+ if (m_resultsButton) >+ updateResultButtonPseudoType(*m_resultsButton, element().maxResults()); >+ } >+ BaseTextInputType::attributeChanged(name); > } > > RenderPtr<RenderElement> SearchInputType::createInputRenderer(RenderStyle&& style) >diff --git a/Source/WebCore/html/SearchInputType.h b/Source/WebCore/html/SearchInputType.h >index df30400750802599024bd1095b7133e27f15a23c..7de2851c64f9e2cf3a2da714cc89ca9f79844e97 100644 >--- a/Source/WebCore/html/SearchInputType.h >+++ b/Source/WebCore/html/SearchInputType.h >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >- * Copyright (C) 2014 Apple Inc. All rights reserved. >+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -41,25 +41,24 @@ class SearchFieldResultsButtonElement; > class SearchInputType final : public BaseTextInputType { > public: > explicit SearchInputType(HTMLInputElement&); >- ~SearchInputType() override; > > void stopSearchEventTimer(); > > private: >- void addSearchResult() override; >- void maxResultsAttributeChanged() override; >- RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) override; >- const AtomicString& formControlType() const override; >- bool isSearchField() const override; >- bool needsContainer() const override; >- void createShadowSubtree() override; >- void destroyShadowSubtree() override; >- HTMLElement* resultsButtonElement() const override; >- HTMLElement* cancelButtonElement() const override; >- void handleKeydownEvent(KeyboardEvent&) override; >- void didSetValueByUserEdit() override; >- bool sizeShouldIncludeDecoration(int defaultSize, int& preferredSize) const override; >- float decorationWidth() const override; >+ void addSearchResult() final; >+ void attributeChanged(const QualifiedName&) final; >+ RenderPtr<RenderElement> createInputRenderer(RenderStyle&&) final; >+ const AtomicString& formControlType() const final; >+ bool isSearchField() const final; >+ bool needsContainer() const final; >+ void createShadowSubtree() final; >+ void destroyShadowSubtree() final; >+ HTMLElement* resultsButtonElement() const final; >+ HTMLElement* cancelButtonElement() const final; >+ void handleKeydownEvent(KeyboardEvent&) final; >+ void didSetValueByUserEdit() final; >+ bool sizeShouldIncludeDecoration(int defaultSize, int& preferredSize) const final; >+ float decorationWidth() const final; > > void searchEventTimerFired(); > bool searchEventsShouldBeDispatched() const; >diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp >index d9c492ed13831f8c691451187d6bbe07bdd6a231..1faeb5108e7166567c3d5ce04c7463681976df59 100644 >--- a/Source/WebCore/html/TextFieldInputType.cpp >+++ b/Source/WebCore/html/TextFieldInputType.cpp >@@ -1,6 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >- * Copyright (C) 2011, 2014 Apple Inc. All rights reserved. >+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -348,13 +348,14 @@ void TextFieldInputType::destroyShadowSubtree() > m_container = nullptr; > } > >-void TextFieldInputType::attributeChanged(const QualifiedName& attributeName) >+void TextFieldInputType::attributeChanged(const QualifiedName& name) > { >- if (attributeName == valueAttr || attributeName == placeholderAttr) >+ if (name == valueAttr || name == placeholderAttr) > updateInnerTextValue(); >+ InputType::attributeChanged(name); > } > >-void TextFieldInputType::disabledAttributeChanged() >+void TextFieldInputType::disabledStateChanged() > { > if (m_innerSpinButton) > m_innerSpinButton->releaseCapture(); >@@ -362,7 +363,7 @@ void TextFieldInputType::disabledAttributeChanged() > updateAutoFillButton(); > } > >-void TextFieldInputType::readonlyAttributeChanged() >+void TextFieldInputType::readOnlyStateChanged() > { > if (m_innerSpinButton) > m_innerSpinButton->releaseCapture(); >diff --git a/Source/WebCore/html/TextFieldInputType.h b/Source/WebCore/html/TextFieldInputType.h >index 07b573d7e489cdec9a67a09b57e45b74af5812fa..a8954b5a3110e89ef6bdaed4cc6c9eed02c30634 100644 >--- a/Source/WebCore/html/TextFieldInputType.h >+++ b/Source/WebCore/html/TextFieldInputType.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2010 Google Inc. All rights reserved. >+ * Copyright (C) 2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions are >@@ -55,13 +56,12 @@ protected: > HTMLElement* capsLockIndicatorElement() const final; > HTMLElement* autoFillButtonElement() const final; > >-protected: > virtual bool needsContainer() const; > void createShadowSubtree() override; > void destroyShadowSubtree() override; >- void attributeChanged(const QualifiedName&) final; >- void disabledAttributeChanged() final; >- void readonlyAttributeChanged() final; >+ void attributeChanged(const QualifiedName&) override; >+ void disabledStateChanged() final; >+ void readOnlyStateChanged() final; > bool supportsReadOnly() const final; > void handleFocusEvent(Node* oldFocusedNode, FocusDirection) final; > void handleBlurEvent() final; >diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp >index 6af94581c647831424443119e6ec2d43a1fcc568..b121183ae00b3d72f4c3a68f6ed1ff70e47cfaf8 100644 >--- a/Source/WebCore/html/shadow/SliderThumbElement.cpp >+++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. >+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved. > * Copyright (C) 2010 Google Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without >@@ -207,11 +207,6 @@ void RenderSliderContainer::layout() > > SliderThumbElement::SliderThumbElement(Document& document) > : HTMLDivElement(HTMLNames::divTag, document) >- , m_inDragMode(false) >-#if ENABLE(IOS_TOUCH_EVENTS) >- , m_exclusiveTouchIdentifier(NoIdentifier) >- , m_isRegisteredAsTouchEventListener(false) >-#endif > { > setHasCustomStyleResolveCallbacks(); > } >@@ -384,6 +379,7 @@ void SliderThumbElement::defaultEventHandler(Event& event) > #endif > > #if !PLATFORM(IOS) >+ > bool SliderThumbElement::willRespondToMouseMoveEvents() > { > const auto input = hostInput(); >@@ -401,6 +397,7 @@ bool SliderThumbElement::willRespondToMouseClickEvents() > > return HTMLDivElement::willRespondToMouseClickEvents(); > } >+ > #endif // !PLATFORM(IOS) > > void SliderThumbElement::willDetachRenderers() >@@ -415,6 +412,7 @@ void SliderThumbElement::willDetachRenderers() > } > > #if ENABLE(IOS_TOUCH_EVENTS) >+ > unsigned SliderThumbElement::exclusiveTouchIdentifier() const > { > return m_exclusiveTouchIdentifier; >@@ -569,9 +567,10 @@ void SliderThumbElement::unregisterForTouchEvents() > document().removeTouchEventHandler(*this); > m_isRegisteredAsTouchEventListener = false; > } >+ > #endif // ENABLE(IOS_TOUCH_EVENTS) > >-void SliderThumbElement::disabledAttributeChanged() >+void SliderThumbElement::hostDisabledStateChanged() > { > if (isDisabledFormControl()) > stopDragging(); >diff --git a/Source/WebCore/html/shadow/SliderThumbElement.h b/Source/WebCore/html/shadow/SliderThumbElement.h >index 1e29d354aa3762249e0c62d45866fdab9c3d8295..a418c185e7799082b611eef93db26d48f52b8d63 100644 >--- a/Source/WebCore/html/shadow/SliderThumbElement.h >+++ b/Source/WebCore/html/shadow/SliderThumbElement.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. >+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved. > * Copyright (C) 2010 Google Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without >@@ -38,7 +38,6 @@ > namespace WebCore { > > class HTMLInputElement; >-class FloatPoint; > class TouchEvent; > > class SliderThumbElement final : public HTMLDivElement { >@@ -55,30 +54,31 @@ public: > void handleTouchEvent(TouchEvent&); > #endif > >- void disabledAttributeChanged(); >+ void hostDisabledStateChanged(); > > private: > SliderThumbElement(Document&); > >- RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; >+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; >+ >+ Ref<Element> cloneElementWithoutAttributesAndChildren(Document&) final; >+ bool isDisabledFormControl() const final; >+ bool matchesReadWritePseudoClass() const final; >+ RefPtr<Element> focusDelegate() final; > >- Ref<Element> cloneElementWithoutAttributesAndChildren(Document&) override; >- bool isDisabledFormControl() const override; >- bool matchesReadWritePseudoClass() const override; >- RefPtr<Element> focusDelegate() override; > #if !PLATFORM(IOS) >- void defaultEventHandler(Event&) override; >- bool willRespondToMouseMoveEvents() override; >- bool willRespondToMouseClickEvents() override; >+ void defaultEventHandler(Event&) final; >+ bool willRespondToMouseMoveEvents() final; >+ bool willRespondToMouseClickEvents() final; > #endif > > #if ENABLE(IOS_TOUCH_EVENTS) >- void didAttachRenderers() override; >+ void didAttachRenderers() final; > #endif >- void willDetachRenderers() override; >+ void willDetachRenderers() final; > >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) override; >- const AtomicString& shadowPseudoId() const override; >+ std::optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final; >+ const AtomicString& shadowPseudoId() const final; > > void startDragging(); > void stopDragging(); >@@ -98,14 +98,14 @@ private: > #endif > > AtomicString m_shadowPseudoId; >- bool m_inDragMode; >+ bool m_inDragMode { false }; > > #if ENABLE(IOS_TOUCH_EVENTS) > // FIXME: Currently it is safe to use 0, but this may need to change > // if touch identifiers change in the future and can be 0. > static const unsigned NoIdentifier = 0; >- unsigned m_exclusiveTouchIdentifier; >- bool m_isRegisteredAsTouchEventListener; >+ unsigned m_exclusiveTouchIdentifier { NoIdentifier }; >+ bool m_isRegisteredAsTouchEventListener { false }; > #endif > }; > >@@ -123,7 +123,7 @@ public: > void updateAppearance(const RenderStyle* parentStyle); > > private: >- bool isSliderThumb() const override; >+ bool isSliderThumb() const final; > }; > > // -------------------------------- >@@ -135,10 +135,10 @@ public: > > private: > SliderContainerElement(Document&); >- RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; >- std::optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) override; >- const AtomicString& shadowPseudoId() const override; >- bool isSliderContainerElement() const override { return true; } >+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; >+ std::optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final; >+ const AtomicString& shadowPseudoId() const final; >+ bool isSliderContainerElement() const final { return true; } > > AtomicString m_shadowPseudoId; > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dbates
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186043
: 341471