Title: [122725] trunk/Source/WebKit/blackberry
Revision
122725
Author
[email protected]
Date
2012-07-16 07:54:03 -0700 (Mon, 16 Jul 2012)

Log Message

[BlackBerry] Text selection with touch hold does not start on text field in some cases
https://bugs.webkit.org/show_bug.cgi?id=91267

Patch by Yongxin Dai <[email protected]> on 2012-07-16
Reviewed by Antonio Gomes.

Input fields host node is by spec non-editable unless the field itself has content editable enabled.
We enable selection if the shadow tree for the input field is selectable.
PR # 173450

Reviewed Internally by Mike Fenton.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::webContext):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::webContext):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (122724 => 122725)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-07-16 14:50:34 UTC (rev 122724)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-07-16 14:54:03 UTC (rev 122725)
@@ -2383,9 +2383,6 @@
         }
     }
 
-    if (!nodeAllowSelectionOverride && !node->canStartSelection())
-        context.resetFlag(Platform::WebContext::IsSelectable);
-
     if (node->isHTMLElement()) {
         HTMLImageElement* imageElement = 0;
         HTMLMediaElement* mediaElement = 0;
@@ -2429,9 +2426,18 @@
             context.setText(curText->wholeText().utf8().data());
     }
 
+    bool canStartSelection = node->canStartSelection();
+
     if (node->isElementNode()) {
         Element* element = static_cast<Element*>(node->shadowAncestorNode());
         if (DOMSupport::isTextBasedContentEditableElement(element)) {
+            if (!canStartSelection) {
+                // Input fields host node is by spec non-editable unless the field itself has content editable enabled.
+                // Enable selection if the shadow tree for the input field is selectable.
+                Node* nodeUnderFinger = m_touchEventHandler->lastFatFingersResult().isValid() ? m_touchEventHandler->lastFatFingersResult().node(FatFingersResult::ShadowContentAllowed) : 0;
+                if (nodeUnderFinger)
+                    canStartSelection = nodeUnderFinger->canStartSelection();
+            }
             context.setFlag(Platform::WebContext::IsInput);
             if (element->hasTagName(HTMLNames::inputTag))
                 context.setFlag(Platform::WebContext::IsSingleLine);
@@ -2444,6 +2450,9 @@
         }
     }
 
+    if (!nodeAllowSelectionOverride && !canStartSelection)
+        context.resetFlag(Platform::WebContext::IsSelectable);
+
     if (node->isFocusable())
         context.setFlag(Platform::WebContext::IsFocusable);
 

Modified: trunk/Source/WebKit/blackberry/ChangeLog (122724 => 122725)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-07-16 14:50:34 UTC (rev 122724)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-07-16 14:54:03 UTC (rev 122725)
@@ -1,3 +1,21 @@
+2012-07-16  Yongxin Dai  <[email protected]>
+
+        [BlackBerry] Text selection with touch hold does not start on text field in some cases
+        https://bugs.webkit.org/show_bug.cgi?id=91267
+
+        Reviewed by Antonio Gomes.
+
+        Input fields host node is by spec non-editable unless the field itself has content editable enabled.
+        We enable selection if the shadow tree for the input field is selectable.
+        PR # 173450
+
+        Reviewed Internally by Mike Fenton.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::webContext):
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::webContext):
+
 2012-07-15  Jonathan Dong  <[email protected]>
 
         [BlackBerry] Move icon database to application data directory.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to