void SliderThumbElement::dragFrom(const LayoutPoint& point) { Ref<SliderThumbElement> protect(*this); setPositionFromPoint(point); #if !PLATFORM(IOS) startDragging(); #endif }
void SliderThumbElement::handleTouchMove(TouchEvent* touchEvent) { unsigned identifier = exclusiveTouchIdentifier(); if (identifier == NoIdentifier) return; Touch* touch = findTouchWithIdentifier(touchEvent->targetTouches(), identifier); if (!touch) return; if (m_inDragMode) setPositionFromPoint(IntPoint(touch->pageX(), touch->pageY())); touchEvent->setDefaultHandled(); }
void SliderThumbElement::defaultEventHandler(Event* event) { if (!event->isMouseEvent()) { HTMLDivElement::defaultEventHandler(event); return; } // FIXME: Should handle this readonly/disabled check in more general way. // Missing this kind of check is likely to occur elsewhere if adding it in // each shadow element. HTMLInputElement* input = hostInput(); if (!input || input->isDisabledOrReadOnly()) { stopDragging(); HTMLDivElement::defaultEventHandler(event); return; } MouseEvent* mouseEvent = toMouseEvent(event); bool isLeftButton = mouseEvent->button() == static_cast<short>(WebPointerProperties::Button::Left); const AtomicString& eventType = event->type(); // We intentionally do not call event->setDefaultHandled() here because // MediaControlTimelineElement::defaultEventHandler() wants to handle these // mouse events. if (eventType == EventTypeNames::mousedown && isLeftButton) { startDragging(); return; } if (eventType == EventTypeNames::mouseup && isLeftButton) { stopDragging(); return; } if (eventType == EventTypeNames::mousemove) { if (m_inDragMode) setPositionFromPoint(LayoutPoint(mouseEvent->absoluteLocation())); return; } HTMLDivElement::defaultEventHandler(event); }
void SliderThumbElement::defaultEventHandler(Event* event) { if (!is<MouseEvent>(*event)) { HTMLDivElement::defaultEventHandler(event); return; } // FIXME: Should handle this readonly/disabled check in more general way. // Missing this kind of check is likely to occur elsewhere if adding it in each shadow element. HTMLInputElement* input = hostInput(); if (!input || input->isDisabledOrReadOnly()) { stopDragging(); HTMLDivElement::defaultEventHandler(event); return; } MouseEvent& mouseEvent = downcast<MouseEvent>(*event); bool isLeftButton = mouseEvent.button() == LeftButton; const AtomicString& eventType = mouseEvent.type(); // We intentionally do not call event->setDefaultHandled() here because // MediaControlTimelineElement::defaultEventHandler() wants to handle these // mouse events. if (eventType == eventNames().mousedownEvent && isLeftButton) { startDragging(); return; } else if (eventType == eventNames().mouseupEvent && isLeftButton) { stopDragging(); return; } else if (eventType == eventNames().mousemoveEvent) { if (m_inDragMode) setPositionFromPoint(mouseEvent.absoluteLocation()); return; } HTMLDivElement::defaultEventHandler(&mouseEvent); }
void SliderThumbElement::defaultEventHandler(Event* event) { if (!event->isMouseEvent() #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) && !event->isTouchEvent() #endif ) { HTMLDivElement::defaultEventHandler(event); return; } #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) bool isLeftButton = false; if (event->isMouseEvent()) { MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); isLeftButton = mouseEvent->button() == LeftButton; } #else MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); bool isLeftButton = mouseEvent->button() == LeftButton; #endif const AtomicString& eventType = event->type(); if (eventType == eventNames().mousedownEvent && isLeftButton #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) || eventType == eventNames().touchstartEvent #endif ) { startDragging(); return; } else if (eventType == eventNames().mouseupEvent && isLeftButton #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) || eventType == eventNames().touchendEvent || eventType == eventNames().touchcancelEvent #endif ) { stopDragging(); return; } else if (eventType == eventNames().mousemoveEvent #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) || eventType == eventNames().touchmoveEvent #endif ) { if (m_inDragMode) #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) { if (event->isMouseEvent()) { MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); #endif setPositionFromPoint(mouseEvent->absoluteLocation()); #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) } else if (event->isTouchEvent()) { TouchEvent* touchEvent = static_cast<TouchEvent*>(event); if (touchEvent->touches() && touchEvent->touches()->item(0)) { IntPoint curPoint; curPoint.setX(touchEvent->touches()->item(0)->pageX()); curPoint.setY(touchEvent->touches()->item(0)->pageY()); setPositionFromPoint(curPoint); // Tell the webview that webkit will handle the following move events event->setDefaultPrevented(true); } } } #endif return; } HTMLDivElement::defaultEventHandler(event); }
void SliderThumbElement::dragFrom(const IntPoint& point) { setPositionFromPoint(point); startDragging(); }
void SliderThumbElement::dragFrom(const LayoutPoint& point) { RefPtrWillBeRawPtr<SliderThumbElement> protector(this); startDragging(); setPositionFromPoint(point); }