Diff
Modified: trunk/ChangeLog (105892 => 105893)
--- trunk/ChangeLog 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/ChangeLog 2012-01-25 18:18:47 UTC (rev 105893)
@@ -1,3 +1,14 @@
+2012-01-25 Kenneth Rohde Christiansen <[email protected]>
+
+ [Qt] Implement tap feedback respecting -webkit-tap-highlight-color
+ https://bugs.webkit.org/show_bug.cgi?id=76914
+
+ Reviewed by Simon Hausmann.
+
+ Add a manual test.
+
+ * ManualTests/qt/tap-highlighting.html: Added.
+
2012-01-25 Roland Steiner <[email protected]>
<style scoped>: Implement registering of <style scoped> with the scoping element
Added: trunk/ManualTests/qt/tap-highlighting.html (0 => 105893)
--- trunk/ManualTests/qt/tap-highlighting.html (rev 0)
+++ trunk/ManualTests/qt/tap-highlighting.html 2012-01-25 18:18:47 UTC (rev 105893)
@@ -0,0 +1,11 @@
+<h1>
+<input style='position:absolute; left:10px; top:10px;' type='text'>
+<input style='position:absolute; left:0px; top:300px; -webkit-transform:skew(30deg) rotate(-40deg) scale(1.2);' type='text'>
+<input style='position:absolute; left:100px; top:100px; -webkit-transform: rotate(-20deg) scale(1.5);' type='button' value='hest#1'>
+<div style='position:absolute; left:400px; top:200px; -webkit-transform:rotate(10deg);'><a href=''>hest#2</a></div>
+<div style='position:absolute; left:300px; top:100px; -webkit-transform:rotate(70deg);'><div style=' -webkit-transform:rotate(10deg);'><a href=''>hest#3</a></div></div>
+<div style='-webkit-transform:rotate(70deg); width:200px'><div style='position:absolute; left:400px; top:-100px; -webkit-transform:rotate(10deg);'><a href=''>hest#4</a></div></div>
+<div><div style='position:absolute; left:400px; top:400px; -webkit-transform:rotate(10deg);'><a href=''>hest#4a</a></div></div>
+<a href='' style='position:absolute;left:500px'>hest#5</a>
+<div style='position:absolute;left:640px'><a href=''>hest#6</a>
+</h1>
Modified: trunk/Source/WebCore/ChangeLog (105892 => 105893)
--- trunk/Source/WebCore/ChangeLog 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebCore/ChangeLog 2012-01-25 18:18:47 UTC (rev 105893)
@@ -1,3 +1,21 @@
+2012-01-25 Kenneth Rohde Christiansen <[email protected]>
+
+ [Qt] Implement tap feedback respecting -webkit-tap-highlight-color
+ https://bugs.webkit.org/show_bug.cgi?id=76914
+
+ Reviewed by Simon Hausmann.
+
+ Implement highlighting of dom nodes with a rounded rect, respecting
+ the color of -webkit-tap-highlight-color and any transform applied
+ to the element.
+
+ Tested with manual test.
+
+ * Target.pri:
+ * page/GestureTapHighlighter.cpp: Added.
+ (WebCore::GestureTapHighlighter::pathForNodeHighlight):
+ * page/GestureTapHighlighter.h: Added.
+
2012-01-25 Joshua Bell <[email protected]>
IndexedDB: Need to distinguish key paths that don't yield value vs. yield invalid key
Modified: trunk/Source/WebCore/Target.pri (105892 => 105893)
--- trunk/Source/WebCore/Target.pri 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebCore/Target.pri 2012-01-25 18:18:47 UTC (rev 105893)
@@ -986,6 +986,7 @@
page/FrameView.cpp \
page/Geolocation.cpp \
page/GeolocationController.cpp \
+ page/GestureTapHighlighter.cpp \
page/GroupSettings.cpp \
page/History.cpp \
page/Location.cpp \
@@ -2044,6 +2045,7 @@
page/FrameView.h \
page/Geolocation.h \
page/Geoposition.h \
+ page/GestureTapHighlighter.h\
page/GroupSettings.h \
page/History.h \
page/Location.h \
Added: trunk/Source/WebCore/page/GestureTapHighlighter.cpp (0 => 105893)
--- trunk/Source/WebCore/page/GestureTapHighlighter.cpp (rev 0)
+++ trunk/Source/WebCore/page/GestureTapHighlighter.cpp 2012-01-25 18:18:47 UTC (rev 105893)
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GestureTapHighlighter.h"
+
+#include "Element.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "GraphicsTypes.h"
+#include "Node.h"
+#include "Page.h"
+#include "RenderBoxModelObject.h"
+#include "RenderInline.h"
+#include "RenderLayer.h"
+#include "RenderObject.h"
+
+namespace WebCore {
+
+namespace {
+
+inline LayoutSize ownerFrameToMainFrameOffset(const RenderObject* o)
+{
+ ASSERT(o->node());
+ Frame* containingFrame = o->frame();
+ if (!containingFrame)
+ return LayoutSize();
+
+ Frame* mainFrame = containingFrame->page()->mainFrame();
+
+ LayoutPoint mainFramePoint = mainFrame->view()->rootViewToContents(containingFrame->view()->contentsToRootView(LayoutPoint()));
+ return toLayoutSize(mainFramePoint);
+}
+
+AffineTransform localToAbsoluteTransform(const RenderObject* o)
+{
+ AffineTransform transform;
+ LayoutPoint referencePoint;
+
+ while (o) {
+ RenderObject* nextContainer = o->container();
+ if (!nextContainer)
+ break;
+
+ LayoutSize containerOffset = o->offsetFromContainer(nextContainer, referencePoint);
+ TransformationMatrix t;
+ o->getTransformFromContainer(nextContainer, containerOffset, t);
+
+ transform = t.toAffineTransform() * transform;
+ referencePoint.move(containerOffset);
+ o = nextContainer;
+ }
+
+ return transform;
+}
+
+Path pathForRenderBox(RenderBox* o)
+{
+ ASSERT(o);
+
+ LayoutRect contentBox;
+ LayoutRect paddingBox;
+ LayoutRect borderBox;
+
+ contentBox = o->contentBoxRect();
+ paddingBox = LayoutRect(
+ contentBox.x() - o->paddingLeft(),
+ contentBox.y() - o->paddingTop(),
+ contentBox.width() + o->paddingLeft() + o->paddingRight(),
+ contentBox.height() + o->paddingTop() + o->paddingBottom());
+ borderBox = LayoutRect(
+ paddingBox.x() - o->borderLeft(),
+ paddingBox.y() - o->borderTop(),
+ paddingBox.width() + o->borderLeft() + o->borderRight(),
+ paddingBox.height() + o->borderTop() + o->borderBottom());
+
+ FloatRect rect(borderBox);
+ rect.inflate(5);
+
+ rect.move(ownerFrameToMainFrameOffset(o));
+
+ Path path;
+ path.addRoundedRect(rect, FloatSize(10, 10));
+
+ return path;
+}
+
+Path pathForRenderInline(RenderInline* o)
+{
+ // FIXME: Adapt this to not just use the bounding box.
+ LayoutRect borderBox = o->linesBoundingBox();
+
+ FloatRect rect(borderBox);
+ rect.inflate(5);
+
+ rect.move(ownerFrameToMainFrameOffset(o));
+
+ Path path;
+ path.addRoundedRect(rect, FloatSize(10, 10));
+
+ return path;
+}
+
+} // anonymous namespace
+
+namespace GestureTapHighlighter {
+
+Path pathForNodeHighlight(const Node* node)
+{
+ RenderObject* renderer = node->renderer();
+
+ Path path;
+ if (!renderer || (!renderer->isBox() && !renderer->isRenderInline()))
+ return path;
+
+ if (renderer->isBox())
+ path = pathForRenderBox(toRenderBox(renderer));
+ else
+ path = pathForRenderInline(toRenderInline(renderer));
+
+ path.transform(localToAbsoluteTransform(renderer));
+ return path;
+}
+
+} // namespace GestureTapHighlighter
+
+} // namespace WebCore
Added: trunk/Source/WebCore/page/GestureTapHighlighter.h (0 => 105893)
--- trunk/Source/WebCore/page/GestureTapHighlighter.h (rev 0)
+++ trunk/Source/WebCore/page/GestureTapHighlighter.h 2012-01-25 18:18:47 UTC (rev 105893)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GestureTapHighlighter_h
+#define GestureTapHighlighter_h
+
+namespace WebCore {
+
+class AffineTransform;
+class Path;
+class Node;
+
+namespace GestureTapHighlighter {
+
+Path pathForNodeHighlight(const Node*);
+
+} // namespace GestureTapHighlighter
+
+} // namespace WebCore
+
+#endif // DOMNodeHighlighter_h
Modified: trunk/Source/WebKit2/ChangeLog (105892 => 105893)
--- trunk/Source/WebKit2/ChangeLog 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/ChangeLog 2012-01-25 18:18:47 UTC (rev 105893)
@@ -1,3 +1,45 @@
+2012-01-25 Kenneth Rohde Christiansen <[email protected]>
+
+ [Qt] Implement tap feedback respecting -webkit-tap-highlight-color
+ https://bugs.webkit.org/show_bug.cgi?id=76914
+
+ Reviewed by Simon Hausmann.
+
+ Implement tap highlighting for Qt. When a touch press is issued,
+ which is not handled by the web page, then we highlight any
+ activatable node below. In all otehr cases, we hide any highlights.
+
+ The highlighting itself is painted on an accelerated PageOverlay,
+ on the web process side.
+
+ * Target.pri:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::handlePotentialActivation):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/qt/QtTapGestureRecognizer.cpp:
+ (WebKit::QtTapGestureRecognizer::recognize):
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ (QtWebPageEventHandler::handlePotentialSingleTapEvent):
+ * UIProcess/qt/QtWebPageEventHandler.h:
+ * WebProcess/WebPage/TapHighlightController.cpp: Added.
+ (WebKit::TapHighlightController::TapHighlightController):
+ (WebKit::TapHighlightController::~TapHighlightController):
+ (WebKit::TapHighlightController::highlight):
+ (WebKit::TapHighlightController::hideHighlight):
+ (WebKit::TapHighlightController::pageOverlayDestroyed):
+ (WebKit::TapHighlightController::willMoveToWebPage):
+ (WebKit::TapHighlightController::didMoveToWebPage):
+ (WebKit::highlightColor):
+ (WebKit::TapHighlightController::drawRect):
+ (WebKit::TapHighlightController::mouseEvent):
+ * WebProcess/WebPage/TapHighlightController.h: Added.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::highlightPotentialActivation):
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::tapHighlightController):
+ * WebProcess/WebPage/WebPage.messages.in:
+
2012-01-25 NĂ¡ndor Huszka <[email protected]>
[WK2] WebKitTestRunner needs layoutTestController.setPopupBlockingEnabled
Modified: trunk/Source/WebKit2/Target.pri (105892 => 105893)
--- trunk/Source/WebKit2/Target.pri 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/Target.pri 2012-01-25 18:18:47 UTC (rev 105893)
@@ -347,6 +347,7 @@
WebProcess/WebPage/DrawingAreaImpl.h \
WebProcess/WebPage/EventDispatcher.h \
WebProcess/WebPage/FindController.h \
+ WebProcess/WebPage/TapHighlightController.h \
WebProcess/WebPage/PageOverlay.h \
WebProcess/WebPage/WebContextMenu.h \
WebProcess/WebPage/WebFrame.h \
@@ -699,6 +700,7 @@
WebProcess/WebPage/EncoderAdapter.cpp \
WebProcess/WebPage/EventDispatcher.cpp \
WebProcess/WebPage/FindController.cpp \
+ WebProcess/WebPage/TapHighlightController.cpp \
WebProcess/WebPage/LayerTreeHost.cpp \
WebProcess/WebPage/PageOverlay.cpp \
WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp \
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (105892 => 105893)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-01-25 18:18:47 UTC (rev 105893)
@@ -977,6 +977,13 @@
#endif
#if ENABLE(TOUCH_EVENTS)
+#if PLATFORM(QT)
+void WebPageProxy::handlePotentialActivation(const IntPoint& layoutPoint)
+{
+ process()->send(Messages::WebPage::HighlightPotentialActivation(layoutPoint), m_pageID);
+}
+#endif
+
void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
{
if (!isValid())
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (105892 => 105893)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2012-01-25 18:18:47 UTC (rev 105893)
@@ -382,7 +382,10 @@
#endif
#if ENABLE(TOUCH_EVENTS)
void handleTouchEvent(const NativeWebTouchEvent&);
+#if PLATFORM(QT)
+ void handlePotentialActivation(const WebCore::IntPoint&);
#endif
+#endif
void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
void centerSelectionInVisibleArea();
Modified: trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp (105892 => 105893)
--- trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp 2012-01-25 18:18:47 UTC (rev 105893)
@@ -68,6 +68,11 @@
} else
m_tapState = SingleTapStarted;
m_touchBeginEventForTap = adoptPtr(new QTouchEvent(*event));
+
+ if (m_tapState == SingleTapStarted) {
+ const QTouchEvent::TouchPoint& touchPoint = event->touchPoints().first();
+ m_eventHandler->handlePotentialSingleTapEvent(touchPoint);
+ }
break;
case QEvent::TouchUpdate:
// If the touch point moves further than the threshold, we cancel the tap gesture.
@@ -111,6 +116,10 @@
default:
break;
}
+
+ if (m_tapState == NoTap)
+ m_eventHandler->handlePotentialSingleTapEvent(QTouchEvent::TouchPoint());
+
return false;
}
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (105892 => 105893)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2012-01-25 18:18:47 UTC (rev 105893)
@@ -286,6 +286,12 @@
return accepted;
}
+void QtWebPageEventHandler::handlePotentialSingleTapEvent(const QTouchEvent::TouchPoint& point)
+{
+ QTransform fromItemTransform = m_webPage->transformFromItem();
+ m_webPageProxy->handlePotentialActivation(fromItemTransform.map(point.pos()).toPoint());
+}
+
void QtWebPageEventHandler::handleSingleTapEvent(const QTouchEvent::TouchPoint& point)
{
m_postponeTextInputStateChanged = true;
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h (105892 => 105893)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.h 2012-01-25 18:18:47 UTC (rev 105893)
@@ -47,6 +47,7 @@
void setViewportInteractionEngine(QtViewportInteractionEngine*);
+ void handlePotentialSingleTapEvent(const QTouchEvent::TouchPoint&);
void handleSingleTapEvent(const QTouchEvent::TouchPoint&);
void handleDoubleTapEvent(const QTouchEvent::TouchPoint&);
Added: trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp (0 => 105893)
--- trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp 2012-01-25 18:18:47 UTC (rev 105893)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "TapHighlightController.h"
+
+#include "ShareableBitmap.h"
+#include "WKPage.h"
+#include "WebCoreArgumentCoders.h"
+#include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include "WebProcess.h"
+#include <WebCore/FocusController.h>
+#include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/GestureTapHighlighter.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/Page.h>
+
+#include <WebCore/RenderObject.h>
+
+using namespace std;
+using namespace WebCore;
+
+namespace WebKit {
+
+TapHighlightController::TapHighlightController(WebPage* webPage)
+ : m_webPage(webPage)
+ , m_overlay(0)
+{
+}
+
+TapHighlightController::~TapHighlightController()
+{
+}
+
+void TapHighlightController::highlight(Node* node)
+{
+ ASSERT(node);
+
+ m_path = GestureTapHighlighter::pathForNodeHighlight(node);
+ m_color = node->renderer()->style()->tapHighlightColor();
+
+ if (!m_overlay) {
+ RefPtr<PageOverlay> overlay = PageOverlay::create(this);
+ m_overlay = overlay.get();
+ m_webPage->installPageOverlay(overlay.release());
+ } else
+ m_overlay->setNeedsDisplay();
+}
+
+void TapHighlightController::hideHighlight()
+{
+ if (m_overlay)
+ m_webPage->uninstallPageOverlay(m_overlay, /* fadeout */ true);
+ ASSERT(!m_overlay);
+}
+
+void TapHighlightController::pageOverlayDestroyed(PageOverlay*)
+{
+}
+
+void TapHighlightController::willMoveToWebPage(PageOverlay*, WebPage* webPage)
+{
+ if (webPage)
+ return;
+
+ // The page overlay is moving away from the web page, reset it.
+ ASSERT(m_overlay);
+ m_overlay = 0;
+}
+
+void TapHighlightController::didMoveToWebPage(PageOverlay*, WebPage*)
+{
+}
+
+static Color highlightColor(Color baseColor, float fractionFadedIn)
+{
+ return Color(baseColor.red(), baseColor.green(), baseColor.blue(), int(baseColor.alpha() * fractionFadedIn));
+}
+
+void TapHighlightController::drawRect(PageOverlay* pageOverlay, GraphicsContext& context, const IntRect& dirtyRect)
+{
+ if (m_path.isEmpty())
+ return;
+
+ float fractionFadedIn = pageOverlay->fractionFadedIn();
+
+ {
+ GraphicsContextStateSaver stateSaver(context);
+ context.setFillColor(highlightColor(m_color, fractionFadedIn), ColorSpaceSRGB);
+ context.fillPath(m_path);
+ }
+}
+
+bool TapHighlightController::mouseEvent(PageOverlay*, const WebMouseEvent&)
+{
+ return false;
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h (0 => 105893)
--- trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h 2012-01-25 18:18:47 UTC (rev 105893)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TapHighlightController_h
+#define TapHighlightController_h
+
+#if ENABLE(TOUCH_EVENTS)
+
+#include "PageOverlay.h"
+#include <WebCore/Color.h>
+#include <WebCore/Path.h>
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+class Frame;
+class IntRect;
+class Node;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class TapHighlightController : private PageOverlay::Client {
+ WTF_MAKE_NONCOPYABLE(TapHighlightController);
+
+public:
+ explicit TapHighlightController(WebPage*);
+ virtual ~TapHighlightController();
+
+ void highlight(WebCore::Node*);
+ void hideHighlight();
+
+private:
+ // PageOverlay::Client.
+ virtual void pageOverlayDestroyed(PageOverlay*);
+ virtual void willMoveToWebPage(PageOverlay*, WebPage*);
+ virtual void didMoveToWebPage(PageOverlay*, WebPage*);
+ virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&);
+ virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
+
+private:
+ WebPage* m_webPage;
+ PageOverlay* m_overlay;
+
+ WebCore::Path m_path;
+ WebCore::Color m_color;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // TapHighlightController_h
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (105892 => 105893)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-01-25 18:18:47 UTC (rev 105893)
@@ -194,6 +194,9 @@
#endif
, m_setCanStartMediaTimer(WebProcess::shared().runLoop(), this, &WebPage::setCanStartMediaTimerFired)
, m_findController(this)
+#if PLATFORM(QT)
+ , m_tapHighlightController(this)
+#endif
, m_geolocationPermissionRequestManager(this)
, m_pageID(pageID)
, m_canRunBeforeUnloadConfirmPanel(parameters.canRunBeforeUnloadConfirmPanel)
@@ -1424,6 +1427,27 @@
}
#if ENABLE(TOUCH_EVENTS)
+#if PLATFORM(QT)
+void WebPage::highlightPotentialActivation(const IntPoint& point)
+{
+ Node* activationNode = 0;
+ Frame* mainframe = m_page->mainFrame();
+
+ if (point != IntPoint::zero()) {
+ HitTestResult result = mainframe->eventHandler()->hitTestResultAtPoint(mainframe->view()->windowToContents(point), /*allowShadowContent*/ false, /*ignoreClipping*/ true);
+ activationNode = result.innerNode();
+
+ if (!activationNode->isFocusable())
+ activationNode = activationNode->enclosingLinkEventParentOrSelf();
+ }
+
+ if (activationNode)
+ tapHighlightController().highlight(activationNode);
+ else
+ tapHighlightController().hideHighlight();
+}
+#endif
+
static bool handleTouchEvent(const WebTouchEvent& touchEvent, Page* page)
{
Frame* frame = page->mainFrame();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (105892 => 105893)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2012-01-25 18:18:47 UTC (rev 105893)
@@ -41,6 +41,7 @@
#include "InjectedBundlePageResourceLoadClient.h"
#include "InjectedBundlePageUIClient.h"
#include "MessageSender.h"
+#include "TapHighlightController.h"
#include "Plugin.h"
#include "SandboxExtension.h"
#include "ShareableBitmap.h"
@@ -316,6 +317,10 @@
static const WebEvent* currentEvent();
FindController& findController() { return m_findController; }
+#if PLATFORM(QT)
+ TapHighlightController& tapHighlightController() { return m_tapHighlightController; }
+#endif
+
GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
NotificationPermissionRequestManager* notificationPermissionRequestManager();
@@ -544,7 +549,10 @@
#if ENABLE(TOUCH_EVENTS)
void touchEvent(const WebTouchEvent&);
void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
+#if PLATFORM(QT)
+ void highlightPotentialActivation(const WebCore::IntPoint&);
#endif
+#endif
void contextMenuHidden() { m_isShowingContextMenu = false; }
static void scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
@@ -708,6 +716,9 @@
#endif
FindController m_findController;
+#if PLATFORM(QT)
+ TapHighlightController m_tapHighlightController;
+#endif
RefPtr<PageOverlay> m_pageOverlay;
RefPtr<WebPage> m_underlayPage;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (105892 => 105893)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2012-01-25 18:12:04 UTC (rev 105892)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2012-01-25 18:18:47 UTC (rev 105893)
@@ -40,7 +40,10 @@
#if ENABLE(TOUCH_EVENTS)
TouchEvent(WebKit::WebTouchEvent event)
TouchEventSyncForTesting(WebKit::WebTouchEvent event) -> (bool handled)
+#if PLATFORM(QT)
+ HighlightPotentialActivation(WebCore::IntPoint point)
#endif
+#endif
ContextMenuHidden()