Title: [115728] trunk
Revision
115728
Author
mifen...@rim.com
Date
2012-05-01 08:32:53 -0700 (Tue, 01 May 2012)

Log Message

Add special attribute for alternate selection touch handling.
https://bugs.webkit.org/show_bug.cgi?id=85284

Reviewed by Antonio Gomes.

PR 152975.

.:

Add manual test for -bb-selection-touchoverride.

Reviewed Internally by Gen Mak.

* ManualTests/blackberry/selection-touch-override.html: Added.

Source/WebKit/blackberry:

Add attribute -bb-selection-touchoverride to override
touch handling on selection overlay.

Reviewed Internally by Gen Mak.

* Api/WebPageClient.h:
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::inputNodeOverridesTouch):
(WebKit):
(BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
* WebKitSupport/SelectionHandler.h:
(SelectionHandler):

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (115727 => 115728)


--- trunk/ChangeLog	2012-05-01 15:30:30 UTC (rev 115727)
+++ trunk/ChangeLog	2012-05-01 15:32:53 UTC (rev 115728)
@@ -1,3 +1,18 @@
+2012-05-01  Mike Fenton  <mifen...@rim.com>
+
+        Add special attribute for alternate selection touch handling.
+        https://bugs.webkit.org/show_bug.cgi?id=85284
+
+        Reviewed by Antonio Gomes.
+
+        PR 152975.
+
+        Add manual test for -bb-selection-touchoverride.
+
+        Reviewed Internally by Gen Mak.
+
+        * ManualTests/blackberry/selection-touch-override.html: Added.
+
 2012-04-25  Raphael Kubo da Costa  <rak...@webkit.org>
 
         [CMake] Add a proper license to FindSqlite.cmake.

Added: trunk/ManualTests/blackberry/selection-touch-override.html (0 => 115728)


--- trunk/ManualTests/blackberry/selection-touch-override.html	                        (rev 0)
+++ trunk/ManualTests/blackberry/selection-touch-override.html	2012-05-01 15:32:53 UTC (rev 115728)
@@ -0,0 +1,2 @@
+<br><textarea cols="45" rows="5">Text Area without override attribute select all this text and tap on the selection, context menu should be shown!</textarea>
+<br><textarea cols="45" rows="5" -bb-selection-touchoverride="on">Text Area with override attribute select all this text and tap on the selection, caret should be placed!</textarea>

Modified: trunk/Source/WebKit/blackberry/Api/WebPageClient.h (115727 => 115728)


--- trunk/Source/WebKit/blackberry/Api/WebPageClient.h	2012-05-01 15:30:30 UTC (rev 115727)
+++ trunk/Source/WebKit/blackberry/Api/WebPageClient.h	2012-05-01 15:32:53 UTC (rev 115728)
@@ -146,7 +146,7 @@
     virtual void checkSpellingOfString(const unsigned short* text, int length, int& misspellingLocation, int& misspellingLength) = 0;
     virtual void requestSpellingSuggestionsForString(unsigned start, unsigned end) = 0;
 
-    virtual void notifySelectionDetailsChanged(const Platform::IntRect& start, const Platform::IntRect& end, const Platform::IntRectRegion&) = 0;
+    virtual void notifySelectionDetailsChanged(const Platform::IntRect& start, const Platform::IntRect& end, const Platform::IntRectRegion&, bool overrideTouchHandling = false) = 0;
     virtual void cancelSelectionVisuals() = 0;
     virtual void notifySelectionHandlesReversed() = 0;
     virtual void notifyCaretChanged(const Platform::IntRect& caret, bool userTouchTriggered, bool singleLineInput = false, const Platform::IntRect& singleLineBoundingBox = Platform::IntRect()) = 0;

Modified: trunk/Source/WebKit/blackberry/ChangeLog (115727 => 115728)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-05-01 15:30:30 UTC (rev 115727)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-05-01 15:32:53 UTC (rev 115728)
@@ -1,3 +1,25 @@
+2012-05-01  Mike Fenton  <mifen...@rim.com>
+
+        Add special attribute for alternate selection touch handling.
+        https://bugs.webkit.org/show_bug.cgi?id=85284
+
+        Reviewed by Antonio Gomes.
+
+        PR 152975.
+
+        Add attribute -bb-selection-touchoverride to override
+        touch handling on selection overlay.
+
+        Reviewed Internally by Gen Mak.
+
+        * Api/WebPageClient.h:
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::inputNodeOverridesTouch):
+        (WebKit):
+        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
+        * WebKitSupport/SelectionHandler.h:
+        (SelectionHandler):
+
 2012-04-30  Benjamin Poulain  <benja...@webkit.org>
 
         Add String::startsWith() and endsWith() for string literals

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (115727 => 115728)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-05-01 15:30:30 UTC (rev 115727)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-05-01 15:32:53 UTC (rev 115728)
@@ -817,6 +817,21 @@
     return false;
 }
 
+bool SelectionHandler::inputNodeOverridesTouch() const
+{
+    if (!m_webPage->m_inputHandler->isInputMode())
+        return false;
+
+    Node* focusedNode = m_webPage->focusedOrMainFrame()->document()->focusedNode();
+    if (!focusedNode || !focusedNode->isElementNode())
+        return false;
+
+    // TODO consider caching this in InputHandler so it is only calculated once per focus.
+    DEFINE_STATIC_LOCAL(QualifiedName, selectionTouchOverrideAttr, (nullAtom, "-bb-selection-touchoverride", nullAtom));
+    Element* element = static_cast<Element*>(focusedNode);
+    return DOMSupport::elementAttributeState(element, selectionTouchOverrideAttr) == DOMSupport::On;
+}
+
 // Note: This is the only function in SelectionHandler in which the coordinate
 // system is not entirely WebKit.
 void SelectionHandler::selectionPositionChanged(bool visualChangeOnly)
@@ -918,7 +933,7 @@
                     startCaret.x(), startCaret.y(), startCaret.width(), startCaret.height(), endCaret.x(), endCaret.y(), endCaret.width(), endCaret.height());
 
 
-    m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion);
+    m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch());
 }
 
 // NOTE: This function is not in WebKit coordinates.

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h (115727 => 115728)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h	2012-05-01 15:30:30 UTC (rev 115727)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h	2012-05-01 15:32:53 UTC (rev 115728)
@@ -81,6 +81,8 @@
     unsigned short extendSelectionToFieldBoundary(bool isStartHandle, const WebCore::IntPoint& selectionPoint, WebCore::VisibleSelection& newSelection);
     WebCore::IntPoint clipPointToVisibleContainer(const WebCore::IntPoint&) const;
 
+    bool inputNodeOverridesTouch() const;
+
     WebPagePrivate* m_webPage;
 
     bool m_selectionActive;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to