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 | |
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')
-rw-r--r-- | Source/WebCore/Android.jscbindings.mk | 3 | ||||
-rw-r--r-- | Source/WebCore/bindings/v8/V8NPUtils.cpp | 5 | ||||
-rw-r--r-- | Source/WebCore/html/HTMLInputElement.cpp | 12 | ||||
-rw-r--r-- | Source/WebCore/html/InputType.cpp | 6 | ||||
-rw-r--r-- | Source/WebCore/html/InputType.h | 9 | ||||
-rw-r--r-- | Source/WebCore/html/RangeInputType.cpp | 29 | ||||
-rw-r--r-- | Source/WebCore/html/RangeInputType.h | 3 | ||||
-rw-r--r-- | Source/WebCore/html/shadow/SliderThumbElement.cpp | 118 | ||||
-rw-r--r-- | Source/WebCore/page/EventHandler.cpp | 34 | ||||
-rw-r--r-- | Source/WebCore/page/EventHandler.h | 6 | ||||
-rw-r--r-- | Source/WebCore/page/FrameView.h | 9 | ||||
-rw-r--r-- | Source/WebCore/rendering/RenderMedia.cpp | 19 |
12 files changed, 159 insertions, 94 deletions
diff --git a/Source/WebCore/Android.jscbindings.mk b/Source/WebCore/Android.jscbindings.mk index 281425c..bd5dfbd 100644 --- a/Source/WebCore/Android.jscbindings.mk +++ b/Source/WebCore/Android.jscbindings.mk @@ -113,11 +113,8 @@ LOCAL_SRC_FILES += \ bindings/js/JSDirectoryEntrySyncCustom.cpp \ bindings/js/JSDocumentCustom.cpp \ bindings/js/JSElementCustom.cpp \ -<<<<<<< HEAD bindings/js/JSEntrySyncCustom.cpp \ -======= bindings/js/JSErrorHandler.cpp \ ->>>>>>> WebKit.org at r76408 bindings/js/JSEventCustom.cpp \ bindings/js/JSEventListener.cpp \ bindings/js/JSEventTarget.cpp \ diff --git a/Source/WebCore/bindings/v8/V8NPUtils.cpp b/Source/WebCore/bindings/v8/V8NPUtils.cpp index dccdb15..250ee5b 100644 --- a/Source/WebCore/bindings/v8/V8NPUtils.cpp +++ b/Source/WebCore/bindings/v8/V8NPUtils.cpp @@ -63,14 +63,9 @@ void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP VOID_TO_NPVARIANT(*result); else if (object->IsString()) { v8::String::Utf8Value utf8(object); -<<<<<<< HEAD int length = utf8.length() + 1; char* utf8Chars = reinterpret_cast<char*>(malloc(length)); memcpy(utf8Chars, *utf8, length); -======= - char* utf8Chars = reinterpret_cast<char*>(malloc(utf8.length())); - memcpy(utf8Chars, *utf8, utf8.length()); ->>>>>>> WebKit.org at r76408 STRINGN_TO_NPVARIANT(utf8Chars, utf8.length(), *result); } else if (object->IsObject()) { DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext()); diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 637e831..0d20389 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -57,6 +57,10 @@ #include "PlatformBridge.h" #endif +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) +#include "TouchEvent.h" +#endif + using namespace std; namespace WebCore { @@ -1054,6 +1058,14 @@ void HTMLInputElement::defaultEventHandler(Event* evt) return; } +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) + if (evt->isTouchEvent() && evt->type() == eventNames().touchstartEvent) { + m_inputType->handleTouchStartEvent(static_cast<TouchEvent*>(evt)); + if (evt->defaultHandled()) + return; + } +#endif + m_inputType->forwardEvent(evt); if (!callBaseClassEarly && !evt->defaultHandled()) diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 2f8d414..8e3a9e3 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -309,6 +309,12 @@ void InputType::handleMouseDownEvent(MouseEvent*) { } +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) +void InputType::handleTouchStartEvent(TouchEvent*) +{ +} +#endif + void InputType::handleDOMActivateEvent(Event*) { } diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index e6ceb96..40606d1 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -54,6 +54,10 @@ class RenderObject; class RenderStyle; class WheelEvent; +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) +class TouchEvent; +#endif + typedef int ExceptionCode; struct ClickHandlingState { @@ -165,6 +169,11 @@ public: virtual void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*); virtual void handleWheelEvent(WheelEvent*); virtual void forwardEvent(Event*); + +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) + virtual void handleTouchStartEvent(TouchEvent*); +#endif + // Helpers for event handlers. virtual bool shouldSubmitImplicitly(Event*); virtual PassRefPtr<HTMLFormElement> formForSubmission() const; diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp index e9ac295..7c74206 100644 --- a/Source/WebCore/html/RangeInputType.cpp +++ b/Source/WebCore/html/RangeInputType.cpp @@ -45,6 +45,10 @@ #include <wtf/MathExtras.h> #include <wtf/PassOwnPtr.h> +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) +#include "TouchEvent.h" +#endif + namespace WebCore { using namespace HTMLNames; @@ -192,21 +196,22 @@ void RangeInputType::handleKeydownEvent(KeyboardEvent* event) event->setDefaultHandled(); } -<<<<<<< HEAD -void RangeInputType::forwardEvent(Event* event) -{ - if (element()->renderer() - && (event->isMouseEvent() #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) - || event->isTouchEvent() -#endif - || event->isDragEvent() - || event->isWheelEvent())) - toRenderSlider(element()->renderer())->forwardEvent(event); +void RangeInputType::handleTouchStartEvent(TouchEvent* touchEvent) +{ + if (SliderThumbElement* thumb = toSliderThumbElement(element()->shadowRoot())) { + if (touchEvent->touches() && touchEvent->touches()->item(0)) { + IntPoint curPoint; + curPoint.setX(touchEvent->touches()->item(0)->pageX()); + curPoint.setY(touchEvent->touches()->item(0)->pageY()); + thumb->dragFrom(curPoint); + touchEvent->setDefaultHandled(); + touchEvent->setDefaultPrevented(true); + } + } } +#endif -======= ->>>>>>> WebKit.org at r76408 void RangeInputType::createShadowSubtree() { element()->setShadowRoot(SliderThumbElement::create(element()->document())); diff --git a/Source/WebCore/html/RangeInputType.h b/Source/WebCore/html/RangeInputType.h index 15d224d..1447018 100644 --- a/Source/WebCore/html/RangeInputType.h +++ b/Source/WebCore/html/RangeInputType.h @@ -66,6 +66,9 @@ private: virtual String fallbackValue(); virtual String sanitizeValue(const String& proposedValue); virtual bool shouldRespectListAttribute(); +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) + virtual void handleTouchStartEvent(TouchEvent*); +#endif }; } // namespace WebCore 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); diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 476921e..8432c10 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -249,6 +249,9 @@ void EventHandler::clear() m_previousWheelScrolledNode = 0; #if ENABLE(TOUCH_EVENTS) m_originatingTouchPointTargets.clear(); +#if PLATFORM(ANDROID) + m_capturingTouchEventsNode = 0; +#endif #endif } @@ -1788,6 +1791,13 @@ void EventHandler::clearDragState() } #endif // ENABLE(DRAG_SUPPORT) +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) +void EventHandler::setCapturingTouchEventsNode(PassRefPtr<Node> n) +{ + m_capturingTouchEventsNode = n; +} +#endif + void EventHandler::setCapturingMouseEventsNode(PassRefPtr<Node> n) { m_capturingMouseEventsNode = n; @@ -2921,7 +2931,20 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) default: break; } +#if PLATFORM(ANDROID) + Node* node = 0; + if (m_capturingTouchEventsNode) + node = m_capturingTouchEventsNode.get(); + else { + HitTestResult result = hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false, false, DontHitTestScrollbars, hitType); + node = result.innerNode(); + ASSERT(node); + // Touch events should not go to text nodes + if (node->isTextNode()) + node = node->parentNode(); + } +#else HitTestResult result = hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false, false, DontHitTestScrollbars, hitType); Node* node = result.innerNode(); ASSERT(node); @@ -2929,6 +2952,8 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) // Touch events should not go to text nodes if (node->isTextNode()) node = node->parentNode(); +#endif + Document* doc = node->document(); if (!doc) @@ -2947,6 +2972,11 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) // Increment the platform touch id by 1 to avoid storing a key of 0 in the hashmap. unsigned touchPointTargetKey = point.id() + 1; RefPtr<EventTarget> touchTarget; +#if PLATFORM(ANDROID) + if (m_capturingTouchEventsNode) + touchTarget = node; + else { +#endif if (pointState == PlatformTouchPoint::TouchPressed) { m_originatingTouchPointTargets.set(touchPointTargetKey, node); touchTarget = node; @@ -2956,7 +2986,9 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey); } else touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey); - +#if PLATFORM(ANDROID) + } +#endif if (!touchTarget.get()) continue; diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index d12a56e..77668f1 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -215,6 +215,9 @@ public: #if ENABLE(TOUCH_EVENTS) bool handleTouchEvent(const PlatformTouchEvent&); +#if PLATFORM(ANDROID) + void setCapturingTouchEventsNode(PassRefPtr<Node>); +#endif #endif private: @@ -440,6 +443,9 @@ private: typedef HashMap<int, RefPtr<EventTarget> > TouchTargetMap; TouchTargetMap m_originatingTouchPointTargets; bool m_touchPressed; +#if PLATFORM(ANDROID) + RefPtr<Node> m_capturingTouchEventsNode; +#endif #endif }; diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h index c75aab8..e61099e 100644 --- a/Source/WebCore/page/FrameView.h +++ b/Source/WebCore/page/FrameView.h @@ -100,13 +100,8 @@ public: bool needsFullRepaint() const { return m_doFullRepaint; } -<<<<<<< HEAD -#if PLATFORM(ANDROID) - void updatePositionedObjects(); -======= #if ENABLE(REQUEST_ANIMATION_FRAME) void serviceScriptedAnimations(); ->>>>>>> WebKit.org at r76408 #endif #if USE(ACCELERATED_COMPOSITING) @@ -121,6 +116,10 @@ public: bool hasOverflowScroll() const { return m_hasOverflowScroll; } #endif +#if PLATFORM(ANDROID) + void updatePositionedObjects(); +#endif + bool hasCompositedContent() const; bool hasCompositedContentIncludingDescendants() const; bool hasCompositingAncestor() const; diff --git a/Source/WebCore/rendering/RenderMedia.cpp b/Source/WebCore/rendering/RenderMedia.cpp index f59a995..0b913ee 100644 --- a/Source/WebCore/rendering/RenderMedia.cpp +++ b/Source/WebCore/rendering/RenderMedia.cpp @@ -39,7 +39,8 @@ #include <wtf/CurrentTime.h> #include <wtf/MathExtras.h> -#if PLATFORM(ANDROID) +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) +#include "TouchEvent.h" #define TOUCH_DELAY 4 #endif @@ -467,7 +468,7 @@ void RenderMedia::updateControlVisibility() if (style()->visibility() != VISIBLE) return; -#if PLATFORM(ANDROID) +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) if (WTF::currentTime() - m_lastTouch > TOUCH_DELAY) m_mouseOver = false; else @@ -631,6 +632,20 @@ void RenderMedia::forwardEvent(Event* event) updateControlVisibility(); } } +#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) + // We want to process touch events landing on the timeline so that the user + // can drag the scrollbar thumb with their finger. + else if (event->isTouchEvent() && m_controlsShadowRoot) { + TouchEvent* touchEvent = static_cast<TouchEvent*>(event); + if (touchEvent->touches() && touchEvent->touches()->item(0)) { + IntPoint point; + point.setX(touchEvent->touches()->item(0)->pageX()); + point.setY(touchEvent->touches()->item(0)->pageY()); + if (m_timeline && m_timeline->hitTest(point)) + m_timeline->defaultEventHandler(event); + } + } +#endif } // We want the timeline slider to be at least 100 pixels wide. |