Пример #1
0
SliderThumbElement* sliderThumbElementOf(Node* node)
{
    ASSERT(node);
    ShadowRoot* shadow = node->toInputElement()->shadowTree()->oldestShadowRoot();
    ASSERT(shadow);
    Node* thumb = shadow->firstChild()->firstChild()->firstChild();
    ASSERT(thumb);
    return toSliderThumbElement(thumb);
}
Пример #2
0
void SliderContainerElement::handleTouchEvent(TouchEvent* event) {
  HTMLInputElement* input = hostInput();
  if (input->isDisabledOrReadOnly())
    return;

  if (event->type() == EventTypeNames::touchend) {
    input->dispatchFormControlChangeEvent();
    event->setDefaultHandled();
    m_slidingDirection = NoMove;
    m_touchStarted = false;
    return;
  }

  // The direction of this series of touch actions has been determined, which is
  // perpendicular to the slider, so no need to adjust the value.
  if (!canSlide()) {
    return;
  }

  TouchList* touches = event->targetTouches();
  SliderThumbElement* thumb = toSliderThumbElement(
      treeScope().getElementById(ShadowElementNames::sliderThumb()));
  if (touches->length() == 1) {
    if (event->type() == EventTypeNames::touchstart) {
      m_startPoint = touches->item(0)->absoluteLocation();
      m_slidingDirection = NoMove;
      m_touchStarted = true;
      thumb->setPositionFromPoint(touches->item(0)->absoluteLocation());
    } else if (m_touchStarted) {
      LayoutPoint currentPoint = touches->item(0)->absoluteLocation();
      if (m_slidingDirection ==
          NoMove) {  // Still needs to update the direction.
        m_slidingDirection = getDirection(currentPoint, m_startPoint);
      }

      // m_slidingDirection has been updated, so check whether it's okay to
      // slide again.
      if (canSlide()) {
        thumb->setPositionFromPoint(touches->item(0)->absoluteLocation());
        event->setDefaultHandled();
      }
    }
  }
}
Пример #3
0
inline SliderThumbElement* RangeInputType::sliderThumbElement() const
{
    return toSliderThumbElement(element().userAgentShadowRoot()->getElementById(ShadowElementNames::sliderThumb()));
}
SliderThumbElement* RenderSlider::shadowSliderThumb() const
{
    Node* shadow = static_cast<Element*>(node())->shadowRoot();
    return shadow ? toSliderThumbElement(shadow->firstChild()) : 0;
}
Пример #5
0
SliderThumbElement* RenderSlider::sliderThumbElement() const
{
    return toSliderThumbElement(static_cast<Element*>(node())->shadowRoot());
}
Пример #6
0
inline SliderThumbElement* RenderSlider::sliderThumbElement() const
{
    return toSliderThumbElement(toElement(node())->userAgentShadowRoot()->getElementById(ShadowElementNames::sliderThumb()));
}