Diff
Modified: trunk/Source/WebCore/ChangeLog (232334 => 232335)
--- trunk/Source/WebCore/ChangeLog 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/ChangeLog 2018-05-31 04:22:59 UTC (rev 232335)
@@ -1,3 +1,122 @@
+2018-05-28 Darin Adler <[email protected]>
+
+ Straighten out HTMLInputElement attribute handling
+ https://bugs.webkit.org/show_bug.cgi?id=186043
+
+ Reviewed by Daniel Bates.
+
+ * 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/BaseChooserOnlyDateAndTimeInputType.cpp:
+ (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree): Call
+ updateInnerTextValue by its new name.
+ (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue): Renamed
+ from updateAppearance.
+ (WebCore::BaseChooserOnlyDateAndTimeInputType::setValue): Call
+ updateInnerTextValue by its new name.
+ (WebCore::BaseChooserOnlyDateAndTimeInputType::attributeChanged): Override this
+ instead of valueAttributeChanged.
+ * html/BaseChooserOnlyDateAndTimeInputType.h: Tighten up inheritance a bit.
+ Also use final a bit more and update 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 may have
+ fixed a bug: With some work we could probably 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::valueAttributeChanged): 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-30 Nan Wang <[email protected]>
AX: VoiceOver on macOS does not announce fieldset description from aria-describedby when focussing inputs
Modified: trunk/Source/WebCore/dom/RadioButtonGroups.cpp (232334 => 232335)
--- trunk/Source/WebCore/dom/RadioButtonGroups.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/dom/RadioButtonGroups.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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 @@
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 @@
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 @@
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
Modified: trunk/Source/WebCore/dom/RadioButtonGroups.h (232334 => 232335)
--- trunk/Source/WebCore/dom/RadioButtonGroups.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/dom/RadioButtonGroups.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
~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;
Modified: trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 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
@@ -64,10 +65,10 @@
auto valueContainer = HTMLDivElement::create(element().document());
valueContainer->setPseudo(valueContainerPseudo);
element().userAgentShadowRoot()->appendChild(valueContainer);
- updateAppearance();
+ updateInnerTextValue();
}
-void BaseChooserOnlyDateAndTimeInputType::updateAppearance()
+void BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue()
{
RefPtr<Node> node = element().userAgentShadowRoot()->firstChild();
if (!is<HTMLElement>(node))
@@ -84,7 +85,7 @@
{
BaseDateAndTimeInputType::setValue(value, valueChanged, eventBehavior);
if (valueChanged)
- updateAppearance();
+ updateInnerTextValue();
}
void BaseChooserOnlyDateAndTimeInputType::detach()
@@ -134,11 +135,15 @@
return element().isTextFormControlFocusable();
}
-void BaseChooserOnlyDateAndTimeInputType::valueAttributeChanged()
+void BaseChooserOnlyDateAndTimeInputType::attributeChanged(const QualifiedName& name)
{
- if (!element().hasDirtyValue())
- updateAppearance();
+ if (name == valueAttr) {
+ if (!element().hasDirtyValue())
+ updateInnerTextValue();
+ }
+ BaseDateAndTimeInputType::attributeChanged(name);
}
}
+
#endif
Modified: trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 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
@@ -34,13 +35,13 @@
namespace WebCore {
-class BaseChooserOnlyDateAndTimeInputType : public BaseDateAndTimeInputType, public DateTimeChooserClient {
+class BaseChooserOnlyDateAndTimeInputType : protected BaseDateAndTimeInputType, private DateTimeChooserClient {
protected:
explicit BaseChooserOnlyDateAndTimeInputType(HTMLInputElement& element) : BaseDateAndTimeInputType(element) { }
- virtual ~BaseChooserOnlyDateAndTimeInputType();
+ ~BaseChooserOnlyDateAndTimeInputType();
private:
- void updateAppearance();
+ void updateInnerTextValue();
void closeDateTimeChooser();
// InputType functions:
@@ -53,11 +54,11 @@
void handleKeyupEvent(KeyboardEvent&) override;
void accessKeyAction(bool sendMouseEvents) override;
bool isMouseFocusable() const override;
- void valueAttributeChanged() override;
+ void attributeChanged(const QualifiedName&) override;
// DateTimeChooserClient functions:
- void didChooseValue(const String&) override;
- void didEndChooser() override;
+ void didChooseValue(const String&) final;
+ void didEndChooser() final;
RefPtr<DateTimeChooser> m_dateTimeChooser;
};
Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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
Modified: trunk/Source/WebCore/html/BaseDateAndTimeInputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/BaseDateAndTimeInputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/BaseDateAndTimeInputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -67,7 +67,7 @@
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;
Modified: trunk/Source/WebCore/html/FileInputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/FileInputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/FileInputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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 @@
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)
Modified: trunk/Source/WebCore/html/FileInputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/FileInputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/FileInputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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;
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll ([email protected])
* (C) 1999 Antti Koivisto ([email protected])
* (C) 2001 Dirk Mueller ([email protected])
- * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved.
* (C) 2006 Alexey Proskuryakov ([email protected])
*
* This library is free software; you can redistribute it and/or
@@ -159,12 +159,12 @@
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 @@
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
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (232334 => 232335)
--- trunk/Source/WebCore/html/HTMLFormControlElement.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll ([email protected])
* (C) 1999 Antti Koivisto ([email protected])
* (C) 2000 Dirk Mueller ([email protected])
- * 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 @@
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;
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -728,7 +728,6 @@
setFormControlValueMatchesRenderer(false);
updateValidity();
m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress;
- m_inputType->valueAttributeChanged();
} else if (name == checkedAttr) {
if (m_inputType->isCheckable())
invalidateStyleForSubtree();
@@ -750,42 +749,12 @@
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();
+ else if (name == maxAttr || name == minAttr || name == multipleAttr || name == patternAttr || name == precisionAttr || name == stepAttr)
updateValidity();
- } else if (name == maxAttr) {
- m_inputType->minOrMaxAttributeChanged();
- updateValidity();
- } else if (name == multipleAttr) {
- m_inputType->multipleAttributeChanged();
- updateValidity();
- } else if (name == stepAttr) {
- m_inputType->stepAttributeChanged();
- 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();
@@ -801,6 +770,18 @@
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);
@@ -1596,12 +1577,12 @@
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
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (232334 => 232335)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll ([email protected])
* (C) 1999 Antti Koivisto ([email protected])
* (C) 2000 Dirk Mueller ([email protected])
- * 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 @@
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();
Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll ([email protected])
* (C) 1999 Antti Koivisto ([email protected])
* (C) 2001 Dirk Mueller ([email protected])
- * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2018 Apple Inc. All rights reserved.
* (C) 2006 Alexey Proskuryakov ([email protected])
*
* This library is free software; you can redistribute it and/or
@@ -508,9 +508,9 @@
updateInnerTextElementEditability();
}
-void HTMLTextFormControlElement::readOnlyAttributeChanged()
+void HTMLTextFormControlElement::readOnlyStateChanged()
{
- HTMLFormControlElementWithState::disabledAttributeChanged();
+ HTMLFormControlElementWithState::readOnlyStateChanged();
updateInnerTextElementEditability();
}
Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.h (232334 => 232335)
--- trunk/Source/WebCore/html/HTMLTextFormControlElement.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll ([email protected])
* (C) 1999 Antti Koivisto ([email protected])
* (C) 2000 Dirk Mueller ([email protected])
- * 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 @@
void parseAttribute(const QualifiedName&, const AtomicString&) override;
void disabledStateChanged() override;
- void readOnlyAttributeChanged() override;
+ void readOnlyStateChanged() override;
virtual bool isInnerTextElementEditable() const;
void updateInnerTextElementEditability();
Modified: trunk/Source/WebCore/html/ImageInputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/ImageInputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/ImageInputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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,24 +117,20 @@
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();
+ 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::srcAttributeChanged()
-{
- if (!element().renderer())
- return;
- element().ensureImageLoader().updateFromElementIgnoringPreviousError();
-}
-
void ImageInputType::attach()
{
BaseButtonInputType::attach();
Modified: trunk/Source/WebCore/html/ImageInputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/ImageInputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/ImageInputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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().
};
Modified: trunk/Source/WebCore/html/InputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/InputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/InputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -595,31 +595,11 @@
{
}
-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::attributeChanged(const QualifiedName&)
-{
-}
-
-void InputType::multipleAttributeChanged()
-{
-}
-
-void InputType::disabledAttributeChanged()
-{
-}
-
-void InputType::readonlyAttributeChanged()
-{
-}
-
-void InputType::requiredAttributeChanged()
-{
-}
-
void InputType::capsLockStateMayHaveChanged()
{
}
@@ -936,10 +896,6 @@
}
#endif
-void InputType::valueAttributeChanged()
-{
-}
-
String InputType::defaultToolTip() const
{
return String();
Modified: trunk/Source/WebCore/html/InputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/InputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/InputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -234,11 +234,6 @@
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,15 +252,13 @@
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;
- virtual void valueAttributeChanged();
virtual bool matchesIndeterminatePseudoClass() const;
virtual bool shouldAppearIndeterminate() const;
virtual bool supportsSelectionAPI() const;
Modified: trunk/Source/WebCore/html/NumberInputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/NumberInputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/NumberInputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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();
+ }
+ TextFieldInputType::attributeChanged(name);
}
-void NumberInputType::stepAttributeChanged()
-{
- InputType::stepAttributeChanged();
-
- if (element().renderer())
- element().renderer()->setNeedsLayoutAndPrefWidthsRecalc();
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/html/NumberInputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/NumberInputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/NumberInputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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
Modified: trunk/Source/WebCore/html/RangeInputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/RangeInputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/RangeInputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
#endif
#endif // ENABLE(TOUCH_EVENTS)
-void RangeInputType::disabledAttributeChanged()
+void RangeInputType::disabledStateChanged()
{
- typedSliderThumbElement().disabledAttributeChanged();
+ typedSliderThumbElement().hostDisabledStateChanged();
}
void RangeInputType::handleKeydownEvent(KeyboardEvent& event)
@@ -317,15 +317,18 @@
element().dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
-void RangeInputType::minOrMaxAttributeChanged()
+void RangeInputType::attributeChanged(const QualifiedName& name)
{
- InputType::minOrMaxAttributeChanged();
+ // 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());
- // Sanitize the value.
- if (element().hasDirtyValue())
- element().setValue(element().value());
-
- typedSliderThumbElement().setPositionFromValue();
+ typedSliderThumbElement().setPositionFromValue();
+ }
+ InputType::attributeChanged(name);
}
void RangeInputType::setValue(const String& value, bool valueChanged, TextFieldEventBehavior eventBehavior)
Modified: trunk/Source/WebCore/html/RangeInputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/RangeInputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/RangeInputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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 @@
void handleTouchEvent(TouchEvent&) final;
#endif
- void disabledAttributeChanged() final;
+ void disabledStateChanged() final;
#if ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS) && ENABLE(TOUCH_SLIDER)
bool hasTouchEventHandler() const final;
Modified: trunk/Source/WebCore/html/SearchInputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/SearchInputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/SearchInputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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 @@
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)
Modified: trunk/Source/WebCore/html/SearchInputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/SearchInputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/SearchInputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 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;
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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 @@
updateAutoFillButton();
}
-void TextFieldInputType::readonlyAttributeChanged()
+void TextFieldInputType::readOnlyStateChanged()
{
if (m_innerSpinButton)
m_innerSpinButton->releaseCapture();
Modified: trunk/Source/WebCore/html/TextFieldInputType.h (232334 => 232335)
--- trunk/Source/WebCore/html/TextFieldInputType.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/TextFieldInputType.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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;
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (232334 => 232335)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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 @@
#endif
#if !PLATFORM(IOS)
+
bool SliderThumbElement::willRespondToMouseMoveEvents()
{
const auto input = hostInput();
@@ -401,6 +397,7 @@
return HTMLDivElement::willRespondToMouseClickEvents();
}
+
#endif // !PLATFORM(IOS)
void SliderThumbElement::willDetachRenderers()
@@ -415,6 +412,7 @@
}
#if ENABLE(IOS_TOUCH_EVENTS)
+
unsigned SliderThumbElement::exclusiveTouchIdentifier() const
{
return m_exclusiveTouchIdentifier;
@@ -569,9 +567,10 @@
document().removeTouchEventHandler(*this);
m_isRegisteredAsTouchEventListener = false;
}
+
#endif // ENABLE(IOS_TOUCH_EVENTS)
-void SliderThumbElement::disabledAttributeChanged()
+void SliderThumbElement::hostDisabledStateChanged()
{
if (isDisabledFormControl())
stopDragging();
Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.h (232334 => 232335)
--- trunk/Source/WebCore/html/shadow/SliderThumbElement.h 2018-05-31 03:57:59 UTC (rev 232334)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.h 2018-05-31 04:22:59 UTC (rev 232335)
@@ -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 @@
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&) override;
- bool isDisabledFormControl() const override;
- bool matchesReadWritePseudoClass() const override;
- RefPtr<Element> focusDelegate() override;
+ Ref<Element> cloneElementWithoutAttributesAndChildren(Document&) final;
+ bool isDisabledFormControl() const final;
+ bool matchesReadWritePseudoClass() const final;
+ RefPtr<Element> focusDelegate() final;
+
#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 @@
#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 @@
void updateAppearance(const RenderStyle* parentStyle);
private:
- bool isSliderThumb() const override;
+ bool isSliderThumb() const final;
};
// --------------------------------
@@ -135,10 +135,10 @@
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;
};