Changeset 232511 in webkit


Ignore:
Timestamp:
Jun 5, 2018 9:16:02 AM (6 years ago)
Author:
Brent Fulgham
Message:

Fix the iOS build after r232496
https://bugs.webkit.org/show_bug.cgi?id=186304

Patch by Antoine Quint <Antoine Quint> 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):

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r232510 r232511  
     12018-06-05  Antoine Quint  <graouts@apple.com>
     2
     3        Fix the iOS build after r232496
     4        https://bugs.webkit.org/show_bug.cgi?id=186304
     5
     6        Reviewed by Brent Fulgham.
     7
     8        The changes in r232496 changed the InputType::element() signature from HTMLInputElement&
     9        to HTMLInputElement* and some call sites did not expect that.
     10
     11        * html/BaseChooserOnlyDateAndTimeInputType.cpp:
     12        (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
     13        (WebCore::BaseChooserOnlyDateAndTimeInputType::createShadowSubtree):
     14        (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue):
     15        (WebCore::BaseChooserOnlyDateAndTimeInputType::didChooseValue):
     16        (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent):
     17        (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent):
     18        (WebCore::BaseChooserOnlyDateAndTimeInputType::accessKeyAction):
     19        (WebCore::BaseChooserOnlyDateAndTimeInputType::isMouseFocusable const):
     20        * html/BaseDateAndTimeInputType.cpp:
     21        (WebCore::BaseDateAndTimeInputType::setValueAsDate const):
     22        (WebCore::BaseDateAndTimeInputType::valueAsDouble const):
     23        (WebCore::BaseDateAndTimeInputType::setValueAsDecimal const):
     24        (WebCore::BaseDateAndTimeInputType::typeMismatch const):
     25        (WebCore::BaseDateAndTimeInputType::serializeWithComponents const):
     26        (WebCore::BaseDateAndTimeInputType::localizeValue const):
     27        (WebCore::BaseDateAndTimeInputType::visibleValue const):
     28        (WebCore::BaseDateAndTimeInputType::valueMissing const):
     29        (WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const):
     30        * html/DateInputType.cpp:
     31        (WebCore::DateInputType::createStepRange const):
     32        * html/DateTimeLocalInputType.cpp:
     33        (WebCore::DateTimeLocalInputType::createStepRange const):
     34        * html/MonthInputType.cpp:
     35        (WebCore::MonthInputType::valueAsDate const):
     36        (WebCore::MonthInputType::createStepRange const):
     37        * html/TimeInputType.cpp:
     38        (WebCore::TimeInputType::createStepRange const):
     39        * html/WeekInputType.cpp:
     40        (WebCore::WeekInputType::createStepRange const):
     41
    1422018-06-03  Darin Adler  <darin@apple.com>
    243
  • trunk/Source/WebCore/html/BaseChooserOnlyDateAndTimeInputType.cpp

    r232496 r232511  
    4747void BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent(Event&)
    4848{
    49     if (element().isDisabledOrReadOnly() || !element().renderer() || !UserGestureIndicator::processingUserGesture())
     49    ASSERT(element());
     50    if (element()->isDisabledOrReadOnly() || !element()->renderer() || !UserGestureIndicator::processingUserGesture())
    5051        return;
    5152
    5253    if (m_dateTimeChooser)
    5354        return;
    54     if (!element().document().page())
     55    if (!element()->document().page())
    5556        return;
    5657    DateTimeChooserParameters parameters;
    57     if (!element().setupDateTimeChooserParameters(parameters))
     58    if (!element()->setupDateTimeChooserParameters(parameters))
    5859        return;
    5960}
     
    6364    static NeverDestroyed<AtomicString> valueContainerPseudo("-webkit-date-and-time-value", AtomicString::ConstructFromLiteral);
    6465
    65     auto valueContainer = HTMLDivElement::create(element().document());
     66    ASSERT(element());
     67    auto valueContainer = HTMLDivElement::create(element()->document());
    6668    valueContainer->setPseudo(valueContainerPseudo);
    67     element().userAgentShadowRoot()->appendChild(valueContainer);
     69    element()->userAgentShadowRoot()->appendChild(valueContainer);
    6870    updateInnerTextValue();
    6971}
     
    7173void BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue()
    7274{
    73     RefPtr<Node> node = element().userAgentShadowRoot()->firstChild();
     75    ASSERT(element());
     76    RefPtr<Node> node = element()->userAgentShadowRoot()->firstChild();
    7477    if (!is<HTMLElement>(node))
    7578        return;
     
    9699void BaseChooserOnlyDateAndTimeInputType::didChooseValue(const String& value)
    97100{
    98     element().setValue(value, DispatchInputAndChangeEvent);
     101    ASSERT(element());
     102    element()->setValue(value, DispatchInputAndChangeEvent);
    99103}
    100104
     
    112116void BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent(KeyboardEvent& event)
    113117{
    114     BaseClickableWithKeyInputType::handleKeydownEvent(element(), event);
     118    ASSERT(element());
     119    BaseClickableWithKeyInputType::handleKeydownEvent(*element(), event);
    115120}
    116121
    117122void BaseChooserOnlyDateAndTimeInputType::handleKeypressEvent(KeyboardEvent& event)
    118123{
    119     BaseClickableWithKeyInputType::handleKeypressEvent(element(), event);
     124    ASSERT(element());
     125    BaseClickableWithKeyInputType::handleKeypressEvent(*element(), event);
    120126}
    121127
     
    128134{
    129135    BaseDateAndTimeInputType::accessKeyAction(sendMouseEvents);
    130     BaseClickableWithKeyInputType::accessKeyAction(element(), sendMouseEvents);
     136    ASSERT(element());
     137    BaseClickableWithKeyInputType::accessKeyAction(*element(), sendMouseEvents);
    131138}
    132139
    133140bool BaseChooserOnlyDateAndTimeInputType::isMouseFocusable() const
    134141{
    135     return element().isTextFormControlFocusable();
     142    ASSERT(element());
     143    return element()->isTextFormControlFocusable();
    136144}
    137145
  • trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp

    r232496 r232511  
    5858ExceptionOr<void> BaseDateAndTimeInputType::setValueAsDate(double value) const
    5959{
    60     element().setValue(serializeWithMilliseconds(value));
     60    ASSERT(element());
     61    element()->setValue(serializeWithMilliseconds(value));
    6162    return { };
    6263}
     
    6465double BaseDateAndTimeInputType::valueAsDouble() const
    6566{
    66     const Decimal value = parseToNumber(element().value(), Decimal::nan());
     67    ASSERT(element());
     68    const Decimal value = parseToNumber(element()->value(), Decimal::nan());
    6769    return value.isFinite() ? value.toDouble() : DateComponents::invalidMilliseconds();
    6870}
     
    7072ExceptionOr<void> BaseDateAndTimeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavior eventBehavior) const
    7173{
    72     element().setValue(serialize(newValue), eventBehavior);
     74    ASSERT(element());
     75    element()->setValue(serialize(newValue), eventBehavior);
    7376    return { };
    7477}
     
    8184bool BaseDateAndTimeInputType::typeMismatch() const
    8285{
    83     return typeMismatchFor(element().value());
     86    ASSERT(element());
     87    return typeMismatchFor(element()->value());
    8488}
    8589
     
    137141String BaseDateAndTimeInputType::serializeWithComponents(const DateComponents& date) const
    138142{
     143    ASSERT(element());
    139144    Decimal step;
    140     if (!element().getAllowedValueStep(&step))
     145    if (!element()->getAllowedValueStep(&step))
    141146        return date.toString();
    142147    if (step.remainder(msecPerMinute).isZero())
     
    158163        return proposedValue;
    159164
    160     String localized = element().locale().formatDateTime(date);
     165    ASSERT(element());
     166    String localized = element()->locale().formatDateTime(date);
    161167    return localized.isEmpty() ? proposedValue : localized;
    162168}
     
    164170String BaseDateAndTimeInputType::visibleValue() const
    165171{
    166     return localizeValue(element().value());
     172    ASSERT(element());
     173    return localizeValue(element()->value());
    167174}
    168175
     
    184191bool BaseDateAndTimeInputType::valueMissing(const String& value) const
    185192{
    186     return element().isRequired() && value.isEmpty();
     193    ASSERT(element());
     194    return element()->isRequired() && value.isEmpty();
    187195}
    188196
     
    190198bool BaseDateAndTimeInputType::isKeyboardFocusable(KeyboardEvent*) const
    191199{
    192     return !element().isReadOnly() && element().isTextFormControlFocusable();
     200    ASSERT(element());
     201    return !element()->isReadOnly() && element()->isTextFormControlFocusable();
    193202}
    194203#endif
  • trunk/Source/WebCore/html/DateInputType.cpp

    r203324 r232511  
    6565    static NeverDestroyed<const StepRange::StepDescription> stepDescription(dateDefaultStep, dateDefaultStepBase, dateStepScaleFactor, StepRange::ParsedStepValueShouldBeInteger);
    6666
    67     const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), 0);
    68     const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumDate()));
    69     const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumDate()));
    70     const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
     67    ASSERT(element());
     68    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), 0);
     69    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumDate()));
     70    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumDate()));
     71    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
    7172    return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
    7273}
  • trunk/Source/WebCore/html/DateTimeLocalInputType.cpp

    r208096 r232511  
    7373    static NeverDestroyed<const StepRange::StepDescription> stepDescription(dateTimeLocalDefaultStep, dateTimeLocalDefaultStepBase, dateTimeLocalStepScaleFactor, StepRange::ScaledStepValueShouldBeInteger);
    7474
    75     const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), 0);
    76     const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumDateTime()));
    77     const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumDateTime()));
    78     const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
     75    ASSERT(element());
     76    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), 0);
     77    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumDateTime()));
     78    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumDateTime()));
     79    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
    7980    return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
    8081}
  • trunk/Source/WebCore/html/MonthInputType.cpp

    r229209 r232511  
    6060double MonthInputType::valueAsDate() const
    6161{
     62    ASSERT(element());
    6263    DateComponents date;
    63     if (!parseToDateComponents(element().value(), &date))
     64    if (!parseToDateComponents(element()->value(), &date))
    6465        return DateComponents::invalidMilliseconds();
    6566    double msec = date.millisecondsSinceEpoch();
     
    9394    static NeverDestroyed<const StepRange::StepDescription> stepDescription(monthDefaultStep, monthDefaultStepBase, monthStepScaleFactor, StepRange::ParsedStepValueShouldBeInteger);
    9495
    95     const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(monthDefaultStepBase));
    96     const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumMonth()));
    97     const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumMonth()));
    98     const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
     96    ASSERT(element());
     97    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(monthDefaultStepBase));
     98    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumMonth()));
     99    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumMonth()));
     100    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
    99101    return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
    100102}
  • trunk/Source/WebCore/html/TimeInputType.cpp

    r229209 r232511  
    8080    static NeverDestroyed<const StepRange::StepDescription> stepDescription(timeDefaultStep, timeDefaultStepBase, timeStepScaleFactor, StepRange::ScaledStepValueShouldBeInteger);
    8181
    82     const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), 0);
    83     const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumTime()));
    84     const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumTime()));
    85     const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
     82    ASSERT(element());
     83    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), 0);
     84    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumTime()));
     85    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumTime()));
     86    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
    8687    return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
    8788}
  • trunk/Source/WebCore/html/WeekInputType.cpp

    r203324 r232511  
    6060    static NeverDestroyed<const StepRange::StepDescription> stepDescription(weekDefaultStep, weekDefaultStepBase, weekStepScaleFactor, StepRange::ParsedStepValueShouldBeInteger);
    6161
    62     const Decimal stepBase = parseToNumber(element().attributeWithoutSynchronization(minAttr), weekDefaultStepBase);
    63     const Decimal minimum = parseToNumber(element().attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumWeek()));
    64     const Decimal maximum = parseToNumber(element().attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumWeek()));
    65     const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().attributeWithoutSynchronization(stepAttr));
     62    ASSERT(element());
     63    const Decimal stepBase = parseToNumber(element()->attributeWithoutSynchronization(minAttr), weekDefaultStepBase);
     64    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), Decimal::fromDouble(DateComponents::minimumWeek()));
     65    const Decimal maximum = parseToNumber(element()->attributeWithoutSynchronization(maxAttr), Decimal::fromDouble(DateComponents::maximumWeek()));
     66    const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->attributeWithoutSynchronization(stepAttr));
    6667    return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, stepDescription);
    6768}
Note: See TracChangeset for help on using the changeset viewer.