Fix the iOS build after r232496
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2018 16:16:02 +0000 (16:16 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2018 16:16:02 +0000 (16:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186304

Patch by Antoine Quint <graouts@apple.com> on 2018-06-05
Reviewed by Brent Fulgham.

The changes in r232496 changed the InputType::element() signature from HTMLInputElement&
to HTMLInputElement* and some call sites did not expect that.

* html/BaseChooserOnlyDateAndTimeInputType.cpp:
(WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
(WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree):
(WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue):
(WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue):
(WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent):
(WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent):
(WebCore::BaseChooserOnlyDateAndTimeInputType::accessKeyAction):
(WebCore::BaseChooserOnlyDateAndTimeInputType::isMouseFocusable const):
* html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::setValueAsDate const):
(WebCore::BaseDateAndTimeInputType::valueAsDouble const):
(WebCore::BaseDateAndTimeInputType::setValueAsDecimal const):
(WebCore::BaseDateAndTimeInputType::typeMismatch const):
(WebCore::BaseDateAndTimeInputType::serializeWithComponents const):
(WebCore::BaseDateAndTimeInputType::localizeValue const):
(WebCore::BaseDateAndTimeInputType::visibleValue const):
(WebCore::BaseDateAndTimeInputType::valueMissing const):
(WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const):
* html/DateInputType.cpp:
(WebCore::DateInputType::createStepRange const):
* html/DateTimeLocalInputType.cpp:
(WebCore::DateTimeLocalInputType::createStepRange const):
* html/MonthInputType.cpp:
(WebCore::MonthInputType::valueAsDate const):
(WebCore::MonthInputType::createStepRange const):
* html/TimeInputType.cpp:
(WebCore::TimeInputType::createStepRange const):
* html/WeekInputType.cpp:
(WebCore::WeekInputType::createStepRange const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232511 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp
Source/WebCore/html/BaseDateAndTimeInputType.cpp
Source/WebCore/html/DateInputType.cpp
Source/WebCore/html/DateTimeLocalInputType.cpp
Source/WebCore/html/MonthInputType.cpp
Source/WebCore/html/TimeInputType.cpp
Source/WebCore/html/WeekInputType.cpp

index 2df7ea1..cac3ff3 100644 (file)
@@ -1,3 +1,44 @@
+2018-06-05  Antoine Quint  <graouts@apple.com>
+
+        Fix the iOS build after r232496
+        https://bugs.webkit.org/show_bug.cgi?id=186304
+
+        Reviewed by Brent Fulgham.
+
+        The changes in r232496 changed the InputType::element() signature from HTMLInputElement&
+        to HTMLInputElement* and some call sites did not expect that.
+
+        * html/BaseChooserOnlyDateAndTimeInputType.cpp:
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree):
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue):
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue):
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent):
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent):
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::accessKeyAction):
+        (WebCore::BaseChooserOnlyDateAndTimeInputType::isMouseFocusable const):
+        * html/BaseDateAndTimeInputType.cpp:
+        (WebCore::BaseDateAndTimeInputType::setValueAsDate const):
+        (WebCore::BaseDateAndTimeInputType::valueAsDouble const):
+        (WebCore::BaseDateAndTimeInputType::setValueAsDecimal const):
+        (WebCore::BaseDateAndTimeInputType::typeMismatch const):
+        (WebCore::BaseDateAndTimeInputType::serializeWithComponents const):
+        (WebCore::BaseDateAndTimeInputType::localizeValue const):
+        (WebCore::BaseDateAndTimeInputType::visibleValue const):
+        (WebCore::BaseDateAndTimeInputType::valueMissing const):
+        (WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const):
+        * html/DateInputType.cpp:
+        (WebCore::DateInputType::createStepRange const):
+        * html/DateTimeLocalInputType.cpp:
+        (WebCore::DateTimeLocalInputType::createStepRange const):
+        * html/MonthInputType.cpp:
+        (WebCore::MonthInputType::valueAsDate const):
+        (WebCore::MonthInputType::createStepRange const):
+        * html/TimeInputType.cpp:
+        (WebCore::TimeInputType::createStepRange const):
+        * html/WeekInputType.cpp:
+        (WebCore::WeekInputType::createStepRange const):
+
 2018-06-03  Darin Adler  <darin@apple.com>
 
         Simplify and remove some unused video element code (helpful for ARC-compatibility)
index 5c463a0..5c12f6c 100644 (file)
@@ -46,15 +46,16 @@ BaseChooserOnlyDateAndTimeInputType::~BaseChooserOnlyDateAndTimeInputType()
 
 void BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent(Event&)
 {
-    if (element().isDisabledOrReadOnly() || !element().renderer() || !UserGestureIndicator::processingUserGesture())
+    ASSERT(element());
+    if (element()->isDisabledOrReadOnly() || !element()->renderer() || !UserGestureIndicator::processingUserGesture())
         return;
 
     if (m_dateTimeChooser)
         return;
-    if (!element().document().page())
+    if (!element()->document().page())
         return;
     DateTimeChooserParameters parameters;
-    if (!element().setupDateTimeChooserParameters(parameters))
+    if (!element()->setupDateTimeChooserParameters(parameters))
         return;
 }
 
@@ -62,15 +63,17 @@ void BaseChooserOnlyDateAndTimeInputType::createShadowSubtree()
 {
     static NeverDestroyed<AtomicString> valueContainerPseudo("-webkit-date-and-time-value", AtomicString::ConstructFromLiteral);
 
-    auto valueContainer = HTMLDivElement::create(element().document());
+    ASSERT(element());
+    auto valueContainer = HTMLDivElement::create(element()->document());
     valueContainer->setPseudo(valueContainerPseudo);
-    element().userAgentShadowRoot()->appendChild(valueContainer);
+    element()->userAgentShadowRoot()->appendChild(valueContainer);
     updateInnerTextValue();
 }
 
 void BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue()
 {
-    RefPtr<Node> node = element().userAgentShadowRoot()->firstChild();
+    ASSERT(element());
+    RefPtr<Node> node = element()->userAgentShadowRoot()->firstChild();
     if (!is<HTMLElement>(node))
         return;
     String displayValue = visibleValue();
@@ -95,7 +98,8 @@ void BaseChooserOnlyDateAndTimeInputType::detach()
 
 void BaseChooserOnlyDateAndTimeInputType::didChooseValue(const String& value)
 {
-    element().setValue(value, DispatchInputAndChangeEvent);
+    ASSERT(element());
+    element()->setValue(value, DispatchInputAndChangeEvent);
 }
 
 void BaseChooserOnlyDateAndTimeInputType::didEndChooser()
@@ -111,12 +115,14 @@ void BaseChooserOnlyDateAndTimeInputType::closeDateTimeChooser()
 
 void BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent(KeyboardEvent& event)
 {
-    BaseClickableWithKeyInputType::handleKeydownEvent(element(), event);
+    ASSERT(element());
+    BaseClickableWithKeyInputType::handleKeydownEvent(*element(), event);
 }
 
 void BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent(KeyboardEvent& event)
 {
-    BaseClickableWithKeyInputType::handleKeypressEvent(element(), event);
+    ASSERT(element());
+    BaseClickableWithKeyInputType::handleKeypressEvent(*element(), event);
 }
 
 void BaseChooserOnlyDateAndTimeInputType::handleKeyupEvent(KeyboardEvent& event)
@@ -127,12 +133,14 @@ void BaseChooserOnlyDateAndTimeInputType::handleKeyupEvent(KeyboardEvent& event)
 void BaseChooserOnlyDateAndTimeInputType::accessKeyAction(bool sendMouseEvents)
 {
     BaseDateAndTimeInputType::accessKeyAction(sendMouseEvents);
-    BaseClickableWithKeyInputType::accessKeyAction(element(), sendMouseEvents);
+    ASSERT(element());
+    BaseClickableWithKeyInputType::accessKeyAction(*element(), sendMouseEvents);
 }
 
 bool BaseChooserOnlyDateAndTimeInputType::isMouseFocusable() const
 {
-    return element().isTextFormControlFocusable();
+    ASSERT(element());
+    return element()->isTextFormControlFocusable();
 }
 
 void BaseChooserOnlyDateAndTimeInputType::attributeChanged(const QualifiedName& name)
index cc9070a..9036e76 100644 (file)
@@ -57,19 +57,22 @@ double BaseDateAndTimeInputType::valueAsDate() const
 
 ExceptionOr<void> BaseDateAndTimeInputType::setValueAsDate(double value) const
 {
-    element().setValue(serializeWithMilliseconds(value));
+    ASSERT(element());
+    element()->setValue(serializeWithMilliseconds(value));
     return { };
 }
 
 double BaseDateAndTimeInputType::valueAsDouble() const
 {
-    const Decimal value = parseToNumber(element().value(), Decimal::nan());
+    ASSERT(element());
+    const Decimal value = parseToNumber(element()->value(), Decimal::nan());
     return value.isFinite() ? value.toDouble() : DateComponents::invalidMilliseconds();
 }
 
 ExceptionOr<void> BaseDateAndTimeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior) const
 {
-    element().setValue(serialize(newValue), eventBehavior);
+    ASSERT(element());
+    element()->setValue(serialize(newValue), eventBehavior);
     return { };
 }
 
@@ -80,7 +83,8 @@ bool BaseDateAndTimeInputType::typeMismatchFor(const String& value) const
 
 bool BaseDateAndTimeInputType::typeMismatch() const
 {
-    return typeMismatchFor(element().value());
+    ASSERT(element());
+    return typeMismatchFor(element()->value());
 }
 
 Decimal BaseDateAndTimeInputType::defaultValueForStepUp() const
@@ -136,8 +140,9 @@ String BaseDateAndTimeInputType::serialize(const Decimal& value) const
 
 String BaseDateAndTimeInputType::serializeWithComponents(const DateComponents& date) const
 {
+    ASSERT(element());
     Decimal step;
-    if (!element().getAllowedValueStep(&step))
+    if (!element()->getAllowedValueStep(&step))
         return date.toString();
     if (step.remainder(msecPerMinute).isZero())
         return date.toString(DateComponents::None);
@@ -157,13 +162,15 @@ String BaseDateAndTimeInputType::localizeValue(const String& proposedValue) cons
     if (!parseToDateComponents(proposedValue, &date))
         return proposedValue;
 
-    String localized = element().locale().formatDateTime(date);
+    ASSERT(element());
+    String localized = element()->locale().formatDateTime(date);
     return localized.isEmpty() ? proposedValue : localized;
 }
 
 String BaseDateAndTimeInputType::visibleValue() const
 {
-    return localizeValue(element().value());
+    ASSERT(element());
+    return localizeValue(element()->value());
 }
 
 String BaseDateAndTimeInputType::sanitizeValue(const String& proposedValue) const
@@ -183,13 +190,15 @@ bool BaseDateAndTimeInputType::shouldRespectListAttribute()
 
 bool BaseDateAndTimeInputType::valueMissing(const String& value) const
 {
-    return element().isRequired() && value.isEmpty();
+    ASSERT(element());
+    return element()->isRequired() && value.isEmpty();
 }
 
 #if PLATFORM(IOS)
 bool BaseDateAndTimeInputType::isKeyboardFocusable(KeyboardEvent*) const
 {
-    return !element().isReadOnly() && element().isTextFormControlFocusable();
+    ASSERT(element());
+    return !element()->isReadOnly() && element()->isTextFormControlFocusable();
 }
 #endif
 
index 1eb61b3..5188ad3 100644 (file)
@@ -64,10 +64,11 @@ StepRange DateInputType::createStepRange(AnyStepHandling anyStepHandling) const
 {
     static NeverDestroyed<const StepRange::StepDescription> stepDescription(dateDefaultStep, dateDefaultStepBase, dateStepScaleFactor, StepRange::ParsedStepValueShouldBeInteger);
 
-    const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), 0);
-    const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumDate()));
-    const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumDate()));
-    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
+    ASSERT(element());
+    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), 0);
+    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumDate()));
+    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumDate()));
+    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
     return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
 }
 
index bdc3857..74f5866 100644 (file)
@@ -72,10 +72,11 @@ StepRange DateTimeLocalInputType::createStepRange(AnyStepHandling anyStepHandlin
 {
     static NeverDestroyed<const StepRange::StepDescription> stepDescription(dateTimeLocalDefaultStep, dateTimeLocalDefaultStepBase, dateTimeLocalStepScaleFactor, StepRange::ScaledStepValueShouldBeInteger);
 
-    const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), 0);
-    const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumDateTime()));
-    const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumDateTime()));
-    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
+    ASSERT(element());
+    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), 0);
+    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumDateTime()));
+    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumDateTime()));
+    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
     return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
 }
 
index 22eeada..5977caa 100644 (file)
@@ -59,8 +59,9 @@ DateComponents::Type MonthInputType::dateType() const
 
 double MonthInputType::valueAsDate() const
 {
+    ASSERT(element());
     DateComponents date;
-    if (!parseToDateComponents(element().value(), &date))
+    if (!parseToDateComponents(element()->value(), &date))
         return DateComponents::invalidMilliseconds();
     double msec = date.millisecondsSinceEpoch();
     ASSERT(std::isfinite(msec));
@@ -92,10 +93,11 @@ StepRange MonthInputType::createStepRange(AnyStepHandling anyStepHandling) const
 {
     static NeverDestroyed<const StepRange::StepDescription> stepDescription(monthDefaultStep, monthDefaultStepBase, monthStepScaleFactor, StepRange::ParsedStepValueShouldBeInteger);
 
-    const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(monthDefaultStepBase));
-    const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumMonth()));
-    const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumMonth()));
-    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
+    ASSERT(element());
+    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(monthDefaultStepBase));
+    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumMonth()));
+    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumMonth()));
+    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
     return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
 }
 
index 4fa481d..079939c 100644 (file)
@@ -79,10 +79,11 @@ StepRange TimeInputType::createStepRange(AnyStepHandling anyStepHandling) const
 {
     static NeverDestroyed<const StepRange::StepDescription> stepDescription(timeDefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValueShouldBeInteger);
 
-    const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), 0);
-    const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumTime()));
-    const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumTime()));
-    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
+    ASSERT(element());
+    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), 0);
+    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumTime()));
+    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumTime()));
+    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
     return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
 }
 
index 7318b59..d63790d 100644 (file)
@@ -59,10 +59,11 @@ StepRange WeekInputType::createStepRange(AnyStepHandling anyStepHandling) const
 {
     static NeverDestroyed<const StepRange::StepDescription> stepDescription(weekDefaultStep, weekDefaultStepBase, weekStepScaleFactor, StepRange::ParsedStepValueShouldBeInteger);
 
-    const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), weekDefaultStepBase);
-    const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumWeek()));
-    const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumWeek()));
-    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
+    ASSERT(element());
+    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), weekDefaultStepBase);
+    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumWeek()));
+    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumWeek()));
+    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
     return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
 }