From ae13c18885c6acb4cf30d666bfe081bdc61e8d0d Mon Sep 17 00:00:00 2001 From: Jaehun Lim Date: Fri, 5 Apr 2013 14:19:21 +0900 Subject: [PATCH] Fix scrolling in iframe over overflow:scroll. [Title] Fix scrolling in iframe over overflow:scroll [Issue#] DCM-1191 [Problem] Scroll is disabled after releasing selected string [Cause] The EventHandler doesn't sync between the event target frame and the focused frame. [Solution] Change the focused frame whenever the event target frame is changed. Change-Id: If86e12d21c863c205230df35c3a95cf06fa59419 --- Source/WebCore/page/EventHandler.cpp | 15 +++++++++++++++ Source/WebCore/page/EventHandler.h | 1 + Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 5d35bbc..68bd9bc 100755 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -1248,6 +1248,7 @@ bool EventHandler::setMousePressNodeAtPoint(const IntPoint& point, bool checkOve HitTestResult result = hitTestResultAtPoint(point, false); Node* node = result.innerNode(); if (!node) { + changeFocusedFrame(m_frame->page() ? m_frame->page()->mainFrame() : 0); setMousePressNode(0); return false; } @@ -1262,6 +1263,7 @@ bool EventHandler::setMousePressNodeAtPoint(const IntPoint& point, bool checkOve && renderer->enclosingLayer()->hasAcceleratedTouchScrolling() && renderer->enclosingLayer()->layerForScrollingContents()) { overflowRenderer = renderer; + changeFocusedFrame(node->document()->frame()); setMousePressNode(node); return true; } @@ -1270,12 +1272,14 @@ bool EventHandler::setMousePressNodeAtPoint(const IntPoint& point, bool checkOve // Find overflow node. if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea()) { + changeFocusedFrame(node->document()->frame()); setMousePressNode(node); return true; } #if ENABLE(TIZEN_INPUT_BOX_SCROLL) // Setting mouse press for inline text box if (renderer->isBox() && renderer->isTextField()) { + changeFocusedFrame(node->document()->frame()); setMousePressNode(node); return true; } @@ -1289,9 +1293,20 @@ bool EventHandler::setMousePressNodeAtPoint(const IntPoint& point, bool checkOve node = 0; } while (node); + changeFocusedFrame(m_frame->page() ? m_frame->page()->mainFrame() : 0); setMousePressNode(0); return false; } + +void EventHandler::changeFocusedFrame(PassRefPtr targetFrame) +{ + if (!m_frame->page()) + return; + + bool changedFocusedFrame = targetFrame != m_frame->page()->focusController()->focusedOrMainFrame(); + if (changedFocusedFrame) + m_frame->page()->focusController()->setFocusedFrame(targetFrame); +} #endif bool EventHandler::logicalScrollOverflow(ScrollLogicalDirection direction, ScrollGranularity granularity, Node* startingNode) diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index 9bc0762..fc2612e 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -147,6 +147,7 @@ public: #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION) bool scrollOverflow(const FloatPoint&); bool setMousePressNodeAtPoint(const IntPoint&, bool checkOverflowLayer, RenderObject*&); + void changeFocusedFrame(PassRefPtr); #endif bool scrollRecursively(ScrollDirection, ScrollGranularity, Node* startingNode = 0); bool logicalScrollRecursively(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0); diff --git a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp index c276791..364e8b4 100755 --- a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp @@ -1088,7 +1088,7 @@ void WebPage::setPressedNodeAtPoint(const IntPoint& point, bool checkOverflowLay { RenderObject* renderer = 0; id = 0; - pressed = m_page->focusController()->focusedOrMainFrame()->eventHandler()->setMousePressNodeAtPoint(point, checkOverflowLayer, renderer); + pressed = m_page->mainFrame()->eventHandler()->setMousePressNodeAtPoint(point, checkOverflowLayer, renderer); #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION_ON_UI_SIDE) if (pressed && renderer) id = toWebGraphicsLayer(renderer->enclosingLayer()->layerForScrollingContents())->id(); -- 2.7.4