diff options
author | Ben Murdoch <benm@google.com> | 2011-05-16 16:35:58 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-23 18:54:14 +0100 |
commit | 6fbaea61d241814b015fd7e022796e68d8ef3e8e (patch) | |
tree | 09be7d423f6dbab5995e21265a9a54650d013a64 /Source/WebCore/html/shadow | |
parent | 61f2d6a1f71aa7a52ec56b93958324b8b6de1b6a (diff) | |
download | external_webkit-6fbaea61d241814b015fd7e022796e68d8ef3e8e.zip external_webkit-6fbaea61d241814b015fd7e022796e68d8ef3e8e.tar.gz external_webkit-6fbaea61d241814b015fd7e022796e68d8ef3e8e.tar.bz2 |
Merge WebKit at r76408: Fix conflicts.
Android.jscbindings.mk
Conflict due to local addition of EntrySyncCustom.cpp and http://trac.webkit.org/changeset/76216
V8NPUtils.cpp
Conflict due to local cherry pick of http://trac.webkit.org/changeset/78994 and
merge of http://trac.webkit.org/changeset/76264
FrameView.h
Conflict due to local addition of updatePositionedObjects() and http://trac.webkit.org/changeset/76278
RangeInputType.cpp
SliderThumbElement.cpp
Conflicts due to Android addition of touch handling code in slider code.
See http://trac.webkit.org/changeset/76147
.gitignore - keep ours
Change-Id: I38aeb361a37e7939f805c6689d7cc8fc720b3e52
Diffstat (limited to 'Source/WebCore/html/shadow')
-rw-r--r-- | Source/WebCore/html/shadow/SliderThumbElement.cpp | 118 |
1 files changed, 52 insertions, 66 deletions
diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index ad93261..758d3c7 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -43,12 +43,13 @@ #include "StepRange.h" #include <wtf/MathExtras.h> -using namespace std; - #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) +#include "Page.h" #include "TouchEvent.h" #endif +using namespace std; + namespace WebCore { // FIXME: Find a way to cascade appearance (see the layout method) and get rid of this class. @@ -139,6 +140,12 @@ void SliderThumbElement::startDragging() { if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(this); +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) + // Touch events come from Java to the main frame event handler, so we need + // to flag we are capturing those events also on the main frame event + // handler. + frame->page()->mainFrame()->eventHandler()->setCapturingTouchEventsNode(this); +#endif m_inDragMode = true; } } @@ -150,6 +157,11 @@ void SliderThumbElement::stopDragging() if (Frame* frame = document()->frame()) frame->eventHandler()->setCapturingMouseEventsNode(0); + +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) + if (Frame* frame = document()->frame()) + frame->page()->mainFrame()->eventHandler()->setCapturingTouchEventsNode(0); +#endif m_inDragMode = false; } @@ -164,88 +176,62 @@ void SliderThumbElement::defaultEventHandler(Event* 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(); -<<<<<<< HEAD if (eventType == eventNames().mousedownEvent && isLeftButton #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) - || eventType == eventNames().touchstartEvent + || eventType == eventNames().touchstartEvent #endif - ) { - if (document()->frame() && renderer()) { - RenderSlider* slider = toRenderSlider(renderer()->parent()); - if (slider) { - if (slider->mouseEventIsInThumb(mouseEvent)) { - // We selected the thumb, we want the cursor to always stay at - // the same position relative to the thumb. - m_offsetToThumb = slider->mouseEventOffsetToThumb(mouseEvent); - } else { - // We are outside the thumb, move the thumb to the point were - // we clicked. We'll be exactly at the center of the thumb. - m_offsetToThumb.setX(0); - m_offsetToThumb.setY(0); - } - - m_inDragMode = true; - document()->frame()->eventHandler()->setCapturingMouseEventsNode(shadowHost()); - event->setDefaultHandled(); - return; - } - } + ) { + startDragging(); + return; } else if (eventType == eventNames().mouseupEvent && isLeftButton #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) - || eventType == eventNames().touchendEvent + || eventType == eventNames().touchendEvent + || eventType == eventNames().touchcancelEvent #endif - ) { - if (m_inDragMode) { - if (Frame* frame = document()->frame()) - frame->eventHandler()->setCapturingMouseEventsNode(0); - m_inDragMode = false; - event->setDefaultHandled(); - return; - } + ) { + stopDragging(); + return; } else if (eventType == eventNames().mousemoveEvent #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) - || eventType == eventNames().touchmoveEvent + || eventType == eventNames().touchmoveEvent #endif - ) { - if (m_inDragMode && renderer() && renderer()->parent()) { - RenderSlider* slider = toRenderSlider(renderer()->parent()); - if (slider) { - FloatPoint curPoint = slider->absoluteToLocal(mouseEvent->absoluteLocation(), false, true); + ) { + if (m_inDragMode) #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) - // Update the position when it is a touch event - if (event->isTouchEvent()) { - TouchEvent* touchEvent = static_cast<TouchEvent*>(event); - if (touchEvent && touchEvent->touches() && touchEvent->touches()->item(0)) { - curPoint.setX(touchEvent->touches()->item(0)->pageX()); - curPoint.setY(touchEvent->touches()->item(0)->pageY()); - curPoint = slider->absoluteToLocal(curPoint, false, true); - } - } - // Tell the webview that webkit will handle the following move events - event->setDefaultPrevented(true); + { + if (event->isMouseEvent()) { + MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); #endif - IntPoint eventOffset(curPoint.x() + m_offsetToThumb.x(), curPoint.y() + m_offsetToThumb.y()); - slider->setValueForPosition(slider->positionForOffset(eventOffset)); - event->setDefaultHandled(); - return; + setPosition(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()); + setPosition(curPoint); + // Tell the webview that webkit will handle the following move events + event->setDefaultPrevented(true); + } } + } -======= - if (eventType == eventNames().mousedownEvent && isLeftButton) { - startDragging(); - return; - } else if (eventType == eventNames().mouseupEvent && isLeftButton) { - stopDragging(); - return; - } else if (eventType == eventNames().mousemoveEvent) { - if (m_inDragMode) - setPosition(mouseEvent->absoluteLocation()); +#endif return; ->>>>>>> WebKit.org at r76408 } HTMLDivElement::defaultEventHandler(event); |