From 95ab5d0ba46f30ec38ae350ec529f5fe9e04cca3 Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Mon, 16 Jul 2012 14:54:03 +0000 Subject: [PATCH] [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 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): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@122725 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/blackberry/Api/WebPage.cpp | 15 ++++++++++++--- Source/WebKit/blackberry/ChangeLog | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 97b56a7..fb3212b 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -2383,9 +2383,6 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy } } - if (!nodeAllowSelectionOverride && !node->canStartSelection()) - context.resetFlag(Platform::WebContext::IsSelectable); - if (node->isHTMLElement()) { HTMLImageElement* imageElement = 0; HTMLMediaElement* mediaElement = 0; @@ -2429,9 +2426,18 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy context.setText(curText->wholeText().utf8().data()); } + bool canStartSelection = node->canStartSelection(); + if (node->isElementNode()) { Element* element = static_cast(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 @@ Platform::WebContext WebPagePrivate::webContext(TargetDetectionStrategy strategy } } + if (!nodeAllowSelectionOverride && !canStartSelection) + context.resetFlag(Platform::WebContext::IsSelectable); + if (node->isFocusable()) context.setFlag(Platform::WebContext::IsFocusable); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 7d76bcb..03b9fee 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,21 @@ +2012-07-16 Yongxin Dai + + [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 [BlackBerry] Move icon database to application data directory. -- 1.8.3.1