Exemplo n.º 1
0
void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree()
{
    ASSERT(element()->shadow());

    Document* document = element()->document();
    ContainerNode* container = element()->userAgentShadowRoot();

    RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(document, *this));
    m_dateTimeEditElement = dateTimeEditElement.get();
    container->appendChild(m_dateTimeEditElement);
    updateInnerTextValue();

    RefPtr<SpinButtonElement> spinButton = SpinButtonElement::create(document, *this);
    m_spinButtonElement = spinButton.get();
    container->appendChild(spinButton);

    bool shouldAddPickerIndicator = false;
#if ENABLE(DATALIST_ELEMENT)
    if (InputType::themeSupportsDataListUI(this))
        shouldAddPickerIndicator = true;
#endif
    RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme();
    if (theme->supportsCalendarPicker(formControlType())) {
        shouldAddPickerIndicator = true;
        m_pickerIndicatorIsAlwaysVisible = true;
    }
    if (shouldAddPickerIndicator) {
        RefPtr<PickerIndicatorElement> pickerElement = PickerIndicatorElement::create(document, *this);
        m_pickerIndicatorElement = pickerElement.get();
        container->appendChild(m_pickerIndicatorElement);
        m_pickerIndicatorIsVisible = true;
        updatePickerIndicatorVisibility();
    }
}
Exemplo n.º 2
0
void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree()
{
    DEFINE_STATIC_LOCAL(AtomicString, dateAndTimeInputContainerPseudoId, ("-webkit-date-and-time-container", AtomicString::ConstructFromLiteral));

    ASSERT(element()->shadow());

    Document* document = element()->document();
    RefPtr<HTMLDivElement> container = HTMLDivElement::create(document);
    element()->userAgentShadowRoot()->appendChild(container);
    container->setShadowPseudoId(dateAndTimeInputContainerPseudoId);

    RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(document, *this));
    m_dateTimeEditElement = dateTimeEditElement.get();
    container->appendChild(m_dateTimeEditElement);
    updateInnerTextValue();

    RefPtr<SpinButtonElement> spinButton = SpinButtonElement::create(document, *this);
    m_spinButtonElement = spinButton.get();
    container->appendChild(spinButton);

#if ENABLE(DATALIST_ELEMENT) || ENABLE(CALENDAR_PICKER)
    bool shouldAddPickerIndicator = false;
#if ENABLE(DATALIST_ELEMENT)
    if (InputType::themeSupportsDataListUI(this))
        shouldAddPickerIndicator = true;
#endif
#if ENABLE(CALENDAR_PICKER)
    RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme();
    if (theme->supportsCalendarPicker(formControlType())) {
        shouldAddPickerIndicator = true;
        m_pickerIndicatorIsAlwaysVisible = true;
    }
#endif
    if (shouldAddPickerIndicator) {
        RefPtr<PickerIndicatorElement> pickerElement = PickerIndicatorElement::create(document);
        m_pickerIndicatorElement = pickerElement.get();
        container->appendChild(m_pickerIndicatorElement);
        m_pickerIndicatorIsVisible = true;
        updatePickerIndicatorVisibility();
    }
#endif // ENABLE(DATALIST_ELEMENT) || ENABLE(CALENDAR_PICKER)
}
void MultipleFieldsTemporalInputTypeView::createShadowSubtree() {
  DCHECK(element().shadow());

  // Element must not have a layoutObject here, because if it did
  // DateTimeEditElement::customStyleForLayoutObject() is called in
  // appendChild() before the field wrapper element is created.
  // FIXME: This code should not depend on such craziness.
  DCHECK(!element().layoutObject());

  Document& document = element().document();
  ContainerNode* container = element().userAgentShadowRoot();

  container->appendChild(DateTimeEditElement::create(document, *this));
  element().updateView();
  container->appendChild(ClearButtonElement::create(document, *this));
  container->appendChild(SpinButtonElement::create(document, *this));

  if (LayoutTheme::theme().supportsCalendarPicker(
          m_inputType->formControlType()))
    m_pickerIndicatorIsAlwaysVisible = true;
  container->appendChild(PickerIndicatorElement::create(document, *this));
  m_pickerIndicatorIsVisible = true;
  updatePickerIndicatorVisibility();
}
void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree()
{
    ASSERT(element().shadow());

    // Element must not have a renderer here, because if it did
    // DateTimeEditElement::customStyleForRenderer() is called in appendChild()
    // before the field wrapper element is created.
    // FIXME: This code should not depend on such craziness.
    ASSERT(!element().renderer());

    Document& document = element().document();
    ContainerNode* container = element().userAgentShadowRoot();

    container->appendChild(DateTimeEditElement::create(document, *this));
    element().updateView();
    container->appendChild(ClearButtonElement::create(document, *this));
    container->appendChild(SpinButtonElement::create(document, *this));

    if (RenderTheme::theme().supportsCalendarPicker(formControlType()))
        m_pickerIndicatorIsAlwaysVisible = true;
    container->appendChild(PickerIndicatorElement::create(document, *this));
    m_pickerIndicatorIsVisible = true;
    updatePickerIndicatorVisibility();
}
void MultipleFieldsTemporalInputTypeView::listAttributeTargetChanged() {
  updatePickerIndicatorVisibility();
}
void BaseMultipleFieldsDateAndTimeInputType::listAttributeTargetChanged()
{
    updatePickerIndicatorVisibility();
}