[BlackBerry] Context menu cannot be invoked after doing text selection in landscape...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2013 17:20:15 +0000 (17:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2013 17:20:15 +0000 (17:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110860

Patch by Sean Wang <Xuewen.Wang@torchmobile.com.cn> on 2013-02-27
Reviewed by Yong Li.

PR 290248 Internally reviewed by Mike Fenton

Add a parameter to notify the webpage client which parts of selection have
changed in visual or in its selected DOM content. Refactor the selection details
parameter to platform repo.

The reason of this issue is that when javascript triggers webpage layout, the selection
will update its apperance event when the selected content is not changed. We want
to hide the context menu only when the selected content is changed not when only its
visual is changed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144202 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/Api/WebPageClient.h
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h

index 37cc3d1..d30d57b 100644 (file)
@@ -43,6 +43,7 @@ class GeoTrackerListener;
 class IntRectRegion;
 class NetworkRequest;
 class NetworkStreamFactory;
+struct SelectionDetails;
 class ViewportAccessor;
 class WebUserMediaRequest;
 
@@ -154,7 +155,7 @@ public:
     virtual void requestSpellingCheckingOptions(imf_sp_text_t&, const BlackBerry::Platform::IntRect& documentCaretRect, const BlackBerry::Platform::IntSize& screenOffset, const bool shouldMoveDialog) = 0;
     virtual int32_t checkSpellingOfStringAsync(wchar_t* text, const unsigned length) = 0;
 
-    virtual void notifySelectionDetailsChanged(const Platform::IntRect& documentStartRect, const Platform::IntRect& documentEndRect, const Platform::IntRectRegion& documentRegion, bool overrideTouchHandling = false, BlackBerry::Platform::RequestedHandlePosition = BlackBerry::Platform::SmartPlacement) = 0;
+    virtual void notifySelectionDetailsChanged(const BlackBerry::Platform::SelectionDetails&) = 0;
     virtual void cancelSelectionVisuals() = 0;
     virtual void notifySelectionHandlesReversed() = 0;
     virtual void notifyCaretChanged(const Platform::IntRect& documentCaretRect, bool userTouchTriggered, bool isSingleLineInput = false, const Platform::IntRect& singleLineDocumentBoundingBox = Platform::IntRect(), bool textFieldIsEmpty = false) = 0;
index 7bf05a1..0a36a26 100644 (file)
@@ -1,5 +1,31 @@
 2013-02-27  Sean Wang  <Xuewen.Wang@torchmobile.com.cn>
 
+        [BlackBerry] Context menu cannot be invoked after doing text selection in landscape mode
+        https://bugs.webkit.org/show_bug.cgi?id=110860
+
+        Reviewed by Yong Li.
+
+        PR 290248 Internally reviewed by Mike Fenton
+
+        Add a parameter to notify the webpage client which parts of selection have
+        changed in visual or in its selected DOM content. Refactor the selection details
+        parameter to platform repo.
+
+        The reason of this issue is that when javascript triggers webpage layout, the selection
+        will update its apperance event when the selected content is not changed. We want
+        to hide the context menu only when the selected content is changed not when only its
+        visual is changed.
+
+* Api/WebPageClient.h:
+        (Platform):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::cancelSelection):
+        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
+        * WebKitSupport/SelectionHandler.h:
+        (SelectionHandler):
+
+2013-02-27  Sean Wang  <Xuewen.Wang@torchmobile.com.cn>
+
         [BlackBerry] The virtual keyboard hides part of Signing In dialog
         https://bugs.webkit.org/show_bug.cgi?id=110836
 
index 3111334..7ac03b3 100644 (file)
@@ -87,8 +87,7 @@ void SelectionHandler::cancelSelection()
         m_webPage->m_selectionOverlay->hide();
     // Notify client with empty selection to ensure the handles are removed if
     // rendering happened prior to processing on webkit thread
-    m_webPage->m_client->notifySelectionDetailsChanged(WebCore::IntRect(DOMSupport::InvalidPoint, WebCore::IntSize()),
-        WebCore::IntRect(DOMSupport::InvalidPoint, WebCore::IntSize()), IntRectRegion());
+    m_webPage->m_client->notifySelectionDetailsChanged(SelectionDetails());
 
     SelectionLog(Platform::LogLevelInfo, "SelectionHandler::cancelSelection");
 
@@ -1019,7 +1018,13 @@ void SelectionHandler::selectionPositionChanged(bool forceUpdateWithoutChange)
     if (m_webPage->m_selectionOverlay)
         m_webPage->m_selectionOverlay->draw(visibleSelectionRegion);
 
-    m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch(), requestedSelectionHandlePosition(frame->selection()->selection()));
+
+    VisibleSelection currentSelection = frame->selection()->selection();
+    SelectionDetails details(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch(),
+        m_lastSelection != currentSelection, requestedSelectionHandlePosition(frame->selection()->selection()));
+
+    m_webPage->m_client->notifySelectionDetailsChanged(details);
+    m_lastSelection = currentSelection;
     SelectionTimingLog(Platform::LogLevelInfo,
         "SelectionHandler::selectionPositionChanged completed at %f",
         m_timer.elapsed());
index 76fc3a1..896de14 100644 (file)
@@ -102,6 +102,7 @@ private:
     BlackBerry::Platform::IntRectRegion m_lastSelectionRegion;
 
     BlackBerry::Platform::StopWatch m_timer;
+    WebCore::VisibleSelection m_lastSelection;
 };
 
 }